jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1213066 - /jmeter/trunk/test/src/org/apache/jmeter/resources/PackageTest.java
Date Sun, 11 Dec 2011 21:05:08 GMT
Author: pmouawad
Date: Sun Dec 11 21:05:08 2011
New Revision: 1213066

URL: http://svn.apache.org/viewvc?rev=1213066&view=rev
Log:
Fixed hard coded "fr"
Handled missing bundles

Modified:
    jmeter/trunk/test/src/org/apache/jmeter/resources/PackageTest.java

Modified: jmeter/trunk/test/src/org/apache/jmeter/resources/PackageTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/resources/PackageTest.java?rev=1213066&r1=1213065&r2=1213066&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/resources/PackageTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/resources/PackageTest.java Sun Dec 11 21:05:08
2011
@@ -281,10 +281,18 @@ public class PackageTest extends TestCas
             ts.addTest(pfx);
         }
         ts.addTest(new PackageTest("checkI18n", "fr"));
-
+        // TODO Add these some day
+//        ts.addTest(new PackageTest("checkI18n", "es"));
+//        ts.addTest(new PackageTest("checkI18n", "pl"));
+//        ts.addTest(new PackageTest("checkI18n", "pt_BR"));
+//        ts.addTest(new PackageTest("checkI18n", "tr"));
+//        ts.addTest(new PackageTest("checkI18n", Locale.JAPANESE.toString()));
+//        ts.addTest(new PackageTest("checkI18n", Locale.SIMPLIFIED_CHINESE.toString()));
+//        ts.addTest(new PackageTest("checkI18n", Locale.TRADITIONAL_CHINESE.toString()));
         return ts;
     }
-
+   
+    
     private int subTestFailures;
 
     private final String lang;
@@ -315,7 +323,7 @@ public class PackageTest extends TestCas
     	for (String prefix : prefixList) {
         	Properties messages = new Properties();
         	messages.load(Thread.currentThread().getContextClassLoader().getResourceAsStream(prefix.substring(1)+".properties"));
-        	checkMessagesForLanguage( missingLabelsPerBundle , missingLabelsPerBundle, messages,prefix.substring(1),
"fr");
+        	checkMessagesForLanguage( missingLabelsPerBundle , missingLabelsPerBundle, messages,prefix.substring(1),
lang);
 		}
     	
     	assertEquals(missingLabelsPerBundle.size()+" missing labels, labels missing:"+printLabels(missingLabelsPerBundle),
0, missingLabelsPerBundle.size());
@@ -333,7 +341,17 @@ public class PackageTest extends TestCas
 			throws IOException {
 		Properties messagesFr = new Properties();
 		String languageBundle = bundlePath+"_"+language+ ".properties";
-    	messagesFr.load(Thread.currentThread().getContextClassLoader().getResourceAsStream(languageBundle));
+		InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(languageBundle);
+		if(inputStream == null) {
+			Map<String, String> messagesAsProperties = new HashMap<String, String>();
+			for (Iterator iterator = messages.entrySet().iterator(); iterator.hasNext();) {
+				Map.Entry<Object, Object> entry = (Map.Entry<Object, Object>) iterator.next();
+				messagesAsProperties.put((String) entry.getKey(), (String) entry.getValue()); 
+			}
+			missingLabelsPerBundle.put(languageBundle, messagesAsProperties);
+			return;
+		}
+    	messagesFr.load(inputStream);
     
     	Map<String, String> missingLabels = new TreeMap<String,String>();
     	for (Iterator<Map.Entry<Object,Object>> iterator =  messages.entrySet().iterator();
iterator.hasNext();) {



Mime
View raw message