[java-shib-shared] 09/09: JSSH-71 Remove the impact of the DestructableComponent Interface

Codeberg noreply at shibboleth.net
Thu Jul 9 10:48:43 UTC 2026


This is an automated email from the git hooks/post-receive script.

codeberg pushed a commit to branch main
in repository java-shib-shared.

View the commit online:
https://codeberg.org/Shibboleth/java-shib-shared/commit/007b16489c081c1163319deee072e2cf302fd4ab

commit 007b16489c081c1163319deee072e2cf302fd4ab
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Tue Jul 7 15:40:47 2026 +0100

    JSSH-71 Remove the impact of the DestructableComponent Interface
    
    https://shibboleth.atlassian.net/browse/JSSH-71
    
    Explicitly test that all appropriate beans in a service are torn down
---
 .../service/ReloadableSpringServiceTest.java       |  4 ++++
 .../spring/service/TestServiceableComponent.java   | 15 ++++++++++++---
 ...ent.java => TestServiceableComponentChild.java} | 22 ++--------------------
 .../shared/spring/service/ServiceableBean1.xml     |  5 ++++-
 4 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/shib-service/src/test/java/net/shibboleth/shared/spring/service/ReloadableSpringServiceTest.java b/shib-service/src/test/java/net/shibboleth/shared/spring/service/ReloadableSpringServiceTest.java
index 157f6e13..b734c8ce 100644
--- a/shib-service/src/test/java/net/shibboleth/shared/spring/service/ReloadableSpringServiceTest.java
+++ b/shib-service/src/test/java/net/shibboleth/shared/spring/service/ReloadableSpringServiceTest.java
@@ -93,20 +93,24 @@ public class ReloadableSpringServiceTest {
         AbstractServiceableComponent<TestServiceableComponent> serviceableComponent = service.getServiceableComponent();
         assert(serviceableComponent != null);
         final TestServiceableComponent component = serviceableComponent.getComponent();
+        final TestServiceableComponentChild child = component.getChild();
 
         Assert.assertEquals("One", component.getTheValue());
         Assert.assertFalse(component.isDestroyed());
+        Assert.assertFalse(child.tornDown);
 
         serviceableComponent.unpinComponent();
         overwriteFileWith("net/shibboleth/shared/spring/service/ServiceableBean2.xml");
 
         long count = 70;
+
         while (count > 0 && !component.isDestroyed() && !component.tornDown) {
             Thread.sleep(RELOAD_DELAY.toMillis());
             count--;
         }
         Assert.assertTrue(component.isDestroyed(), "After 7 second initial component has still not be destroyed");
         Assert.assertTrue(component.tornDown, "After 7 second initial component has still not been torn down");
+        Assert.assertTrue(child.tornDown, "After 7 second initial child has still not been torn down");
 
         //
         // The reload will have destroyed the old component
diff --git a/shib-service/src/test/java/net/shibboleth/shared/spring/service/TestServiceableComponent.java b/shib-service/src/test/java/net/shibboleth/shared/spring/service/TestServiceableComponent.java
index 1012d1ae..5e449280 100644
--- a/shib-service/src/test/java/net/shibboleth/shared/spring/service/TestServiceableComponent.java
+++ b/shib-service/src/test/java/net/shibboleth/shared/spring/service/TestServiceableComponent.java
@@ -21,9 +21,19 @@ import net.shibboleth.shared.component.AbstractIdentifiableInitializableComponen
 public class TestServiceableComponent extends AbstractIdentifiableInitializableComponent {
 
     private String theValue;
-    
+
     public boolean tornDown;
 
+    private TestServiceableComponentChild child;
+
+    public void setChild(TestServiceableComponentChild child) {
+        this.child = child;
+    }
+
+    public TestServiceableComponentChild getChild() {
+        return child;
+    }
+
     /**
      * @return Returns the theValue.
      */
@@ -41,5 +51,4 @@ public class TestServiceableComponent extends AbstractIdentifiableInitializableC
     @OnTeardown public void teardown() {
         tornDown = true;
     }
-
-}
\ No newline at end of file
+}
diff --git a/shib-service/src/test/java/net/shibboleth/shared/spring/service/TestServiceableComponent.java b/shib-service/src/test/java/net/shibboleth/shared/spring/service/TestServiceableComponentChild.java
similarity index 62%
copy from shib-service/src/test/java/net/shibboleth/shared/spring/service/TestServiceableComponent.java
copy to shib-service/src/test/java/net/shibboleth/shared/spring/service/TestServiceableComponentChild.java
index 1012d1ae..6b719077 100644
--- a/shib-service/src/test/java/net/shibboleth/shared/spring/service/TestServiceableComponent.java
+++ b/shib-service/src/test/java/net/shibboleth/shared/spring/service/TestServiceableComponentChild.java
@@ -15,31 +15,13 @@
 package net.shibboleth.shared.spring.service;
 
 import net.shibboleth.shared.annotation.OnTeardown;
-import net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent;
 
 @SuppressWarnings("javadoc")
-public class TestServiceableComponent extends AbstractIdentifiableInitializableComponent {
+public class TestServiceableComponentChild {
 
-    private String theValue;
-    
     public boolean tornDown;
 
-    /**
-     * @return Returns the theValue.
-     */
-    public String getTheValue() {
-        return theValue;
-    }
-
-    /**
-     * @param value The theValue to set.
-     */
-    public void setTheValue(final String value) {
-        theValue = value;
-    }
-
     @OnTeardown public void teardown() {
         tornDown = true;
     }
-
-}
\ No newline at end of file
+}
diff --git a/shib-service/src/test/resources/net/shibboleth/shared/spring/service/ServiceableBean1.xml b/shib-service/src/test/resources/net/shibboleth/shared/spring/service/ServiceableBean1.xml
index 279da85a..ee5c695e 100644
--- a/shib-service/src/test/resources/net/shibboleth/shared/spring/service/ServiceableBean1.xml
+++ b/shib-service/src/test/resources/net/shibboleth/shared/spring/service/ServiceableBean1.xml
@@ -9,5 +9,8 @@
 	<bean id="TheTestServiceableComponentOne"
 		class="net.shibboleth.shared.spring.service.TestServiceableComponent"
 		p:id="TheTestServiceableComponentOne"
+		p:child-ref="childBean"
 		p:theValue="One"/>
-</beans>
\ No newline at end of file
+
+	<bean id="childBean" class="net.shibboleth.shared.spring.service.TestServiceableComponentChild" />
+</beans>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list