[java-identity-provider COMMIT] /trunk/idp-attribute-resolver-api/src/test/java/net/shibboleth/idp/attribute/resolver...
noreply at shibboleth.net
noreply at shibboleth.net
Wed May 7 04:13:02 EDT 2014
Author: rdw
Date: Wed May 7 04:13:02 2014
New Revision: 5864
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5864&view=rev
Log:
IDP-280 extended tests
Modified:
trunk/idp-attribute-resolver-api/src/test/java/net/shibboleth/idp/attribute/resolver/AbstractResolverPluginTest.java
Modified: trunk/idp-attribute-resolver-api/src/test/java/net/shibboleth/idp/attribute/resolver/AbstractResolverPluginTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-resolver-api/src/test/java/net/shibboleth/idp/attribute/resolver/AbstractResolverPluginTest.java?rev=5864&r1=5863&r2=5864&view=diff
==============================================================================
--- trunk/idp-attribute-resolver-api/src/test/java/net/shibboleth/idp/attribute/resolver/AbstractResolverPluginTest.java (original)
+++ trunk/idp-attribute-resolver-api/src/test/java/net/shibboleth/idp/attribute/resolver/AbstractResolverPluginTest.java Wed May 7 04:13:02 2014
@@ -26,10 +26,12 @@
import net.shibboleth.idp.attribute.resolver.context.AttributeResolverWorkContext;
import net.shibboleth.utilities.java.support.logic.ConstraintViolationException;
+import org.opensaml.messaging.context.navigate.ParentContextLookup;
import org.opensaml.profile.context.ProfileRequestContext;
import org.testng.Assert;
import org.testng.annotations.Test;
+import com.google.common.base.Function;
import com.google.common.base.Predicates;
/** Unit test for {@link ResolverPlugin}. */
@@ -52,13 +54,19 @@
plugin.setActivationCriteria(Predicates.<ProfileRequestContext> alwaysFalse());
Assert.assertEquals(plugin.getActivationCriteria(), Predicates.alwaysFalse());
-
try {
plugin.setActivationCriteria(null);
Assert.fail("Able to set a null activiation criteria");
} catch (ConstraintViolationException e) {
// expected this
}
+ }
+
+ @Test public void nativation() {
+ MockBaseResolverPlugin plugin = new MockBaseResolverPlugin(" foo ", "bar");
+ Assert.assertEquals(plugin.getProfileContextStrategy().getClass(), ParentContextLookup.class);
+ plugin.setProfileContextStrategy(new TestFunc());
+ Assert.assertEquals(plugin.getProfileContextStrategy().getClass(), TestFunc.class);
}
/** Test setters to {@link ResolverPlugin#setPropagateResolutionExceptions(boolean)}. */
@@ -153,11 +161,18 @@
}
/** {@inheritDoc} */
- @Override
- @Nullable protected String doResolve(@Nonnull final AttributeResolutionContext resolutionContext,
+ @Override @Nullable protected String doResolve(@Nonnull final AttributeResolutionContext resolutionContext,
@Nonnull final AttributeResolverWorkContext workContext) throws ResolutionException {
return resolverValue;
}
}
-
+
+ static class TestFunc implements Function<AttributeResolutionContext, ProfileRequestContext> {
+
+ /** {@inheritDoc} */
+ @Override @Nullable public ProfileRequestContext apply(@Nullable AttributeResolutionContext input) {
+ return null;
+ }
+
+ }
}
More information about the commits
mailing list