servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r669428 - in /servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test: java/org/apache/servicemix/cxfbc/ java/org/apache/servicemix/cxfbc/provider/ resources/org/apache/servicemix/cxfbc/provider/
Date Thu, 19 Jun 2008 08:50:14 GMT
Author: ffang
Date: Thu Jun 19 01:50:14 2008
New Revision: 669428

URL: http://svn.apache.org/viewvc?rev=669428&view=rev
Log:
[SM-1413]test to verify both send and sendSync can work with cxf bc provider using jms transport
identically

Modified:
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/GreeterImplTwoWayJMS.java
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/provider/CxfBCSEProviderSystemTest.java
    servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/provider/xbean_provider_without_jbi_wrapper.xml

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/GreeterImplTwoWayJMS.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/GreeterImplTwoWayJMS.java?rev=669428&r1=669427&r2=669428&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/GreeterImplTwoWayJMS.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/GreeterImplTwoWayJMS.java
Thu Jun 19 01:50:14 2008
@@ -29,6 +29,14 @@
     extends org.apache.hello_world_soap_http.GreeterImpl {
     public String greetMe(String me) {
         System.out.println("\n\n*** GreetMe called with: " + me + "***\n\n");
+        if ("ffang".equals(me)) {
+            try {
+                Thread.sleep(3000);
+            } catch (InterruptedException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+        }
         return "Hello " + me;
     }
         

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/provider/CxfBCSEProviderSystemTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/provider/CxfBCSEProviderSystemTest.java?rev=669428&r1=669427&r2=669428&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/provider/CxfBCSEProviderSystemTest.java
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/provider/CxfBCSEProviderSystemTest.java
Thu Jun 19 01:50:14 2008
@@ -30,6 +30,8 @@
 
 import org.apache.servicemix.JbiConstants;
 import org.apache.servicemix.client.DefaultServiceMixClient;
+import org.apache.servicemix.cxfbc.EmbededJMSBrokerLauncher;
+import org.apache.servicemix.cxfbc.MyJMSServer;
 import org.apache.servicemix.jbi.container.SpringJBIContainer;
 import org.apache.servicemix.jbi.jaxp.SourceTransformer;
 import org.apache.servicemix.jbi.jaxp.StringSource;
@@ -45,6 +47,8 @@
     private InOut io;    
 
     private ServerLauncher sl;
+    private ServerLauncher embeddedLauncher;
+    private ServerLauncher jmsLauncher;
     
     
     public void startServers() throws Exception {
@@ -53,9 +57,23 @@
         }
         Map<String, String> props = new HashMap<String, String>();          
     
         
-        assertTrue("server did not launch correctly", 
-                   launchServer(MyServer.class, props, false));
+        
 
+        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(EmbededJMSBrokerLauncher.class, props, false));
+        embeddedLauncher =  sl;
+        assertTrue("server did not launch correctly", 
+                launchServer(MyJMSServer.class, null, false));
+        jmsLauncher = sl;
+        
+        assertTrue("server did not launch correctly", 
+                launchServer(MyServer.class, props, false));
         
         serversStarted = true;
     }
@@ -109,6 +127,19 @@
         }
         
         try {
+            embeddedLauncher.stopServer();         
+        } catch (IOException ex) {
+            ex.printStackTrace();
+            fail("failed to stop server " + embeddedLauncher.getClass());
+        }
+        try {
+            jmsLauncher.stopServer();         
+        } catch (IOException ex) {
+            ex.printStackTrace();
+            fail("failed to stop server " + jmsLauncher.getClass());
+        } 
+        
+        try {
             sl.stopServer();         
         } catch (IOException ex) {
             ex.printStackTrace();
@@ -126,6 +157,26 @@
         setUpJBI("org/apache/servicemix/cxfbc/provider/xbean_provider_without_jbi_wrapper.xml");
         greetMeProviderTestBase(true);
     }
