[java-identity-provider] branch master updated: Test cleanup.
Scott Cantor
cantor.2 at osu.edu
Thu May 16 09:37:08 EDT 2019
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch master
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=f9b93444908f5c2ae28aecf2c91e42b802b68a2b
The following commit(s) were added to refs/heads/master by this push:
new f9b9344 Test cleanup.
f9b9344 is described below
commit f9b93444908f5c2ae28aecf2c91e42b802b68a2b
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu May 16 09:37:05 2019 -0400
Test cleanup.
---
.../idp/profile/impl/FilterAttributesTest.java | 44 ++++------------------
.../idp/profile/impl/ResolveAttributesTest.java | 41 +++-----------------
.../impl/AddAttributeStatementToAssertionTest.java | 34 ++---------------
.../FilterByQueriedAttributeDesignatorsTest.java | 32 +---------------
.../impl/AddAttributeStatementToAssertionTest.java | 34 ++---------------
.../impl/FilterByQueriedAttributesTest.java | 32 +---------------
6 files changed, 24 insertions(+), 193 deletions(-)
diff --git a/idp-profile-impl/src/test/java/net/shibboleth/idp/profile/impl/FilterAttributesTest.java b/idp-profile-impl/src/test/java/net/shibboleth/idp/profile/impl/FilterAttributesTest.java
index 61889c7..f44a4ef 100644
--- a/idp-profile-impl/src/test/java/net/shibboleth/idp/profile/impl/FilterAttributesTest.java
+++ b/idp-profile-impl/src/test/java/net/shibboleth/idp/profile/impl/FilterAttributesTest.java
@@ -22,13 +22,10 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
-import javax.annotation.Nullable;
-
import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.idp.attribute.IdPAttributeValue;
import net.shibboleth.idp.attribute.StringAttributeValue;
import net.shibboleth.idp.attribute.context.AttributeContext;
-import net.shibboleth.idp.attribute.filter.AttributeFilter;
import net.shibboleth.idp.attribute.filter.AttributeFilterPolicy;
import net.shibboleth.idp.attribute.filter.AttributeRule;
import net.shibboleth.idp.attribute.filter.MockMatcher;
@@ -42,8 +39,7 @@ import net.shibboleth.idp.profile.RequestContextBuilder;
import net.shibboleth.idp.profile.context.RelyingPartyContext;
import net.shibboleth.idp.profile.context.navigate.WebflowRequestContextProfileRequestContextLookup;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-import net.shibboleth.utilities.java.support.service.AbstractReloadableService;
-import net.shibboleth.utilities.java.support.service.ServiceableComponent;
+import net.shibboleth.utilities.java.support.service.MockReloadableService;
import org.opensaml.profile.context.ProfileRequestContext;
import org.springframework.webflow.execution.Event;
@@ -71,7 +67,7 @@ public class FilterAttributesTest {
final AttributeFilterImpl engine = new AttributeFilterImpl("test", null);
engine.initialize();
- final FilterAttributes action = new FilterAttributes(new FilterService(engine));
+ final FilterAttributes action = new FilterAttributes(new MockReloadableService(engine));
action.initialize();
final Event event = action.execute(src);
@@ -87,7 +83,7 @@ public class FilterAttributesTest {
final AttributeFilterImpl engine = new AttributeFilterImpl("test", null);
engine.initialize();
- final FilterAttributes action = new FilterAttributes(new FilterService(engine));
+ final FilterAttributes action = new FilterAttributes(new MockReloadableService(engine));
action.initialize();
final Event event = action.execute(src);
@@ -130,7 +126,7 @@ public class FilterAttributesTest {
attributeCtx.setIdPAttributes(attributes);
prc.getSubcontext(RelyingPartyContext.class).addSubcontext(attributeCtx);
- final FilterAttributes action = new FilterAttributes(new FilterService(engine));
+ final FilterAttributes action = new FilterAttributes(new MockReloadableService(engine));
action.initialize();
final Event event = action.execute(src);
@@ -192,7 +188,7 @@ public class FilterAttributesTest {
final AttributeFilterContext attributeFilterCtx = new AttributeFilterContext();
prc.getSubcontext(RelyingPartyContext.class).addSubcontext(attributeFilterCtx);
- final FilterAttributes action = new FilterAttributes(new FilterService(engine));
+ final FilterAttributes action = new FilterAttributes(new MockReloadableService(engine));
action.initialize();
final Event event = action.execute(src);
@@ -251,7 +247,7 @@ public class FilterAttributesTest {
final AttributeFilterContext attributeFilterCtx = new AttributeFilterContext();
prc.getSubcontext(RelyingPartyContext.class).addSubcontext(attributeFilterCtx);
- final FilterAttributes action = new FilterAttributes(new FilterService(engine));
+ final FilterAttributes action = new FilterAttributes(new MockReloadableService(engine));
action.initialize();
final Event event = action.execute(src);
@@ -274,7 +270,7 @@ public class FilterAttributesTest {
final AttributeFilterContext attributeFilterCtx = new AttributeFilterContext();
prc.getSubcontext(RelyingPartyContext.class).addSubcontext(attributeFilterCtx);
- final FilterAttributes action = new FilterAttributes(new FilterService(null));
+ final FilterAttributes action = new FilterAttributes(new MockReloadableService(null));
action.setMaskFailures(false);
action.initialize();
@@ -302,30 +298,4 @@ public class FilterAttributesTest {
}
}
-
- private static class FilterService extends AbstractReloadableService<AttributeFilter> {
-
- private ServiceableComponent<AttributeFilter> component;
-
- protected FilterService(ServiceableComponent<AttributeFilter> what) {
- component = what;
- }
-
- /** {@inheritDoc} */
- @Override
- @Nullable public ServiceableComponent<AttributeFilter> getServiceableComponent() {
- if (null == component) {
- return null;
- }
- component.pinComponent();
- return component;
- }
-
- /** {@inheritDoc} */
- @Override
- protected boolean shouldReload() {
- return false;
- }
- }
-
}
\ No newline at end of file
diff --git a/idp-profile-impl/src/test/java/net/shibboleth/idp/profile/impl/ResolveAttributesTest.java b/idp-profile-impl/src/test/java/net/shibboleth/idp/profile/impl/ResolveAttributesTest.java
index bed053e..da718d0 100644
--- a/idp-profile-impl/src/test/java/net/shibboleth/idp/profile/impl/ResolveAttributesTest.java
+++ b/idp-profile-impl/src/test/java/net/shibboleth/idp/profile/impl/ResolveAttributesTest.java
@@ -20,13 +20,10 @@ package net.shibboleth.idp.profile.impl;
import java.util.Collections;
import java.util.Map;
-import javax.annotation.Nullable;
-
import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.idp.attribute.StringAttributeValue;
import net.shibboleth.idp.attribute.context.AttributeContext;
import net.shibboleth.idp.attribute.resolver.AttributeDefinition;
-import net.shibboleth.idp.attribute.resolver.AttributeResolver;
import net.shibboleth.idp.attribute.resolver.MockAttributeDefinition;
import net.shibboleth.idp.attribute.resolver.ResolutionException;
import net.shibboleth.idp.attribute.resolver.context.AttributeResolutionContext;
@@ -40,8 +37,7 @@ import net.shibboleth.idp.profile.context.RelyingPartyContext;
import net.shibboleth.idp.profile.context.navigate.WebflowRequestContextProfileRequestContextLookup;
import net.shibboleth.utilities.java.support.collection.LazySet;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-import net.shibboleth.utilities.java.support.service.AbstractReloadableService;
-import net.shibboleth.utilities.java.support.service.ServiceableComponent;
+import net.shibboleth.utilities.java.support.service.MockReloadableService;
import org.opensaml.profile.context.ProfileRequestContext;
import org.springframework.webflow.execution.Event;
@@ -77,7 +73,7 @@ public class ResolveAttributesTest {
ad1.initialize();
resolver.initialize();
- final ResolveAttributes action = new ResolveAttributes(new AttributeService(resolver));
+ final ResolveAttributes action = new ResolveAttributes(new MockReloadableService(resolver));
action.initialize();
final Event event = action.execute(src);
@@ -115,7 +111,7 @@ public class ResolveAttributesTest {
attributeResolutionCtx.setRequestedIdPAttributeNames(Collections.singleton("ad1"));
prc.addSubcontext(attributeResolutionCtx);
- final ResolveAttributes action = new ResolveAttributes(new AttributeService(resolver));
+ final ResolveAttributes action = new ResolveAttributes(new MockReloadableService(resolver));
action.initialize();
Event event = action.execute(src);
@@ -170,7 +166,7 @@ public class ResolveAttributesTest {
ad1.initialize();
resolver.initialize();
- final ResolveAttributes action = new ResolveAttributes(new AttributeService(resolver));
+ final ResolveAttributes action = new ResolveAttributes(new MockReloadableService(resolver));
action.initialize();
final Event event = action.execute(src);
@@ -190,39 +186,12 @@ public class ResolveAttributesTest {
final LazySet<AttributeDefinition> definitions = new LazySet<>();
definitions.add(new MockAttributeDefinition("ad1", new ResolutionException()));
- final ResolveAttributes action = new ResolveAttributes(new AttributeService(null));
+ final ResolveAttributes action = new ResolveAttributes(new MockReloadableService(null));
action.setMaskFailures(false);
action.initialize();
final Event event = action.execute(src);
ActionTestingSupport.assertEvent(event, IdPEventIds.UNABLE_RESOLVE_ATTRIBS);
}
-
-
- private static class AttributeService extends AbstractReloadableService<AttributeResolver> {
-
- private ServiceableComponent<AttributeResolver> component;
-
- protected AttributeService(final ServiceableComponent<AttributeResolver> what) {
- component = what;
- }
-
- /** {@inheritDoc} */
- @Override
- @Nullable public ServiceableComponent<AttributeResolver> getServiceableComponent() {
- if (null == component) {
- return null;
- }
- component.pinComponent();
- return component;
- }
-
- /** {@inheritDoc} */
- @Override
- protected boolean shouldReload() {
- return false;
- }
-
- }
}
\ No newline at end of file
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/AddAttributeStatementToAssertionTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/AddAttributeStatementToAssertionTest.java
index a0a4660..11697ee 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/AddAttributeStatementToAssertionTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/AddAttributeStatementToAssertionTest.java
@@ -43,8 +43,7 @@ import net.shibboleth.idp.saml.attribute.transcoding.SAMLAttributeTranscoder;
import net.shibboleth.idp.saml.attribute.transcoding.impl.SAML1StringAttributeTranscoder;
import net.shibboleth.idp.saml.saml1.profile.SAML1ActionTestingSupport;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-import net.shibboleth.utilities.java.support.service.AbstractReloadableService;
-import net.shibboleth.utilities.java.support.service.ServiceableComponent;
+import net.shibboleth.utilities.java.support.service.MockReloadableService;
import org.opensaml.core.OpenSAMLInitBaseTestCase;
import org.opensaml.core.xml.XMLObject;
@@ -131,7 +130,7 @@ public class AddAttributeStatementToAssertionTest extends OpenSAMLInitBaseTestCa
registry.initialize();
action = new AddAttributeStatementToAssertion();
- action.setTranscoderRegistry(new RegistryService(registry));
+ action.setTranscoderRegistry(new MockReloadableService(registry));
}
/** Test that the action errors out properly if there is no relying party context. */
@@ -193,7 +192,7 @@ public class AddAttributeStatementToAssertionTest extends OpenSAMLInitBaseTestCa
localregistry.setTranscoderRegistry(Collections.singletonList(new TranscodingRule(rule)));
localregistry.initialize();
- action.setTranscoderRegistry(new RegistryService(localregistry));
+ action.setTranscoderRegistry(new MockReloadableService(localregistry));
final IdPAttribute attribute = new IdPAttribute(MY_NAME_1);
attribute.setValues(Arrays.asList(new StringAttributeValue(MY_VALUE_1)));
@@ -229,7 +228,7 @@ public class AddAttributeStatementToAssertionTest extends OpenSAMLInitBaseTestCa
localregistry.setTranscoderRegistry(Collections.singletonList(new TranscodingRule(rule)));
localregistry.initialize();
- action.setTranscoderRegistry(new RegistryService(localregistry));
+ action.setTranscoderRegistry(new MockReloadableService(localregistry));
final IdPAttribute attribute = new IdPAttribute(MY_NAME_1);
attribute.setValues(Arrays.asList(new StringAttributeValue(MY_VALUE_1)));
@@ -390,29 +389,4 @@ public class AddAttributeStatementToAssertionTest extends OpenSAMLInitBaseTestCa
}
}
- private static class RegistryService extends AbstractReloadableService<AttributeTranscoderRegistry> {
-
- private ServiceableComponent<AttributeTranscoderRegistry> component;
-
- protected RegistryService(ServiceableComponent<AttributeTranscoderRegistry> what) {
- component = what;
- }
-
- /** {@inheritDoc} */
- @Override
- @Nullable public ServiceableComponent<AttributeTranscoderRegistry> getServiceableComponent() {
- if (null == component) {
- return null;
- }
- component.pinComponent();
- return component;
- }
-
- /** {@inheritDoc} */
- @Override
- protected boolean shouldReload() {
- return false;
- }
- }
-
}
\ No newline at end of file
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/FilterByQueriedAttributeDesignatorsTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/FilterByQueriedAttributeDesignatorsTest.java
index 4d6bbb0..9c5514d 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/FilterByQueriedAttributeDesignatorsTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/FilterByQueriedAttributeDesignatorsTest.java
@@ -22,8 +22,6 @@ import static org.testng.Assert.assertEquals;
import java.util.Collection;
import java.util.List;
-import javax.annotation.Nullable;
-
import org.opensaml.core.xml.XMLObjectBaseTestCase;
import org.opensaml.core.xml.io.UnmarshallingException;
import org.opensaml.profile.context.ProfileRequestContext;
@@ -49,9 +47,8 @@ import net.shibboleth.idp.profile.RequestContextBuilder;
import net.shibboleth.idp.profile.context.RelyingPartyContext;
import net.shibboleth.idp.profile.context.navigate.WebflowRequestContextProfileRequestContextLookup;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-import net.shibboleth.utilities.java.support.service.AbstractReloadableService;
+import net.shibboleth.utilities.java.support.service.MockReloadableService;
import net.shibboleth.utilities.java.support.service.ReloadableService;
-import net.shibboleth.utilities.java.support.service.ServiceableComponent;
import net.shibboleth.utilities.java.support.xml.XMLParserException;
/** Tests for {@link FilterByQueriedAttributeDesignators} */
@@ -91,7 +88,7 @@ public class FilterByQueriedAttributeDesignatorsTest extends XMLObjectBaseTestCa
}
@BeforeClass public void setup() {
- registry = new RegistryService(getBean(PATH + "saml1Mapper.xml", AttributeTranscoderRegistryImpl.class));
+ registry = new MockReloadableService(getBean(PATH + "saml1Mapper.xml", AttributeTranscoderRegistryImpl.class));
}
@BeforeMethod public void setUpMethod() throws ComponentInitializationException, XMLParserException, UnmarshallingException {
@@ -143,29 +140,4 @@ public class FilterByQueriedAttributeDesignatorsTest extends XMLObjectBaseTestCa
assertEquals(ac.getIdPAttributes().size(), 3);
}
- private static class RegistryService extends AbstractReloadableService<AttributeTranscoderRegistry> {
-
- private ServiceableComponent<AttributeTranscoderRegistry> component;
-
- protected RegistryService(ServiceableComponent<AttributeTranscoderRegistry> what) {
- component = what;
- }
-
- /** {@inheritDoc} */
- @Override
- @Nullable public ServiceableComponent<AttributeTranscoderRegistry> getServiceableComponent() {
- if (null == component) {
- return null;
- }
- component.pinComponent();
- return component;
- }
-
- /** {@inheritDoc} */
- @Override
- protected boolean shouldReload() {
- return false;
- }
- }
-
}
\ No newline at end of file
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/AddAttributeStatementToAssertionTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/AddAttributeStatementToAssertionTest.java
index 762877a..c512c5b 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/AddAttributeStatementToAssertionTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/AddAttributeStatementToAssertionTest.java
@@ -43,8 +43,7 @@ import net.shibboleth.idp.saml.attribute.transcoding.SAMLAttributeTranscoder;
import net.shibboleth.idp.saml.attribute.transcoding.impl.SAML2StringAttributeTranscoder;
import net.shibboleth.idp.saml.saml2.profile.SAML2ActionTestingSupport;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-import net.shibboleth.utilities.java.support.service.AbstractReloadableService;
-import net.shibboleth.utilities.java.support.service.ServiceableComponent;
+import net.shibboleth.utilities.java.support.service.MockReloadableService;
import org.opensaml.core.OpenSAMLInitBaseTestCase;
import org.opensaml.core.xml.XMLObject;
@@ -129,7 +128,7 @@ public class AddAttributeStatementToAssertionTest extends OpenSAMLInitBaseTestCa
registry.initialize();
action = new AddAttributeStatementToAssertion();
- action.setTranscoderRegistry(new RegistryService(registry));
+ action.setTranscoderRegistry(new MockReloadableService(registry));
}
/** Test that the action errors out properly if there is no relying party context. */
@@ -191,7 +190,7 @@ public class AddAttributeStatementToAssertionTest extends OpenSAMLInitBaseTestCa
localregistry.setTranscoderRegistry(Collections.singletonList(new TranscodingRule(rule)));
localregistry.initialize();
- action.setTranscoderRegistry(new RegistryService(localregistry));
+ action.setTranscoderRegistry(new MockReloadableService(localregistry));
final IdPAttribute attribute = new IdPAttribute(MY_NAME_1);
attribute.setValues(Arrays.asList(new StringAttributeValue(MY_VALUE_1)));
@@ -227,7 +226,7 @@ public class AddAttributeStatementToAssertionTest extends OpenSAMLInitBaseTestCa
localregistry.setTranscoderRegistry(Collections.singletonList(new TranscodingRule(rule)));
localregistry.initialize();
- action.setTranscoderRegistry(new RegistryService(localregistry));
+ action.setTranscoderRegistry(new MockReloadableService(localregistry));
final IdPAttribute attribute = new IdPAttribute(MY_NAME_1);
attribute.setValues(Arrays.asList(new StringAttributeValue(MY_VALUE_1)));
@@ -389,29 +388,4 @@ public class AddAttributeStatementToAssertionTest extends OpenSAMLInitBaseTestCa
}
}
- private static class RegistryService extends AbstractReloadableService<AttributeTranscoderRegistry> {
-
- private ServiceableComponent<AttributeTranscoderRegistry> component;
-
- protected RegistryService(ServiceableComponent<AttributeTranscoderRegistry> what) {
- component = what;
- }
-
- /** {@inheritDoc} */
- @Override
- @Nullable public ServiceableComponent<AttributeTranscoderRegistry> getServiceableComponent() {
- if (null == component) {
- return null;
- }
- component.pinComponent();
- return component;
- }
-
- /** {@inheritDoc} */
- @Override
- protected boolean shouldReload() {
- return false;
- }
- }
-
}
\ No newline at end of file
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/FilterByQueriedAttributesTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/FilterByQueriedAttributesTest.java
index cc6738c..8539242 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/FilterByQueriedAttributesTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/FilterByQueriedAttributesTest.java
@@ -22,8 +22,6 @@ import static org.testng.Assert.assertEquals;
import java.util.Collection;
import java.util.List;
-import javax.annotation.Nullable;
-
import org.opensaml.core.xml.XMLObjectBaseTestCase;
import org.opensaml.core.xml.io.UnmarshallingException;
import org.opensaml.profile.context.ProfileRequestContext;
@@ -49,9 +47,8 @@ import net.shibboleth.idp.profile.RequestContextBuilder;
import net.shibboleth.idp.profile.context.RelyingPartyContext;
import net.shibboleth.idp.profile.context.navigate.WebflowRequestContextProfileRequestContextLookup;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-import net.shibboleth.utilities.java.support.service.AbstractReloadableService;
+import net.shibboleth.utilities.java.support.service.MockReloadableService;
import net.shibboleth.utilities.java.support.service.ReloadableService;
-import net.shibboleth.utilities.java.support.service.ServiceableComponent;
import net.shibboleth.utilities.java.support.xml.XMLParserException;
/** Tests for {@link FilterByQueriedAttributes} */
@@ -91,7 +88,7 @@ public class FilterByQueriedAttributesTest extends XMLObjectBaseTestCase {
}
@BeforeClass public void setup() {
- registry = new RegistryService(getBean(PATH + "saml2Mapper.xml", AttributeTranscoderRegistryImpl.class));
+ registry = new MockReloadableService(getBean(PATH + "saml2Mapper.xml", AttributeTranscoderRegistryImpl.class));
}
@BeforeMethod public void setUpMethod() throws ComponentInitializationException, XMLParserException, UnmarshallingException {
@@ -141,29 +138,4 @@ public class FilterByQueriedAttributesTest extends XMLObjectBaseTestCase {
assertEquals(ac.getIdPAttributes().size(), 2);
}
- private static class RegistryService extends AbstractReloadableService<AttributeTranscoderRegistry> {
-
- private ServiceableComponent<AttributeTranscoderRegistry> component;
-
- protected RegistryService(ServiceableComponent<AttributeTranscoderRegistry> what) {
- component = what;
- }
-
- /** {@inheritDoc} */
- @Override
- @Nullable public ServiceableComponent<AttributeTranscoderRegistry> getServiceableComponent() {
- if (null == component) {
- return null;
- }
- component.pinComponent();
- return component;
- }
-
- /** {@inheritDoc} */
- @Override
- protected boolean shouldReload() {
- return false;
- }
- }
-
}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list