[java-shib-metadata] branch main updated: Javadoc
Rod Widdowson
rdw at steadingsoftware.com
Sun Oct 2 14:22:36 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-metadata.
View the commit online:
http://git.shibboleth.net/view/?p=java-shib-metadata.git;a=commit;h=244d6e8a95d3601b489e860defe1e6e27c7f7f94
The following commit(s) were added to refs/heads/main by this push:
new 244d6e8a9 Javadoc
244d6e8a9 is described below
commit 244d6e8a95d3601b489e860defe1e6e27c7f7f94
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sun Oct 2 15:22:17 2022 +0100
Javadoc
---
.../SignatureValidationCriteriaSetFactoryBean.java | 2 +-
.../spring/metadata/MetadataFailFastTest.java | 11 ++++
.../spring/testing/AbstractFailFastTest.java | 73 +++++++++++++++++++---
3 files changed, 78 insertions(+), 8 deletions(-)
diff --git a/shib-metadata-spring/src/main/java/net/shibboleth/spring/metadata/filter/SignatureValidationCriteriaSetFactoryBean.java b/shib-metadata-spring/src/main/java/net/shibboleth/spring/metadata/filter/SignatureValidationCriteriaSetFactoryBean.java
index bcc65cad9..aad7e8dd2 100644
--- a/shib-metadata-spring/src/main/java/net/shibboleth/spring/metadata/filter/SignatureValidationCriteriaSetFactoryBean.java
+++ b/shib-metadata-spring/src/main/java/net/shibboleth/spring/metadata/filter/SignatureValidationCriteriaSetFactoryBean.java
@@ -82,7 +82,7 @@ public class SignatureValidationCriteriaSetFactoryBean implements FactoryBean<Cr
/**
* Set the parameters resolver instance to use.
*
- * <p>If not supplied, an instance of {@link BasicSignatureValidationParametersResolver} will be used.<p>
+ * <p>If not supplied, an instance of {@link BasicSignatureValidationParametersResolver} will be used.</p>
*
* @param newResolver the parameters resolver
*/
diff --git a/shib-metadata-spring/src/test/java/net/shibboleth/spring/metadata/MetadataFailFastTest.java b/shib-metadata-spring/src/test/java/net/shibboleth/spring/metadata/MetadataFailFastTest.java
index 343919ea1..8d1272206 100644
--- a/shib-metadata-spring/src/test/java/net/shibboleth/spring/metadata/MetadataFailFastTest.java
+++ b/shib-metadata-spring/src/test/java/net/shibboleth/spring/metadata/MetadataFailFastTest.java
@@ -31,6 +31,7 @@ import org.testng.annotations.Test;
import net.shibboleth.shared.collection.Pair;
import net.shibboleth.shared.service.ReloadableService;
import net.shibboleth.shared.service.ServiceableComponent;
+import net.shibboleth.shared.testing.RepositorySupport;
import net.shibboleth.spring.testing.AbstractFailFastTest;
/**
@@ -41,6 +42,16 @@ import net.shibboleth.spring.testing.AbstractFailFastTest;
public class MetadataFailFastTest extends AbstractFailFastTest {
private static int uniquifier;
+ /** return an HTTP URL for the file of this name
+ * @param filePart
+ * @return the URL (as a string)
+ */
+ protected String makeURLPath(final String filePart) {
+ return RepositorySupport.buildHTTPResourceURL("java-shib-metadata",
+ "shib-metadata-spring/src/test/resources" + getPath() + filePart,
+ false);
+ }
+
@Test public void workingInline() throws IOException {
final Object bean = getBean(propertySource("ServiceConfiguration", makePath("inLineMetadataGood.xml")), "metadataBeansDefaultFF.xml");
diff --git a/shib-metadata-testing/src/main/java/net/shibboleth/spring/testing/AbstractFailFastTest.java b/shib-metadata-testing/src/main/java/net/shibboleth/spring/testing/AbstractFailFastTest.java
index db916bae1..c4c047e25 100644
--- a/shib-metadata-testing/src/main/java/net/shibboleth/spring/testing/AbstractFailFastTest.java
+++ b/shib-metadata-testing/src/main/java/net/shibboleth/spring/testing/AbstractFailFastTest.java
@@ -40,42 +40,58 @@ import net.shibboleth.shared.collection.Pair;
import net.shibboleth.shared.service.ReloadableService;
import net.shibboleth.shared.spring.util.ApplicationContextBuilder;
import net.shibboleth.shared.spring.util.SpringSupport;
-import net.shibboleth.shared.testing.RepositorySupport;
/**
* Base class for testing metadata providers.
*/
- at SuppressWarnings({"javadoc"})
public class AbstractFailFastTest extends OpenSAMLInitBaseTestCase {
+ /** The directory where our test files are. */
private String workspaceDirName;
+ /** All the {@link GenericApplicationContext} ever allocated for this test. They are explicitly torn down at the end. */
static List<GenericApplicationContext> contexts;
+ /** Make note of newly allocated {@link GenericApplicationContext}.
+ * @param context what to remember.
+ */
protected void registerContext(final GenericApplicationContext context) {
synchronized(contexts) {
contexts.add(context);
}
}
+ /** Our test path.
+ * @return the path
+ */
protected String getPath() {
return "/net/shibboleth/spring/failfast/";
}
+ /** get the directory where our tests are stored.
+ * @return the directoryname
+ */
protected String getWorkspaceDirName() {
return workspaceDirName;
}
+ /** Allocate up any per test resources.
+ * @throws IOException neveer
+ */
@BeforeSuite public void beforeSuite() throws IOException {
contexts = new ArrayList<>();
}
+ /** Set up our state.
+ * @throws IOException if required.
+ */
@BeforeClass public void beforeClass() throws IOException {
final ClassPathResource resource =
new ClassPathResource(getPath());
workspaceDirName = resource.getFile().getAbsolutePath() + "/";
}
+ /** tear down all the {@link GenericApplicationContext} we have used. */
@SuppressWarnings("resource")
@AfterSuite public void afterSuite() {
final Iterator<GenericApplicationContext> contextIterator = contexts.iterator();
@@ -88,6 +104,13 @@ public class AbstractFailFastTest extends OpenSAMLInitBaseTestCase {
}
}
+ /** Conjur up, and remember a {@link GenericApplicationContext}.
+ * @param contextName what to call it
+ * @param propSource Any properties to define
+ * @param files all the files to read
+ * @return a {@link GenericApplicationContext}
+ * @throws IOException as required.
+ */
protected ApplicationContext getApplicationContext(final String contextName, final MockPropertySource propSource, final String... files)
throws IOException {
final Resource[] resources = new Resource[files.length];
@@ -111,14 +134,33 @@ public class AbstractFailFastTest extends OpenSAMLInitBaseTestCase {
return context;
}
+ /** Conjur up, and remember a {@link GenericApplicationContext}.
+ * @param contextName what to call it
+ * @param files all the files to read
+ * @return a {@link GenericApplicationContext}
+ * @throws IOException as required.
+ */
protected ApplicationContext getApplicationContext(final String contextName, final String... files) throws IOException {
return getApplicationContext(contextName, null, files);
}
+ /** Read and parse some files, then look for a {@link ReloadableService} in them. Fail fast.
+ * @param propSource Any properties to define
+ * @param files all the files to read
+ * @return the bean
+ * @throws IOException as required.
+ */
protected Object getBean(final MockPropertySource propSource, final String... files) throws IOException {
return getBean(propSource, true, files);
}
+ /** Read and parse some files, then look for a {@link ReloadableService} in them.
+ * @param propSource Any properties to define
+ * @param failFast do we fail fast or not?
+ * @param files all the files to read
+ * @return the bean
+ * @throws IOException as required
+ */
protected Object getBean(final MockPropertySource propSource, Boolean failFast, final String... files) throws IOException {
@SuppressWarnings("rawtypes") final Class<ReloadableService> claz = ReloadableService.class;
@@ -139,16 +181,30 @@ public class AbstractFailFastTest extends OpenSAMLInitBaseTestCase {
}
}
+ /** Read and parse some files, then look for a {@link ReloadableService} in them. Fail fast.
+ * @param files all the files to read
+ * @return the bean
+ * @throws IOException as required
+ */
protected Object getBean(final String... files) throws IOException {
return getBean(null, files);
}
+ /** Create a {@link MockPropertySource} with one property in it.
+ * @param name the property name
+ * @param value the property value
+ * @return the {@link MockPropertySource}
+ */
protected MockPropertySource propertySource(final String name, final String value) {
MockPropertySource propSource = new MockPropertySource("localProperties");
propSource.setProperty(name, value);
return propSource;
}
+ /** Create a {@link MockPropertySource} populated with the provided properties
+ * @param values the properties (name,value) to set.
+ * @return the {@link MockPropertySource}
+ */
protected MockPropertySource propertySource(final Collection<Pair<String,String>> values) {
MockPropertySource propSource = new MockPropertySource("localProperties");
for (final Pair<String, String> value: values) {
@@ -157,17 +213,20 @@ public class AbstractFailFastTest extends OpenSAMLInitBaseTestCase {
return propSource;
}
+ /** Return the name of the file in the working dir with this name.
+ * @param filePart the file name
+ * @return the Fully Qualified Path
+ */
protected String makePath(final String filePart) {
return getWorkspaceDirName() + filePart;
}
+ /** Return the name of the file in the working dir with this name.
+ * @param filePart the file name
+ * @return the Fully Qualified Path
+ */
protected String makeTempPath(final String filePart) {
return getWorkspaceDirName() + filePart;
}
- protected String makeURLPath(final String filePart) {
- return RepositorySupport.buildHTTPResourceURL("java-shib-metadata",
- "shib-metadata-spring/src/test/resources" + getPath() + filePart,
- false);
- }
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list