Author: richard.opalka(a)jboss.com
Date: 2010-07-09 07:39:54 -0400 (Fri, 09 Jul 2010)
New Revision: 12619
Added:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/jmsendpoints/
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/jmsendpoints/jmstransport/
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/jmsendpoints/jmstransport/JMSEndpointsTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/jmsendpoints/jmstransport/Organization.java
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/jmsendpoints/jmstransport/OrganizationJmsEndpoint.java
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/jmsendpoints/
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/jmsendpoints/META-INF/
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/jmsendpoints/META-INF/hornetq-jms.xml
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/jmsendpoints/META-INF/jbossws-cxf.xml
Modified:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-samples-jaxws.xml
stack/cxf/trunk/modules/testsuite/test-excludes-jboss501.txt
stack/cxf/trunk/modules/testsuite/test-excludes-jboss510.txt
stack/cxf/trunk/modules/testsuite/test-excludes-jboss601.txt
Log:
[JBWS-3086] merging CXF JMS prototype upstream - providing test case
Modified:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-samples-jaxws.xml
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-samples-jaxws.xml 2010-07-09
11:11:37 UTC (rev 12618)
+++
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-samples-jaxws.xml 2010-07-09
11:39:54 UTC (rev 12619)
@@ -76,6 +76,19 @@
</metainf>
</jar>
+ <!-- jms endpoints sample-->
+ <!-- jms transport from java for as6 -->
+ <jar
jarfile="${tests.output.dir}/test-libs/jaxws-samples-jmsendpoints-as6.jar">
+ <fileset dir="${tests.output.dir}/test-classes">
+ <include
name="org/jboss/test/ws/jaxws/samples/jmsendpoints/jmstransport/Organization.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/jmsendpoints/jmstransport/OrganizationJmsEndpoint.class"/>
+ </fileset>
+ <metainf
dir="${tests.output.dir}/test-resources/jaxws/samples/jmsendpoints/META-INF">
+ <include name="hornetq-jms.xml"/>
+ <include name="jbossws-cxf.xml"/>
+ </metainf>
+ </jar>
+
<!-- jaxws-samples-wsrm -->
<war
warfile="${tests.output.dir}/test-libs/jaxws-samples-wsrm.war"
Added:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/jmsendpoints/jmstransport/JMSEndpointsTestCase.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/jmsendpoints/jmstransport/JMSEndpointsTestCase.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/jmsendpoints/jmstransport/JMSEndpointsTestCase.java 2010-07-09
11:39:54 UTC (rev 12619)
@@ -0,0 +1,154 @@
+/*
+ * 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.samples.jmsendpoints.jmstransport;
+
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.common.ObjectNameFactory;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestHelper;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ * The test for cxf jms transport packaged in a jar file and deployed with
jbossws-cxf.xml
+ *
+ * @author <a href=mailto:ema@redhat.com> Jim Ma </a>
+ */
+public class JMSEndpointsTestCase extends JBossWSTest
+{
+ private static boolean waitForResponse;
+
+ public static Test suite() throws Exception
+ {
+ if (isHornetQAvailable()) {
+ return new JBossWSTestSetup(JMSEndpointsTestCase.class,
"jaxws-samples-jmsendpoints-as6.jar");
+ } else {
+ return new TestSuite();
+ }
+ }
+
+ public static boolean isHornetQAvailable()
+ {
+ try
+ {
+ ObjectName oname =
ObjectNameFactory.create("jboss.system:type=Server");
+ String jbossVersion = (String)getServer().getAttribute(oname,
"VersionNumber");
+ return JBossWSTestHelper.isTargetJBoss6() &&
!jbossVersion.contains("M2");
+ }
+ catch (Exception e)
+ {
+ return false;
+ }
+ }
+
+ public void testMessagingClient() throws Exception
+ {
+ String reqMessage =
+ "<env:Envelope
xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
+ "<env:Body>" +
+ "<ns1:getContactInfo
xmlns:ns1='http://org.jboss.ws/samples/jmstransport'>" +
+ "<arg0>mafia</arg0>" +
+ "</ns1:getContactInfo>" +
+ "</env:Body>" +
+ "</env:Envelope>";
+
+ String resMessage =
+ "<soap:Envelope
xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>" +
+ "<soap:Body>" +
+ "<ns1:getContactInfoResponse
xmlns:ns1='http://org.jboss.ws/samples/jmstransport'>" +
+ "<return>The 'mafia' boss is currently out of
office, please call again.</return>" +
+ "</ns1:getContactInfoResponse>" +
+ "</soap:Body>" +
+ "</soap:Envelope>";
+
+ InitialContext context = new InitialContext();
+ QueueConnectionFactory connectionFactory =
(QueueConnectionFactory)context.lookup("ConnectionFactory");
+ Queue reqQueue = (Queue)context.lookup("queue/RequestQueue");
+ Queue resQueue = (Queue)context.lookup("queue/ResponseQueue");
+
+ QueueConnection con = connectionFactory.createQueueConnection();
+ 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);
+
+ waitForResponse = true;
+
+ QueueSender sender = session.createSender(reqQueue);
+ sender.send(message);
+ sender.close();
+
+ int timeout = 5;
+ while (waitForResponse && timeout > 0)
+ {
+ Thread.sleep(1000);
+ timeout = timeout -1;
+ }
+
+ 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();
+ }
+ }
+ }
+}
Added:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/jmsendpoints/jmstransport/Organization.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/jmsendpoints/jmstransport/Organization.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/jmsendpoints/jmstransport/Organization.java 2010-07-09
11:39:54 UTC (rev 12619)
@@ -0,0 +1,32 @@
+/*
+ * 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.samples.jmsendpoints.jmstransport;
+
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+@WebService(targetNamespace = "http://org.jboss.ws/samples/jmstransport")
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+public interface Organization
+{
+ String getContactInfo(String organization);
+}
Added:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/jmsendpoints/jmstransport/OrganizationJmsEndpoint.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/jmsendpoints/jmstransport/OrganizationJmsEndpoint.java
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/jmsendpoints/jmstransport/OrganizationJmsEndpoint.java 2010-07-09
11:39:54 UTC (rev 12619)
@@ -0,0 +1,43 @@
+/*
+ * 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.samples.jmsendpoints.jmstransport;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+@WebService
+(
+ serviceName="OrganizationService",
+ portName="JmsPort",
+ targetNamespace = "http://org.jboss.ws/samples/jmstransport",
+
endpointInterface="org.jboss.test.ws.jaxws.samples.jmsendpoints.jmstransport.Organization"
+)
+@SOAPBinding(style = SOAPBinding.Style.RPC)
+public class OrganizationJmsEndpoint implements Organization
+{
+ @WebMethod
+ public String getContactInfo(String organization)
+ {
+ return "The '" + organization + "' boss is currently out of
office, please call again.";
+ }
+}
\ No newline at end of file
Added:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/jmsendpoints/META-INF/hornetq-jms.xml
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/jmsendpoints/META-INF/hornetq-jms.xml
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/jmsendpoints/META-INF/hornetq-jms.xml 2010-07-09
11:39:54 UTC (rev 12619)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration
+ xmlns="urn:hornetq"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
+ <queue name="RequestQueue">
+ <entry name="/queue/RequestQueue"/>
+ </queue>
+ <queue name="ResponseQueue">
+ <entry name="/queue/ResponseQueue"/>
+ </queue>
+</configuration>
Added:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/jmsendpoints/META-INF/jbossws-cxf.xml
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/jmsendpoints/META-INF/jbossws-cxf.xml
(rev 0)
+++
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/samples/jmsendpoints/META-INF/jbossws-cxf.xml 2010-07-09
11:39:54 UTC (rev 12619)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans
+
xmlns='http://www.springframework.org/schema/beans'
+
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+
xmlns:beans='http://www.springframework.org/schema/beans'
+
xmlns:jms="http://cxf.apache.org/transports/jms"
+
xmlns:jaxws='http://cxf.apache.org/jaxws'
+
xsi:schemaLocation='http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+
http://www.w3.org/2006/07/ws-policy http://www.w3.org/2006/07/ws-policy.xsd
+
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
+
http://cxf.apache.org/transports/jms
http://cxf.apache.org/schemas/configuration/jms.xsd'>
+
+ <jaxws:endpoint
+
implementor='org.jboss.test.ws.jaxws.samples.jmsendpoints.jmstransport.OrganizationJmsEndpoint'
+
transportId="http://cxf.apache.org/transports/jms">
+ </jaxws:endpoint>
+
+ <jms:destination
name="{http://org.jboss.ws/samples/jmstransport}JmsPort.jms-destination">
+ <jms:address
+ destinationStyle="queue"
+ jndiConnectionFactoryName="ConnectionFactory"
+ jndiDestinationName="queue/RequestQueue"
+ jndiReplyDestinationName="queue/ResponseQueue">
+ </jms:address>
+ </jms:destination>
+
+ <jms:conduit
name="{http://org.jboss.ws/samples/jmstransport}JmsPort.jms-conduit">
+ <jms:address
+ destinationStyle="queue"
+ jndiConnectionFactoryName="ConnectionFactory"
+ jndiDestinationName="queue/RequestQueue"
+ jndiReplyDestinationName="queue/ResponseQueue">
+ </jms:address>
+ </jms:conduit>
+
+</beans>
Modified: stack/cxf/trunk/modules/testsuite/test-excludes-jboss501.txt
===================================================================
--- stack/cxf/trunk/modules/testsuite/test-excludes-jboss501.txt 2010-07-09 11:11:37 UTC
(rev 12618)
+++ stack/cxf/trunk/modules/testsuite/test-excludes-jboss501.txt 2010-07-09 11:39:54 UTC
(rev 12619)
@@ -58,7 +58,9 @@
# [JBWS-3001] Verify @PostConstruct and @PreDestroy annotations support for POJO based
endpoints
org/jboss/test/ws/jaxws/jbws2268/**
-# [JBWS-3028] Complete UsernameToken JAAS integration: PicketBox not available
-# on AS 5.x
+# [JBWS-3028] Complete UsernameToken JAAS integration: PicketBox not available on AS 5.x
org/jboss/test/ws/jaxws/samples/wsse/UsernameAuthorizationCustomFileTestCase.*
+# [JBWS-3086] This have been merged to AS 600M3 and upstream only
+org/jboss/test/ws/jaxws/samples/jmsendpoints/**
+
Modified: stack/cxf/trunk/modules/testsuite/test-excludes-jboss510.txt
===================================================================
--- stack/cxf/trunk/modules/testsuite/test-excludes-jboss510.txt 2010-07-09 11:11:37 UTC
(rev 12618)
+++ stack/cxf/trunk/modules/testsuite/test-excludes-jboss510.txt 2010-07-09 11:39:54 UTC
(rev 12619)
@@ -58,7 +58,9 @@
# [JBWS-3001] Verify @PostConstruct and @PreDestroy annotations support for POJO based
endpoints
org/jboss/test/ws/jaxws/jbws2268/**
-# [JBWS-3028] Complete UsernameToken JAAS integration: PicketBox not available
-# on AS 5.x
+# [JBWS-3028] Complete UsernameToken JAAS integration: PicketBox not available on AS 5.x
org/jboss/test/ws/jaxws/samples/wsse/UsernameAuthorizationCustomFileTestCase.*
+
+# [JBWS-3086] This have been merged to AS 600M3 and upstream only
+org/jboss/test/ws/jaxws/samples/jmsendpoints/**
Modified: stack/cxf/trunk/modules/testsuite/test-excludes-jboss601.txt
===================================================================
--- stack/cxf/trunk/modules/testsuite/test-excludes-jboss601.txt 2010-07-09 11:11:37 UTC
(rev 12618)
+++ stack/cxf/trunk/modules/testsuite/test-excludes-jboss601.txt 2010-07-09 11:39:54 UTC
(rev 12619)
@@ -52,3 +52,6 @@
# [JBWS-3001] Verify @PostConstruct and @PreDestroy annotations support for POJO based
endpoints
org/jboss/test/ws/jaxws/jbws2268/**
+# [JBWS-3086] TODO: merge to AS IL trunk once SPI, COMMON and FRAMEWORK are updated
there
+org/jboss/test/ws/jaxws/samples/jmsendpoints/**
+