[java-shib-attribute] 01/01: JSSH-71 Remove the impact of the DestructableComponent Interface
Codeberg
noreply at shibboleth.net
Mon Jul 6 15:28:41 UTC 2026
This is an automated email from the git hooks/post-receive script.
codeberg pushed a commit to branch dev/JSSH-71
in repository java-shib-attribute.
View the commit online:
https://codeberg.org/Shibboleth/java-shib-attribute/commit/bcc42ccf8d82bd01748a09a6c883a4a7d2606135
commit bcc42ccf8d82bd01748a09a6c883a4a7d2606135
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Mon Jul 6 16:27:52 2026 +0100
JSSH-71 Remove the impact of the DestructableComponent Interface
https://shibboleth.atlassian.net/browse/JSSH-71
Stop testing destroy state.
---
.../filter/matcher/impl/ScriptedMatcherTest.java | 28 +++--------
.../logic/impl/AbstractComposedMatcherTest.java | 40 ---------------
.../filter/matcher/logic/impl/AndMatcherTest.java | 8 ---
.../filter/matcher/logic/impl/NotMatcherTest.java | 8 ---
.../filter/matcher/logic/impl/OrMatcherTest.java | 9 ----
.../policyrule/impl/ScriptedPolicyRuleTest.java | 22 +--------
.../logic/impl/AbstractComposedPolicyRuleTest.java | 43 ----------------
.../filter/tests/AttributeFilterPolicyTest.java | 25 ++--------
.../tests/AttributeValueFilterPolicyTest.java | 57 ++--------------------
.../resolver/ad/impl/PrescopedAtributeTest.java | 27 ++--------
.../resolver/ad/impl/RegexAtributeTest.java | 29 ++---------
.../resolver/ad/impl/ScopedAttributeTest.java | 27 ++--------
.../ad/impl/StaticAttributeDefinitionTest.java | 27 ----------
.../ad/mapped/impl/MappedAttributeTest.java | 16 ------
.../resolver/dc/impl/StaticDataConnectorTest.java | 13 +----
.../resolver/impl/AttributeResolverImplTest.java | 10 +---
16 files changed, 34 insertions(+), 355 deletions(-)
diff --git a/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/impl/ScriptedMatcherTest.java b/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/impl/ScriptedMatcherTest.java
index 604800590..dc3abcb7d 100644
--- a/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/impl/ScriptedMatcherTest.java
+++ b/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/impl/ScriptedMatcherTest.java
@@ -14,7 +14,12 @@
package net.shibboleth.idp.attribute.filter.matcher.impl;
-import static org.testng.Assert.*;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNotSame;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
import java.util.Set;
@@ -28,7 +33,6 @@ import net.shibboleth.idp.attribute.filter.context.AttributeFilterContext;
import net.shibboleth.shared.annotation.constraint.NonnullBeforeTest;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.component.DestroyedComponentException;
import net.shibboleth.shared.component.UninitializedComponentException;
import net.shibboleth.shared.component.UnmodifiableComponentException;
import net.shibboleth.shared.scripting.EvaluableScript;
@@ -164,7 +168,7 @@ public class ScriptedMatcherTest extends AbstractMatcherPolicyRuleTest {
assertTrue(result.contains(value1) || result.contains(value2) || result.contains(value3));
}
- @Test public void testInitTeardown() throws ComponentInitializationException {
+ @Test public void testInit() throws ComponentInitializationException {
final ScriptedMatcher matcher = newScriptedMatcher(returnOneValueScript);
@@ -186,24 +190,8 @@ public class ScriptedMatcherTest extends AbstractMatcherPolicyRuleTest {
} catch (final UnmodifiableComponentException e) {
thrown = true;
}
+ assertTrue(thrown, "setScript after init");
- matcher.destroy();
-
- thrown = false;
- try {
- matcher.initialize();
- } catch (final DestroyedComponentException e) {
- thrown = true;
- }
- assertTrue(thrown, "getMatchingValues after destroy");
-
- thrown = false;
- try {
- matcher.getMatchingValues(attribute, filterContext);
- } catch (final DestroyedComponentException e) {
- thrown = true;
- }
- assertTrue(thrown, "getMatchingValues after destroy");
}
@SuppressWarnings("unlikely-arg-type")
diff --git a/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/logic/impl/AbstractComposedMatcherTest.java b/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/logic/impl/AbstractComposedMatcherTest.java
index 5aefb88c9..5da331d5f 100644
--- a/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/logic/impl/AbstractComposedMatcherTest.java
+++ b/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/logic/impl/AbstractComposedMatcherTest.java
@@ -30,10 +30,8 @@ import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.idp.attribute.IdPAttributeValue;
import net.shibboleth.idp.attribute.filter.Matcher;
import net.shibboleth.idp.attribute.filter.context.AttributeFilterContext;
-import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.AbstractInitializableComponent;
import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.component.DestroyedComponentException;
import net.shibboleth.shared.component.DestructableComponent;
import net.shibboleth.shared.component.InitializableComponent;
@@ -41,44 +39,6 @@ import net.shibboleth.shared.component.InitializableComponent;
@SuppressWarnings("javadoc")
public class AbstractComposedMatcherTest {
- @Test public void testInitDestroy() throws ComponentInitializationException {
- final List<Matcher> firstList = new ArrayList<>(2);
- ComposedMatcher matcher = new ComposedMatcher(CollectionSupport.emptyList());
-
- for (int i = 0; i < 2; i++) {
- firstList.add(new TestMatcher());
- }
-
- matcher.destroy();
-
- boolean thrown = false;
- try {
- matcher.initialize();
- } catch (final DestroyedComponentException e) {
- thrown = true;
- }
-
- assertTrue(thrown, "Initialize after destroy");
-
- for (int i = 0; i < 2; i++) {
- firstList.add(new TestMatcher());
- }
- matcher = new ComposedMatcher(firstList);
-
- assertEquals(firstList.size(), matcher.getComposedMatchers().size());
-
- thrown = false;
- try {
- matcher.getComposedMatchers().add(new TestMatcher());
- } catch (final UnsupportedOperationException e) {
- thrown = true;
- }
- assertTrue(thrown, "Set into the returned list");
- matcher.setId("Test");
-
- matcher.initialize();
- }
-
@Test public void testParams() throws ComponentInitializationException {
ComposedMatcher matcher = new ComposedMatcher(null);
diff --git a/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/logic/impl/AndMatcherTest.java b/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/logic/impl/AndMatcherTest.java
index 9b6884719..33be5bb86 100644
--- a/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/logic/impl/AndMatcherTest.java
+++ b/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/logic/impl/AndMatcherTest.java
@@ -34,7 +34,6 @@ import net.shibboleth.idp.attribute.filter.matcher.impl.AbstractMatcherPolicyRul
import net.shibboleth.idp.attribute.filter.matcher.impl.MockValuePredicateMatcher;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.component.DestroyedComponentException;
import net.shibboleth.shared.component.UninitializedComponentException;
import net.shibboleth.shared.logic.PredicateSupport;
@@ -83,13 +82,6 @@ public class AndMatcherTest extends AbstractMatcherPolicyRuleTest {
assertEquals(result.size(), 1);
assertTrue(result.contains(value2));
- matcher.destroy();
- try {
- matcher.getMatchingValues(attribute, filterContext);
- fail();
- } catch (final DestroyedComponentException e) {
- // expect this
- }
}
@Test public void testFails() throws Exception {
diff --git a/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/logic/impl/NotMatcherTest.java b/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/logic/impl/NotMatcherTest.java
index 7e67474f8..fc62f2f1b 100644
--- a/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/logic/impl/NotMatcherTest.java
+++ b/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/logic/impl/NotMatcherTest.java
@@ -80,14 +80,6 @@ public class NotMatcherTest extends AbstractMatcherPolicyRuleTest {
assert result != null;
assertEquals(result.size(), 1);
assertTrue(result.contains(value3));
- matcher.destroy();
- try {
- matcher.getMatchingValues(attribute, filterContext);
- fail();
- } catch (final DestroyedComponentException e) {
- // expect this
- }
-
final OrMatcher orMatcher =
OrMatcherTest.newOrMatcher(CollectionSupport.listOf(new MockValuePredicateMatcher(equalValue1()),
new MockValuePredicateMatcher(equalValue2()), new MockValuePredicateMatcher(equalValue3())));
diff --git a/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/logic/impl/OrMatcherTest.java b/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/logic/impl/OrMatcherTest.java
index 68cbdb437..fe1283973 100644
--- a/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/logic/impl/OrMatcherTest.java
+++ b/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/logic/impl/OrMatcherTest.java
@@ -36,7 +36,6 @@ import net.shibboleth.idp.attribute.filter.matcher.impl.AbstractMatcherPolicyRul
import net.shibboleth.idp.attribute.filter.matcher.impl.MockValuePredicateMatcher;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.component.DestroyedComponentException;
import net.shibboleth.shared.component.UninitializedComponentException;
import net.shibboleth.shared.logic.PredicateSupport;
@@ -87,14 +86,6 @@ public class OrMatcherTest extends AbstractMatcherPolicyRuleTest {
assertEquals(result.size(), 2);
assertTrue(result.contains(value2) && result.contains(value1));
- matcher.destroy();
- try {
- matcher.getMatchingValues(attribute, filterContext);
- fail();
- } catch (final DestroyedComponentException e) {
- // expect this
- }
-
matcher = newOrMatcher(CollectionSupport.emptyList());
matcher.setId("test");
try {
diff --git a/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/policyrule/impl/ScriptedPolicyRuleTest.java b/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/policyrule/impl/ScriptedPolicyRuleTest.java
index bdeb44d88..bbf744e49 100644
--- a/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/policyrule/impl/ScriptedPolicyRuleTest.java
+++ b/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/policyrule/impl/ScriptedPolicyRuleTest.java
@@ -29,7 +29,6 @@ import net.shibboleth.idp.attribute.filter.context.AttributeFilterContext;
import net.shibboleth.idp.attribute.filter.matcher.impl.AbstractMatcherPolicyRuleTest;
import net.shibboleth.shared.annotation.constraint.NonnullBeforeTest;
import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.component.DestroyedComponentException;
import net.shibboleth.shared.component.UninitializedComponentException;
import net.shibboleth.shared.component.UnmodifiableComponentException;
import net.shibboleth.shared.scripting.EvaluableScript;
@@ -118,7 +117,7 @@ public class ScriptedPolicyRuleTest extends AbstractMatcherPolicyRuleTest {
}
@SuppressWarnings("null")
- @Test public void testInitTeardown() throws ComponentInitializationException {
+ @Test public void testInit() throws ComponentInitializationException {
final ScriptedPolicyRule rule = newScriptedPolicyRule(trueReturnScript);
boolean thrown = false;
@@ -139,25 +138,6 @@ public class ScriptedPolicyRuleTest extends AbstractMatcherPolicyRuleTest {
} catch (final UnmodifiableComponentException e) {
thrown = true;
}
-
- rule.destroy();
-
- thrown = false;
- try {
- rule.initialize();
- } catch (final DestroyedComponentException e) {
- thrown = true;
- }
- assertTrue(thrown, "init after destroy");
-
- thrown = false;
- try {
- rule.matches(filterContext);
- } catch (final DestroyedComponentException e) {
- thrown = true;
- }
- assertTrue(thrown, "matches after destroy");
-
}
@SuppressWarnings({ "unlikely-arg-type", "null" })
diff --git a/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/policyrule/logic/impl/AbstractComposedPolicyRuleTest.java b/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/policyrule/logic/impl/AbstractComposedPolicyRuleTest.java
index d4cadc8ce..a1a7e44c9 100644
--- a/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/policyrule/logic/impl/AbstractComposedPolicyRuleTest.java
+++ b/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/policyrule/logic/impl/AbstractComposedPolicyRuleTest.java
@@ -27,10 +27,8 @@ import org.testng.annotations.Test;
import net.shibboleth.idp.attribute.filter.PolicyRequirementRule;
import net.shibboleth.idp.attribute.filter.context.AttributeFilterContext;
-import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.AbstractInitializableComponent;
import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.component.DestroyedComponentException;
import net.shibboleth.shared.component.DestructableComponent;
import net.shibboleth.shared.component.InitializableComponent;
import net.shibboleth.shared.primitive.LoggerFactory;
@@ -39,47 +37,6 @@ import net.shibboleth.shared.primitive.LoggerFactory;
@SuppressWarnings("javadoc")
public class AbstractComposedPolicyRuleTest {
- @Test
- public void testInitDestroy() throws ComponentInitializationException {
- final List<PolicyRequirementRule> firstList = new ArrayList<>(2);
- ComposedPolicyRule rule = new ComposedPolicyRule(CollectionSupport.emptyList());
-
- for (int i = 0; i < 2;i++) {
- firstList.add(new TestMatcher());
- }
-
- rule.destroy();
-
- boolean thrown = false;
- try {
- rule.initialize();
- } catch (final DestroyedComponentException e) {
- thrown = true;
- }
-
- assertTrue(thrown, "Initialize after destroy");
-
- for (int i = 0; i < 2;i++) {
- firstList.add(new TestMatcher());
- }
- rule = new ComposedPolicyRule(firstList);
-
- assertEquals(firstList.size(), rule.getComposedRules().size());
-
- thrown = false;
- try {
- rule.getComposedRules().add(new TestMatcher());
- } catch (final UnsupportedOperationException e) {
- thrown = true;
- }
- assertTrue(thrown, "Set into the returned list");
- rule.setId("Test");
-
- rule.initialize();
-
- rule.destroy();
- }
-
@Test
public void testParams() throws ComponentInitializationException {
ComposedPolicyRule rule = new ComposedPolicyRule(null);
diff --git a/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/tests/AttributeFilterPolicyTest.java b/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/tests/AttributeFilterPolicyTest.java
index 76ac856e8..eb823abc4 100644
--- a/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/tests/AttributeFilterPolicyTest.java
+++ b/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/tests/AttributeFilterPolicyTest.java
@@ -19,6 +19,10 @@ import java.util.List;
import javax.annotation.Nonnull;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.idp.attribute.IdPAttributeSupport;
import net.shibboleth.idp.attribute.StringAttributeValue;
@@ -34,14 +38,9 @@ import net.shibboleth.shared.annotation.constraint.NonnullBeforeTest;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.component.DestroyedComponentException;
import net.shibboleth.shared.component.UninitializedComponentException;
import net.shibboleth.shared.logic.ConstraintViolationException;
-import org.testng.Assert;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
/** {@link AttributeFilterPolicy} unit test. */
@SuppressWarnings("javadoc")
public class AttributeFilterPolicyTest {
@@ -100,7 +99,7 @@ public class AttributeFilterPolicyTest {
}
}
- @Test public void testInitDestroy() throws ComponentInitializationException {
+ @Test public void testInit() throws ComponentInitializationException {
final MockPolicyRequirementRule localPolicyMatcher = policyMatcher;
assert localPolicyMatcher!=null && valuePolicy!=null;
final List<AttributeRule> valuePolicyList = CollectionSupport.listOf(valuePolicy);
@@ -122,20 +121,6 @@ public class AttributeFilterPolicyTest {
Assert.assertFalse(policyMatcher.isDestroyed(), "Initialized");
Assert.assertFalse(valueMatcher.isDestroyed(), "Initialized");
- policy.destroy();
- policyMatcher.destroy();
- valueMatcher.destroy();
- Assert.assertTrue(policy.isDestroyed(), "Destroyed");
- Assert.assertTrue(policyMatcher.isDestroyed(), "Destroyed");
- Assert.assertTrue(valueMatcher.isDestroyed(), "Destroyed");
-
- boolean thrown = false;
- try {
- policy.initialize();
- } catch (final DestroyedComponentException e) {
- thrown = true;
- }
- Assert.assertTrue(thrown, "Destroyed");
}
@Test public void testAttributeValuePolicies() throws ComponentInitializationException {
diff --git a/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/tests/AttributeValueFilterPolicyTest.java b/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/tests/AttributeValueFilterPolicyTest.java
index f4b95bbac..f4ba629b4 100644
--- a/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/tests/AttributeValueFilterPolicyTest.java
+++ b/shib-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/tests/AttributeValueFilterPolicyTest.java
@@ -17,6 +17,9 @@ package net.shibboleth.idp.attribute.filter.tests;
import java.util.Arrays;
import java.util.Collection;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.idp.attribute.IdPAttributeValue;
import net.shibboleth.idp.attribute.StringAttributeValue;
@@ -28,12 +31,8 @@ import net.shibboleth.idp.attribute.filter.context.AttributeFilterWorkContext;
import net.shibboleth.idp.attribute.filter.testing.MockMatcher;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.component.DestroyedComponentException;
import net.shibboleth.shared.component.UnmodifiableComponentException;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
/**
* Tests for {@link AttributeRule}
*/
@@ -67,13 +66,6 @@ public class AttributeValueFilterPolicyTest {
Assert.assertTrue(policy.isDestroyed(), "Destroyed");
Assert.assertTrue(matcher.isDestroyed(), "Destroyed");
- boolean thrown = false;
- try {
- policy.initialize();
- } catch (final DestroyedComponentException e) {
- thrown = true;
- }
- Assert.assertTrue(thrown, "initialize after destroy");
}
@@ -112,24 +104,6 @@ public class AttributeValueFilterPolicyTest {
}
Assert.assertEquals(policy.getAttributeId(), "ID", "Get Attribute ID");
- policy.destroy();
-
- try {
- policy.getAttributeId();
- Assert.fail("GetAttributeId after destroy");
- } catch (final DestroyedComponentException e) {
- // expected
- }
-
- policy = new AttributeRule();
- policy.destroy();
-
- try {
- policy.setAttributeId("foo");
- Assert.fail("SetAttributeId after destroy");
- } catch (final DestroyedComponentException e) {
- // expected
- }
}
@@ -163,23 +137,6 @@ public class AttributeValueFilterPolicyTest {
policy.setMatcher(Matcher.MATCHES_ALL);
policy.setIsDenyRule(false);
policy.initialize();
- policy.destroy();
- thrown = false;
- try {
- policy.setMatcher(Matcher.MATCHES_NONE);
- } catch (final UnmodifiableComponentException | DestroyedComponentException e) {
- thrown = true;
- }
- Assert.assertTrue(thrown, "setMatchingPermittedValues after destroy");
-
- thrown = false;
- try {
- policy.getMatcher();
- } catch (DestroyedComponentException e) {
- thrown = true;
- }
- Assert.assertTrue(thrown, "isMatchingPermittedValues after destroy");
-
}
@Test public void testApply() throws ComponentInitializationException, AttributeFilterException {
@@ -234,14 +191,6 @@ public class AttributeValueFilterPolicyTest {
Assert.assertTrue(result.contains(cStringAttributeValue));
Assert.assertNull(workCtx.getPermittedIdPAttributeValues().get(ATTR_NAME));
- policy.destroy();
-
- try {
- policy.apply(attribute1, context);
- Assert.fail("validate after destroy");
- } catch (DestroyedComponentException e) {
- // expected
- }
}
}
\ No newline at end of file
diff --git a/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/PrescopedAtributeTest.java b/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/PrescopedAtributeTest.java
index ae186cae2..4b16ee6ac 100644
--- a/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/PrescopedAtributeTest.java
+++ b/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/PrescopedAtributeTest.java
@@ -14,7 +14,10 @@
package net.shibboleth.idp.attribute.resolver.ad.impl;
-import static org.testng.Assert.*;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
import java.util.ArrayList;
import java.util.Collection;
@@ -42,7 +45,6 @@ import net.shibboleth.idp.attribute.resolver.testing.TestSources;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.collection.LazySet;
import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.component.DestroyedComponentException;
import net.shibboleth.shared.component.UninitializedComponentException;
/**
@@ -219,7 +221,7 @@ public class PrescopedAtributeTest {
assertEquals(f.iterator().next(), EmptyAttributeValue.ZERO_LENGTH);
}
- @Test public void initDestroyParms() throws ResolutionException, ComponentInitializationException {
+ @Test public void init() throws ResolutionException, ComponentInitializationException {
PrescopedAttributeDefinition attrDef = new PrescopedAttributeDefinition();
final ResolverDataConnectorDependency depend = new ResolverDataConnectorDependency("connector1");
@@ -250,24 +252,5 @@ public class PrescopedAtributeTest {
assertEquals(attrDef.getScopeDelimiter(), DELIMITER);
- attrDef.destroy();
- try {
- attrDef.initialize();
- fail("Init after destroy");
- } catch (final DestroyedComponentException e) {
- // OK
- }
- try {
- attrDef.resolve(new AttributeResolutionContext());
- fail("Resolve after destroy");
- } catch (final DestroyedComponentException e) {
- // OK
- }
- try {
- attrDef.setScopeDelimiter(DELIMITER);
- fail("Set Delimiter after destroy");
- } catch (final DestroyedComponentException e) {
- // OK
- }
}
}
diff --git a/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/RegexAtributeTest.java b/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/RegexAtributeTest.java
index d33f31e43..fe71ed249 100644
--- a/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/RegexAtributeTest.java
+++ b/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/RegexAtributeTest.java
@@ -14,7 +14,10 @@
package net.shibboleth.idp.attribute.resolver.ad.impl;
-import static org.testng.Assert.*;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
import java.util.ArrayList;
import java.util.Collection;
@@ -42,9 +45,7 @@ import net.shibboleth.idp.attribute.resolver.testing.TestSources;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.collection.LazySet;
import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.component.DestroyedComponentException;
import net.shibboleth.shared.component.UninitializedComponentException;
-import net.shibboleth.shared.component.UnmodifiableComponentException;
/**
* Test for regex attribute definitions.
@@ -178,7 +179,7 @@ public class RegexAtributeTest {
assertEquals(f.iterator().next(), EmptyAttributeValue.ZERO_LENGTH);
}
- @Test public void initDestroyParms() throws ResolutionException, ComponentInitializationException {
+ @Test public void initParms() throws ResolutionException, ComponentInitializationException {
RegexSplitAttributeDefinition attrDef = new RegexSplitAttributeDefinition();
final ResolverDataConnectorDependency depend =
@@ -214,25 +215,5 @@ public class RegexAtributeTest {
attrDef.initialize();
assertEquals(attrDef.getRegularExpression(), TestSources.CONNECTOR_ATTRIBUTE_VALUE_REGEXP_PATTERN);
-
- attrDef.destroy();
- try {
- attrDef.initialize();
- fail("Init after destroy");
- } catch (final DestroyedComponentException e) {
- // OK
- }
- try {
- attrDef.setRegularExpression(TestSources.CONNECTOR_ATTRIBUTE_VALUE_REGEXP_PATTERN);
- fail("setRegExp after destroy");
- } catch (final UnmodifiableComponentException | DestroyedComponentException e) {
- // OK
- }
- try {
- attrDef.resolve(new AttributeResolutionContext());
- fail("Resolve after destroy");
- } catch (final DestroyedComponentException e) {
- // OK
- }
}
}
diff --git a/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/ScopedAttributeTest.java b/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/ScopedAttributeTest.java
index 5a200b2db..97979111c 100644
--- a/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/ScopedAttributeTest.java
+++ b/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/ScopedAttributeTest.java
@@ -14,7 +14,10 @@
package net.shibboleth.idp.attribute.resolver.ad.impl;
-import static org.testng.Assert.*;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
import java.util.ArrayList;
import java.util.Arrays;
@@ -44,7 +47,6 @@ import net.shibboleth.idp.attribute.resolver.testing.TestSources;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.collection.LazySet;
import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.component.DestroyedComponentException;
import net.shibboleth.shared.component.UninitializedComponentException;
/**
@@ -198,7 +200,7 @@ public class ScopedAttributeTest {
}
- @Test public void initDestroyParms() throws ResolutionException, ComponentInitializationException {
+ @Test public void testInit() throws ResolutionException, ComponentInitializationException {
ScopedAttributeDefinition attrDef = new ScopedAttributeDefinition();
final Set<ResolverDataConnectorDependency> pluginDependencies =
@@ -240,25 +242,6 @@ public class ScopedAttributeTest {
assertEquals(attrDef.getScope(), TEST_SCOPE);
- attrDef.destroy();
- try {
- attrDef.initialize();
- fail("Init after destroy");
- } catch (final DestroyedComponentException e) {
- // OK
- }
- try {
- attrDef.resolve(new AttributeResolutionContext());
- fail("Resolve after destroy");
- } catch (final DestroyedComponentException e) {
- // OK
- }
- try {
- attrDef.setScope(TEST_SCOPE);
- fail("Set Delimiter after destroy");
- } catch (final DestroyedComponentException e) {
- // OK
- }
}
}
diff --git a/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/StaticAttributeDefinitionTest.java b/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/StaticAttributeDefinitionTest.java
index 48251a82c..b675ecebd 100644
--- a/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/StaticAttributeDefinitionTest.java
+++ b/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/impl/StaticAttributeDefinitionTest.java
@@ -29,7 +29,6 @@ import net.shibboleth.idp.attribute.resolver.ResolutionException;
import net.shibboleth.idp.attribute.resolver.context.AttributeResolutionContext;
import net.shibboleth.idp.attribute.resolver.context.AttributeResolverWorkContext;
import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.component.DestroyedComponentException;
import net.shibboleth.shared.component.UninitializedComponentException;
import net.shibboleth.shared.component.UnmodifiableComponentException;
@@ -83,32 +82,6 @@ public class StaticAttributeDefinitionTest {
} catch (UnmodifiableComponentException e) {
// OK
}
-
- attrDef.destroy();
-
- try {
- attrDef.initialize();
- fail();
- } catch (DestroyedComponentException e) {
- //OK
- }
-
- try {
- attrDef.setValue(new IdPAttribute("other"));
- fail();
- } catch (UnmodifiableComponentException e) {
- // OK
- } catch (DestroyedComponentException e) {
- //OK
- }
-
- try {
- attrDef.resolve(new AttributeResolutionContext());
- fail();
- } catch (DestroyedComponentException e) {
- // OK
- }
-
}
}
diff --git a/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/mapped/impl/MappedAttributeTest.java b/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/mapped/impl/MappedAttributeTest.java
index 519a3362f..7e8b0c295 100644
--- a/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/mapped/impl/MappedAttributeTest.java
+++ b/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/ad/mapped/impl/MappedAttributeTest.java
@@ -37,7 +37,6 @@ import net.shibboleth.idp.attribute.resolver.testing.TestSources;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.collection.LazySet;
import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.component.DestroyedComponentException;
/** Test the mapped attribute type. */
@SuppressWarnings("javadoc")
@@ -75,21 +74,6 @@ public class MappedAttributeTest {
definition.initialize();
- definition.destroy();
- try {
- definition.initialize();
- fail("init a torn down mapper?");
- } catch (final DestroyedComponentException e) {
- // expected this
- }
-
- try {
- definition.resolve(new AttributeResolutionContext());
- fail("resolve a torn down mapper?");
- } catch (final DestroyedComponentException e) {
- // expected this
- }
-
}
@Test public void noAttributeValues() throws Exception {
diff --git a/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/dc/impl/StaticDataConnectorTest.java b/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/dc/impl/StaticDataConnectorTest.java
index d14d9d3e7..dce48eecc 100644
--- a/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/dc/impl/StaticDataConnectorTest.java
+++ b/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/dc/impl/StaticDataConnectorTest.java
@@ -34,7 +34,6 @@ import net.shibboleth.idp.attribute.resolver.context.AttributeResolutionContext;
import net.shibboleth.idp.attribute.resolver.context.AttributeResolverWorkContext;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.component.DestroyedComponentException;
import net.shibboleth.shared.component.UninitializedComponentException;
import net.shibboleth.shared.component.UnmodifiableComponentException;
@@ -83,7 +82,7 @@ public class StaticDataConnectorTest {
}
- @Test public void initDestroy() throws ComponentInitializationException, ResolutionException {
+ @Test public void testInit() throws ComponentInitializationException, ResolutionException {
StaticDataConnector connector = new StaticDataConnector();
connector.setId("Static");
@@ -109,15 +108,5 @@ public class StaticDataConnectorTest {
} catch (UnmodifiableComponentException ex) {
// OK
}
-
- connector.destroy();
-
- try {
- connector.resolve(new AttributeResolutionContext());
- fail();
- } catch (DestroyedComponentException e) {
- //OK
- }
}
-
}
diff --git a/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/impl/AttributeResolverImplTest.java b/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/impl/AttributeResolverImplTest.java
index a1aa6f847..1ce66e912 100644
--- a/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/impl/AttributeResolverImplTest.java
+++ b/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/impl/AttributeResolverImplTest.java
@@ -59,7 +59,6 @@ import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.collection.CollectionSupport;
import net.shibboleth.shared.collection.LazySet;
import net.shibboleth.shared.component.ComponentInitializationException;
-import net.shibboleth.shared.component.DestroyedComponentException;
import net.shibboleth.shared.primitive.LoggerFactory;
/** Test case for {@link AttributeResolverImpl}. */
@@ -72,7 +71,7 @@ public class AttributeResolverImplTest {
*
* @throws Exception if something goes wrong
*/
- @Test public void initDestroy() throws Exception {
+ @Test public void testInit() throws Exception {
final MockAttributeDefinition attrDef = new MockAttributeDefinition("foo", new IdPAttribute("test"));
final MockDataConnector dataCon = new MockDataConnector("bar", (Map<String, IdPAttribute>) null);
dataCon.initialize();
@@ -105,13 +104,6 @@ public class AttributeResolverImplTest {
assertTrue(dataCon.isInitialized());
assertTrue(dataCon.isDestroyed());
- try {
- resolver.initialize();
- fail();
- } catch (final DestroyedComponentException e) {
- // OK
- }
-
}
/**
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list