/hg/rhino-tests: Updated four new tests in AbstractScriptEngineC...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Fri May 10 02:09:27 PDT 2013
changeset c34799b2f593 in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=c34799b2f593
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Fri May 10 11:12:17 2013 +0200
Updated four new tests in AbstractScriptEngineClassTest for (Open)JDK8.
diffstat:
ChangeLog | 6 +
src/org/RhinoTests/AbstractScriptEngineClassTest.java | 134 +++++++++++++++++-
2 files changed, 136 insertions(+), 4 deletions(-)
diffs (192 lines):
diff -r bdda58cfb157 -r c34799b2f593 ChangeLog
--- a/ChangeLog Thu May 09 09:40:02 2013 +0200
+++ b/ChangeLog Fri May 10 11:12:17 2013 +0200
@@ -1,3 +1,9 @@
+2013-05-10 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/RhinoTests/AbstractScriptEngineClassTest.java:
+ Updated four new tests in AbstractScriptEngineClassTest for
+ (Open)JDK8.
+
2013-05-09 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/RhinoTests/SimpleBindingsClassTest.java:
diff -r bdda58cfb157 -r c34799b2f593 src/org/RhinoTests/AbstractScriptEngineClassTest.java
--- a/src/org/RhinoTests/AbstractScriptEngineClassTest.java Thu May 09 09:40:02 2013 +0200
+++ b/src/org/RhinoTests/AbstractScriptEngineClassTest.java Fri May 10 11:12:17 2013 +0200
@@ -740,6 +740,32 @@
"public void javax.script.AbstractScriptEngine.setContext(javax.script.ScriptContext)",
};
+ final String[] methodsThatShouldExist_jdk8 = {
+ "public abstract java.lang.Object javax.script.ScriptEngine.eval(java.io.Reader,javax.script.ScriptContext) throws javax.script.ScriptException",
+ "public abstract java.lang.Object javax.script.ScriptEngine.eval(java.lang.String,javax.script.ScriptContext) throws javax.script.ScriptException",
+ "public abstract javax.script.Bindings javax.script.ScriptEngine.createBindings()",
+ "public abstract javax.script.ScriptEngineFactory javax.script.ScriptEngine.getFactory()",
+ "public boolean java.lang.Object.equals(java.lang.Object)",
+ "public final native java.lang.Class java.lang.Object.getClass()",
+ "public final native void java.lang.Object.notify()",
+ "public final native void java.lang.Object.notifyAll()",
+ "public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException",
+ "public final void java.lang.Object.wait() throws java.lang.InterruptedException",
+ "public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException",
+ "public java.lang.Object javax.script.AbstractScriptEngine.eval(java.io.Reader) throws javax.script.ScriptException",
+ "public java.lang.Object javax.script.AbstractScriptEngine.eval(java.io.Reader,javax.script.Bindings) throws javax.script.ScriptException",
+ "public java.lang.Object javax.script.AbstractScriptEngine.eval(java.lang.String) throws javax.script.ScriptException",
+ "public java.lang.Object javax.script.AbstractScriptEngine.eval(java.lang.String,javax.script.Bindings) throws javax.script.ScriptException",
+ "public java.lang.Object javax.script.AbstractScriptEngine.get(java.lang.String)",
+ "public java.lang.String java.lang.Object.toString()",
+ "public javax.script.Bindings javax.script.AbstractScriptEngine.getBindings(int)",
+ "public javax.script.ScriptContext javax.script.AbstractScriptEngine.getContext()",
+ "public native int java.lang.Object.hashCode()",
+ "public void javax.script.AbstractScriptEngine.put(java.lang.String,java.lang.Object)",
+ "public void javax.script.AbstractScriptEngine.setBindings(javax.script.Bindings,int)",
+ "public void javax.script.AbstractScriptEngine.setContext(javax.script.ScriptContext)",
+ };
+
// get all inherited methods
Method[] methods = this.abstractScriptEngineClass.getMethods();
// and transform the array into a list of method names
@@ -747,7 +773,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),
@@ -788,6 +827,20 @@
"public void javax.script.AbstractScriptEngine.setContext(javax.script.ScriptContext)",
};
+ final String[] declaredMethodsThatShouldExist_jdk8 = {
+ "protected javax.script.ScriptContext javax.script.AbstractScriptEngine.getScriptContext(javax.script.Bindings)",
+ "public java.lang.Object javax.script.AbstractScriptEngine.eval(java.io.Reader) throws javax.script.ScriptException",
+ "public java.lang.Object javax.script.AbstractScriptEngine.eval(java.io.Reader,javax.script.Bindings) throws javax.script.ScriptException",
+ "public java.lang.Object javax.script.AbstractScriptEngine.eval(java.lang.String) throws javax.script.ScriptException",
+ "public java.lang.Object javax.script.AbstractScriptEngine.eval(java.lang.String,javax.script.Bindings) throws javax.script.ScriptException",
+ "public java.lang.Object javax.script.AbstractScriptEngine.get(java.lang.String)",
+ "public javax.script.Bindings javax.script.AbstractScriptEngine.getBindings(int)",
+ "public javax.script.ScriptContext javax.script.AbstractScriptEngine.getContext()",
+ "public void javax.script.AbstractScriptEngine.put(java.lang.String,java.lang.Object)",
+ "public void javax.script.AbstractScriptEngine.setBindings(javax.script.Bindings,int)",
+ "public void javax.script.AbstractScriptEngine.setContext(javax.script.ScriptContext)",
+ };
+
// get all declared methods
Method[] declaredMethods = this.abstractScriptEngineClass.getDeclaredMethods();
// and transform the array into a list of method names
@@ -795,7 +848,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),
@@ -858,7 +924,43 @@
methodsThatShouldExist_jdk7.put("eval", new Class[] {java.lang.String.class, javax.script.ScriptContext.class});
methodsThatShouldExist_jdk7.put("createBindings", new Class[] {});
- Map<String, Class[]> methodsThatShouldExist = getJavaVersion() < 7 ? methodsThatShouldExist_jdk6 : methodsThatShouldExist_jdk7;
+ Map<String, Class[]> methodsThatShouldExist_jdk8 = new TreeMap<String, Class[]>();
+ methodsThatShouldExist_jdk8.put("eval", new Class[] {java.io.Reader.class});
+ methodsThatShouldExist_jdk8.put("eval", new Class[] {java.lang.String.class, javax.script.Bindings.class});
+ methodsThatShouldExist_jdk8.put("eval", new Class[] {java.lang.String.class});
+ methodsThatShouldExist_jdk8.put("eval", new Class[] {java.io.Reader.class, javax.script.Bindings.class});
+ methodsThatShouldExist_jdk8.put("setBindings", new Class[] {javax.script.Bindings.class, int.class});
+ methodsThatShouldExist_jdk8.put("getBindings", new Class[] {int.class});
+ methodsThatShouldExist_jdk8.put("setContext", new Class[] {javax.script.ScriptContext.class});
+ methodsThatShouldExist_jdk8.put("get", new Class[] {java.lang.String.class});
+ methodsThatShouldExist_jdk8.put("put", new Class[] {java.lang.String.class, java.lang.Object.class});
+ methodsThatShouldExist_jdk8.put("getContext", new Class[] {});
+ methodsThatShouldExist_jdk8.put("wait", new Class[] {long.class, int.class});
+ methodsThatShouldExist_jdk8.put("wait", new Class[] {long.class});
+ methodsThatShouldExist_jdk8.put("wait", new Class[] {});
+ methodsThatShouldExist_jdk8.put("equals", new Class[] {java.lang.Object.class});
+ methodsThatShouldExist_jdk8.put("toString", new Class[] {});
+ methodsThatShouldExist_jdk8.put("hashCode", new Class[] {});
+ methodsThatShouldExist_jdk8.put("getClass", new Class[] {});
+ methodsThatShouldExist_jdk8.put("notify", new Class[] {});
+ methodsThatShouldExist_jdk8.put("notifyAll", new Class[] {});
+ methodsThatShouldExist_jdk8.put("eval", new Class[] {java.lang.String.class, javax.script.ScriptContext.class});
+ methodsThatShouldExist_jdk8.put("eval", new Class[] {java.io.Reader.class, javax.script.ScriptContext.class});
+ methodsThatShouldExist_jdk8.put("createBindings", new Class[] {});
+ methodsThatShouldExist_jdk8.put("getFactory", 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()) {
@@ -910,7 +1012,31 @@
methodsThatShouldExist_jdk7.put("setContext", new Class[] {javax.script.ScriptContext.class});
methodsThatShouldExist_jdk7.put("getScriptContext", new Class[] {javax.script.Bindings.class});
- Map<String, Class[]> methodsThatShouldExist = getJavaVersion() < 7 ? methodsThatShouldExist_jdk6 : methodsThatShouldExist_jdk7;
+ Map<String, Class[]> methodsThatShouldExist_jdk8 = new TreeMap<String, Class[]>();
+ methodsThatShouldExist_jdk8.put("eval", new Class[] {java.io.Reader.class});
+ methodsThatShouldExist_jdk8.put("eval", new Class[] {java.lang.String.class, javax.script.Bindings.class});
+ methodsThatShouldExist_jdk8.put("eval", new Class[] {java.lang.String.class});
+ methodsThatShouldExist_jdk8.put("eval", new Class[] {java.io.Reader.class, javax.script.Bindings.class});
+ methodsThatShouldExist_jdk8.put("setBindings", new Class[] {javax.script.Bindings.class, int.class});
+ methodsThatShouldExist_jdk8.put("getBindings", new Class[] {int.class});
+ methodsThatShouldExist_jdk8.put("setContext", new Class[] {javax.script.ScriptContext.class});
+ methodsThatShouldExist_jdk8.put("getScriptContext", new Class[] {javax.script.Bindings.class});
+ methodsThatShouldExist_jdk8.put("get", new Class[] {java.lang.String.class});
+ methodsThatShouldExist_jdk8.put("put", new Class[] {java.lang.String.class, java.lang.Object.class});
+ methodsThatShouldExist_jdk8.put("getContext", 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