+    
+    public void testGreetMeProviderWithJmSTransportSync() throws Exception {
+        setUpJBI("org/apache/servicemix/cxfbc/provider/xbean_provider_without_jbi_wrapper.xml");
+        greetMeProviderJmsTestBase(true, "Edell");
+    }
+    
+    public void testGreetMeProviderWithJmSTransportAsync() throws Exception {
+        setUpJBI("org/apache/servicemix/cxfbc/provider/xbean_provider_without_jbi_wrapper.xml");
+        greetMeProviderJmsTestBase(false, "Edell");
+    }
+    
+    public void testGreetMeProviderWithJmSTransportSyncTimeOut() throws Exception {
+        setUpJBI("org/apache/servicemix/cxfbc/provider/xbean_provider_without_jbi_wrapper.xml");
+        greetMeProviderJmsTestBase(true, "ffang");
+    }
+    
+    public void testGreetMeProviderWithJmSTransportAsyncTimeOut() throws Exception {
+        setUpJBI("org/apache/servicemix/cxfbc/provider/xbean_provider_without_jbi_wrapper.xml");
+        greetMeProviderJmsTestBase(false, "ffang");
+    }
         
     private void greetMeProviderTestBase(boolean useDynamicUri) throws Exception {
 
@@ -143,11 +194,43 @@
             io.getInMessage().setProperty(JbiConstants.HTTP_DESTINATION_URI, "http://localhost:9002/dynamicuritest");
         }
         client.sendSync(io);
+        
         assertTrue(new SourceTransformer().contentToString(
                 io.getOutMessage()).indexOf("Hello Edell") >= 0);        
         
     }
     
+    private void greetMeProviderJmsTestBase(boolean sync, String name) throws Exception {
+
+        client = new DefaultServiceMixClient(jbi);
+        
+        io = client.createInOutExchange();
+        io.setService(new QName("http://apache.org/hello_world_soap_http", "HelloWorldService"));
+        io.setInterfaceName(new QName("http://apache.org/hello_world_soap_http", "Greeter"));
+        io.setOperation(new QName("http://apache.org/hello_world_soap_http", "greetMe"));
+        //send message to proxy
+        io.getInMessage().setContent(new StringSource(
+              "<greetMe xmlns='http://apache.org/hello_world_soap_http/types'><requestType>"
+              + name
+              + "</requestType></greetMe>"));
+        
+        if (sync) {
+            client.sendSync(io);
+        } else {
+            client.send(io);
+            Thread.sleep(5000);
+        }
+        if ("ffang".equals(name)) {
+            //in this case, the server is intended to sleep 3 sec, 
+            //which will cause time out both for sync and async invoke
+            assertTrue(new SourceTransformer().contentToString(
+                    io.getFault()).indexOf("JMSClientTransport.receive() timed out. No message
available.") >= 0);
+        } else {
+            //in this case, both sync and async invocation shouldn't see the timeout problem
+            assertTrue(new SourceTransformer().contentToString(
+                io.getOutMessage()).indexOf("Hello " + name) >= 0);
+        }
+    }
 
     @Override
     protected AbstractXmlApplicationContext createBeanFactory() {

Modified: servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/provider/xbean_provider_without_jbi_wrapper.xml
URL: http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/provider/xbean_provider_without_jbi_wrapper.xml?rev=669428&r1=669427&r2=669428&view=diff
==============================================================================
--- servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/provider/xbean_provider_without_jbi_wrapper.xml
(original)
+++ servicemix/smx3/branches/servicemix-3.2/deployables/bindingcomponents/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/provider/xbean_provider_without_jbi_wrapper.xml
Thu Jun 19 01:50:14 2008
@@ -20,7 +20,8 @@
 <beans xmlns:sm="http://servicemix.apache.org/config/1.0"
        xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
        xmlns:test="urn:test"
-       xmlns:greeter="http://apache.org/hello_world_soap_http_provider">
+       xmlns:greeter="http://apache.org/hello_world_soap_http_provider"
+       xmlns:jmsgreeter="http://apache.org/hello_world_soap_http">
 
        
   <sm:container id="jbi" embedded="true">
@@ -47,6 +48,26 @@
           <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
         </cxfbc:outFaultInterceptors>
       </cxfbc:provider>
+       
+      <cxfbc:provider wsdl="org/apache/servicemix/cxfbc/ws/security/hello_world.wsdl"
+                      service="jmsgreeter:HelloWorldService"
+                      endpoint="HelloWorldPortProxy"
+                      interfaceName="jmsgreeter:Greetr"
+                      useJBIWrapper="false"
+                     >
+          <cxfbc:inInterceptors>
+            <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+          </cxfbc:inInterceptors>
+          <cxfbc:outInterceptors>
+            <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+          </cxfbc:outInterceptors>
+          <cxfbc:inFaultInterceptors>
+            <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+          </cxfbc:inFaultInterceptors>
+          <cxfbc:outFaultInterceptors>
+            <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+          </cxfbc:outFaultInterceptors>
+      </cxfbc:provider>
     </sm:endpoints>
     
   </sm:container>



Mime
View raw message