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 B6A25F0E7 for ; Fri, 22 Mar 2013 12:40:49 +0000 (UTC) Received: (qmail 30878 invoked by uid 500); 22 Mar 2013 12:40:49 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 30798 invoked by uid 500); 22 Mar 2013 12:40:49 -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 30790 invoked by uid 99); 22 Mar 2013 12:40:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Mar 2013 12:40:49 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Mar 2013 12:40:46 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 9FFA523889CB; Fri, 22 Mar 2013 12:40:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1459745 - in /cxf/branches/wss4j2.0-port/systests/ws-security/src/test: java/org/apache/cxf/systest/ws/x509/ resources/org/apache/cxf/systest/ws/x509/ resources/org/apache/cxf/systest/ws/x509/client/ resources/org/apache/cxf/systest/ws/x50... Date: Fri, 22 Mar 2013 12:40:26 -0000 To: commits@cxf.apache.org From: coheigea@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130322124026.9FFA523889CB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: coheigea Date: Fri Mar 22 12:40:25 2013 New Revision: 1459745 URL: http://svn.apache.org/r1459745 Log: Adding some negative test-coverage for X.509 Tokens Added: cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/clean-policy.xml cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/end-supp-token-policy.xml cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/supp-token-pki-policy.xml cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/supp-token-policy.xml Modified: cxf/branches/wss4j2.0-port/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/DoubleItX509.wsdl cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/client/client.xml cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/server/server.xml Modified: cxf/branches/wss4j2.0-port/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java?rev=1459745&r1=1459744&r2=1459745&view=diff ============================================================================== --- cxf/branches/wss4j2.0-port/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java (original) +++ cxf/branches/wss4j2.0-port/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java Fri Mar 22 12:40:25 2013 @@ -629,4 +629,90 @@ public class X509TokenTest extends Abstr bus.shutdown(true); } + @org.junit.Test + public void testSupportingToken() throws Exception { + + SpringBusFactory bf = new SpringBusFactory(); + URL busFile = X509TokenTest.class.getResource("client/client.xml"); + + Bus bus = bf.createBus(busFile.toString()); + SpringBusFactory.setDefaultBus(bus); + SpringBusFactory.setThreadDefaultBus(bus); + + URL wsdl = X509TokenTest.class.getResource("DoubleItX509.wsdl"); + Service service = Service.create(wsdl, SERVICE_QNAME); + + // Successful invocation + QName portQName = new QName(NAMESPACE, "DoubleItTransportSupportingTokenPort"); + DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class); + updateAddressPort(port, PORT2); + port.doubleIt(25); + + // This should fail, as the client is not sending an X.509 Supporting Token + portQName = new QName(NAMESPACE, "DoubleItTransportSupportingTokenPort2"); + port = service.getPort(portQName, DoubleItPortType.class); + updateAddressPort(port, PORT2); + + try { + port.doubleIt(25); + fail("Failure expected on not sending an X.509 Supporting Token"); + } catch (javax.xml.ws.soap.SOAPFaultException ex) { + String error = "These policy alternatives can not be satisfied"; + assertTrue(ex.getMessage().contains(error)); + } + + // This should fail, as the client is not sending a PKI Token + portQName = new QName(NAMESPACE, "DoubleItTransportPKISupportingTokenPort"); + port = service.getPort(portQName, DoubleItPortType.class); + updateAddressPort(port, PORT2); + + try { + port.doubleIt(25); + fail("Failure expected on not sending a PKI token"); + } catch (javax.xml.ws.soap.SOAPFaultException ex) { + String error = "These policy alternatives can not be satisfied"; + assertTrue(ex.getMessage().contains(error)); + } + + ((java.io.Closeable)port).close(); + bus.shutdown(true); + } + + @org.junit.Test + public void testEndorsing() throws Exception { + + SpringBusFactory bf = new SpringBusFactory(); + URL busFile = X509TokenTest.class.getResource("client/client.xml"); + + Bus bus = bf.createBus(busFile.toString()); + SpringBusFactory.setDefaultBus(bus); + SpringBusFactory.setThreadDefaultBus(bus); + + URL wsdl = X509TokenTest.class.getResource("DoubleItX509.wsdl"); + Service service = Service.create(wsdl, SERVICE_QNAME); + + // Successful invocation + QName portQName = new QName(NAMESPACE, "DoubleItTransportEndorsingPort"); + DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class); + updateAddressPort(port, PORT2); + port.doubleIt(25); + + // This should fail, as the client is not endorsing the token + portQName = new QName(NAMESPACE, "DoubleItTransportEndorsingPort2"); + port = service.getPort(portQName, DoubleItPortType.class); + updateAddressPort(port, PORT2); + + try { + port.doubleIt(25); + fail("Failure expected on not endorsing the token"); + } catch (javax.xml.ws.soap.SOAPFaultException ex) { + String error = "These policy alternatives can not be satisfied"; + assertTrue(ex.getMessage().contains(error)); + } + + ((java.io.Closeable)port).close(); + bus.shutdown(true); + } + + } Modified: cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/DoubleItX509.wsdl URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/DoubleItX509.wsdl?rev=1459745&r1=1459744&r2=1459745&view=diff ============================================================================== --- cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/DoubleItX509.wsdl (original) +++ cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/DoubleItX509.wsdl Fri Mar 22 12:40:25 2013 @@ -311,6 +311,22 @@ + + + + + + + + + + + + + + + @@ -375,6 +391,26 @@ binding="tns:DoubleItTransportKVTBinding"> + + + + + + + + + + + + + + + Added: cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/clean-policy.xml URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/clean-policy.xml?rev=1459745&view=auto ============================================================================== --- cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/clean-policy.xml (added) +++ cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/clean-policy.xml Fri Mar 22 12:40:25 2013 @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Modified: cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/client/client.xml URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/client/client.xml?rev=1459745&r1=1459744&r2=1459745&view=diff ============================================================================== --- cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/client/client.xml (original) +++ cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/client/client.xml Fri Mar 22 12:40:25 2013 @@ -259,6 +259,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Added: cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/end-supp-token-policy.xml URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/end-supp-token-policy.xml?rev=1459745&view=auto ============================================================================== --- cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/end-supp-token-policy.xml (added) +++ cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/end-supp-token-policy.xml Fri Mar 22 12:40:25 2013 @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Modified: cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/server/server.xml URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/server/server.xml?rev=1459745&r1=1459744&r2=1459745&view=diff ============================================================================== --- cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/server/server.xml (original) +++ cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/server/server.xml Fri Mar 22 12:40:25 2013 @@ -447,4 +447,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Added: cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/supp-token-pki-policy.xml URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/supp-token-pki-policy.xml?rev=1459745&view=auto ============================================================================== --- cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/supp-token-pki-policy.xml (added) +++ cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/supp-token-pki-policy.xml Fri Mar 22 12:40:25 2013 @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Added: cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/supp-token-policy.xml URL: http://svn.apache.org/viewvc/cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/supp-token-policy.xml?rev=1459745&view=auto ============================================================================== --- cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/supp-token-policy.xml (added) +++ cxf/branches/wss4j2.0-port/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/x509/supp-token-policy.xml Fri Mar 22 12:40:25 2013 @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file