Author: sebb
Date: Mon May 18 22:52:28 2009
New Revision: 776125

URL: http://svn.apache.org/viewvc?rev=776125&view=rev
Log:
Ensure test suite works for Locale language != "en"

Modified:
    jakarta/jmeter/trunk/test/src/org/apache/jmeter/junit/JMeterTest.java

Modified: jakarta/jmeter/trunk/test/src/org/apache/jmeter/junit/JMeterTest.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/test/src/org/apache/jmeter/junit/JMeterTest.java?rev=776125&r1=776124&r2=776125&view=diff
==============================================================================
--- jakarta/jmeter/trunk/test/src/org/apache/jmeter/junit/JMeterTest.java 
(original)
+++ jakarta/jmeter/trunk/test/src/org/apache/jmeter/junit/JMeterTest.java Mon 
May 18 22:52:28 2009
@@ -74,6 +74,8 @@
     
     private static final Locale TEST_LOCALE = Locale.ENGLISH; 
     
+    private static final Locale DEFAULT_LOCALE = Locale.getDefault(); 
+    
     public JMeterTest(String name) {
         super(name);
     }
@@ -130,6 +132,8 @@
     public static Test suite() throws Exception {
         // The Locale used to instantiate the GUI objects
         JMeterUtils.setLocale(TEST_LOCALE);
+        Locale.setDefault(TEST_LOCALE);
+        // Needs to be done before any GUI classes are instantiated
         
         TestSuite suite = new TestSuite("JMeterTest");
         suite.addTest(new JMeterTest("readAliases"));
@@ -143,9 +147,17 @@
         suite.addTest(suiteFunctions());
         suite.addTest(new JMeterTest("checkGuiSet"));
         suite.addTest(new JMeterTest("checkFunctionSet"));
+        
+        suite.addTest(new JMeterTest("resetLocale")); // revert
         return suite;
     }
 
+    // Restore the original Locale
+    public void resetLocale(){
+        JMeterUtils.setLocale(DEFAULT_LOCALE);
+        Locale.setDefault(DEFAULT_LOCALE);
+    }
+
     /*
      * Extract titles from component_reference.xml
      */
@@ -392,9 +404,6 @@
      * Test GUI elements - run for all components
      */
     public void GUIComponents1() throws Exception {
-        // We must set the Locale to the same value that was used when the
-        // GUI objects was instantiated in this class
-        JMeterUtils.setLocale(TEST_LOCALE);
         String name = guiItem.getClass().getName();
 
         assertEquals("Name should be same as static label for " + name, 
guiItem.getStaticLabel(), guiItem.getName());



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to