You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2014/09/16 16:05:26 UTC
git commit: Re-enabling Metadata test
Repository: cxf-fediz
Updated Branches:
refs/heads/master 8fe5f0045 -> f0f39d93e
Re-enabling Metadata test
Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/f0f39d93
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/f0f39d93
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/f0f39d93
Branch: refs/heads/master
Commit: f0f39d93ea466fef2eb78ecec5d50f7b72f09bf9
Parents: 8fe5f00
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Tue Sep 16 15:05:14 2014 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Tue Sep 16 15:05:14 2014 +0100
----------------------------------------------------------------------
.../fediz/integrationtests/AbstractTests.java | 57 ++++----------------
1 file changed, 11 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/f0f39d93/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
----------------------------------------------------------------------
diff --git a/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java b/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
index 52278bc..2327bf3 100644
--- a/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
+++ b/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
@@ -20,6 +20,8 @@
package org.apache.cxf.fediz.integrationtests;
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.xml.XmlPage;
import org.apache.cxf.fediz.core.ClaimTypes;
import org.junit.Assert;
@@ -283,59 +285,22 @@ public abstract class AbstractTests {
Assert.assertEquals(ex.getStatusCode(), 403);
}
}
-/*
+
@org.junit.Test
public void testMetadata() throws Exception {
String url = "https://localhost:" + getRpHttpsPort()
+ "/fedizhelloworld/FederationMetadata/2007-06/FederationMetadata.xml";
- CloseableHttpClient httpClient = null;
- try {
- KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
- FileInputStream instream = new FileInputStream(new File("./target/test-classes/client.jks"));
- try {
- trustStore.load(instream, "clientpass".toCharArray());
- } finally {
- try {
- instream.close();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- SSLContextBuilder sslContextBuilder = new SSLContextBuilder();
- sslContextBuilder.loadTrustMaterial(trustStore, new TrustSelfSignedStrategy());
- sslContextBuilder.loadKeyMaterial(trustStore, "clientpass".toCharArray());
-
- SSLContext sslContext = sslContextBuilder.build();
- SSLConnectionSocketFactory sslSocketFactory =
- new SSLConnectionSocketFactory(sslContext);
-
- HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
- httpClientBuilder.setSSLSocketFactory(sslSocketFactory);
- httpClientBuilder.setRedirectStrategy(new LaxRedirectStrategy());
-
- httpClient = httpClientBuilder.build();
+ final WebClient webClient = new WebClient();
+ webClient.getOptions().setUseInsecureSSL(true);
+ webClient.getOptions().setSSLClientCertificate(
+ this.getClass().getClassLoader().getResource("client.jks"), "clientpass", "jks");
- HttpGet httpget = new HttpGet(url);
-
- HttpResponse response = httpClient.execute(httpget);
- HttpEntity entity = response.getEntity();
-
- Assert.assertEquals(200, response.getStatusLine().getStatusCode());
-
- String metadata = EntityUtils.toString(entity);
- Assert.assertTrue(metadata.startsWith("<EntityDescriptor"));
- } finally {
- // When HttpClient instance is no longer needed,
- // shut down the connection manager to ensure
- // immediate deallocation of all system resources
- if (httpClient != null) {
- httpClient.close();
- }
- }
+ final XmlPage rpPage = webClient.getPage(url);
+ final String xmlContent = rpPage.asXml();
+ Assert.assertTrue(xmlContent.startsWith("<EntityDescriptor"));
}
-
+ /*
@org.junit.Test
public void testAliceLogout() throws Exception {
// Authenticate as "alice"