[jbossws-commits] JBossWS SVN: r15900 - in stack/cxf/trunk/modules/testsuite/cxf-spring-tests: src/test/java/org/jboss/test/ws/jaxws/cxf/jms and 3 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Thu Mar 8 07:14:54 EST 2012


Author: alessio.soldano at jboss.com
Date: 2012-03-08 07:14:52 -0500 (Thu, 08 Mar 2012)
New Revision: 15900

Modified:
   stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-jars-jaxws.xml
   stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/DeploymentTestServlet.java
   stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/HelloWorldImpl.java
   stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/JMSEndpointAPITestCase.java
   stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/JMSEndpointOnlyDeploymentTestCase.java
   stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/TestServlet.java
   stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms_http/DeploymentTestServlet.java
   stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms_http/HelloWorldImpl.java
   stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms_http/JMSHTTPEndpointDeploymentTestCase.java
   stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/jms/META-INF-as7/wsdl/HelloWorldService.wsdl
   stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/jms_http/WEB-INF/wsdl/HelloWorldService.wsdl
Log:
[JBWS-3454] Refactoring / enhancing SOAP-over-JMS integration tests; test user setup (guest/pass w/ guest role) required


Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-jars-jaxws.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-jars-jaxws.xml	2012-03-08 11:04:08 UTC (rev 15899)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/scripts/cxf-jars-jaxws.xml	2012-03-08 12:14:52 UTC (rev 15900)
@@ -129,17 +129,7 @@
       </manifest>
     </war>
   	
-    <!-- jaxws-jms-api-client -->
-    <jar destfile="${tests.output.dir}/test-libs/jaxws-cxf-jms-api-as7-client.jar">
-      <fileset dir="${tests.output.dir}/test-classes">
-        <include name="org/jboss/test/ws/jaxws/cxf/jms/HelloWorld*.class"/>
-      </fileset>
-      <metainf dir="${tests.output.dir}/test-resources/jaxws/cxf/jms/META-INF-as7">
-        <include name="wsdl/**/*" />
-      </metainf>
-    </jar>
-  	
-    <!-- jaxws-jms-only-deployment -->
+    <!-- jaxws-cxf-jms-only-deployment -->
     <jar destfile="${tests.output.dir}/test-libs/jaxws-cxf-jms-only-deployment.jar">
       <fileset dir="${tests.output.dir}/test-classes">
         <include name="org/jboss/test/ws/jaxws/cxf/jms/HelloWorld*.class"/>
@@ -152,7 +142,7 @@
       </manifest>
     </jar>
   	
-    <!-- jaxws-jms-http-deployment -->
+    <!-- jaxws-cxf-jms-http-deployment -->
     <war warfile="${tests.output.dir}/test-libs/jaxws-cxf-jms-http-deployment.war" webxml="${tests.output.dir}/test-resources/jaxws/cxf/jms_http/WEB-INF/web.xml">
       <classes dir="${tests.output.dir}/test-classes">
         <include name="org/jboss/test/ws/jaxws/cxf/jms_http/HelloWorld*.class"/>
@@ -166,7 +156,7 @@
       </manifest>
     </war>
   	
-    <!-- jaxws-jms-only-deployment-test-servlet -->
+    <!-- jaxws-cxf-jms-only-deployment-test-servlet -->
     <war warfile="${tests.output.dir}/test-libs/jaxws-cxf-jms-only-deployment-test-servlet.war"
     	needxmlfile='false'>
       <classes dir="${tests.output.dir}/test-classes">
@@ -181,7 +171,7 @@
       </manifest>
     </war>
   	
