[jbossws-commits] JBossWS SVN: r18169 - in stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests: src/test/java/org/jboss/test/ws/jaxws and 4 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Wed Dec 11 08:32:03 EST 2013


Author: asoldano
Date: 2013-12-11 08:32:02 -0500 (Wed, 11 Dec 2013)
New Revision: 18169

Added:
   stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbpapp10905/
   stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbpapp10905/Dto.java
   stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbpapp10905/Hello.java
   stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbpapp10905/HelloJavaBean.java
   stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbpapp10905/OperationSpecificWSSETestCase.java
   stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbpapp10905/
   stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbpapp10905/META-INF/
   stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbpapp10905/META-INF/jboss-wsse-client.xml
   stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbpapp10905/META-INF/jboss-wsse-server.xml
   stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbpapp10905/wsse.keystore
   stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbpapp10905/wsse.truststore
Modified:
   stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml
Log:
[JBPAPP-10905] Adding testcase


Modified: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml	2013-12-11 13:30:58 UTC (rev 18168)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml	2013-12-11 13:32:02 UTC (rev 18169)
@@ -142,6 +142,27 @@
 			</webinf>
 		</war>
 
+        <!-- jaxws-jbpapp10905-->
+		<jar destfile="${tests.output.dir}/test-libs/jaxws-jbpapp10905.jar">
+			<fileset dir="${tests.output.dir}/test-classes">
+				<include name="org/jboss/test/ws/jaxws/jbpapp10905/*.class" />
+				<exclude name="org/jboss/test/ws/jaxws/jbpapp10905/*TestCase.class" />
+			</fileset>
+			<metainf dir="${tests.output.dir}/test-resources/jaxws/jbpapp10905/META-INF">
+				<include name="jboss-wsse-server.xml" />
+			</metainf>
+			<metainf dir="${tests.output.dir}/test-resources/jaxws/jbpapp10905/">
+				<include name="wsse.truststore" />
+				<include name="wsse.keystore" />
+			</metainf>
+		</jar>
+		<jar jarfile="${tests.output.dir}/test-libs/jaxws-jbpapp10905-client.jar">
+			<metainf dir="${tests.output.dir}/test-resources/jaxws/jbpapp10905">
+				<include name="wsse.truststore" />
+				<include name="wsse.keystore" />
+			</metainf>
+		</jar>
+
 		<!-- jaxws-jbpapp2143 -->
 		<war warfile="${tests.output.dir}/test-libs/jaxws-jbpapp2143.war" webxml="${tests.output.dir}/test-resources/jaxws/jbpapp2143/WEB-INF/web.xml">
 			<classes dir="${tests.output.dir}/test-classes">

Added: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbpapp10905/Dto.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbpapp10905/Dto.java	                        (rev 0)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbpapp10905/Dto.java	2013-12-11 13:32:02 UTC (rev 18169)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2013, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbpapp10905;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+
+ at XmlAccessorType(XmlAccessType.FIELD)
+public class Dto
+{
+   @XmlElement(namespace="http://org.jboss.ws/jbpapp10905")
+   private String par1;
+   @XmlElement(namespace="http://org.jboss.ws/jbpapp10905")
+   private String par2;
+   
+   public String getPar1()
+   {
+      return par1;
+   }
+   public void setPar1(String par1)
+   {
+      this.par1 = par1;
+   }
+   public String getPar2()
+   {
+      return par2;
+   }
+   public void setPar2(String par2)
+   {
+      this.par2 = par2;
+   }
+}


Property changes on: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbpapp10905/Dto.java
___________________________________________________________________
Added: svn:keywords
   + Rev Date
Added: svn:eol-style
   + native

Added: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbpapp10905/Hello.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbpapp10905/Hello.java	                        (rev 0)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbpapp10905/Hello.java	2013-12-11 13:32:02 UTC (rev 18169)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2013, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbpapp10905;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+ at WebService(name = "Hello")
+ at SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
+public interface Hello
+{
+   @WebMethod(action = "echoOp")
+   public Dto echo(Dto dto);
+   
+   @WebMethod
+   public Dto echo2(Dto dto);
+   
+   @WebMethod(action = "echo3Op")
+   public Dto echo3(Dto dto);
+}


