/hg/rhino-tests: Updated four tests in ScriptEngineFactoryClassT...

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Mon May 27 03:19:45 PDT 2013


changeset 40d19c67580c in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=40d19c67580c
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Mon May 27 12:23:11 2013 +0200

	Updated four tests in ScriptEngineFactoryClassTest for (Open)JDK8 API:
	getMethod, getMethods, getDeclaredMethod and getDeclaredMethods.


diffstat:

 ChangeLog                                            |    6 +
 src/org/RhinoTests/ScriptEngineFactoryClassTest.java |  114 ++++++++++++++++++-
 2 files changed, 116 insertions(+), 4 deletions(-)

diffs (172 lines):

diff -r 81b74072fff0 -r 40d19c67580c ChangeLog
--- a/ChangeLog	Fri May 24 12:04:59 2013 +0200
+++ b/ChangeLog	Mon May 27 12:23:11 2013 +0200
@@ -1,3 +1,9 @@
+2013-05-27  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/RhinoTests/ScriptEngineFactoryClassTest.java:
+	Updated four tests in ScriptEngineFactoryClassTest for (Open)JDK8 API:
+	getMethod, getMethods, getDeclaredMethod and getDeclaredMethods.
+
 2013-05-24  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/RhinoTests/ScriptEngineFactoryClassTest.java:
diff -r 81b74072fff0 -r 40d19c67580c src/org/RhinoTests/ScriptEngineFactoryClassTest.java
--- a/src/org/RhinoTests/ScriptEngineFactoryClassTest.java	Fri May 24 12:04:59 2013 +0200
+++ b/src/org/RhinoTests/ScriptEngineFactoryClassTest.java	Mon May 27 12:23:11 2013 +0200
@@ -629,6 +629,21 @@
             "public abstract javax.script.ScriptEngine javax.script.ScriptEngineFactory.getScriptEngine()",
         };
 
+        final String[] methodsThatShouldExist_jdk8 = {
+            "public abstract java.lang.Object javax.script.ScriptEngineFactory.getParameter(java.lang.String)",
+            "public abstract java.lang.String javax.script.ScriptEngineFactory.getEngineName()",
+            "public abstract java.lang.String javax.script.ScriptEngineFactory.getEngineVersion()",
+            "public abstract java.lang.String javax.script.ScriptEngineFactory.getLanguageName()",
+            "public abstract java.lang.String javax.script.ScriptEngineFactory.getLanguageVersion()",
+            "public abstract java.lang.String javax.script.ScriptEngineFactory.getMethodCallSyntax(java.lang.String,java.lang.String,java.lang.String[])",
+            "public abstract java.lang.String javax.script.ScriptEngineFactory.getOutputStatement(java.lang.String)",
+            "public abstract java.lang.String javax.script.ScriptEngineFactory.getProgram(java.lang.String[])",
+            "public abstract java.util.List javax.script.ScriptEngineFactory.getExtensions()",
+            "public abstract java.util.List javax.script.ScriptEngineFactory.getMimeTypes()",
+            "public abstract java.util.List javax.script.ScriptEngineFactory.getNames()",
+            "public abstract javax.script.ScriptEngine javax.script.ScriptEngineFactory.getScriptEngine()",
+        };
+
         // get all inherited methods
         Method[] methods = this.scriptEngineFactoryClass.getMethods();
         // and transform the array into a list of method names
@@ -636,7 +651,20 @@
         for (Method method : methods) {
             methodsAsString.add(method.toString());
         }
