jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1561141 - /jmeter/trunk/test/src/org/apache/jmeter/gui/util/JSyntaxTextAreaTest.java
Date Fri, 24 Jan 2014 20:14:18 GMT
Author: sebb
Date: Fri Jan 24 20:14:17 2014
New Revision: 1561141

URL: http://svn.apache.org/r1561141
Log:
Check that syntax types have valid values

Modified:
    jmeter/trunk/test/src/org/apache/jmeter/gui/util/JSyntaxTextAreaTest.java

Modified: jmeter/trunk/test/src/org/apache/jmeter/gui/util/JSyntaxTextAreaTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/gui/util/JSyntaxTextAreaTest.java?rev=1561141&r1=1561140&r2=1561141&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/gui/util/JSyntaxTextAreaTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/gui/util/JSyntaxTextAreaTest.java Fri Jan 24 20:14:17
2014
@@ -18,7 +18,13 @@
 
 package org.apache.jmeter.gui.util;
 
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.HashSet;
+import java.util.Properties;
+
 import org.apache.jmeter.junit.JMeterTestCase;
+import org.apache.jmeter.util.JMeterUtils;
 import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
 
 public class JSyntaxTextAreaTest extends JMeterTestCase {
@@ -35,4 +41,36 @@ public class JSyntaxTextAreaTest extends
     assertEquals(SyntaxConstants.SYNTAX_STYLE_NONE, textArea.getSyntaxEditingStyle());
     
   }
+  
+    public void testSyntaxNames() throws IllegalArgumentException,
+            IllegalAccessException {
+        HashSet<String> values = new HashSet<String>();
+        for (Field field : SyntaxConstants.class.getFields()) {
+            int modifiers = field.getModifiers();
+            if (field.getType().equals(String.class)
+                    && Modifier.isStatic(modifiers)
+                    && Modifier.isPublic(modifiers)) {
+                values.add((String) field.get(null));
+            }
+        }
+        final Properties languageProperties = JMeterUtils
+                .loadProperties("org/apache/jmeter/gui/util/textarea.properties"); //$NON-NLS-1$;
+        for (Object s : languageProperties.values()) {
+            if (!values.contains(s)) {
+                fail("Invalid property value: " + s);
+            }
+        }
+        // Show unused entries
+//        for (Object s : languageProperties.values()) {
+//            values.remove(s);
+//        }
+//        if (values.size() > 0) {
+//            System.out.print("Unused JSyntaxAreaTypes:");
+//            for (String value : values) {
+//                System.out.print(" ");
+//                System.out.print(value);
+//            }
+//            System.out.println();
+//        }
+    }
 }



Mime
View raw message