Author: asoldano
Date: 2013-12-10 11:50:16 -0500 (Tue, 10 Dec 2013)
New Revision: 18159
Added:
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/operationDispatch/
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/operationDispatch/SOAPActionDispatchTestCase.java
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/operationDispatch/SampleWS.java
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/operationDispatch/SampleWSSEI.java
framework/branches/jbossws-framework-3.1.2/testsuite/test/resources/jaxws/operationDispatch/
framework/branches/jbossws-framework-3.1.2/testsuite/test/resources/jaxws/operationDispatch/WEB-INF/
framework/branches/jbossws-framework-3.1.2/testsuite/test/resources/jaxws/operationDispatch/WEB-INF/web.xml
Modified:
framework/branches/jbossws-framework-3.1.2/testsuite/test/ant-import/build-jars-jaxws.xml
Log:
[JBPAPP-10922] Adding testcase
Modified:
framework/branches/jbossws-framework-3.1.2/testsuite/test/ant-import/build-jars-jaxws.xml
===================================================================
---
framework/branches/jbossws-framework-3.1.2/testsuite/test/ant-import/build-jars-jaxws.xml 2013-12-09
18:51:05 UTC (rev 18158)
+++
framework/branches/jbossws-framework-3.1.2/testsuite/test/ant-import/build-jars-jaxws.xml 2013-12-10
16:50:16 UTC (rev 18159)
@@ -852,6 +852,14 @@
</webinf>
</war>
+ <!-- jaxws-operationDispatch -->
+ <war
destfile="${tests.output.dir}/test-libs/jaxws-operationDispatch.war"
webxml="${tests.output.dir}/test-resources/jaxws/operationDispatch/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/test-classes">
+ <include
name="org/jboss/test/ws/jaxws/operationDispatch/**/*.class"/>
+ </classes>
+ <webinf
dir="${tests.output.dir}/test-resources/jaxws/operationDispatch/WEB-INF"/>
+ </war>
+
<!-- jaxws-webfault -->
<war warfile="${tests.output.dir}/test-libs/jaxws-webfault.war"
webxml="${tests.output.dir}/test-resources/jaxws/webfault/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/test-classes">
Added:
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/operationDispatch/SOAPActionDispatchTestCase.java
===================================================================
---
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/operationDispatch/SOAPActionDispatchTestCase.java
(rev 0)
+++
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/operationDispatch/SOAPActionDispatchTestCase.java 2013-12-10
16:50:16 UTC (rev 18159)
@@ -0,0 +1,112 @@
+/*
+ * 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.operationDispatch;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.Service.Mode;
+import javax.xml.ws.soap.SOAPBinding;
+
+import junit.framework.Test;
+
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * Verifies proper operation dispatching based on SOAPAction header
+ *
+ * @author alessio.soldano(a)jboss.com
+ */
+public class SOAPActionDispatchTestCase extends JBossWSTest
+{
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(SOAPActionDispatchTestCase.class,
"jaxws-operationDispatch.war");
+ }
+
+ private final String msgString =
+ "<soap:Envelope
xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>" +
+ " <soap:Body>" +
+ " </soap:Body>" +
+ "</soap:Envelope>";
+
+ public void testJAXWSServiceInvocation() throws Exception
+ {
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-operationDispatch/SampleWS?wsdl");
+ QName serviceName = new
QName("http://operationDispatch.jaxws.ws.test.jboss.org/",
"SampleWSService");
+ Service service = Service.create(wsdlURL, serviceName);
+
+ SampleWSSEI port = service.getPort(SampleWSSEI.class);
+ assertEquals("foo", port.foo());
+ assertEquals("bar", port.bar());
+ }
+
+ public void testJAXWSDispatchInvocation() throws Exception
+ {
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-operationDispatch/SampleWS?wsdl");
+ QName serviceName = new
QName("http://operationDispatch.jaxws.ws.test.jboss.org/",
"SampleWSService");
+ QName portName = new
QName("http://operationDispatch.jaxws.ws.test.jboss.org/",
"SampleWSPort");
+
+ Service service = Service.create(serviceName);
+ service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
wsdlURL.toExternalForm());
+
+ Dispatch<SOAPMessage> dispatch = service.createDispatch(portName,
SOAPMessage.class, Mode.MESSAGE);
+
+ sendMessage(dispatch, "opFoo", "fooResponse");
+ sendMessage(dispatch, "opBar", "barResponse");
+
+ }
+
+ private void sendMessage(final Dispatch<SOAPMessage> dispatch, final String
soapAction, final String responseElementName) throws SOAPException, IOException {
+ SOAPMessage reqMsg = getRequestMessage();
+ reqMsg.getMimeHeaders().addHeader("SOAPAction", soapAction);
+ SOAPMessage resMsg = dispatch.invoke(reqMsg);
+ SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();
+
+ SOAPHeader soapHeader = resEnv.getHeader();
+ if (soapHeader != null)
+ soapHeader.detachNode();
+ Element body = resEnv.getBody();
+ Node child = body.getFirstChild();
+ assertEquals(responseElementName, child.getLocalName());
+ }
+
+ private SOAPMessage getRequestMessage() throws SOAPException, IOException
+ {
+ MessageFactory msgFactory = MessageFactory.newInstance();
+ SOAPMessage reqMsg = msgFactory.createMessage(null, new
ByteArrayInputStream(msgString.getBytes()));
+ return reqMsg;
+ }
+
+}
Property changes on:
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/operationDispatch/SOAPActionDispatchTestCase.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/operationDispatch/SampleWS.java
===================================================================
---
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/operationDispatch/SampleWS.java
(rev 0)
+++
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/operationDispatch/SampleWS.java 2013-12-10
16:50:16 UTC (rev 18159)
@@ -0,0 +1,44 @@
+/*
+ * 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.operationDispatch;
+
+import javax.jws.WebService;
+
+@WebService(endpointInterface =
"org.jboss.test.ws.jaxws.operationDispatch.SampleWSSEI")
+public class SampleWS implements SampleWSSEI
+{
+
+ public SampleWS()
+ {
+ }
+
+ public String foo()
+ {
+ return "foo";
+ }
+
+ public String bar()
+ {
+ return "bar";
+ }
+
+}
Property changes on:
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/operationDispatch/SampleWS.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/operationDispatch/SampleWSSEI.java
===================================================================
---
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/operationDispatch/SampleWSSEI.java
(rev 0)
+++
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/operationDispatch/SampleWSSEI.java 2013-12-10
16:50:16 UTC (rev 18159)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.operationDispatch;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+@WebService
+@SOAPBinding(
+ style = SOAPBinding.Style.DOCUMENT,
+ use = SOAPBinding.Use.LITERAL,
+ parameterStyle = SOAPBinding.ParameterStyle.BARE
+)
+public interface SampleWSSEI
+{
+ @WebMethod(action="opFoo")
+ String foo();
+
+ @WebMethod(action="opBar")
+ String bar();
+}
Property changes on:
framework/branches/jbossws-framework-3.1.2/testsuite/test/java/org/jboss/test/ws/jaxws/operationDispatch/SampleWSSEI.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
framework/branches/jbossws-framework-3.1.2/testsuite/test/resources/jaxws/operationDispatch/WEB-INF/web.xml
===================================================================
---
framework/branches/jbossws-framework-3.1.2/testsuite/test/resources/jaxws/operationDispatch/WEB-INF/web.xml
(rev 0)
+++
framework/branches/jbossws-framework-3.1.2/testsuite/test/resources/jaxws/operationDispatch/WEB-INF/web.xml 2013-12-10
16:50:16 UTC (rev 18159)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+ <servlet>
+ <servlet-name>SampleWS</servlet-name>
+
<servlet-class>org.jboss.test.ws.jaxws.operationDispatch.SampleWS</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>SampleWS</servlet-name>
+ <url-pattern>/SampleWS</url-pattern>
+ </servlet-mapping>
+
+</web-app>
Property changes on:
framework/branches/jbossws-framework-3.1.2/testsuite/test/resources/jaxws/operationDispatch/WEB-INF/web.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native