[java-opensaml] branch master updated: IDP-1380 Clean up some support test code (to help the IDP tests)
Rod Widdowson
rdw at steadingsoftware.com
Thu Dec 13 11:40:29 EST 2018
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch master
in repository java-opensaml.
View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=98af951d63ab32a4628204e526032d4e174dee15
The following commit(s) were added to refs/heads/master by this push:
new 98af951 IDP-1380 Clean up some support test code (to help the IDP tests)
98af951 is described below
commit 98af951d63ab32a4628204e526032d4e174dee15
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Thu Dec 13 16:39:20 2018 +0000
IDP-1380 Clean up some support test code (to help the IDP tests)
https://issues.shibboleth.net/jira/browse/IDP-1380
---
.../impl/FileBackedHTTPMetadataResolverTest.java | 2 --
.../resolver/impl/HTTPMetadataResolverTest.java | 31 +++++++++++++---------
.../memcached/MemcachedStorageServiceTest.java | 2 +-
3 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/impl/FileBackedHTTPMetadataResolverTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/impl/FileBackedHTTPMetadataResolverTest.java
index 72516d4..28d42d4 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/impl/FileBackedHTTPMetadataResolverTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/impl/FileBackedHTTPMetadataResolverTest.java
@@ -48,8 +48,6 @@ import net.shibboleth.utilities.java.support.resolver.ResolverException;
*/
public class FileBackedHTTPMetadataResolverTest extends XMLObjectBaseTestCase {
- static final String DATA_PATH = "/org/opensaml/saml/metadata/resolver/impl/";
-
private HttpClientBuilder httpClientBuilder;
private String relativeMDResource;
diff --git a/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/impl/HTTPMetadataResolverTest.java b/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/impl/HTTPMetadataResolverTest.java
index 3091a00..9e14beb 100644
--- a/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/impl/HTTPMetadataResolverTest.java
+++ b/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/impl/HTTPMetadataResolverTest.java
@@ -18,6 +18,8 @@
package org.opensaml.saml.metadata.resolver.impl;
import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
import java.net.URISyntaxException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
@@ -48,6 +50,8 @@ import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import com.google.common.io.ByteStreams;
+
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
import net.shibboleth.utilities.java.support.httpclient.HttpClientBuilder;
import net.shibboleth.utilities.java.support.httpclient.HttpClientSupport;
@@ -68,6 +72,8 @@ public class HTTPMetadataResolverTest extends XMLObjectBaseTestCase {
private String entityID;
private HTTPMetadataResolver metadataProvider;
private CriteriaSet criteriaSet;
+
+ static final String DATA_PATH = "/org/opensaml/saml/metadata/resolver/impl/";
@BeforeClass
protected void setUpClass() {
@@ -321,27 +327,26 @@ public class HTTPMetadataResolverTest extends XMLObjectBaseTestCase {
Assert.assertNotNull(descriptor, "Retrieved entity descriptor was null");
Assert.assertEquals(descriptor.getEntityID(), entityID, "Entity's ID does not match requested ID");
}
-
-
-
// Helpers
- public static TrustEngine<? super X509Credential> buildPKIXTrustEngine(String cert, String name, boolean nameCheckEnabled) throws URISyntaxException, CertificateException {
- File certFile = new File(FileBackedHTTPMetadataResolver.class.getResource(FileBackedHTTPMetadataResolverTest.DATA_PATH + cert).toURI());
- X509Certificate rootCert = X509Support.decodeCertificate(certFile);
- PKIXValidationInformation info = new BasicPKIXValidationInformation(Collections.singletonList(rootCert), null, 5);
- Set<String> trustedNames = (Set<String>) (name != null ? Collections.singleton(name) : Collections.emptySet());
- StaticPKIXValidationInformationResolver resolver = new StaticPKIXValidationInformationResolver(Collections.singletonList(info), trustedNames);
+ public static TrustEngine<? super X509Credential> buildPKIXTrustEngine(String cert, String name, boolean nameCheckEnabled) throws URISyntaxException, CertificateException, IOException {
+ final InputStream certStream = FileBackedHTTPMetadataResolver.class.getResourceAsStream((HTTPMetadataResolverTest.DATA_PATH + cert));
+ final X509Certificate rootCert = X509Support.decodeCertificate(ByteStreams.toByteArray(certStream));
+ final PKIXValidationInformation info = new BasicPKIXValidationInformation(Collections.singletonList(rootCert), null, 5);
+ final Set<String> trustedNames = (Set<String>) (name != null ? Collections.singleton(name) : Collections.emptySet());
+ final StaticPKIXValidationInformationResolver resolver = new StaticPKIXValidationInformationResolver(Collections.singletonList(info), trustedNames);
return new PKIXX509CredentialTrustEngine(resolver,
new CertPathPKIXTrustEvaluator(),
(nameCheckEnabled ? new BasicX509CredentialNameEvaluator() : null));
}
- public static TrustEngine<? super X509Credential> buildExplicitKeyTrustEngine(String cert) throws URISyntaxException, CertificateException {
- File certFile = new File(FileBackedHTTPMetadataResolver.class.getResource(FileBackedHTTPMetadataResolverTest.DATA_PATH + cert).toURI());
- X509Certificate entityCert = X509Support.decodeCertificate(certFile);
- X509Credential entityCredential = new BasicX509Credential(entityCert);
+ public static TrustEngine<? super X509Credential> buildExplicitKeyTrustEngine(String cert) throws URISyntaxException, CertificateException, IOException {
+
+ final InputStream certStream = FileBackedHTTPMetadataResolver.class.getResourceAsStream(HTTPMetadataResolverTest.DATA_PATH + cert);
+ final X509Certificate entityCert = X509Support.decodeCertificate(ByteStreams.toByteArray(certStream));
+ final X509Credential entityCredential = new BasicX509Credential(entityCert);
return new ExplicitKeyTrustEngine(new StaticCredentialResolver(entityCredential));
+
}
public static LayeredConnectionSocketFactory buildTrustEngineSocketFactory() {
diff --git a/opensaml-storage-impl/src/test/java/org/opensaml/storage/impl/memcached/MemcachedStorageServiceTest.java b/opensaml-storage-impl/src/test/java/org/opensaml/storage/impl/memcached/MemcachedStorageServiceTest.java
index efb56f2..0f5d89e 100644
--- a/opensaml-storage-impl/src/test/java/org/opensaml/storage/impl/memcached/MemcachedStorageServiceTest.java
+++ b/opensaml-storage-impl/src/test/java/org/opensaml/storage/impl/memcached/MemcachedStorageServiceTest.java
@@ -46,7 +46,7 @@ import static org.testng.Assert.*;
* <code>localhost:11211</code>. This test may be executed by running the test goal with the <code>all</code> maven
* profile if a local memcached service is available.
*/
- at Test(groups = {"needs-external-fixture"})
+ at Test(groups = {"needs-external-fixture"}, enabled=false)
public class MemcachedStorageServiceTest {
private MemcachedStorageService service;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list