[java-support] branch master updated: Mocked reloadable service wrapper for tests.
Scott Cantor
cantor.2 at osu.edu
Thu May 16 09:29:40 EDT 2019
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch master
in repository java-support.
View the commit online:
http://git.shibboleth.net/view/?p=java-support.git;a=commit;h=a16c48467e3bd3e870d7b3f73635a328668840d0
The following commit(s) were added to refs/heads/master by this push:
new a16c484 Mocked reloadable service wrapper for tests.
a16c484 is described below
commit a16c48467e3bd3e870d7b3f73635a328668840d0
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu May 16 09:29:37 2019 -0400
Mocked reloadable service wrapper for tests.
---
.../support/service/MockReloadableService.java | 54 ++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/src/test/java/net/shibboleth/utilities/java/support/service/MockReloadableService.java b/src/test/java/net/shibboleth/utilities/java/support/service/MockReloadableService.java
new file mode 100644
index 0000000..2e66464
--- /dev/null
+++ b/src/test/java/net/shibboleth/utilities/java/support/service/MockReloadableService.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements. See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.utilities.java.support.service;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import net.shibboleth.utilities.java.support.logic.Constraint;
+
+/**
+ * Utility class for wrapping a serviceable component in a dummy reloadable service.
+ *
+ * @param <T> type of component
+ */
+public class MockReloadableService<T> extends AbstractReloadableService<T> {
+
+ @Nonnull private final ServiceableComponent<T> component;
+
+ public MockReloadableService(@Nonnull final ServiceableComponent<T> what) {
+ component = Constraint.isNotNull(what, "Component cannot be null");
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ @Nullable public ServiceableComponent<T> 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