-        String[] methodsThatShouldExist = getJavaVersion() < 7 ? methodsThatShouldExist_jdk6 : methodsThatShouldExist_jdk7;
+
+        String[] methodsThatShouldExist = null;
+        switch (getJavaVersion()) {
+            case 6:
+                methodsThatShouldExist = methodsThatShouldExist_jdk6;
+                break;
+            case 7:
+                methodsThatShouldExist = methodsThatShouldExist_jdk7;
+                break;
+            case 8:
+                methodsThatShouldExist = methodsThatShouldExist_jdk8;
+                break;
+        }
+
         // check if all required methods really exists
         for (String methodThatShouldExists : methodsThatShouldExist) {
             assertTrue(methodsAsString.contains(methodThatShouldExists),
@@ -679,6 +707,21 @@
             "public abstract javax.script.ScriptEngine javax.script.ScriptEngineFactory.getScriptEngine()",
         };
 
+        final String[] declaredMethodsThatShouldExist_jdk8 = {
+            "public abstract java.lang.Object javax.script.ScriptEngineFactory.getParameter(java.lang.String)",
+            "public abstract java.lang.String javax.script.ScriptEngineFactory.getEngineName()",
+            "public abstract java.lang.String javax.script.ScriptEngineFactory.getEngineVersion()",
+            "public abstract java.lang.String javax.script.ScriptEngineFactory.getLanguageName()",
+            "public abstract java.lang.String javax.script.ScriptEngineFactory.getLanguageVersion()",
+            "public abstract java.lang.String javax.script.ScriptEngineFactory.getMethodCallSyntax(java.lang.String,java.lang.String,java.lang.String[])",
+            "public abstract java.lang.String javax.script.ScriptEngineFactory.getOutputStatement(java.lang.String)",
+            "public abstract java.lang.String javax.script.ScriptEngineFactory.getProgram(java.lang.String[])",
+            "public abstract java.util.List javax.script.ScriptEngineFactory.getExtensions()",
+            "public abstract java.util.List javax.script.ScriptEngineFactory.getMimeTypes()",
+            "public abstract java.util.List javax.script.ScriptEngineFactory.getNames()",
+            "public abstract javax.script.ScriptEngine javax.script.ScriptEngineFactory.getScriptEngine()",
+        };
+
         // get all declared methods
         Method[] declaredMethods = this.scriptEngineFactoryClass.getDeclaredMethods();
         // and transform the array into a list of method names
@@ -686,7 +729,20 @@
         for (Method method : declaredMethods) {
             methodsAsString.add(method.toString());
         }
-        String[] declaredMethodsThatShouldExist = getJavaVersion() < 7 ? declaredMethodsThatShouldExist_jdk6 : declaredMethodsThatShouldExist_jdk7;
+
+        String[] declaredMethodsThatShouldExist = null;
+        switch (getJavaVersion()) {
+            case 6:
+                declaredMethodsThatShouldExist = declaredMethodsThatShouldExist_jdk6;
+                break;
+            case 7:
+                declaredMethodsThatShouldExist = declaredMethodsThatShouldExist_jdk7;
+                break;
+            case 8:
+                declaredMethodsThatShouldExist = declaredMethodsThatShouldExist_jdk8;
+                break;
+        }
+
         // check if all required methods really exists
         for (String methodThatShouldExists : declaredMethodsThatShouldExist) {
             assertTrue(methodsAsString.contains(methodThatShouldExists),
@@ -727,7 +783,32 @@
         methodsThatShouldExist_jdk7.put("getProgram", new Class[] {String[].class});
         methodsThatShouldExist_jdk7.put("getScriptEngine", new Class[] {});
 
-        Map<String, Class[]> methodsThatShouldExist = getJavaVersion() < 7 ? methodsThatShouldExist_jdk6 : methodsThatShouldExist_jdk7;
+        Map<String, Class[]> methodsThatShouldExist_jdk8 = new TreeMap<String, Class[]>();
+        methodsThatShouldExist_jdk8.put("getEngineName", new Class[] {});
+        methodsThatShouldExist_jdk8.put("getEngineVersion", new Class[] {});
+        methodsThatShouldExist_jdk8.put("getMimeTypes", new Class[] {});
+        methodsThatShouldExist_jdk8.put("getNames", new Class[] {});
+        methodsThatShouldExist_jdk8.put("getLanguageName", new Class[] {});
+        methodsThatShouldExist_jdk8.put("getLanguageVersion", new Class[] {});
+        methodsThatShouldExist_jdk8.put("getParameter", new Class[] {java.lang.String.class});
+        methodsThatShouldExist_jdk8.put("getMethodCallSyntax", new Class[] {java.lang.String.class, java.lang.String.class, String[].class});
+        methodsThatShouldExist_jdk8.put("getOutputStatement", new Class[] {java.lang.String.class});
+        methodsThatShouldExist_jdk8.put("getProgram", new Class[] {String[].class});
+        methodsThatShouldExist_jdk8.put("getScriptEngine", new Class[] {});
+        methodsThatShouldExist_jdk8.put("getExtensions", new Class[] {});
+
+        Map<String, Class[]> methodsThatShouldExist = null;
+        switch (getJavaVersion()) {
+            case 6:
+                methodsThatShouldExist = methodsThatShouldExist_jdk6;
+                break;
+            case 7:
+                methodsThatShouldExist = methodsThatShouldExist_jdk7;
+                break;
+            case 8:
+                methodsThatShouldExist = methodsThatShouldExist_jdk8;
+                break;
+        }
 
         // check if all required methods really exist
         for (Map.Entry<String, Class[]> methodThatShouldExists : methodsThatShouldExist.entrySet()) {
@@ -781,7 +862,32 @@
         methodsThatShouldExist_jdk7.put("getProgram", new Class[] {String[].class});
         methodsThatShouldExist_jdk7.put("getScriptEngine", new Class[] {});
 
-        Map<String, Class[]> methodsThatShouldExist = getJavaVersion() < 7 ? methodsThatShouldExist_jdk6 : methodsThatShouldExist_jdk7;
+        Map<String, Class[]> methodsThatShouldExist_jdk8 = new TreeMap<String, Class[]>();
+        methodsThatShouldExist_jdk8.put("getEngineName", new Class[] {});
+        methodsThatShouldExist_jdk8.put("getEngineVersion", new Class[] {});
+        methodsThatShouldExist_jdk8.put("getMimeTypes", new Class[] {});
+        methodsThatShouldExist_jdk8.put("getNames", new Class[] {});
+        methodsThatShouldExist_jdk8.put("getLanguageName", new Class[] {});
+        methodsThatShouldExist_jdk8.put("getLanguageVersion", new Class[] {});
+        methodsThatShouldExist_jdk8.put("getParameter", new Class[] {java.lang.String.class});
+        methodsThatShouldExist_jdk8.put("getMethodCallSyntax", new Class[] {java.lang.String.class, java.lang.String.class, String[].class});
+        methodsThatShouldExist_jdk8.put("getOutputStatement", new Class[] {java.lang.String.class});
+        methodsThatShouldExist_jdk8.put("getProgram", new Class[] {String[].class});
+        methodsThatShouldExist_jdk8.put("getScriptEngine", new Class[] {});
+        methodsThatShouldExist_jdk8.put("getExtensions", new Class[] {});
+
+        Map<String, Class[]> methodsThatShouldExist = null;
+        switch (getJavaVersion()) {
+            case 6:
+                methodsThatShouldExist = methodsThatShouldExist_jdk6;
+                break;
+            case 7:
+                methodsThatShouldExist = methodsThatShouldExist_jdk7;
+                break;
+            case 8:
+                methodsThatShouldExist = methodsThatShouldExist_jdk8;
+                break;
+        }
 
         // check if all required methods really exist
         for (Map.Entry<String, Class[]> methodThatShouldExists : methodsThatShouldExist.entrySet()) {



More information about the distro-pkg-dev mailing list