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 DC3FD10811 for ; Fri, 15 Nov 2013 14:38:08 +0000 (UTC) Received: (qmail 37873 invoked by uid 500); 15 Nov 2013 14:38:08 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 37822 invoked by uid 500); 15 Nov 2013 14:38:07 -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 37813 invoked by uid 99); 15 Nov 2013 14:38:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Nov 2013 14:38:06 +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, 15 Nov 2013 14:38:04 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 902E02388999; Fri, 15 Nov 2013 14:37:44 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1542275 - in /cxf/trunk/systests/ws-security/src/test: java/org/apache/cxf/systest/ws/parts/ resources/org/apache/cxf/systest/ws/parts/ Date: Fri, 15 Nov 2013 14:37:44 -0000 To: commits@cxf.apache.org From: coheigea@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131115143744.902E02388999@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: coheigea Date: Fri Nov 15 14:37:43 2013 New Revision: 1542275 URL: http://svn.apache.org/r1542275 Log: Adding @Ignore'd tests for SwA negative tests Added: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/parts/DoubleIt3Impl.java cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/encrypted-attachments-policy.xml cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/signed-attachments-policy.xml Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/parts/PartsTest.java cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/DoubleItParts.wsdl cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/client.xml cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/server.xml Added: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/parts/DoubleIt3Impl.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/parts/DoubleIt3Impl.java?rev=1542275&view=auto ============================================================================== --- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/parts/DoubleIt3Impl.java (added) +++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/parts/DoubleIt3Impl.java Fri Nov 15 14:37:43 2013 @@ -0,0 +1,53 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.systest.ws.parts; + +import java.util.Arrays; + +import javax.jws.WebService; + +import org.apache.cxf.feature.Features; +import org.example.contract.doubleit.DoubleItFault; +import org.example.contract.doubleit.DoubleItSwaPortType; +import org.example.schema.doubleit.DoubleIt3; +import org.example.schema.doubleit.DoubleItResponse; + +@WebService(targetNamespace = "http://www.example.org/contract/DoubleIt", + serviceName = "DoubleItService", + endpointInterface = "org.example.contract.doubleit.DoubleItSwaPortType") +@Features(features = "org.apache.cxf.feature.LoggingFeature") +public class DoubleIt3Impl implements DoubleItSwaPortType { + + @Override + public DoubleItResponse doubleIt3(DoubleIt3 parameters, byte[] attachment) throws DoubleItFault { + int numberToDouble = parameters.getNumberToDouble(); + if (numberToDouble == 0) { + throw new DoubleItFault("0 can't be doubled!"); + } + + if (!Arrays.equals(attachment, "12345".getBytes())) { + throw new DoubleItFault("Unexpected attachment value!"); + } + + DoubleItResponse response = new DoubleItResponse(); + response.setDoubledNumber(numberToDouble * 2); + return response; + } + +} Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/parts/PartsTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/parts/PartsTest.java?rev=1542275&r1=1542274&r2=1542275&view=diff ============================================================================== --- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/parts/PartsTest.java (original) +++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/parts/PartsTest.java Fri Nov 15 14:37:43 2013 @@ -28,9 +28,9 @@ import org.apache.cxf.Bus; import org.apache.cxf.bus.spring.SpringBusFactory; import org.apache.cxf.systest.ws.common.SecurityTestUtil; import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase; - import org.example.contract.doubleit.DoubleItPortType; - +import org.example.contract.doubleit.DoubleItSwaPortType; +import org.example.schema.doubleit.DoubleIt3; import org.junit.BeforeClass; /** @@ -459,5 +459,125 @@ public class PartsTest extends AbstractB ((java.io.Closeable)port).close(); bus.shutdown(true); } + + // TODO - re-enable once we move off WSS4J 2.0-beta + @org.junit.Test + @org.junit.Ignore + public void testSignedAttachments() throws Exception { + + SpringBusFactory bf = new SpringBusFactory(); + URL busFile = PartsTest.class.getResource("client.xml"); + + Bus bus = bf.createBus(busFile.toString()); + SpringBusFactory.setDefaultBus(bus); + SpringBusFactory.setThreadDefaultBus(bus); + + URL wsdl = PartsTest.class.getResource("DoubleItParts.wsdl"); + Service service = Service.create(wsdl, SERVICE_QNAME); + + // Successful invocation + QName portQName = new QName(NAMESPACE, "DoubleItSignedAttachmentsPort"); + DoubleItSwaPortType port = service.getPort(portQName, DoubleItSwaPortType.class); + updateAddressPort(port, PORT); + + // DOM + DoubleIt3 doubleIt = new DoubleIt3(); + doubleIt.setNumberToDouble(25); + port.doubleIt3(doubleIt, "12345".getBytes()); + + // Streaming + // SecurityTestUtil.enableStreaming(port); + // port.doubleIt(25); + + // This should fail, as the service requires that the Attachments must be signed + portQName = new QName(NAMESPACE, "DoubleItSignedAttachmentsPort2"); + port = service.getPort(portQName, DoubleItSwaPortType.class); + updateAddressPort(port, PORT); + + // DOM + try { + doubleIt = new DoubleIt3(); + doubleIt.setNumberToDouble(25); + port.doubleIt3(doubleIt, "12345".getBytes()); + fail("Failure expected on an attachment which isn't signed"); + } catch (javax.xml.ws.soap.SOAPFaultException ex) { + String error = "SignedParts"; + assertTrue(ex.getMessage().contains(error)); + } + /* + // Streaming + try { + SecurityTestUtil.enableStreaming(port); + port.doubleIt(25); + fail("Failure expected on a body which isn't signed"); + } catch (javax.xml.ws.soap.SOAPFaultException ex) { + // String error = "SignedParts"; + // assertTrue(ex.getMessage().contains(error)); + } + */ + + ((java.io.Closeable)port).close(); + bus.shutdown(true); + } + + // TODO - re-enable once we move off WSS4J 2.0-beta + @org.junit.Test + @org.junit.Ignore + public void testEncryptedAttachments() throws Exception { + + SpringBusFactory bf = new SpringBusFactory(); + URL busFile = PartsTest.class.getResource("client.xml"); + + Bus bus = bf.createBus(busFile.toString()); + SpringBusFactory.setDefaultBus(bus); + SpringBusFactory.setThreadDefaultBus(bus); + + URL wsdl = PartsTest.class.getResource("DoubleItParts.wsdl"); + Service service = Service.create(wsdl, SERVICE_QNAME); + + // Successful invocation + QName portQName = new QName(NAMESPACE, "DoubleItEncryptedAttachmentsPort"); + DoubleItSwaPortType port = service.getPort(portQName, DoubleItSwaPortType.class); + updateAddressPort(port, PORT); + + // DOM + DoubleIt3 doubleIt = new DoubleIt3(); + doubleIt.setNumberToDouble(25); + port.doubleIt3(doubleIt, "12345".getBytes()); + + // Streaming + // SecurityTestUtil.enableStreaming(port); + // port.doubleIt(25); + + // This should fail, as the service requires that the Attachments must be encrypted + portQName = new QName(NAMESPACE, "DoubleItEncryptedAttachmentsPort2"); + port = service.getPort(portQName, DoubleItSwaPortType.class); + updateAddressPort(port, PORT); + + // DOM + try { + doubleIt = new DoubleIt3(); + doubleIt.setNumberToDouble(25); + port.doubleIt3(doubleIt, "12345".getBytes()); + fail("Failure expected on an attachment which isn't encrypted"); + } catch (javax.xml.ws.soap.SOAPFaultException ex) { + String error = "EncryptedParts"; + assertTrue(ex.getMessage().contains(error)); + } + /* + // Streaming + try { + SecurityTestUtil.enableStreaming(port); + port.doubleIt(25); + fail("Failure expected on a body which isn't signed"); + } catch (javax.xml.ws.soap.SOAPFaultException ex) { + // String error = "SignedParts"; + // assertTrue(ex.getMessage().contains(error)); + } + */ + + ((java.io.Closeable)port).close(); + bus.shutdown(true); + } } Modified: cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/DoubleItParts.wsdl URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/DoubleItParts.wsdl?rev=1542275&r1=1542274&r2=1542275&view=diff ============================================================================== --- cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/DoubleItParts.wsdl (original) +++ cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/DoubleItParts.wsdl Fri Nov 15 14:37:43 2013 @@ -17,7 +17,7 @@ specific language governing permissions and limitations under the License. --> - + @@ -34,6 +34,29 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -83,5 +106,18 @@ + + + + + + + + + + + + + Modified: cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/client.xml URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/client.xml?rev=1542275&r1=1542274&r2=1542275&view=diff ============================================================================== --- cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/client.xml (original) +++ cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/client.xml Fri Nov 15 14:37:43 2013 @@ -264,4 +264,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Added: cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/encrypted-attachments-policy.xml URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/encrypted-attachments-policy.xml?rev=1542275&view=auto ============================================================================== --- cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/encrypted-attachments-policy.xml (added) +++ cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/encrypted-attachments-policy.xml Fri Nov 15 14:37:43 2013 @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Modified: cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/server.xml URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/server.xml?rev=1542275&r1=1542274&r2=1542275&view=diff ============================================================================== --- cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/server.xml (original) +++ cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/server.xml Fri Nov 15 14:37:43 2013 @@ -240,4 +240,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Added: cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/signed-attachments-policy.xml URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/signed-attachments-policy.xml?rev=1542275&view=auto ============================================================================== --- cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/signed-attachments-policy.xml (added) +++ cxf/trunk/systests/ws-security/src/test/resources/org/apache/cxf/systest/ws/parts/signed-attachments-policy.xml Fri Nov 15 14:37:43 2013 @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +