Author: asoldano
Date: 2015-03-05 06:50:15 -0500 (Thu, 05 Mar 2015)
New Revision: 19526
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/application-roles.properties
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/application-users.properties
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/DeploymentTestServlet.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/HelloWorld.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/HelloWorldImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/JMSEndpointAPITestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/JMSEndpointOnlyDeploymentTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/TestServlet.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jms/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jms/META-INF/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jms/META-INF/wsdl/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jms/META-INF/wsdl/HelloWorldService.wsdl
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-jms.groovy
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/pom.xml
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/arquillian.xml
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/container.properties
stack/cxf/trunk/modules/testsuite/pom.xml
Log:
[JBWS-3874] Adding jms tests to the cxf-tests module and creating a new server
configuration for them
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/pom.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/pom.xml 2015-03-05 06:52:26 UTC (rev
19525)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/pom.xml 2015-03-05 11:50:15 UTC (rev
19526)
@@ -128,6 +128,25 @@
</properties>
</configuration>
</execution>
+ <execution>
+ <id>testsuite-jms</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+
<source>${basedir}/src/test/scripts/jbws-testsuite-jms.groovy</source>
+ <properties>
+
<inputFile>${jboss.home}/standalone/configuration/standalone-full.xml</inputFile>
+
<outputFile>${jboss.home}/standalone/configuration/jbws-testsuite-jms.xml</outputFile>
+ <serverLog>jbws-testsuite-jms.log</serverLog>
+
<srcUsersProperties>${project.build.directory}/test-classes/application-users.properties</srcUsersProperties>
+
<destUsersProperties>${jboss.home}/standalone/configuration/application-users.properties</destUsersProperties>
+
<srcRolesProperties>${project.build.directory}/test-classes/application-roles.properties</srcRolesProperties>
+
<destRolesProperties>${jboss.home}/standalone/configuration/application-roles.properties</destRolesProperties>
+ </properties>
+ </configuration>
+ </execution>
</executions>
</plugin>
<plugin>
@@ -341,6 +360,31 @@
<port>19990</port> <!-- Keep in sync with the port-offset
-->
</configuration>
</execution>
+ <execution>
+ <id>jms</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ <configuration>
+ <jvmArgs>-server -XX:+UseCompressedOops -Xms48m -Xmx384m
-XX:MaxPermSize=192m -Djboss.socket.binding.port-offset=${port-offset.cxf-tests.jms}
${additionalJvmArgs}</jvmArgs>
+ <serverConfig>jbws-testsuite-jms.xml</serverConfig>
+ <jbossHome>${jboss.home}</jbossHome>
+ <!-- TODO: add serverArgs section to use a custom bind address
(requires wildfly-maven-plugin 1.1.0 +)
+
https://github.com/wildfly/wildfly-maven-plugin/commit/160b1a29f4e26fff9f...
-->
+ <port>44990</port> <!-- Keep in sync with the port-offset
-->
+ </configuration>
+ </execution>
+ <execution>
+ <id>jms-shutdown</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>shutdown</goal>
+ </goals>
+ <configuration>
+ <port>44990</port> <!-- Keep in sync with the port-offset
-->
+ </configuration>
+ </execution>
</executions>
</plugin>
</plugins>
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/application-roles.properties
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/application-roles.properties
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/application-roles.properties 2015-03-05
11:50:15 UTC (rev 19526)
@@ -0,0 +1 @@
+kermit=guest
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/application-roles.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/application-users.properties
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/application-users.properties
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/application-users.properties 2015-03-05
11:50:15 UTC (rev 19526)
@@ -0,0 +1 @@
+kermit=0491092837b7e5aef6f270a3b85f8336
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/application-users.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/arquillian.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/arquillian.xml 2015-03-05
06:52:26 UTC (rev 19525)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/arquillian.xml 2015-03-05
11:50:15 UTC (rev 19526)
@@ -45,5 +45,19 @@
<property
name="waitForPortsTimeoutInSeconds">8</property>
</configuration>
</container>
+ <container qualifier="jms">
+ <configuration>
+ <property name="jbossHome">${jboss.home}</property>
+ <property name="javaVmArguments">-server
-XX:+UseCompressedOops -Xms48m -Xmx384m -XX:MaxPermSize=192m
-Djboss.socket.binding.port-offset=${port-offset.cxf-tests.jms}
${additionalJvmArgs}</property>
+ <property
name="serverConfig">jbws-testsuite-jms.xml</property>
+ <property
name="allowConnectingToRunningServer">true</property>
+ <property
name="managementAddress">${jboss.bind.address:localhost}</property>
+ <property
name="jbossArguments">${jbossArguments}</property>
+ <property
name="managementPort">${add_int(port-offset.cxf-tests.jms,9990)}</property>
+ <!-- AS7-4070 -->
+ <property
name="waitForPorts">${add_int(port-offset.cxf-tests.jms,8787)}
${add_int(port-offset.cxf-tests.jms,9990)}</property>
+ <property
name="waitForPortsTimeoutInSeconds">8</property>
+ </configuration>
+ </container>
</group>
</arquillian>
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/container.properties
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/container.properties 2015-03-05
06:52:26 UTC (rev 19525)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/container.properties 2015-03-05
11:50:15 UTC (rev 19526)
@@ -3,6 +3,7 @@
port-offset.cxf-tests.jboss=(a)port-offset.cxf-tests.jboss@
port-offset.cxf-tests.ssl-mutual-auth=(a)port-offset.cxf-tests.ssl-mutual-auth@
port-offset.cxf-tests.default-config-tests=(a)port-offset.cxf-tests.default-config-tests@
+port-offset.cxf-tests.jms=(a)port-offset.cxf-tests.jms@
port-offset.shared-tests.jboss=(a)port-offset.shared-tests.jboss@
port-offset.shared-tests.default-config-tests=(a)port-offset.shared-tests.default-config-tests@
port-offset.cxf-spring-tests.jboss=(a)port-offset.cxf-spring-tests.jboss@
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/DeploymentTestServlet.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/DeploymentTestServlet.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/DeploymentTestServlet.java 2015-03-05
11:50:15 UTC (rev 19526)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, 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.cxf.jms;
+
+import java.io.IOException;
+import java.net.URL;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+
+@WebServlet(name = "TestServlet", urlPatterns = "/*")
+public class DeploymentTestServlet extends HttpServlet
+{
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
+ {
+ try
+ {
+ boolean result;
+ URL wsdlUrl =
Thread.currentThread().getContextClassLoader().getResource("META-INF/wsdl/HelloWorldService.wsdl");
+ //start a new bus to avoid affecting the one that could already be assigned to
this thread
+ Bus bus = BusFactory.newInstance().createBus();
+ BusFactory.setThreadDefaultBus(bus);
+ try
+ {
+ //HelloWorldServiceLocal service references local connection factory (for
in-VM use)
+ QName serviceName = new QName("http://org.jboss.ws/jaxws/cxf/jms",
"HelloWorldServiceLocal");
+ Service service = Service.create(wsdlUrl, serviceName);
+
+ //JMS test
+ HelloWorld proxy = (HelloWorld) service.getPort(new
QName("http://org.jboss.ws/jaxws/cxf/jms", "HelloWorldImplPort"),
HelloWorld.class);
+ result = "Hi".equals(proxy.echo("Hi"));
+ }
+ finally
+ {
+ bus.shutdown(true);
+ }
+ res.getWriter().print(result);
+ }
+ catch (Throwable t)
+ {
+ t.printStackTrace();
+ throw new ServletException(t);
+ }
+ }
+}
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/DeploymentTestServlet.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/HelloWorld.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/HelloWorld.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/HelloWorld.java 2015-03-05
11:50:15 UTC (rev 19526)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.cxf.jms;
+
+import javax.jws.WebService;
+
+@WebService(targetNamespace = "http://org.jboss.ws/jaxws/cxf/jms")
+public interface HelloWorld
+{
+ String echo(String input);
+}
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/HelloWorld.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/HelloWorldImpl.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/HelloWorldImpl.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/HelloWorldImpl.java 2015-03-05
11:50:15 UTC (rev 19526)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.cxf.jms;
+
+import javax.jws.WebService;
+
+@WebService
+(
+ portName = "HelloWorldImplPort",
+ serviceName = "HelloWorldServiceLocal",
+ wsdlLocation = "META-INF/wsdl/HelloWorldService.wsdl",
+ endpointInterface = "org.jboss.test.ws.jaxws.cxf.jms.HelloWorld",
+ targetNamespace = "http://org.jboss.ws/jaxws/cxf/jms"
+)
+public class HelloWorldImpl implements HelloWorld
+{
+ public String echo(String input)
+ {
+ System.out.println("input: " + input);
+ return input;
+ }
+}
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/HelloWorldImpl.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/JMSEndpointAPITestCase.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/JMSEndpointAPITestCase.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/JMSEndpointAPITestCase.java 2015-03-05
11:50:15 UTC (rev 19526)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, 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.cxf.jms;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.container.test.api.TargetsContainer;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.ws.common.IOUtils;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestHelper;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.File;
+import java.net.URL;
+
+/**
+ * Test case for publishing a JMS (SOAP-over-JMS 1.0) endpoint through API
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 29-Apr-2011
+ */
+(a)RunWith(Arquillian.class)
+public final class JMSEndpointAPITestCase extends JBossWSTest
+{
+ private static final String JMS_SERVER = "jms";
+
+ @Deployment(testable = false)
+ @TargetsContainer(JMS_SERVER)
+ public static WebArchive createWarDeployment() {
+ WebArchive archive =
ShrinkWrap.create(WebArchive.class,"jaxws-cxf-jms-api.war");
+ archive
+ .setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client
services,org.hornetq\n"))
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/jms/META-INF/wsdl/HelloWorldService.wsdl"),
"classes/META-INF/wsdl/HelloWorldService.wsdl")
+ .addClass(org.jboss.test.ws.jaxws.cxf.jms.HelloWorld.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.jms.HelloWorldImpl.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.jms.TestServlet.class);
+ return archive;
+ }
+
+ @Test
+ @RunAsClient
+ public void testServerSide() throws Exception
+ {
+ URL url = new URL("http://" + getServerHost() + ":" +
getServerPort(CXF_TESTS_GROUP_QUALIFIER, JMS_SERVER) + "/jaxws-cxf-jms-api");
+ assertEquals("true", IOUtils.readAndCloseStream(url.openStream()));
+ }
+
+}
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/JMSEndpointAPITestCase.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/JMSEndpointOnlyDeploymentTestCase.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/JMSEndpointOnlyDeploymentTestCase.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/JMSEndpointOnlyDeploymentTestCase.java 2015-03-05
11:50:15 UTC (rev 19526)
@@ -0,0 +1,221 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, 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.cxf.jms;
+
+import org.apache.cxf.frontend.ClientProxy;
+import org.apache.cxf.transport.jms.JMSConduit;
+import org.apache.cxf.transport.jms.JMSConfiguration;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.container.test.api.TargetsContainer;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.ws.common.DOMUtils;
+import org.jboss.ws.common.IOUtils;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestHelper;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.jms.*;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import java.io.File;
+import java.net.URL;
+import java.util.Properties;
+
+/**
+ * Test case for deploying an archive with a JMS (SOAP-over-JMS 1.0) endpoint only
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 10-Jun-2011
+ */
+(a)RunWith(Arquillian.class)
+public class JMSEndpointOnlyDeploymentTestCase extends JBossWSTest
+{
+ private static final String JMS_SERVER = "jms";
+ private static volatile boolean waitForResponse;
+
+ @Deployment(name="jaxws-cxf-jms-only-deployment-test-servlet", order=1,
testable = false)
+ @TargetsContainer(JMS_SERVER)
+ public static WebArchive createWarDeployment() {
+ WebArchive archive = ShrinkWrap.create(WebArchive.class,
"jaxws-cxf-jms-only-deployment-test-servlet.war");
+ archive
+ .setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.ws.cxf.jbossws-cxf-client
services,org.hornetq\n"))
+ .addAsWebInfResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/jms/META-INF/wsdl/HelloWorldService.wsdl"),
"classes/META-INF/wsdl/HelloWorldService.wsdl")
+ .addClass(org.jboss.test.ws.jaxws.cxf.jms.DeploymentTestServlet.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.jms.HelloWorld.class);
+ return archive;
+ }
+
+ @Deployment(name="jaxws-cxf-jms-only-deployment", order=2, testable =
false)
+ @TargetsContainer(JMS_SERVER)
+ public static JavaArchive createJarDeployment() {
+ JavaArchive archive =
ShrinkWrap.create(JavaArchive.class,"jaxws-cxf-jms-only-deployment.jar");
+ archive
+ .setManifest(new StringAsset("Manifest-Version: 1.0\n"
+ + "Dependencies: org.hornetq\n"))
+ .addClass(org.jboss.test.ws.jaxws.cxf.jms.HelloWorld.class)
+ .addClass(org.jboss.test.ws.jaxws.cxf.jms.HelloWorldImpl.class)
+ .addAsManifestResource(new File(JBossWSTestHelper.getTestResourcesDir() +
"/jaxws/cxf/jms/META-INF/wsdl/HelloWorldService.wsdl"),
"wsdl/HelloWorldService.wsdl");
+ return archive;
+ }
+
+ @Test
+ @RunAsClient
+ public void testJMSEndpointServerSide() throws Exception
+ {
+ URL url = new URL("http://" + getServerHost() + ":" +
getServerPort(CXF_TESTS_GROUP_QUALIFIER, JMS_SERVER) +
"/jaxws-cxf-jms-only-deployment-test-servlet");
+ assertEquals("true", IOUtils.readAndCloseStream(url.openStream()));
+ }
+
+ @Test
+ @RunAsClient
+ public void testJMSEndpointClientSide() throws Exception
+ {
+ URL wsdlUrl =
getResourceURL("jaxws/cxf/jms/META-INF/wsdl/HelloWorldService.wsdl");
+ QName serviceName = new QName("http://org.jboss.ws/jaxws/cxf/jms",
"HelloWorldService");
+
+ Service service = Service.create(wsdlUrl, serviceName);
+ HelloWorld proxy = (HelloWorld) service.getPort(new
QName("http://org.jboss.ws/jaxws/cxf/jms", "HelloWorldImplPort"),
HelloWorld.class);
+ setupProxy(proxy);
+ try {
+ assertEquals("Hi", proxy.echo("Hi"));
+ } catch (Exception e) {
+ rethrowAndHandleAuthWarning(e);
+ }
+ }
+
+ @Test
+ @RunAsClient
+ public void testMessagingClient() throws Exception
+ {
+ String reqMessage =
+ "<soap:Envelope
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
+ " <soap:Body>" +
+ " <ns2:echo
xmlns:ns2=\"http://org.jboss.ws/jaxws/cxf/jms\">" +
+ " <arg0>Hi</arg0>" +
+ " </ns2:echo>" +
+ " </soap:Body>" +
+ "</soap:Envelope>";
+
+ String resMessage =
+ "<soap:Envelope
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
+ " <soap:Body>" +
+ " <ns2:echoResponse
xmlns:ns2=\"http://org.jboss.ws/jaxws/cxf/jms\">" +
+ " <return>Hi</return>" +
+ " </ns2:echoResponse>" +
+ " </soap:Body>" +
+ "</soap:Envelope>";
+
+ Properties env = new Properties();
+ env.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jboss.naming.remote.client.InitialContextFactory");
+ env.put(Context.PROVIDER_URL, "http-remoting://" + getServerHost() +
":" + getServerPort(CXF_TESTS_GROUP_QUALIFIER, JMS_SERVER));
+ env.put(Context.SECURITY_PRINCIPAL, JBossWSTestHelper.getTestUsername());
+ env.put(Context.SECURITY_CREDENTIALS, JBossWSTestHelper.getTestPassword());
+ InitialContext context = null;
+ try {
+ context = new InitialContext(env);
+ } catch (Exception e) {
+ rethrowAndHandleAuthWarning(e);
+ }
+ QueueConnectionFactory connectionFactory =
(QueueConnectionFactory)context.lookup("jms/RemoteConnectionFactory");
+ Queue reqQueue = (Queue)context.lookup("jms/queue/test");
+ Queue resQueue = (Queue)context.lookup("jms/queue/test");
+
+ QueueConnection con =
connectionFactory.createQueueConnection(JBossWSTestHelper.getTestUsername(),
JBossWSTestHelper.getTestPassword());
+ QueueSession session = con.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+ QueueReceiver receiver = session.createReceiver(resQueue);
+ ResponseListener responseListener = new ResponseListener();
+ receiver.setMessageListener(responseListener);
+ con.start();
+
+ TextMessage message = session.createTextMessage(reqMessage);
+ message.setJMSReplyTo(resQueue);
+ message.setStringProperty("SOAPJMS_contentType", "text/xml");
+ message.setStringProperty("SOAPJMS_requestURI",
"jms:queue:testQueue");
+
+ waitForResponse = true;
+
+ QueueSender sender = session.createSender(reqQueue);
+ sender.send(message);
+ sender.close();
+
+ int timeout = 30000;
+ while (waitForResponse && timeout > 0)
+ {
+ Thread.sleep(100);
+ timeout -= 100;
+ }
+
+ assertNotNull("Expected response message", responseListener.resMessage);
+ assertEquals(DOMUtils.parse(resMessage),
DOMUtils.parse(responseListener.resMessage));
+
+ sender.close();
+ receiver.close();
+ con.stop();
+ session.close();
+ con.close();
+ }
+
+ public static class ResponseListener implements MessageListener
+ {
+ public String resMessage;
+
+ public void onMessage(Message msg)
+ {
+ TextMessage textMessage = (TextMessage)msg;
+ try
+ {
+ resMessage = textMessage.getText();
+ waitForResponse = false;
+ }
+ catch (Throwable t)
+ {
+ t.printStackTrace();
+ }
+ }
+ }
+
+ private void setupProxy(HelloWorld proxy) {
+ JMSConduit conduit = (JMSConduit)ClientProxy.getClient(proxy).getConduit();
+ JMSConfiguration config = conduit.getJmsConfig();
+ config.setUserName(JBossWSTestHelper.getTestUsername());
+ config.setPassword(JBossWSTestHelper.getTestPassword());
+ Properties props = conduit.getJmsConfig().getJndiEnvironment();
+ props.put(Context.SECURITY_PRINCIPAL, JBossWSTestHelper.getTestUsername());
+ props.put(Context.SECURITY_CREDENTIALS, JBossWSTestHelper.getTestPassword());
+ }
+
+ private static void rethrowAndHandleAuthWarning(Exception e) throws Exception {
+ System.out.println("This test requires a testQueue JMS queue and a user with
'guest' role to be available on the application server; " +
+ "queue are easily added using jboss-cli.sh/bat, while users are added
using add-user.sh/bat. When running test please specify user " +
+ "and password using -Dtest.username=\"foo\"
-Dtest.password=\"bar\".");
+ throw e;
+ }
+}
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/JMSEndpointOnlyDeploymentTestCase.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/TestServlet.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/TestServlet.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/TestServlet.java 2015-03-05
11:50:15 UTC (rev 19526)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.cxf.jms;
+
+import java.io.IOException;
+import java.net.URL;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.Service;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+
+@WebServlet(name = "TestServlet", urlPatterns = "/*")
+public class TestServlet extends HttpServlet
+{
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
+ {
+ try
+ {
+ boolean result;
+ URL wsdlUrl = Thread.currentThread().getContextClassLoader()
+ .getResource("META-INF/wsdl/HelloWorldService.wsdl");
+ //start a new bus to avoid affecting the one that could already be assigned to
this thread
+ Bus bus = BusFactory.newInstance().createBus();
+ BusFactory.setThreadDefaultBus(bus);
+ Object implementor = new HelloWorldImpl();
+ Endpoint ep = Endpoint.publish("jms:queue:testQueue", implementor);
+ try
+ {
+ //use HelloWorldServiceLocal service which has local connection factory
references (we're running on the same JVM here)
+ QName serviceName = new QName("http://org.jboss.ws/jaxws/cxf/jms",
"HelloWorldServiceLocal");
+
+ Service service = Service.create(wsdlUrl, serviceName);
+ HelloWorld proxy = (HelloWorld) service.getPort(new
QName("http://org.jboss.ws/jaxws/cxf/jms", "HelloWorldImplPort"),
HelloWorld.class);
+ result = "Hi".equals(proxy.echo("Hi"));
+ }
+ finally
+ {
+ ep.stop();
+ bus.shutdown(true);
+ }
+ res.getWriter().print(result);
+ }
+ catch (Throwable t)
+ {
+ t.printStackTrace();
+ throw new ServletException(t);
+ }
+ }
+}
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/TestServlet.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jms/META-INF/wsdl/HelloWorldService.wsdl
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jms/META-INF/wsdl/HelloWorldService.wsdl
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jms/META-INF/wsdl/HelloWorldService.wsdl 2015-03-05
11:50:15 UTC (rev 19526)
@@ -0,0 +1,86 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<wsdl:definitions name="HelloWorldService"
targetNamespace="http://org.jboss.ws/jaxws/cxf/jms"
+
xmlns:ns1="http://schemas.xmlsoap.org/soap/http"
+
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://org.jboss.ws/jaxws/cxf/jms"
+
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+
xmlns:soapjms="http://www.w3.org/2010/soapjms/"
+
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <wsdl:types>
+<xs:schema elementFormDefault="unqualified"
targetNamespace="http://org.jboss.ws/jaxws/cxf/jms" version="1.0"
xmlns:tns="http://org.jboss.ws/jaxws/cxf/jms"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
+<xs:element name="echo" type="tns:echo"/>
+<xs:element name="echoResponse" type="tns:echoResponse"/>
+<xs:complexType name="echo">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+<xs:complexType name="echoResponse">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+</xs:schema>
+ </wsdl:types>
+ <wsdl:message name="echoResponse">
+ <wsdl:part element="tns:echoResponse" name="parameters">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="echo">
+ <wsdl:part element="tns:echo" name="parameters">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="HelloWorld">
+ <wsdl:operation name="echo">
+ <wsdl:input message="tns:echo" name="echo">
+ </wsdl:input>
+ <wsdl:output message="tns:echoResponse"
name="echoResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="HelloWorldServiceSoapBinding"
type="tns:HelloWorld">
+ <soap:binding style="document"
transport="http://www.w3.org/2010/soapjms/"/>
+ <wsdl:operation name="echo">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="echo">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="echoResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="HttpHelloWorldServiceSoapBinding"
type="tns:HelloWorld">
+ <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="echo">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="echo">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="echoResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="HelloWorldService">
+
<soapjms:jndiConnectionFactoryName>java:jms/RemoteConnectionFactory</soapjms:jndiConnectionFactoryName>
+
<soapjms:jndiInitialContextFactory>org.jboss.naming.remote.client.InitialContextFactory</soapjms:jndiInitialContextFactory>
+
<soapjms:jndiURL>http-remoting://@jboss.bind.address@:@add_int(port-offset.cxf-tests.jms,8080)@</soapjms:jndiURL>
+ <wsdl:port binding="tns:HelloWorldServiceSoapBinding"
name="HelloWorldImplPort">
+ <soap:address location="jms:queue:testQueue"/>
+ </wsdl:port>
+ <wsdl:port binding="tns:HttpHelloWorldServiceSoapBinding"
name="HttpHelloWorldImplPort">
+ <soap:address location="http://host:port"/><!-- will be
rewritten at deploy time -->
+ </wsdl:port>
+ </wsdl:service>
+ <wsdl:service name="HelloWorldServiceLocal">
+
<soapjms:jndiConnectionFactoryName>java:/ConnectionFactory</soapjms:jndiConnectionFactoryName>
+ <soapjms:jndiURL></soapjms:jndiURL>
+ <wsdl:port binding="tns:HelloWorldServiceSoapBinding"
name="HelloWorldImplPort">
+ <soap:address location="jms:queue:testQueue"/>
+ </wsdl:port>
+ <wsdl:port binding="tns:HttpHelloWorldServiceSoapBinding"
name="HttpHelloWorldImplPort">
+ <soap:address location="http://host:port"/><!-- will be
rewritten at deploy time -->
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file
Property changes on:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/resources/jaxws/cxf/jms/META-INF/wsdl/HelloWorldService.wsdl
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-jms.groovy
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-jms.groovy
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/scripts/jbws-testsuite-jms.groovy 2015-03-05
11:50:15 UTC (rev 19526)
@@ -0,0 +1,57 @@
+def root = new XmlParser().parse(project.properties['inputFile'])
+
+/**
+ * Fix logging: remove CONSOLE handler and set a specific log file
+ *
+ */
+def logHandlers = root.profile.subsystem.'root-logger'.handlers[0]
+def consoleHandler = logHandlers.find{it.@name == 'CONSOLE'}
+logHandlers.remove(consoleHandler)
+def file = root.profile.subsystem.'periodic-rotating-file-handler'.file[0]
+file.attributes()['path'] = project.properties['serverLog']
+
+/**
+ * Add a JMS queue like this
+ *
+ * <subsystem xmlns="urn:jboss:domain:messaging:2.0">
+ * <hornetq-server>
+ * <jms-destinations>
+ * <jms-queue name="testQueue">
+ * <entry name="queue/test"/>
+ * <entry name="java:jboss/exported/jms/queue/test"/>
+ * </jms-queue>
+ * </jms-destinations>
+ * </hornetq-server>
+ * </subsystem>
+ **/
+def hornetqServer = root.profile.subsystem.'hornetq-server'[0]
+def jmsDestinations = hornetqServer.'jms-destinations'[0]
+if (jmsDestinations == null) {
+ jmsDestinations = hornetqServer.appendNode('jms-destinations');
+}
+def jmsQueue = jmsDestinations.appendNode('jms-queue',
['name':'testQueue'])
+jmsQueue.appendNode('entry', ['name':'queue/test'])
+jmsQueue.appendNode('entry',
['name':'java:jboss/exported/jms/queue/test'])
+
+/**
+ * Save the configuration to a new file
+ */
+def writer = new StringWriter()
+writer.println('<?xml version="1.0"
encoding="UTF-8"?>')
+new XmlNodePrinter(new PrintWriter(writer)).print(root)
+def f = new File(project.properties['outputFile'])
+f.write(writer.toString())
+
+/*
+ * copy the preconfigured application-roles.properties and application-users.properties
+ * files into the standalone/configure directory
+ */
+def srcUsersProperties = project.properties['srcUsersProperties']
+def destUsersProperties = project.properties['destUsersProperties']
+new AntBuilder().copy( file:srcUsersProperties,
+ tofile:destUsersProperties)
+
+def srcRolesProperties = project.properties['srcRolesProperties']
+def destRolesProperties = project.properties['destRolesProperties']
+new AntBuilder().copy( file:srcRolesProperties,
+ tofile:destRolesProperties)
Modified: stack/cxf/trunk/modules/testsuite/pom.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/pom.xml 2015-03-05 06:52:26 UTC (rev 19525)
+++ stack/cxf/trunk/modules/testsuite/pom.xml 2015-03-05 11:50:15 UTC (rev 19526)
@@ -35,6 +35,7 @@
<port-offset.cxf-tests.jboss>0</port-offset.cxf-tests.jboss>
<port-offset.cxf-tests.ssl-mutual-auth>5000</port-offset.cxf-tests.ssl-mutual-auth>
<port-offset.cxf-tests.default-config-tests>10000</port-offset.cxf-tests.default-config-tests>
+ <port-offset.cxf-tests.jms>35000</port-offset.cxf-tests.jms>
<port-offset.shared-tests.jboss>15000</port-offset.shared-tests.jboss>
<port-offset.shared-tests.default-config-tests>20000</port-offset.shared-tests.default-config-tests>
<port-offset.shared-tests.address-rewrite>25000</port-offset.shared-tests.address-rewrite>
@@ -319,7 +320,7 @@
<test.archive.directory>${test.archive.directory}</test.archive.directory>
<test.classes.directory>${test.classes.directory}</test.classes.directory>
<test.resources.directory>${test.resources.directory}</test.resources.directory>
- <test.username>test.username</test.username>
+ <test.username>${test.username}</test.username>
<test.password>${test.password}</test.password>
<wsdl.publish.location>${wsdl.publish.location}</wsdl.publish.location>
</systemPropertyVariables>