[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
Sun Jul 13 18:36:09 EDT 2014
Author: rdw
Date: Sun Jul 13 18:36:09 2014
New Revision: 6292
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=6292&view=rev
Log:
IDP-394 Start to make scripted tests run under JDK8. Low hanging fruit first.
Added:
trunk/idp-attribute-resolver-impl/src/test/resources/data/net/shibboleth/idp/attribute/resolver/impl/ad/jdk8/
trunk/idp-attribute-resolver-impl/src/test/resources/data/net/shibboleth/idp/attribute/resolver/impl/ad/jdk8/context.script
trunk/idp-attribute-resolver-impl/src/test/resources/data/net/shibboleth/idp/attribute/resolver/impl/ad/jdk8/fail6.script
trunk/idp-attribute-resolver-impl/src/test/resources/data/net/shibboleth/idp/attribute/resolver/impl/ad/jdk8/simple2.script
trunk/idp-attribute-resolver-impl/src/test/resources/data/net/shibboleth/idp/attribute/resolver/impl/ad/jdk8/simpleWithPredef.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=6292&r1=6291&r2=6292&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 Sun Jul 13 18:36:09 2014
@@ -65,14 +65,22 @@
/** Simple result. */
private static final String SIMPLE_VALUE = "simple";
- private String fileNameToPath(String fileName) {
+ private String fileNameToPath(String fileName, boolean isV8Capable) {
+ if (isV8() && !isV8Capable) {
+ return "/data/net/shibboleth/idp/attribute/resolver/impl/ad/jdk8/" + fileName;
+ }
return "/data/net/shibboleth/idp/attribute/resolver/impl/ad/" + fileName;
}
+ private String getScript(String fileName, boolean isV8Capable) throws IOException {
+ return StringSupport.inputStreamToString(getClass().getResourceAsStream(fileNameToPath(fileName, isV8Capable)),
+ null);
+ }
+
private String getScript(String fileName) throws IOException {
- return StringSupport.inputStreamToString(getClass().getResourceAsStream(fileNameToPath(fileName)), null);
- }
-
+ return getScript(fileName, true);
+ }
+
private boolean isV8() {
final String ver = System.getProperty("java.version");
return ver.startsWith("1.8");
@@ -89,10 +97,6 @@
@Test public void simple() throws ResolutionException, ComponentInitializationException, ScriptException,
IOException {
- if (isV8()) {
- return;
- }
-
final IdPAttribute test = new IdPAttribute(TEST_ATTRIBUTE_NAME);
test.setValues(Collections.singleton(new StringAttributeValue(SIMPLE_VALUE)));
@@ -123,9 +127,6 @@
@Test public void simple2() throws ResolutionException, ComponentInitializationException, ScriptException,
IOException {
- if (isV8()) {
- return;
- }
final IdPAttribute test = new IdPAttribute(TEST_ATTRIBUTE_NAME);
test.setValues(Collections.singleton(new StringAttributeValue(SIMPLE_VALUE)));
@@ -133,7 +134,7 @@
final ScriptedAttributeDefinition attr = new ScriptedAttributeDefinition();
Assert.assertNull(attr.getScript());
attr.setId(TEST_ATTRIBUTE_NAME);
- attr.setScript(new EvaluableScript(SCRIPT_LANGUAGE, getScript("simple2.script")));
+ attr.setScript(new EvaluableScript(SCRIPT_LANGUAGE, getScript("simple2.script", false)));
attr.initialize();
Assert.assertNotNull(attr.getScript());
@@ -145,12 +146,8 @@
Assert.assertEquals(results.iterator().next().getValue(), SIMPLE_VALUE, "Scripted result contains known value");
}
- @Test public void simpleWithPredef() throws ResolutionException, ComponentInitializationException,
- ScriptException, IOException {
-
- if (isV8()) {
- return;
- }
+ @Test public void simpleWithPredef() throws ResolutionException, ComponentInitializationException, ScriptException,
+ IOException {
final IdPAttribute test = new IdPAttribute(TEST_ATTRIBUTE_NAME);
final IdPAttributeValue<?> attributeValue = new StringAttributeValue(SIMPLE_VALUE);
@@ -160,7 +157,7 @@
final ScriptedAttributeDefinition attr = new ScriptedAttributeDefinition();
Assert.assertNull(attr.getScript());
attr.setId(TEST_ATTRIBUTE_NAME);
- attr.setScript(new EvaluableScript(SCRIPT_LANGUAGE, getScript("simpleWithPredef.script")));
+ attr.setScript(new EvaluableScript(SCRIPT_LANGUAGE, getScript("simpleWithPredef.script", false)));
[... 190 lines stripped ...]
More information about the commits
mailing list