[java-identity-provider COMMIT] in /trunk: idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filte...

noreply at shibboleth.net noreply at shibboleth.net
Tue Jul 15 07:41:27 EDT 2014


Author: rdw
Date: Tue Jul 15 07:41:27 2014
New Revision: 6295

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=6295&view=rev
Log:
JDK-394 More work on JDK8/Nashorn

Modified:
    trunk/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/impl/ScriptedMatcherTest.java
    trunk/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/policyrule/impl/ScriptedPolicyRuleTest.java
    trunk/idp-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/ScriptedAttributeTest.java
    trunk/idp-attribute-resolver-impl/src/test/resources/data/net/shibboleth/idp/attribute/resolver/impl/ad/fail2.script

Modified: trunk/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/impl/ScriptedMatcherTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/impl/ScriptedMatcherTest.java?rev=6295&r1=6294&r2=6295&view=diff
==============================================================================
--- trunk/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/impl/ScriptedMatcherTest.java (original)
+++ trunk/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/impl/ScriptedMatcherTest.java Tue Jul 15 07:41:27 2014
@@ -60,28 +60,43 @@
 
         filterContext = new AttributeFilterContext();
 
-        returnOneValueScript =
-                new EvaluableScript("JavaScript", new StringBuilder().append("importPackage(Packages.java.util);")
-                        .append("filterContext.getPrefilteredIdPAttributes();").append("x = new HashSet();")
-                        .append("x.add(attribute.getValues().iterator().next());").append("x;").toString());
-
         nullReturnScript = new EvaluableScript("JavaScript", "null;");
-
-        invalidReturnObjectScript = new EvaluableScript("JavaScript", "new java.lang.String();");
-
-        addedValuesScript =
-                new EvaluableScript("JavaScript", new StringBuilder().append("importPackage(Packages.java.util);")
-                        .append("filterContext.getPrefilteredIdPAttributes();").append("x = new HashSet();")
-                        .append("x.add(attribute.getValues().iterator().next());")
-                        .append("x.add(new net.shibboleth.idp.attribute.StringAttributeValue(\"a\"));").append("x;")
-                        .toString());
-
+        
+        
+        if (!isV8()){
+            returnOneValueScript =
+                    new EvaluableScript("JavaScript", new StringBuilder().append("importPackage(Packages.java.util);")
+                            .append("filterContext.getPrefilteredIdPAttributes();").append("x = new HashSet();")
+                            .append("x.add(attribute.getValues().iterator().next());").append("x;").toString());
+    
+            invalidReturnObjectScript = new EvaluableScript("JavaScript", "new java.lang.String();");
+    
+            addedValuesScript =
+                    new EvaluableScript("JavaScript", new StringBuilder().append("importPackage(Packages.java.util);")
+                            .append("filterContext.getPrefilteredIdPAttributes();").append("x = new HashSet();")
+                            .append("x.add(attribute.getValues().iterator().next());")
+                            .append("x.add(new net.shibboleth.idp.attribute.StringAttributeValue(\"a\"));").append("x;")
+                            .toString());
+        } else {
+            
+            returnOneValueScript =
+                    new EvaluableScript("JavaScript", new StringBuilder().append("load('nashorn:mozilla_compat.js');importPackage(Packages.java.util);")
+                            .append("filterContext.getPrefilteredIdPAttributes();").append("x = new HashSet();")
+                            .append("x.add(attribute.getValues().iterator().next());").append("x;").toString());
+    
+            invalidReturnObjectScript = new EvaluableScript("JavaScript", "load('nashorn:mozilla_compat.js');new java.lang.String();");
+    
+            addedValuesScript =
+                    new EvaluableScript("JavaScript", new StringBuilder().append("load('nashorn:mozilla_compat.js');importPackage(Packages.java.util);")
+                            .append("importPackage(Packages.net.shibboleth.idp.attribute);")
+                            .append("filterContext.getPrefilteredIdPAttributes();").append("x = new HashSet();")
+                            .append("x.add(attribute.getValues().iterator().next());")
+                            .append("x.add(new StringAttributeValue(\"a\"));").append("x;")
+                            .toString());
+        }
     }
 
     @Test public void testGetMatcher() throws Exception {
-        if (isV8()) {
-            return;
-        }
         
         ScriptedMatcher matcher = new ScriptedMatcher(returnOneValueScript);
         matcher.setId("Test");
@@ -92,9 +107,6 @@
     
 

[... 213 lines stripped ...]


More information about the commits mailing list