-    <!-- jaxws-jms-http-deployment-test-servlet -->
+    <!-- jaxws-cxf-jms-http-deployment-test-servlet -->
     <war warfile="${tests.output.dir}/test-libs/jaxws-cxf-jms-http-deployment-test-servlet.war"
     	needxmlfile='false'>
       <classes dir="${tests.output.dir}/test-classes">

Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/DeploymentTestServlet.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/DeploymentTestServlet.java	2012-03-08 11:04:08 UTC (rev 15899)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/DeploymentTestServlet.java	2012-03-08 12:14:52 UTC (rev 15900)
@@ -1,6 +1,6 @@
 /*
  * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * 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.
  *
@@ -52,7 +52,8 @@
          BusFactory.setThreadDefaultBus(bus);
          try
          {
-            QName serviceName = new QName("http://org.jboss.ws/jaxws/cxf/jms", "HelloWorldService");
+            //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

Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/HelloWorldImpl.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/HelloWorldImpl.java	2012-03-08 11:04:08 UTC (rev 15899)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/HelloWorldImpl.java	2012-03-08 12:14:52 UTC (rev 15900)
@@ -26,7 +26,7 @@
 @WebService
 (
    portName = "HelloWorldImplPort",
-   serviceName = "HelloWorldService",
+   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"

Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/JMSEndpointAPITestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/JMSEndpointAPITestCase.java	2012-03-08 11:04:08 UTC (rev 15899)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/JMSEndpointAPITestCase.java	2012-03-08 12:14:52 UTC (rev 15900)
@@ -1,6 +1,6 @@
 /*
  * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * 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.
  *
@@ -25,10 +25,6 @@
 import java.io.InputStreamReader;
 import java.net.URL;
 
-import javax.xml.namespace.QName;
-import javax.xml.ws.Endpoint;
-import javax.xml.ws.Service;
-
 import junit.framework.Test;
 
 import org.jboss.wsf.test.JBossWSCXFTestSetup;
@@ -44,7 +40,7 @@
 {
    public static Test suite()
    {
-      return new JBossWSCXFTestSetup(JMSEndpointAPITestCase.class, "jaxws-cxf-jms-api-as7-client.jar,jaxws-cxf-jms-api-as7.war");
+      return new JBossWSCXFTestSetup(JMSEndpointAPITestCase.class, "jaxws-cxf-jms-api-as7.war");
    }
    
    public void testServerSide() throws Exception
@@ -54,26 +50,4 @@
       assertEquals("true", br.readLine());
    }
    
-   public void testClientSide() throws Exception
-   {
-      if (isTargetJBoss7()) {
-         System.out.println("FIXME: can't lookup ConnectionFactory, remote JNDI binding not available yet on AS7");
-         return;
-      }
-      URL wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("META-INF/wsdl/HelloWorldService.wsdl");
-      Object implementor = new HelloWorldImpl();
-      Endpoint ep = Endpoint.publish("jms:queue:testQueue", implementor);
-      try
-      {
-         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);
-         assertEquals("Hi", proxy.echo("Hi"));
-      }
-      finally
-      {
-         ep.stop();
-      }
-   }
 }

Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/JMSEndpointOnlyDeploymentTestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/JMSEndpointOnlyDeploymentTestCase.java	2012-03-08 11:04:08 UTC (rev 15899)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/JMSEndpointOnlyDeploymentTestCase.java	2012-03-08 12:14:52 UTC (rev 15900)
@@ -24,12 +24,29 @@
 import java.io.BufferedReader;
 import java.io.InputStreamReader;
 import java.net.URL;
+import java.util.Properties;
 
+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.naming.Context;
+import javax.naming.InitialContext;
 import javax.xml.namespace.QName;
 import javax.xml.ws.Service;
 
 import junit.framework.Test;
 
+import org.apache.cxf.frontend.ClientProxy;
+import org.apache.cxf.transport.jms.JMSConduit;
+import org.apache.cxf.transport.jms.JNDIConfiguration;
+import org.jboss.ws.common.DOMUtils;
 import org.jboss.wsf.test.JBossWSCXFTestSetup;
 import org.jboss.wsf.test.JBossWSTest;
 
@@ -41,6 +58,8 @@
  */
 public class JMSEndpointOnlyDeploymentTestCase extends JBossWSTest
 {
+   private static boolean waitForResponse;
+   
    public static Test suite()
    {
       return new JBossWSCXFTestSetup(JMSEndpointOnlyDeploymentTestCase.class, "jaxws-cxf-jms-only-deployment-test-servlet.war,jaxws-cxf-jms-only-deployment.jar");
@@ -55,16 +74,108 @@
    
    public void testJMSEndpointClientSide() throws Exception
    {
-      if (isTargetJBoss7())
-      {
-         System.out.println("FIXME: can't lookup ConnectionFactory, remote JNDI binding not available yet on AS7");
-         return;
-      }
-      URL wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("META-INF/wsdl/HelloWorldService.wsdl");
+      URL wsdlUrl = getResourceURL("jaxws/cxf/jms/META-INF-as7/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);
       assertEquals("Hi", proxy.echo("Hi"));
    }
+   
+   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, "remote://" + getServerHost() + ":4447");
+      env.put(Context.SECURITY_PRINCIPAL, "guest");
+      env.put(Context.SECURITY_CREDENTIALS, "pass");
+      InitialContext context = new InitialContext(env);
+      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("guest", "pass");
+      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) {
+      final String user = "guest";
+      final String pwd = "pass";
+      JMSConduit conduit = (JMSConduit)ClientProxy.getClient(proxy).getConduit();
+      JNDIConfiguration jndiConfig = conduit.getJmsConfig().getJndiConfig();
+      jndiConfig.setConnectionUserName(user);
+      jndiConfig.setConnectionPassword(pwd);
+      Properties props = conduit.getJmsConfig().getJndiTemplate().getEnvironment();
+      props.put(Context.SECURITY_PRINCIPAL, user);
+      props.put(Context.SECURITY_CREDENTIALS, pwd);
+   }
 }

Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/TestServlet.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/TestServlet.java	2012-03-08 11:04:08 UTC (rev 15899)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms/TestServlet.java	2012-03-08 12:14:52 UTC (rev 15900)
@@ -56,7 +56,8 @@
          Endpoint ep = Endpoint.publish("jms:queue:testQueue", implementor);
          try
          {
-            QName serviceName = new QName("http://org.jboss.ws/jaxws/cxf/jms", "HelloWorldService");
+            //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);

Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms_http/DeploymentTestServlet.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms_http/DeploymentTestServlet.java	2012-03-08 11:04:08 UTC (rev 15899)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms_http/DeploymentTestServlet.java	2012-03-08 12:14:52 UTC (rev 15900)
@@ -52,11 +52,12 @@
          BusFactory.setThreadDefaultBus(bus);
          try
          {
-            QName serviceName = new QName("http://org.jboss.ws/jaxws/cxf/jms", "HelloWorldService");
-            Service service = Service.create(wsdlUrl, serviceName);
+            Service service = Service.create(wsdlUrl, new QName("http://org.jboss.ws/jaxws/cxf/jms", "HelloWorldService"));
+            //HelloWorldServiceLocal service references local connection factory (for in-VM use)
+            Service serviceLocal = Service.create(wsdlUrl, new QName("http://org.jboss.ws/jaxws/cxf/jms", "HelloWorldServiceLocal"));
             
             //JMS test
-            HelloWorld proxy = (HelloWorld) service.getPort(new QName("http://org.jboss.ws/jaxws/cxf/jms", "HelloWorldImplPort"), HelloWorld.class);
+            HelloWorld proxy = (HelloWorld) serviceLocal.getPort(new QName("http://org.jboss.ws/jaxws/cxf/jms", "HelloWorldImplPort"), HelloWorld.class);
             result = "Hi".equals(proxy.echo("Hi"));
             //HTTP test
             HelloWorld httpProxy = (HelloWorld) service.getPort(new QName("http://org.jboss.ws/jaxws/cxf/jms", "HttpHelloWorldImplPort"), HelloWorld.class);

Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms_http/HelloWorldImpl.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms_http/HelloWorldImpl.java	2012-03-08 11:04:08 UTC (rev 15899)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms_http/HelloWorldImpl.java	2012-03-08 12:14:52 UTC (rev 15900)
@@ -26,7 +26,7 @@
 @WebService
 (
    portName = "HelloWorldImplPort",
-   serviceName = "HelloWorldService",
+   serviceName = "HelloWorldServiceLocal",
    wsdlLocation = "WEB-INF/wsdl/HelloWorldService.wsdl",
    endpointInterface = "org.jboss.test.ws.jaxws.cxf.jms_http.HelloWorld",
    targetNamespace = "http://org.jboss.ws/jaxws/cxf/jms"

Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms_http/JMSHTTPEndpointDeploymentTestCase.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms_http/JMSHTTPEndpointDeploymentTestCase.java	2012-03-08 11:04:08 UTC (rev 15899)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jms_http/JMSHTTPEndpointDeploymentTestCase.java	2012-03-08 12:14:52 UTC (rev 15900)
@@ -24,12 +24,18 @@
 import java.io.BufferedReader;
 import java.io.InputStreamReader;
 import java.net.URL;
+import java.util.Properties;
 
+import javax.naming.Context;
 import javax.xml.namespace.QName;
 import javax.xml.ws.Service;
 
 import junit.framework.Test;
 
+import org.apache.cxf.frontend.ClientProxy;
+import org.apache.cxf.transport.jms.JMSConduit;
+import org.apache.cxf.transport.jms.JNDIConfiguration;
+import org.jboss.test.ws.jaxws.cxf.jms.HelloWorld;
 import org.jboss.wsf.test.JBossWSCXFTestSetup;
 import org.jboss.wsf.test.JBossWSTest;
 
@@ -55,16 +61,12 @@
    
    public void testJMSEndpointClientSide() throws Exception
    {
-      if (isTargetJBoss7())
-      {
-         System.out.println("FIXME: can't lookup ConnectionFactory, remote JNDI binding not available yet on AS7");
-         return;
-      }
-      URL wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("META-INF/wsdl/HelloWorldService.wsdl");
+      URL wsdlUrl = getResourceURL("jaxws/cxf/jms_http/WEB-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);
       assertEquals("Hi", proxy.echo("Hi"));
    }
    
@@ -77,4 +79,16 @@
       HelloWorld proxy = (HelloWorld) service.getPort(new QName("http://org.jboss.ws/jaxws/cxf/jms", "HttpHelloWorldImplPort"), HelloWorld.class);
       assertEquals("(http) Hi", proxy.echo("Hi"));
    }
+   
+   private void setupProxy(HelloWorld proxy) {
+      final String user = "guest";
+      final String pwd = "pass";
+      JMSConduit conduit = (JMSConduit)ClientProxy.getClient(proxy).getConduit();
+      JNDIConfiguration jndiConfig = conduit.getJmsConfig().getJndiConfig();
+      jndiConfig.setConnectionUserName(user);
+      jndiConfig.setConnectionPassword(pwd);
+      Properties props = conduit.getJmsConfig().getJndiTemplate().getEnvironment();
+      props.put(Context.SECURITY_PRINCIPAL, user);
+      props.put(Context.SECURITY_CREDENTIALS, pwd);
+   }
 }

Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/jms/META-INF-as7/wsdl/HelloWorldService.wsdl
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/jms/META-INF-as7/wsdl/HelloWorldService.wsdl	2012-03-08 11:04:08 UTC (rev 15899)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/jms/META-INF-as7/wsdl/HelloWorldService.wsdl	2012-03-08 12:14:52 UTC (rev 15900)
@@ -63,6 +63,17 @@
     </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>remote://localhost:4447</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>
     <wsdl:port binding="tns:HelloWorldServiceSoapBinding" name="HelloWorldImplPort">
       <soap:address location="jms:queue:testQueue"/>

Modified: stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/jms_http/WEB-INF/wsdl/HelloWorldService.wsdl
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/jms_http/WEB-INF/wsdl/HelloWorldService.wsdl	2012-03-08 11:04:08 UTC (rev 15899)
+++ stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/resources/jaxws/cxf/jms_http/WEB-INF/wsdl/HelloWorldService.wsdl	2012-03-08 12:14:52 UTC (rev 15900)
@@ -63,7 +63,9 @@
     </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="HelloWorldService">
-    <soapjms:jndiConnectionFactoryName>java:/ConnectionFactory</soapjms:jndiConnectionFactoryName>
+    <soapjms:jndiConnectionFactoryName>java:jms/RemoteConnectionFactory</soapjms:jndiConnectionFactoryName>
+    <soapjms:jndiInitialContextFactory>org.jboss.naming.remote.client.InitialContextFactory</soapjms:jndiInitialContextFactory>
+    <soapjms:jndiURL>remote://localhost:4447</soapjms:jndiURL>
     <wsdl:port binding="tns:HelloWorldServiceSoapBinding" name="HelloWorldImplPort">
       <soap:address location="jms:queue:testQueue"/>
     </wsdl:port>
@@ -71,4 +73,10 @@
       <soap:address location="http://localhost:8080/jaxws-cxf-jms-http-deployment"/>
     </wsdl:port>
   </wsdl:service>
+  <wsdl:service name="HelloWorldServiceLocal">
+    <soapjms:jndiConnectionFactoryName>java:/ConnectionFactory</soapjms:jndiConnectionFactoryName>
+    <wsdl:port binding="tns:HelloWorldServiceSoapBinding" name="HelloWorldImplPort">
+      <soap:address location="jms:queue:testQueue"/>
+    </wsdl:port>
+  </wsdl:service>
 </wsdl:definitions>
\ No newline at end of file



More information about the jbossws-commits mailing list