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

noreply at shibboleth.net noreply at shibboleth.net
Sat Jan 31 10:37:40 EST 2015


Author: rdw
Date: Sat Jan 31 10:37:40 2015
New Revision: 7294

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7294&view=rev
Log:
Show how to make logging work in Nashorn

Added:
    trunk/idp-attribute-resolver-impl/src/test/resources/data/net/shibboleth/idp/attribute/resolver/impl/ad/jdk8/logging.script
    trunk/idp-attribute-resolver-impl/src/test/resources/data/net/shibboleth/idp/attribute/resolver/impl/ad/logging.script
Modified:
    trunk/idp-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/ScriptedAttributeTest.java

Modified: trunk/idp-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/ScriptedAttributeTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/ScriptedAttributeTest.java?rev=7294&r1=7293&r2=7294&view=diff
==============================================================================
--- trunk/idp-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/ScriptedAttributeTest.java (original)
+++ trunk/idp-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/ScriptedAttributeTest.java Sat Jan 31 10:37:40 2015
@@ -173,6 +173,24 @@
         Assert.assertEquals(results.size(), 1, "Scripted result value count");
         Assert.assertEquals(results.iterator().next(), new EmptyAttributeValue(EmptyType.NULL_VALUE), "Scripted result contains expected value");
     }
+    
+    @Test public void logging() throws Exception {
+
+        final IdPAttribute test = new IdPAttribute(TEST_ATTRIBUTE_NAME);
+
+        test.setValues(Collections.singletonList(new StringAttributeValue(SIMPLE_VALUE)));
+
+        final ScriptedAttributeDefinition attr = new ScriptedAttributeDefinition();
+        Assert.assertNull(attr.getScript());
+        attr.setId(TEST_ATTRIBUTE_NAME);
+        attr.setScript(new EvaluableScript(SCRIPT_LANGUAGE, getScript("logging.script", false)));
+        attr.initialize();
+
+        final IdPAttribute val = attr.resolve(generateContext());
+        final List<IdPAttributeValue<?>> results = val.getValues();
+
+        Assert.assertEquals(results.size(), 2, "Scripted result value count");
+}
 
 
     @Test public void simpleWithPredef() throws ResolutionException, ComponentInitializationException, ScriptException,



More information about the commits mailing list