[java-shib-shared] branch main updated: JSSH-5 ServiceableComponent should implement AutoClose
Rod Widdowson
rdw at steadingsoftware.com
Fri Nov 25 14:29:43 UTC 2022
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch main
in repository java-shib-shared.
View the commit online:
http://git.shibboleth.net/view/?p=java-shib-shared.git;a=commit;h=076adbb17abc69072902ca4f9fe04d9bc2fcc37a
The following commit(s) were added to refs/heads/main by this push:
new 076adbb1 JSSH-5 ServiceableComponent should implement AutoClose
076adbb1 is described below
commit 076adbb17abc69072902ca4f9fe04d9bc2fcc37a
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Fri Nov 25 13:49:05 2022 +0000
JSSH-5 ServiceableComponent should implement AutoClose
https://shibboleth.atlassian.net/browse/JSSH-5
Start to tease the ServiceableComponent from the Component by
implementing a container ServiceableComponent called (for now
a SpringServiceableComponent)
The MockReloadableService uses this (which makes the upstream
tests easier to adjust as we continue the separation).
---
.../service/impl/SpringServiceableComponent.java | 45 +++++++---------------
.../shared/testing/MockReloadableService.java | 14 ++++---
2 files changed, 23 insertions(+), 36 deletions(-)
diff --git a/shib-testing/src/main/java/net/shibboleth/shared/testing/MockReloadableService.java b/shib-service/src/main/java/net/shibboleth/shared/spring/service/impl/SpringServiceableComponent.java
similarity index 52%
copy from shib-testing/src/main/java/net/shibboleth/shared/testing/MockReloadableService.java
copy to shib-service/src/main/java/net/shibboleth/shared/spring/service/impl/SpringServiceableComponent.java
index c4a05a5d..31eacbeb 100644
--- a/shib-testing/src/main/java/net/shibboleth/shared/testing/MockReloadableService.java
+++ b/shib-service/src/main/java/net/shibboleth/shared/spring/service/impl/SpringServiceableComponent.java
@@ -15,48 +15,31 @@
* limitations under the License.
*/
-package net.shibboleth.shared.testing;
+package net.shibboleth.shared.spring.service.impl;
import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import net.shibboleth.shared.service.AbstractReloadableService;
import net.shibboleth.shared.service.ServiceableComponent;
import net.shibboleth.shared.spring.service.AbstractServiceableComponent;
/**
- * Utility class for wrapping a serviceable component in a dummy reloadable service.
- *
- * @param <T> type of component
+ * A container @{link {@link ServiceableComponent} which is (usually) created during spring service
+ * creation as part of service (re)load.
*/
-public class MockReloadableService<T> extends AbstractReloadableService<T> {
+public class SpringServiceableComponent<T> extends AbstractServiceableComponent<T> {
- /** The component we are presenting to provide. */
- @Nonnull private final AbstractServiceableComponent<T> component;
-
- /**
- * Constructor.
- *
- * @param what component
- */
- public MockReloadableService(final @Nonnull AbstractServiceableComponent<T> what) {
- component = what;
- }
-
- /** {@inheritDoc} */
- @Override
- @Nullable public ServiceableComponent<T> getServiceableComponent() {
- if (null == component) {
- return null;
- }
- component.pinComponent();
- return component;
+ @Nonnull final T theComponent;
+
+
+ public SpringServiceableComponent(final @Nonnull T what) {
+ theComponent = what;
}
-
+
/** {@inheritDoc} */
@Override
- protected boolean shouldReload() {
- return false;
+ @Nonnull
+ public T getComponent() {
+ return theComponent;
}
-}
\ No newline at end of file
+}
diff --git a/shib-testing/src/main/java/net/shibboleth/shared/testing/MockReloadableService.java b/shib-testing/src/main/java/net/shibboleth/shared/testing/MockReloadableService.java
index c4a05a5d..bc583b89 100644
--- a/shib-testing/src/main/java/net/shibboleth/shared/testing/MockReloadableService.java
+++ b/shib-testing/src/main/java/net/shibboleth/shared/testing/MockReloadableService.java
@@ -17,12 +17,11 @@
package net.shibboleth.shared.testing;
-import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.shibboleth.shared.service.AbstractReloadableService;
import net.shibboleth.shared.service.ServiceableComponent;
-import net.shibboleth.shared.spring.service.AbstractServiceableComponent;
+import net.shibboleth.shared.spring.service.impl.SpringServiceableComponent;
/**
* Utility class for wrapping a serviceable component in a dummy reloadable service.
@@ -32,15 +31,19 @@ import net.shibboleth.shared.spring.service.AbstractServiceableComponent;
public class MockReloadableService<T> extends AbstractReloadableService<T> {
/** The component we are presenting to provide. */
- @Nonnull private final AbstractServiceableComponent<T> component;
+ @Nullable private final SpringServiceableComponent<T> component;
/**
* Constructor.
*
* @param what component
*/
- public MockReloadableService(final @Nonnull AbstractServiceableComponent<T> what) {
- component = what;
+ public MockReloadableService(final @Nullable T what) {
+ if (what == null) {
+ component = null;
+ } else {
+ component = new SpringServiceableComponent<>(what);
+ }
}
/** {@inheritDoc} */
@@ -49,6 +52,7 @@ public class MockReloadableService<T> extends AbstractReloadableService<T> {
if (null == component) {
return null;
}
+ assert(component != null);
component.pinComponent();
return component;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list