Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 1BB6B200C77 for ; Mon, 10 Apr 2017 19:23:17 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 1A24B160B7F; Mon, 10 Apr 2017 17:23:17 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5E513160BA5 for ; Mon, 10 Apr 2017 19:23:16 +0200 (CEST) Received: (qmail 74426 invoked by uid 500); 10 Apr 2017 17:23:15 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 74325 invoked by uid 99); 10 Apr 2017 17:23:13 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Apr 2017 17:23:13 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A3150E038D; Mon, 10 Apr 2017 17:23:13 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: coheigea@apache.org To: commits@cxf.apache.org Date: Mon, 10 Apr 2017 17:23:14 -0000 Message-Id: In-Reply-To: <7dc18d32716d46cd884e3bc0bd8fb8bd@git.apache.org> References: <7dc18d32716d46cd884e3bc0bd8fb8bd@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/3] cxf-fediz git commit: Adding more REST tests archived-at: Mon, 10 Apr 2017 17:23:17 -0000 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 Authored: Mon Apr 10 16:18:01 2017 +0100 Committer: Colm O hEigeartaigh 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());