Author: jim.ma
Date: 2010-04-29 22:11:30 -0400 (Thu, 29 Apr 2010)
New Revision: 12123
Added:
stack/cxf/branches/jms-integration/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/endpointsdd/
stack/cxf/branches/jms-integration/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/endpointsdd/jmstransport/
stack/cxf/branches/jms-integration/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/endpointsdd/jmstransport/EndpointsDDFromJavaJMSTransportTestCase.java
stack/cxf/branches/jms-integration/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/endpointsdd/jmstransport/Organization.java
stack/cxf/branches/jms-integration/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/endpointsdd/jmstransport/OrganizationJmsEndpoint.java
stack/cxf/branches/jms-integration/modules/testsuite/cxf-tests/src/test/resources/jaxws/samples/endpointsdd/
Modified:
stack/cxf/branches/jms-integration/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/CXFEndpointsDeployment.java
stack/cxf/branches/jms-integration/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/EndpointsDescriptorDeploymentAspect.java
stack/cxf/branches/jms-integration/modules/server/src/main/resources/jbossws-cxf-config-as5.xml
stack/cxf/branches/jms-integration/modules/testsuite/cxf-tests/scripts/cxf-samples-jaxws.xml
Log:
[JBWS-2791]:Added test case for jms endpoint deployed with jbossws-endpoint.xml
Modified:
stack/cxf/branches/jms-integration/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/CXFEndpointsDeployment.java
===================================================================
---
stack/cxf/branches/jms-integration/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/CXFEndpointsDeployment.java 2010-04-29
03:26:44 UTC (rev 12122)
+++
stack/cxf/branches/jms-integration/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/CXFEndpointsDeployment.java 2010-04-30
02:11:30 UTC (rev 12123)
@@ -125,7 +125,7 @@
{
connectionFactory.destroy();
}
- //TODO:Remove above code after CXF fix this issue
+ //TODO:Remove above code after fix CXF-2788
//close LifecycleListener if exists
busHolder.getBus().shutdown(false);
busHolder.close();
Modified:
stack/cxf/branches/jms-integration/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/EndpointsDescriptorDeploymentAspect.java
===================================================================
---
stack/cxf/branches/jms-integration/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/EndpointsDescriptorDeploymentAspect.java 2010-04-29
03:26:44 UTC (rev 12122)
+++
stack/cxf/branches/jms-integration/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/EndpointsDescriptorDeploymentAspect.java 2010-04-30
02:11:30 UTC (rev 12123)
@@ -92,7 +92,7 @@
if (jmsMD.getRequestDestination() != null)
{
DDJmsAddressBean addressBean = new DDJmsAddressBean(jmsMD.getPortName(),
true, jmsMD
- .getReplyDestination().getProperties());
+ .getRequestDestination().getProperties());
ddBeans.addAddress(addressBean);
}
Modified:
stack/cxf/branches/jms-integration/modules/server/src/main/resources/jbossws-cxf-config-as5.xml
===================================================================
---
stack/cxf/branches/jms-integration/modules/server/src/main/resources/jbossws-cxf-config-as5.xml 2010-04-29
03:26:44 UTC (rev 12122)
+++
stack/cxf/branches/jms-integration/modules/server/src/main/resources/jbossws-cxf-config-as5.xml 2010-04-30
02:11:30 UTC (rev 12123)
@@ -51,7 +51,6 @@
<property
name="requires">EndpointAddress,JAXBIntros</property>
<property name="provides">StackDescriptor</property>
<property name="relativeOrder">22</property> <!--
[JBDEPLOY-201] workaround -->
- <property name="processEndpointDeployment">true</property>
</bean>
@@ -89,7 +88,6 @@
<property name="provides">BusHolder</property>
<property
name="requires">ResourceResolver,StackDescriptor</property>
<property name="relativeOrder">24</property> <!--
[JBDEPLOY-201] workaround -->
- <property name="processEndpointDeployment">true</property>
</bean>
</deployment>
Modified:
stack/cxf/branches/jms-integration/modules/testsuite/cxf-tests/scripts/cxf-samples-jaxws.xml
===================================================================
---
stack/cxf/branches/jms-integration/modules/testsuite/cxf-tests/scripts/cxf-samples-jaxws.xml 2010-04-29
03:26:44 UTC (rev 12122)
+++
stack/cxf/branches/jms-integration/modules/testsuite/cxf-tests/scripts/cxf-samples-jaxws.xml 2010-04-30
02:11:30 UTC (rev 12123)
@@ -16,6 +16,60 @@
<mkdir dir="${tests.output.dir}/test-libs"/>
+ <!--jms transport endpoints deployment descriptor sample-->
+ <jar
jarfile="${tests.output.dir}/test-libs/jaxws-samples-endpointsdd-as5.jar">
+ <fileset dir="${tests.output.dir}/test-classes">
+ <include
name="org/jboss/test/ws/jaxws/samples/endpointsdd/jmstransport/Organization.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/endpointsdd/jmstransport/OrganizationJmsEndpoint.class"/>
+ </fileset>
+ <metainf
dir="${tests.output.dir}/test-resources/jaxws/samples/endpointsdd/WEB-INF">
+ <include name="jboss-service.xml"/>
+ <include name="jbossws-endpoints.xml"/>
+ </metainf>
+ </jar>
+ <jar
jarfile="${tests.output.dir}/test-libs/jaxws-samples-endpointsdd-as6.jar">
+ <fileset dir="${tests.output.dir}/test-classes">
+ <include
name="org/jboss/test/ws/jaxws/samples/endpointsdd/jmstransport/Organization.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/endpointsdd/jmstransport/OrganizationJmsEndpoint.class"/>
+ </fileset>
+ <metainf
dir="${tests.output.dir}/test-resources/jaxws/samples/endpointsdd/WEB-INF">
+ <include name="hornetq-jms.xml"/>
+ <include name="jbossws-endpoints.xml"/>
+ </metainf>
+ </jar>
+
+
+ <war
+ warfile="${tests.output.dir}/test-libs/jaxws-samples-jms-as5.war"
+
webxml="${tests.output.dir}/test-resources/jaxws/samples/endpointsdd/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/test-classes">
+ <include
name="org/jboss/test/ws/jaxws/samples/endpointsdd/jmstransport/Organization.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/endpointsdd/jmstransport/OrganizationHttpEndpoint.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/endpointsdd/jmstransport/OrganizationJmsEndpoint.class"/>
+ </classes>
+ <webinf
dir="${tests.output.dir}/test-resources/jaxws/samples/endpointsdd/WEB-INF">
+ <include name="jboss-web.xml"/>
+ <include name="jboss-service.xml"/>
+ <include name="jbossws-endpoints.xml"/>
+ </webinf>
+ </war>
+
+
+ <war
+ warfile="${tests.output.dir}/test-libs/jaxws-samples-jms-as6.war"
+
webxml="${tests.output.dir}/test-resources/jaxws/samples/endpointsdd/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/test-classes">
+ <include
name="org/jboss/test/ws/jaxws/samples/endpointsdd/jmstransport/Organization.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/endpointsdd/jmstransport/OrganizationHttpEndpoint.class"/>
+ <include
name="org/jboss/test/ws/jaxws/samples/endpointsdd/jmstransport/OrganizationJmsEndpoint.class"/>
+ </classes>
+ <webinf
dir="${tests.output.dir}/test-resources/jaxws/samples/endpointsdd/WEB-INF">
+ <include name="jboss-web.xml"/>
+ <include name="hornetq-jms.xml"/>
+ <include name="jbossws-endpoints.xml"/>
+ </webinf>
+ </war>
+
<!-- jaxws-samples-jmstransport -->
<war
warfile="${tests.output.dir}/test-libs/jaxws-samples-jmstransport.war"
Added:
stack/cxf/branches/jms-integration/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/endpointsdd/jmstransport/EndpointsDDFromJavaJMSTransportTestCase.java
===================================================================
---
stack/cxf/branches/jms-integration/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/endpointsdd/jmstransport/EndpointsDDFromJavaJMSTransportTestCase.java
(rev 0)
+++
stack/cxf/branches/jms-integration/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/endpointsdd/jmstransport/EndpointsDDFromJavaJMSTransportTestCase.java 2010-04-30
02:11:30 UTC (rev 12123)
@@ -0,0 +1,149 @@
+/*
+ * 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.endpointsdd.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 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-endpoints.xml
+ *
+ * @author <a href=mailto:ema@redhat.com> Jim Ma </a>
+ */
+public class EndpointsDDFromJavaJMSTransportTestCase extends JBossWSTest
+{
+ private static boolean waitForResponse;
+
+ public static Test suite() throws Exception
+ {
+ return new JBossWSTestSetup(EndpointsDDFromJavaJMSTransportTestCase.class,
isHornetQAvailable() ? "jaxws-samples-endpointsdd-as6.jar" :
"jaxws-samples-endpointsdd-as5.jar");
+ }
+
+ 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/branches/jms-integration/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/endpointsdd/jmstransport/Organization.java
===================================================================
---
stack/cxf/branches/jms-integration/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/endpointsdd/jmstransport/Organization.java
(rev 0)
+++
stack/cxf/branches/jms-integration/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/endpointsdd/jmstransport/Organization.java 2010-04-30
02:11:30 UTC (rev 12123)
@@ -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.endpointsdd.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/branches/jms-integration/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/endpointsdd/jmstransport/OrganizationJmsEndpoint.java
===================================================================
---
stack/cxf/branches/jms-integration/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/endpointsdd/jmstransport/OrganizationJmsEndpoint.java
(rev 0)
+++
stack/cxf/branches/jms-integration/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/endpointsdd/jmstransport/OrganizationJmsEndpoint.java 2010-04-30
02:11:30 UTC (rev 12123)
@@ -0,0 +1,38 @@
+/*
+ * 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.endpointsdd.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.endpointsdd.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