/hg/rhino-tests: Updated four tests in ScriptContextClassTest fo...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Mon Jun 3 02:47:14 PDT 2013
changeset 5d030140c10f in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=5d030140c10f
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Mon Jun 03 11:50:42 2013 +0200
Updated four tests in ScriptContextClassTest for (Open)JDK8 API:
getMethod, getMethods, getDeclaredMethod and getDeclaredMethods.
diffstat:
ChangeLog | 6 +
src/org/RhinoTests/ScriptContextClassTest.java | 122 ++++++++++++++++++++++++-
2 files changed, 124 insertions(+), 4 deletions(-)
diffs (180 lines):
diff -r 89917103dafe -r 5d030140c10f ChangeLog
--- a/ChangeLog Fri May 31 14:26:53 2013 +0200
+++ b/ChangeLog Mon Jun 03 11:50:42 2013 +0200
@@ -1,3 +1,9 @@
+2013-06-03 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/RhinoTests/ScriptContextClassTest.java:
+ Updated four tests in ScriptContextClassTest for (Open)JDK8 API:
+ getMethod, getMethods, getDeclaredMethod and getDeclaredMethods.
+
2013-05-31 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/RhinoTests/InvocableClassTest.java:
diff -r 89917103dafe -r 5d030140c10f src/org/RhinoTests/ScriptContextClassTest.java
--- a/src/org/RhinoTests/ScriptContextClassTest.java Fri May 31 14:26:53 2013 +0200
+++ b/src/org/RhinoTests/ScriptContextClassTest.java Mon Jun 03 11:50:42 2013 +0200
@@ -657,6 +657,23 @@
"public abstract void javax.script.ScriptContext.setWriter(java.io.Writer)",
};
+ final String[] methodsThatShouldExist_jdk8 = {
+ "public abstract int javax.script.ScriptContext.getAttributesScope(java.lang.String)",
+ "public abstract java.io.Reader javax.script.ScriptContext.getReader()",
+ "public abstract java.io.Writer javax.script.ScriptContext.getErrorWriter()",
+ "public abstract java.io.Writer javax.script.ScriptContext.getWriter()",
+ "public abstract java.lang.Object javax.script.ScriptContext.getAttribute(java.lang.String)",
+ "public abstract java.lang.Object javax.script.ScriptContext.getAttribute(java.lang.String,int)",
+ "public abstract java.lang.Object javax.script.ScriptContext.removeAttribute(java.lang.String,int)",
+ "public abstract java.util.List javax.script.ScriptContext.getScopes()",
+ "public abstract javax.script.Bindings javax.script.ScriptContext.getBindings(int)",
+ "public abstract void javax.script.ScriptContext.setAttribute(java.lang.String,java.lang.Object,int)",
+ "public abstract void javax.script.ScriptContext.setBindings(javax.script.Bindings,int)",
+ "public abstract void javax.script.ScriptContext.setErrorWriter(java.io.Writer)",
+ "public abstract void javax.script.ScriptContext.setReader(java.io.Reader)",
+ "public abstract void javax.script.ScriptContext.setWriter(java.io.Writer)",
+ };
+
// get all inherited methods
Method[] methods = this.scriptContextClass.getMethods();
// and transform the array into a list of method names
@@ -664,7 +681,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),
@@ -711,6 +741,23 @@
"public abstract void javax.script.ScriptContext.setWriter(java.io.Writer)",
};
+ final String[] declaredMethodsThatShouldExist_jdk8 = {
+ "public abstract int javax.script.ScriptContext.getAttributesScope(java.lang.String)",
+ "public abstract java.io.Reader javax.script.ScriptContext.getReader()",
+ "public abstract java.io.Writer javax.script.ScriptContext.getErrorWriter()",
+ "public abstract java.io.Writer javax.script.ScriptContext.getWriter()",
+ "public abstract java.lang.Object javax.script.ScriptContext.getAttribute(java.lang.String)",
+ "public abstract java.lang.Object javax.script.ScriptContext.getAttribute(java.lang.String,int)",
+ "public abstract java.lang.Object javax.script.ScriptContext.removeAttribute(java.lang.String,int)",
+ "public abstract java.util.List javax.script.ScriptContext.getScopes()",
+ "public abstract javax.script.Bindings javax.script.ScriptContext.getBindings(int)",
+ "public abstract void javax.script.ScriptContext.setAttribute(java.lang.String,java.lang.Object,int)",
+ "public abstract void javax.script.ScriptContext.setBindings(javax.script.Bindings,int)",
+ "public abstract void javax.script.ScriptContext.setErrorWriter(java.io.Writer)",
+ "public abstract void javax.script.ScriptContext.setReader(java.io.Reader)",
+ "public abstract void javax.script.ScriptContext.setWriter(java.io.Writer)",
+ };
+
// get all declared methods
Method[] declaredMethods = this.scriptContextClass.getDeclaredMethods();
// and transform the array into a list of method names
@@ -718,7 +765,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),
@@ -763,7 +823,34 @@
methodsThatShouldExist_jdk7.put("removeAttribute", new Class[] {java.lang.String.class, int.class});
methodsThatShouldExist_jdk7.put("setAttribute", new Class[] {java.lang.String.class, java.lang.Object.class, int.class});
- Map<String, Class[]> methodsThatShouldExist = getJavaVersion() < 7 ? methodsThatShouldExist_jdk6 : methodsThatShouldExist_jdk7;
+ Map<String, Class[]> methodsThatShouldExist_jdk8 = new TreeMap<String, Class[]>();
+ methodsThatShouldExist_jdk8.put("setBindings", new Class[] {javax.script.Bindings.class, int.class});
+ methodsThatShouldExist_jdk8.put("getBindings", new Class[] {int.class});
+ methodsThatShouldExist_jdk8.put("getWriter", new Class[] {});
+ methodsThatShouldExist_jdk8.put("setWriter", new Class[] {java.io.Writer.class});
+ methodsThatShouldExist_jdk8.put("getReader", new Class[] {});
+ methodsThatShouldExist_jdk8.put("setReader", new Class[] {java.io.Reader.class});
+ methodsThatShouldExist_jdk8.put("getErrorWriter", new Class[] {});
+ methodsThatShouldExist_jdk8.put("setErrorWriter", new Class[] {java.io.Writer.class});
+ methodsThatShouldExist_jdk8.put("setAttribute", new Class[] {java.lang.String.class, java.lang.Object.class, int.class});
+ methodsThatShouldExist_jdk8.put("getAttribute", new Class[] {java.lang.String.class});
+ methodsThatShouldExist_jdk8.put("getAttribute", new Class[] {java.lang.String.class, int.class});
+ methodsThatShouldExist_jdk8.put("removeAttribute", new Class[] {java.lang.String.class, int.class});
+ methodsThatShouldExist_jdk8.put("getAttributesScope", new Class[] {java.lang.String.class});
+ methodsThatShouldExist_jdk8.put("getScopes", 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()) {
@@ -821,7 +908,34 @@
methodsThatShouldExist_jdk7.put("removeAttribute", new Class[] {java.lang.String.class, int.class});
methodsThatShouldExist_jdk7.put("setAttribute", new Class[] {java.lang.String.class, java.lang.Object.class, int.class});
- Map<String, Class[]> methodsThatShouldExist = getJavaVersion() < 7 ? methodsThatShouldExist_jdk6 : methodsThatShouldExist_jdk7;
+ Map<String, Class[]> methodsThatShouldExist_jdk8 = new TreeMap<String, Class[]>();
+ methodsThatShouldExist_jdk8.put("setBindings", new Class[] {javax.script.Bindings.class, int.class});
+ methodsThatShouldExist_jdk8.put("getBindings", new Class[] {int.class});
+ methodsThatShouldExist_jdk8.put("getWriter", new Class[] {});
+ methodsThatShouldExist_jdk8.put("setWriter", new Class[] {java.io.Writer.class});
+ methodsThatShouldExist_jdk8.put("getReader", new Class[] {});
+ methodsThatShouldExist_jdk8.put("setReader", new Class[] {java.io.Reader.class});
+ methodsThatShouldExist_jdk8.put("getErrorWriter", new Class[] {});
+ methodsThatShouldExist_jdk8.put("setErrorWriter", new Class[] {java.io.Writer.class});
+ methodsThatShouldExist_jdk8.put("setAttribute", new Class[] {java.lang.String.class, java.lang.Object.class, int.class});
+ methodsThatShouldExist_jdk8.put("getAttribute", new Class[] {java.lang.String.class});
+ methodsThatShouldExist_jdk8.put("getAttribute", new Class[] {java.lang.String.class, int.class});
+ methodsThatShouldExist_jdk8.put("removeAttribute", new Class[] {java.lang.String.class, int.class});
+ methodsThatShouldExist_jdk8.put("getAttributesScope", new Class[] {java.lang.String.class});
+ methodsThatShouldExist_jdk8.put("getScopes", 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