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:24:15 UTC

[cxf-fediz] branch 1.4.x-fixes updated: Adding swagger test

This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch 1.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf-fediz.git


The following commit(s) were added to refs/heads/1.4.x-fixes by this push:
     new 08724f6  Adding swagger test
08724f6 is described below

commit 08724f6b96a55a60d3bbdda1eb09659a4a82837b
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 796357a..211f2bd 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
@@ -32,7 +32,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;
@@ -1368,4 +1370,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();
+    }
+
 }