cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r441368 - in /incubator/cxf/trunk/systests: ./ src/test/java/org/apache/cxf/systest/jms/
Date Fri, 08 Sep 2006 04:16:14 GMT
Author: ningjiang
Date: Thu Sep  7 21:16:13 2006
New Revision: 441368

URL: http://svn.apache.org/viewvc?view=rev&rev=441368
Log:
[CXF-41] Add CXF JMSTransport System test 
Current system test using doc-lit style. 
The rpc-lit and fault need to wait for rt-core support.

Added:
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/EmbeddedJMSBrokerLauncher.java
  (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplDoc.java
  (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplQueueOneWay.java
  (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplTopicOneWay.java
  (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplTwoWayJMS.java
  (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
  (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/Server.java   (with
props)
Modified:
    incubator/cxf/trunk/systests/pom.xml

Modified: incubator/cxf/trunk/systests/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/pom.xml?view=diff&rev=441368&r1=441367&r2=441368
==============================================================================
--- incubator/cxf/trunk/systests/pom.xml (original)
+++ incubator/cxf/trunk/systests/pom.xml Thu Sep  7 21:16:13 2006
@@ -112,6 +112,11 @@
             <artifactId>cxf-rt-transports-local</artifactId>
             <version>${project.version}</version>
         </dependency>
+         <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-transports-jms</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-ws-addr</artifactId>

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/EmbeddedJMSBrokerLauncher.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/EmbeddedJMSBrokerLauncher.java?view=auto&rev=441368
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/EmbeddedJMSBrokerLauncher.java
(added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/EmbeddedJMSBrokerLauncher.java
Thu Sep  7 21:16:13 2006
@@ -0,0 +1,61 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.jms;
+
+import org.activemq.broker.BrokerContainer;
+import org.activemq.broker.impl.BrokerContainerImpl;
+import org.activemq.store.vm.VMPersistenceAdapter;
+import org.apache.cxf.systest.common.TestServerBase;
+
+
+
+public class EmbeddedJMSBrokerLauncher extends TestServerBase {
+    
+    BrokerContainer container;
+    final String brokerUrl1 = "tcp://localhost:61500";            
+            
+    public void tearDown() throws Exception {
+        if (container != null) {
+            container.stop();
+        }
+    }
+            
+    public void run() {
+        try {                
+            container = new BrokerContainerImpl();
+            container.addConnector(brokerUrl1);
+            container.setPersistenceAdapter(new VMPersistenceAdapter());
+            container.start();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void main(String[] args) {
+        try {
+            EmbeddedJMSBrokerLauncher s = new EmbeddedJMSBrokerLauncher();
+            s.start();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            System.exit(-1);
+        } finally {
+            System.out.println("done!");
+        }
+    }
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/EmbeddedJMSBrokerLauncher.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplDoc.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplDoc.java?view=auto&rev=441368
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplDoc.java
(added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplDoc.java
Thu Sep  7 21:16:13 2006
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.jms;
+
+import javax.jws.WebService;
+
+import org.apache.hello_world_doc_lit.Greeter;
+import org.apache.hello_world_doc_lit.PingMeFault;
+import org.apache.hello_world_doc_lit.types.FaultDetail;
+
+
+@WebService(serviceName = "SOAPService2", 
+            portName = "SoapPort2", 
+            endpointInterface = "org.apache.hello_world_doc_lit.Greeter",
+            targetNamespace = "http://apache.org/hello_world_doc_lit")
+public class GreeterImplDoc implements Greeter {
+
+    public String sayHi() {
+        System.out.println("Call sayHi here ");
+        return "Bonjour";
+    }
+
+    public String greetMe(String requestType) {
+        System.out.println("Reached here :" + requestType);
+        return "Hello " + requestType;
+    }
+
+    public void greetMeOneWay(String requestType) {
+        System.out.println("*********  greetMeOneWay: " + requestType);        
+    }
+
+    public void pingMe() throws PingMeFault {
+        FaultDetail faultDetail = new FaultDetail();
+        faultDetail.setMajor((short)2);
+        faultDetail.setMinor((short)1);
+        throw new PingMeFault("PingMeFault raised by server", faultDetail);
+        
+    }
+
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplDoc.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplQueueOneWay.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplQueueOneWay.java?view=auto&rev=441368
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplQueueOneWay.java
(added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplQueueOneWay.java
Thu Sep  7 21:16:13 2006
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.jms;
+
+import javax.jws.WebService;
+
+import org.apache.cxf.hello_world_jms.HelloWorldOneWayPort;
+
+
+
+@WebService(serviceName = "HelloWorldOneWayQueueService", 
+            portName = "HelloWorldOneWayQueuePort", 
+            endpointInterface = "org.apache.cxf.hello_world_jms.HelloWorldOneWayPort",
+            targetNamespace = "http://cxf.apache.org/hello_world_jms")
+public class GreeterImplQueueOneWay implements HelloWorldOneWayPort {
+
+    public void greetMeOneWay(String stringParam0) {
+        System.out.println("*********  greetMeOneWay: " + stringParam0);
+
+    }
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplQueueOneWay.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplTopicOneWay.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplTopicOneWay.java?view=auto&rev=441368
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplTopicOneWay.java
(added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplTopicOneWay.java
Thu Sep  7 21:16:13 2006
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.jms;
+
+import javax.jws.WebService;
+
+import org.apache.cxf.hello_world_jms.HelloWorldPubSubPort;
+
+@WebService(serviceName = "HelloWorldPubSubService", 
+            portName = "HelloWorldPubSubPort", 
+            endpointInterface = "org.apache.cxf.hello_world_jms.HelloWorldPubSubPort",
+            targetNamespace = "http://cxf.apache.org/hello_world_jms")
+public class GreeterImplTopicOneWay implements HelloWorldPubSubPort {
+
+    public void greetMeOneWay(String stringParam0) {
+        System.out.println("*********  greetMeOneWay: " + stringParam0);
+    }
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplTopicOneWay.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplTwoWayJMS.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplTwoWayJMS.java?view=auto&rev=441368
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplTwoWayJMS.java
(added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplTwoWayJMS.java
Thu Sep  7 21:16:13 2006
@@ -0,0 +1,69 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.jms;
+
+import javax.jws.WebService;
+
+import org.apache.cxf.hello_world_jms.BadRecordLitFault;
+import org.apache.cxf.hello_world_jms.HelloWorldPortType;
+import org.apache.cxf.hello_world_jms.NoSuchCodeLitFault;
+import org.apache.cxf.hello_world_jms.types.ErrorCode;
+import org.apache.cxf.hello_world_jms.types.NoSuchCodeLit;
+import org.apache.cxf.hello_world_jms.types.TestRpcLitFaultResponse;
+
+
+
+@WebService(serviceName = "HelloWorldService", 
+            portName = "HelloWorldPort",
+            endpointInterface = "org.apache.cxf.hello_world_jms.HelloWorldPortType",
+            targetNamespace = "http://cxf.apache.org/hello_world_jms")
+public class GreeterImplTwoWayJMS implements HelloWorldPortType {
+
+    public String greetMe(String me) {
+        System.out.println("Reached here :" + me);
+        return "Hello " + me;
+    }
+
+    public String sayHi() {
+        return "Bonjour";
+    }
+    
+    public void greetMeOneWay(String requestType) {
+        System.out.println("*********  greetMeOneWay: " + requestType);
+    }
+    
+    public TestRpcLitFaultResponse testRpcLitFault(String faultType) 
+        throws BadRecordLitFault, NoSuchCodeLitFault {
+        if (faultType.equals(BadRecordLitFault.class.getSimpleName())) {
+            throw new BadRecordLitFault("TestBadRecordLit", "BadRecordLitFault");
+        }
+        if (faultType.equals(NoSuchCodeLitFault.class.getSimpleName())) {
+            ErrorCode ec = new ErrorCode();
+            ec.setMajor((short)1);
+            ec.setMinor((short)1);
+            NoSuchCodeLit nscl = new NoSuchCodeLit();
+            nscl.setCode(ec);
+            throw new NoSuchCodeLitFault("TestNoSuchCodeLit", nscl);
+        }
+        
+        return new TestRpcLitFaultResponse();
+    }
+    
+    
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/GreeterImplTwoWayJMS.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java?view=auto&rev=441368
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
(added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
Thu Sep  7 21:16:13 2006
@@ -0,0 +1,258 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.jms;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.cxf.hello_world_jms.BadRecordLitFault;
+import org.apache.cxf.hello_world_jms.HelloWorldOneWayPort;
+import org.apache.cxf.hello_world_jms.HelloWorldOneWayQueueService;
+import org.apache.cxf.hello_world_jms.HelloWorldPortType;
+import org.apache.cxf.hello_world_jms.HelloWorldPubSubPort;
+import org.apache.cxf.hello_world_jms.HelloWorldPubSubService;
+import org.apache.cxf.hello_world_jms.HelloWorldService;
+import org.apache.cxf.hello_world_jms.NoSuchCodeLitFault;
+import org.apache.cxf.systest.common.ClientServerSetupBase;
+import org.apache.cxf.systest.common.ClientServerTestBase;
+import org.apache.cxf.transport.jms.JMSConstants;
+import org.apache.cxf.transports.jms.context.JMSMessageHeadersType;
+import org.apache.cxf.transports.jms.context.JMSPropertyType;
+import org.apache.hello_world_doc_lit.Greeter;
+import org.apache.hello_world_doc_lit.SOAPService2;
+
+public class JMSClientServerTest extends ClientServerTestBase {
+
+    private QName serviceName; 
+    private QName portName;
+
+    public static Test suite() throws Exception {
+        TestSuite suite = new TestSuite(JMSClientServerTest.class);
+        return new ClientServerSetupBase(suite) {
+            public void startServers() throws Exception {
+                Map<String, String> props = new HashMap<String, String>();  
             
+                if (System.getProperty("activemq.store.dir") != null) {
+                    props.put("activemq.store.dir", System.getProperty("activemq.store.dir"));
+                }
+                props.put("java.util.logging.config.file", 
+                          System.getProperty("java.util.logging.config.file"));
+                
+                assertTrue("server did not launch correctly", 
+                           launchServer(EmbeddedJMSBrokerLauncher.class, props, null));
+
+                assertTrue("server did not launch correctly", 
+                           launchServer(Server.class, false));
+            }
+        };
+    }  
+    
+    public void testDocBasicConnection() throws Exception {
+        serviceName =  new QName("http://apache.org/hello_world_doc_lit", 
+                                 "SOAPService2");
+        portName = new QName("http://apache.org/hello_world_doc_lit", "SoapPort2");
+        URL wsdl = getClass().getResource("/wsdl/hello_world_doc_lit.wsdl");
+        assertNotNull(wsdl);
+
+        SOAPService2 service = new SOAPService2(wsdl, serviceName);
+        assertNotNull(service);
+
+        String response1 = new String("Hello Milestone-");
+        String response2 = new String("Bonjour");
+        try {
+            Greeter greeter = service.getPort(portName, Greeter.class);
+            for (int idx = 0; idx < 5; idx++) {
+                String greeting = greeter.greetMe("Milestone-" + idx);
+                assertNotNull("no response received from service", greeting);
+                String exResponse = response1 + idx;
+                assertEquals(exResponse, greeting);
+
+                String reply = greeter.sayHi();
+                assertNotNull("no response received from service", reply);
+                assertEquals(response2, reply);
+                
+                /*try {
+                    greeter.pingMe();
+                    fail("Should have thrown FaultException");
+                } catch (PingMeFault ex) {
+                    assertNotNull(ex.getFaultInfo());
+                }*/                
+              
+            }
+        } catch (UndeclaredThrowableException ex) {
+            throw (Exception)ex.getCause();
+        }
+    }
+
+    public void utestBasicConnection() throws Exception {
+        serviceName =  new QName("http://cxf.apache.org/hello_world_jms", 
+                                 "HelloWorldService");
+        portName = new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldPort");
+        URL wsdl = getClass().getResource("/wsdl/jms_test.wsdl");
+        assertNotNull(wsdl);
+
+        HelloWorldService service = new HelloWorldService(wsdl, serviceName);
+        assertNotNull(service);
+
+        String response1 = new String("Hello Milestone-");
+        String response2 = new String("Bonjour");
+        try {
+            HelloWorldPortType greeter = service.getPort(portName, HelloWorldPortType.class);
+            for (int idx = 0; idx < 5; idx++) {
+                String greeting = greeter.greetMe("Milestone-" + idx);
+                assertNotNull("no response received from service", greeting);
+                String exResponse = response1 + idx;
+                assertEquals(exResponse, greeting);
+
+                String reply = greeter.sayHi();
+                assertNotNull("no response received from service", reply);
+                assertEquals(response2, reply);
+                
+                try {
+                    greeter.testRpcLitFault("BadRecordLitFault");
+                    fail("Should have thrown BadRecoedLitFault");
+                } catch (BadRecordLitFault ex) {
+                    assertNotNull(ex.getFaultInfo());
+                }
+                
+                try {
+                    greeter.testRpcLitFault("NoSuchCodeLitFault");
+                    fail("Should have thrown NoSuchCodeLitFault exception");
+                } catch (NoSuchCodeLitFault nslf) {
+                    assertNotNull(nslf.getFaultInfo());
+                    assertNotNull(nslf.getFaultInfo().getCode());
+                } 
+            }
+        } catch (UndeclaredThrowableException ex) {
+            throw (Exception)ex.getCause();
+        }
+    }
+    
+    public void utestOneWayTopicConnection() throws Exception {
+        serviceName =  new QName("http://cxf.apache.org/hello_world_jms", 
+                                 "HelloWorldPubSubService");
+        portName = new QName("http://cxf.apache.org/hello_world_jms", 
+                             "HelloWorldPubSubPort");
+        URL wsdl = getClass().getResource("/wsdl/jms_test.wsdl");
+        assertNotNull(wsdl);
+
+        HelloWorldPubSubService service = new HelloWorldPubSubService(wsdl, serviceName);
+        assertNotNull(service);
+
+        try {
+            HelloWorldPubSubPort greeter = service.getPort(portName, HelloWorldPubSubPort.class);
+            for (int idx = 0; idx < 5; idx++) {
+                greeter.greetMeOneWay("JMS:PubSub:Milestone-" + idx);
+            }
+            //Give some time to complete one-way calls.
+            Thread.sleep(100L);
+        } catch (UndeclaredThrowableException ex) {
+            throw (Exception)ex.getCause();
+        }
+    }
+    
+    public void utestOneWayQueueConnection() throws Exception {
+        serviceName =  new QName("http://cxf.apache.org/hello_world_jms", 
+                                 "HelloWorldOneWayQueueService");
+        portName = new QName("http://cxf.apache.org/hello_world_jms", 
+                             "HelloWorldOneWayPort");
+        URL wsdl = getClass().getResource("/wsdl/jms_test.wsdl");
+        assertNotNull(wsdl);
+
+        HelloWorldOneWayQueueService service = new HelloWorldOneWayQueueService(wsdl, serviceName);
+        assertNotNull(service);
+
+        try {
+            HelloWorldOneWayPort greeter = service.getPort(portName, HelloWorldOneWayPort.class);
+            for (int idx = 0; idx < 5; idx++) {
+                greeter.greetMeOneWay("JMS:Queue:Milestone-" + idx);
+            }
+            //Give some time to complete one-way calls.
+            Thread.sleep(100L);
+        } catch (UndeclaredThrowableException ex) {
+            throw (Exception)ex.getCause();
+        }
+    }
+    
+    public void utestContextPropogation() throws Exception {
+        serviceName =  new QName("http://cxf.apache.org/hello_world_jms",
+                                 "HelloWorldService");
+        portName = new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldPort");
+        URL wsdl = getClass().getResource("/wsdl/jms_test.wsdl");
+        assertNotNull(wsdl);
+
+        HelloWorldService service = new HelloWorldService(wsdl, serviceName);
+        assertNotNull(service);
+
+        try {
+            HelloWorldPortType greeter = service.getPort(portName, HelloWorldPortType.class);
+            InvocationHandler handler  = Proxy.getInvocationHandler(greeter);
+            BindingProvider  bp = null;
+            
+            if (handler instanceof BindingProvider) {
+                bp = (BindingProvider)handler;
+                //System.out.println(bp.toString());
+                Map<String, Object> requestContext = bp.getRequestContext();
+                JMSMessageHeadersType requestHeader = new JMSMessageHeadersType();
+                requestHeader.setJMSCorrelationID("JMS_SAMPLE_CORRELATION_ID");
+                requestHeader.setJMSExpiration(3600000L);
+                JMSPropertyType propType = new JMSPropertyType();
+                propType.setName("Test.Prop");
+                propType.setValue("mustReturn");
+                requestHeader.getProperty().add(propType);
+                requestContext.put(JMSConstants.JMS_CLIENT_REQUEST_HEADERS, requestHeader);
+            } 
+ 
+            String greeting = greeter.greetMe("Milestone-");
+            assertNotNull("no response received from service", greeting);
+
+            assertEquals("Hello Milestone-", greeting);
+
+            if (bp != null) {
+                Map<String, Object> responseContext = bp.getResponseContext();
+                JMSMessageHeadersType responseHdr = 
+                     (JMSMessageHeadersType)responseContext.get(JMSConstants.JMS_CLIENT_RESPONSE_HEADERS);
+                if (responseHdr == null) {
+                    fail("response Header should not be null");
+                }
+                
+                assertTrue("CORRELATION ID should match :", 
+                           "JMS_SAMPLE_CORRELATION_ID".equals(responseHdr.getJMSCorrelationID()));
+                assertTrue("response Headers must conain the app specific property set by
request context.", 
+                           responseHdr.getProperty() != null);
+            }
+        } catch (UndeclaredThrowableException ex) {
+            throw (Exception)ex.getCause();
+        }
+    }
+    
+    
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(JMSClientServerTest.class);
+    }
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/Server.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/Server.java?view=auto&rev=441368
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/Server.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/Server.java Thu
Sep  7 21:16:13 2006
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.jms;
+
+import javax.xml.ws.Endpoint;
+
+import org.apache.cxf.systest.common.TestServerBase;
+
+public class Server extends TestServerBase {
+
+
+    protected void run()  {
+        //Object implementor = new GreeterImplTwoWayJMS();        
+        //Object impl2 =  new GreeterImplQueueOneWay();
+        //Object impl3  = new GreeterImplTopicOneWay();
+        Object impleDoc = new GreeterImplDoc();
+        Endpoint.publish(null, impleDoc);
+        //String address = "http://localhost:9000/SoapContext/SoapPort";
+        //Endpoint.publish(address, implementor);
+        //Endpoint.publish("http://testaddr.not.required/", impl2);
+        //Endpoint.publish("http://testaddr.not.required.topic/", impl3);
+    }
+
+
+    public static void main(String[] args) {
+        try {
+            Server s = new Server();
+            s.start();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            System.exit(-1);
+        } finally {
+            System.out.println("done!");
+        }
+    }
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jms/Server.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message