Property changes on: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbpapp10905/Hello.java
___________________________________________________________________
Added: svn:keywords
   + Rev Date
Added: svn:eol-style
   + native

Added: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbpapp10905/HelloJavaBean.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbpapp10905/HelloJavaBean.java	                        (rev 0)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbpapp10905/HelloJavaBean.java	2013-12-11 13:32:02 UTC (rev 18169)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2013, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbpapp10905;
+
+import javax.ejb.Stateless;
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+import org.jboss.ws.annotation.EndpointConfig;
+import org.jboss.wsf.spi.annotation.WebContext;
+
+
+ at Stateless
+ at WebService(name = "Hello", serviceName = "HelloService", targetNamespace = "http://org.jboss.ws/jbpapp10905")
+ at SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
+ at WebContext(contextRoot = "/jaxws-jbpapp10905", urlPattern = "/*")
+ at EndpointConfig(configName = "Standard WSSecurity Endpoint")
+public class HelloJavaBean
+{
+   @WebMethod(action = "echoOp")
+   public Dto echo(Dto dto)
+   {
+      return dto;
+   }
+   
+   @WebMethod
+   public Dto echo2(Dto dto)
+   {
+      Dto res = new Dto();
+      res.setPar1(dto.getPar1() + "2");
+      res.setPar2(dto.getPar2() + "2");
+      return res;
+   }
+   
+   @WebMethod(action = "echo3Op")
+   public Dto echo3(Dto dto)
+   {
+      Dto res = new Dto();
+      res.setPar1(dto.getPar1() + "3");
+      res.setPar2(dto.getPar2() + "3");
+      return res;
+   }
+}


Property changes on: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbpapp10905/HelloJavaBean.java
___________________________________________________________________
Added: svn:keywords
   + Rev Date
Added: svn:eol-style
   + native

Added: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbpapp10905/OperationSpecificWSSETestCase.java
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbpapp10905/OperationSpecificWSSETestCase.java	                        (rev 0)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbpapp10905/OperationSpecificWSSETestCase.java	2013-12-11 13:32:02 UTC (rev 18169)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2013, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbpapp10905;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import junit.framework.Test;
+
+import org.jboss.ws.core.StubExt;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ * http://jira.jboss.org/jira/browse/JBPAPP-10905
+ *
+ * @author alessio.soldano at jboss.com
+ * @since 10-Dec-2013
+ */
+public class OperationSpecificWSSETestCase extends JBossWSTest
+{
+   private final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-jbpapp10905";
+
+   public static Test suite() throws Exception
+   {
+      return new JBossWSTestSetup(OperationSpecificWSSETestCase.class, "jaxws-jbpapp10905-client.jar,jaxws-jbpapp10905.jar");
+   }
+   
+   public void testEcho() throws Exception
+   {
+      Hello port = getPort();
+      Dto dto = new Dto();
+      dto.setPar1("first parameter");
+      dto.setPar2("second parameter");
+      try
+      {
+         Dto result = port.echo(dto);
+         assertEquals(dto.getPar1(), result.getPar1());
+         assertEquals(dto.getPar2(), result.getPar2());
+      }
+      catch (Exception e)
+      {
+         fail();
+      }
+   }
+   
+   /**
+    * 'echo2' operation invocation, which must fail because the operation has no explicit
+    * SOAPAction assigned, we're sending an encrypted payload and WS-Addressing is not enabled
+    * 
+    * @throws Exception
+    */
+   public void testEcho2() throws Exception
+   {
+      Hello port = getPort();
+      Dto dto = new Dto();
+      dto.setPar1("first parameter");
+      dto.setPar2("second parameter");
+      try
+      {
+         port.echo2(dto);
+         fail();
+      }
+      catch (Exception e)
+      {
+         assertTrue(e.getMessage().contains("Could not determine the operation configuration"));
+      }
+   }
+   
+   /**
+    * 'echo3' operation invocation, which must fail because we're not signing the message
+    * and the server requires signature for invocations to this operation
+    * 
+    * @throws Exception
+    */
+   public void testEcho3() throws Exception
+   {
+      Hello port = getPort();
+      Dto dto = new Dto();
+      dto.setPar1("first parameter");
+      dto.setPar2("second parameter");
+      try
+      {
+         port.echo3(dto);
+         fail();
+      }
+      catch (Exception e)
+      {
+         assertTrue(e.getMessage().contains("WS-Security"));
+      }
+   }
+
+   private Hello getPort() throws Exception
+   {
+      URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
+      QName serviceName = new QName("http://org.jboss.ws/jbpapp10905", "HelloService");
+      Hello port = Service.create(wsdlURL, serviceName).getPort(Hello.class);
+      URL securityURL = getResourceURL("jaxws/jbpapp10905/META-INF/jboss-wsse-client.xml");
+      ((StubExt)port).setSecurityConfig(securityURL.toExternalForm());
+      ((StubExt)port).setConfigName("Standard WSSecurity Client");
+      return port;
+   }
+}


