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 2019/05/24 15:01:01 UTC
[cxf-fediz] branch master updated: Adding swagger test
This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf-fediz.git
The following commit(s) were added to refs/heads/master by this push:
new 0f209c1 Adding swagger test
0f209c1 is described below
commit 0f209c1c24a4a51c91d20848037cae7b281ce3af
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Fri May 24 16:00:49 2019 +0100
Adding swagger test
---
.../org/apache/cxf/fediz/systests/idp/IdpTest.java | 24 ++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/systests/idp/src/test/java/org/apache/cxf/fediz/systests/idp/IdpTest.java b/systests/idp/src/test/java/org/apache/cxf/fediz/systests/idp/IdpTest.java
index 3a57c45..ee710ac 100644
--- a/systests/idp/src/test/java/org/apache/cxf/fediz/systests/idp/IdpTest.java
+++ b/systests/idp/src/test/java/org/apache/cxf/fediz/systests/idp/IdpTest.java
@@ -33,7 +33,9 @@ import org.w3c.dom.Node;
import com.gargoylesoftware.htmlunit.CookieManager;
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
+import com.gargoylesoftware.htmlunit.UnexpectedPage;
import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.WebResponse;
import com.gargoylesoftware.htmlunit.html.DomElement;
import com.gargoylesoftware.htmlunit.html.DomNodeList;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
@@ -1361,4 +1363,26 @@ public class IdpTest {
webClient.close();
}
+ @org.junit.Test
+ public void testSwagger() throws Exception {
+ String url = "https://localhost:" + getIdpHttpsPort() + "/fediz-idp/services/rs/swagger.json";
+
+ String user = "alice";
+ String password = "ecila";
+
+ final WebClient webClient = new WebClient();
+ webClient.getOptions().setUseInsecureSSL(true);
+ webClient.getCredentialsProvider().setCredentials(
+ new AuthScope("localhost", Integer.parseInt(getIdpHttpsPort())),
+ new UsernamePasswordCredentials(user, password));
+
+ final UnexpectedPage swaggerPage = webClient.getPage(url);
+ WebResponse response = swaggerPage.getWebResponse();
+ Assert.assertEquals("application/json", response.getContentType());
+ String json = response.getContentAsString();
+ Assert.assertTrue(json.contains("Claims"));
+
+ webClient.close();
+ }
+
}