cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [2/3] cxf-fediz git commit: Adding more REST tests
Date Mon, 10 Apr 2017 17:23:14 GMT
Adding more REST tests


Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/bcaf14b7
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/bcaf14b7
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/bcaf14b7

Branch: refs/heads/1.3.x-fixes
Commit: bcaf14b737eb345fb7d7715a8c08609ac18e70ea
Parents: 8b10a26
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Mon Apr 10 16:18:01 2017 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Mon Apr 10 18:22:37 2017 +0100

----------------------------------------------------------------------
 .../idp/integrationtests/RestITTest.java        | 35 +++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bcaf14b7/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/integrationtests/RestITTest.java
----------------------------------------------------------------------
diff --git a/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/integrationtests/RestITTest.java
b/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/integrationtests/RestITTest.java
index 8c02d11..2f570a4 100644
--- a/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/integrationtests/RestITTest.java
+++ b/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/integrationtests/RestITTest.java
@@ -35,7 +35,10 @@ import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.fediz.service.idp.domain.Application;
 import org.apache.cxf.fediz.service.idp.domain.Idp;
 import org.apache.cxf.fediz.service.idp.domain.RequestClaim;
+import org.apache.cxf.fediz.service.idp.rest.Claims;
+import org.apache.cxf.fediz.service.idp.rest.Entitlements;
 import org.apache.cxf.fediz.service.idp.rest.Idps;
+import org.apache.cxf.fediz.service.idp.rest.Roles;
 import org.apache.xml.security.utils.Base64;
 import org.junit.AfterClass;
 import org.junit.Assert;
@@ -212,7 +215,37 @@ public class RestITTest {
         Assert.assertEquals("Claims size should be 1 instead of " + application.getRequestedClaims().size(),
                             1, application.getRequestedClaims().size());
     }
-    
+
+    @Test
+    public void testGetAllClaims() throws UnsupportedEncodingException, MalformedURLException
{
+        String address = "https://localhost:" + idpHttpsPort + "/" + getContextName() + "/services/rs";
+        Client client = ClientBuilder.newClient();
+        Claims claims = client.target(address).path("claims")
+            .request("application/xml").header("Authorization", getBasicAuthentication("admin",
"password"))
+            .get(Claims.class);
+        Assert.assertEquals(2, claims.getClaims().size());
+    }
+
+    @Test
+    public void testGetAllEntitlements() throws UnsupportedEncodingException, MalformedURLException
{
+        String address = "https://localhost:" + idpHttpsPort + "/" + getContextName() + "/services/rs";
+        Client client = ClientBuilder.newClient();
+        Entitlements entitlements = client.target(address).path("entitlements")
+            .request("application/xml").header("Authorization", getBasicAuthentication("admin",
"password"))
+            .get(Entitlements.class);
+        Assert.assertEquals(5, entitlements.getEntitlements().size());
+    }
+
+    @Test
+    public void testGetAllRoles() throws UnsupportedEncodingException, MalformedURLException
{
+        String address = "https://localhost:" + idpHttpsPort + "/" + getContextName() + "/services/rs";
+        Client client = ClientBuilder.newClient();
+        Roles roles = client.target(address).path("roles")
+            .request("application/xml").header("Authorization", getBasicAuthentication("admin",
"password"))
+            .get(Roles.class);
+        Assert.assertEquals(2, roles.getRoles().size());
+    }
+
     private String getBasicAuthentication(String username, String password) throws UnsupportedEncodingException
{
         String token = username + ":" + password;
         return "Basic " + Base64.encode(token.getBytes());


Mime
View raw message