Property changes on: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbpapp10905/OperationSpecificWSSETestCase.java
___________________________________________________________________
Added: svn:keywords
   + Rev Date
Added: svn:eol-style
   + native

Added: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbpapp10905/META-INF/jboss-wsse-client.xml
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbpapp10905/META-INF/jboss-wsse-client.xml	                        (rev 0)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbpapp10905/META-INF/jboss-wsse-client.xml	2013-12-11 13:32:02 UTC (rev 18169)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jboss-ws-security xmlns="http://www.jboss.com/ws-security/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.jboss.com/ws-security/config http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">
+  <key-store-file>META-INF/wsse.keystore</key-store-file>
+  <key-store-password>jbossws</key-store-password>
+  <trust-store-file>META-INF/wsse.truststore</trust-store-file>
+  <trust-store-password>jbossws</trust-store-password>
+  
+  <config>
+    <encrypt type="x509v3" alias="wsse"/>
+    <requires>
+      <encryption/>
+    </requires>
+  </config>
+  
+</jboss-ws-security>
\ No newline at end of file


Property changes on: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbpapp10905/META-INF/jboss-wsse-client.xml
___________________________________________________________________
Added: svn:mime-type
   + text/xml
Added: svn:keywords
   + Rev Date
Added: svn:eol-style
   + native

Added: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbpapp10905/META-INF/jboss-wsse-server.xml
===================================================================
--- stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbpapp10905/META-INF/jboss-wsse-server.xml	                        (rev 0)
+++ stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbpapp10905/META-INF/jboss-wsse-server.xml	2013-12-11 13:32:02 UTC (rev 18169)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jboss-ws-security xmlns="http://www.jboss.com/ws-security/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.jboss.com/ws-security/config http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">
+  <key-store-file>META-INF/wsse.keystore</key-store-file>
+  <key-store-password>jbossws</key-store-password>
+  <trust-store-file>META-INF/wsse.truststore</trust-store-file>
+  <trust-store-password>jbossws</trust-store-password>
+  
+  <port name="HelloPort">
+    <operation name="{http://org.jboss.ws/jbpapp10905}echo">
+      <config>
+        <encrypt type="x509v3" alias="wsse"/>
+        <requires>
+          <encryption/>
+        </requires>
+      </config>
+    </operation>
+    <operation name="{http://org.jboss.ws/jbpapp10905}echo3">
+      <config>
+        <encrypt type="x509v3" alias="wsse"/>
+        <requires>
+          <encryption/>
+          <signature/>
+        </requires>
+      </config>
+    </operation>
+  </port>
+</jboss-ws-security>
\ No newline at end of file


Property changes on: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbpapp10905/META-INF/jboss-wsse-server.xml
___________________________________________________________________
Added: svn:mime-type
   + text/xml
Added: svn:keywords
   + Rev Date
Added: svn:eol-style
   + native

Added: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbpapp10905/wsse.keystore
===================================================================
(Binary files differ)


Property changes on: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbpapp10905/wsse.keystore
___________________________________________________________________
Added: svn:mime-type
   + application/x-java-keystore

Added: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbpapp10905/wsse.truststore
===================================================================
(Binary files differ)


Property changes on: stack/native/branches/jbossws-native-3.1.2/modules/testsuite/native-tests/src/test/resources/jaxws/jbpapp10905/wsse.truststore
___________________________________________________________________
Added: svn:mime-type
   + application/x-java-keystore



More information about the jbossws-commits mailing list