Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6688D188B9 for ; Wed, 6 Jan 2016 11:32:37 +0000 (UTC) Received: (qmail 58311 invoked by uid 500); 6 Jan 2016 11:32:37 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 58242 invoked by uid 500); 6 Jan 2016 11:32:37 -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 58228 invoked by uid 99); 6 Jan 2016 11:32:37 -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; Wed, 06 Jan 2016 11:32:37 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 27979DFE6E; Wed, 6 Jan 2016 11:32:37 +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 Message-Id: <56ebbcd7e972442aa746833bc1ce7847@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: cxf git commit: Adding another secured fault test Date: Wed, 6 Jan 2016 11:32:37 +0000 (UTC) Repository: cxf Updated Branches: refs/heads/master 19b53fc0d -> fa985a4e4 Adding another secured fault test Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/fa985a4e Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/fa985a4e Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/fa985a4e Branch: refs/heads/master Commit: fa985a4e4da2059e68635e5e1c538ae46a03643c Parents: 19b53fc Author: Colm O hEigeartaigh Authored: Wed Jan 6 11:32:02 2016 +0000 Committer: Colm O hEigeartaigh Committed: Wed Jan 6 11:32:02 2016 +0000 ---------------------------------------------------------------------- .../apache/cxf/systest/ws/fault/FaultTest.java | 35 +++++++++++ .../cxf/systest/ws/fault/DoubleItFault.wsdl | 66 ++++++++++++++++++++ .../org/apache/cxf/systest/ws/fault/client.xml | 8 +++ .../org/apache/cxf/systest/ws/fault/server.xml | 6 ++ 4 files changed, 115 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/fa985a4e/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java ---------------------------------------------------------------------- diff --git a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java index 4bc825b..9a27fc5 100644 --- a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java +++ b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/FaultTest.java @@ -225,4 +225,39 @@ public class FaultTest extends AbstractBusClientServerTestBase { client.destroy(); } + @org.junit.Test + public void testSoap11PolicyWithParts() throws Exception { + + SpringBusFactory bf = new SpringBusFactory(); + URL busFile = FaultTest.class.getResource("client.xml"); + + Bus bus = bf.createBus(busFile.toString()); + SpringBusFactory.setDefaultBus(bus); + SpringBusFactory.setThreadDefaultBus(bus); + + URL wsdl = FaultTest.class.getResource("DoubleItFault.wsdl"); + Service service = Service.create(wsdl, SERVICE_QNAME); + QName portQName = new QName(NAMESPACE, "DoubleItSoap11PolicyWithPartsPort"); + DoubleItPortType utPort = + service.getPort(portQName, DoubleItPortType.class); + updateAddressPort(utPort, PORT); + + // Make a successful invocation + ((BindingProvider)utPort).getRequestContext().put("security.username", "alice"); + utPort.doubleIt(25); + + // Now make an invocation using another username + ((BindingProvider)utPort).getRequestContext().put("security.username", "bob"); + ((BindingProvider)utPort).getRequestContext().put("security.password", "password"); + try { + utPort.doubleIt(25); + fail("Expected failure on bob"); + } catch (Exception ex) { + assertTrue(ex.getMessage().contains("This is a fault")); + } + + ((java.io.Closeable)utPort).close(); + bus.shutdown(true); + } + } http://git-wip-us.apache.org/repos/asf/cxf/blob/fa985a4e/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/DoubleItFault.wsdl ---------------------------------------------------------------------- diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/DoubleItFault.wsdl b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/DoubleItFault.wsdl index 2d4bf02..df7ffe1 100644 --- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/DoubleItFault.wsdl +++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/DoubleItFault.wsdl @@ -93,6 +93,21 @@ + + + + + + + + + + + + + + + @@ -109,6 +124,10 @@ + + + + @@ -193,6 +212,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/cxf/blob/fa985a4e/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/client.xml ---------------------------------------------------------------------- diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/client.xml b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/client.xml index 8863d41..b22bb4d 100644 --- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/client.xml +++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/client.xml @@ -56,4 +56,12 @@ + + + + + + + + http://git-wip-us.apache.org/repos/asf/cxf/blob/fa985a4e/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/server.xml ---------------------------------------------------------------------- diff --git a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/server.xml b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/server.xml index 3362cab..6fb8461 100644 --- a/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/server.xml +++ b/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/fault/server.xml @@ -50,4 +50,10 @@ + + + + + +