cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r797463 - in /cxf/branches/2.2.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
Date Fri, 24 Jul 2009 14:02:29 GMT
Author: dkulp
Date: Fri Jul 24 14:02:28 2009
New Revision: 797463

URL: http://svn.apache.org/viewvc?rev=797463&view=rev
Log:
Merged revisions 797233 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r797233 | dkulp | 2009-07-23 17:34:00 -0400 (Thu, 23 Jul 2009) | 2 lines
  
  Fix some issues that could cause the JMS tests to hang instead of error
  out by adding some timeouts.
........

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
    cxf/branches/2.2.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jul 24 14:02:28 2009
@@ -1 +1 @@
-/cxf/trunk:782728-782730,783097,783294,783396,784059,784181-784184,784893,784895,785279-785282,785468,785621,785624,785651,785734,785866,786142,786271-786272,786395,786512,786514,786582-786583,786638,786647,786850,787200,787269,787277-787279,787290-787291,787305,787323,787366,787849,788030,788060,788187,788444,788451,788703,788752,788774,788819-788820,789013,789371,789387,789420,789527-789530,789704-789705,789788,789811,789896-789901,790074,790094,790134,790188,790294,790553,790637-790644,790868,791301,791354,791538,791753,791947,792007,792096,792183,792261-792265,792271,792604,792683-792685,792975,792985,793059,793570,794297,794396,794680,794728,794771,794778-794780,794892,795044,795104,795160,795583,795907,796022-796023,796352,796593,796741,796780,796994-796997,797117,797159,797192,797194,797231-797232
+/cxf/trunk:782728-782730,783097,783294,783396,784059,784181-784184,784893,784895,785279-785282,785468,785621,785624,785651,785734,785866,786142,786271-786272,786395,786512,786514,786582-786583,786638,786647,786850,787200,787269,787277-787279,787290-787291,787305,787323,787366,787849,788030,788060,788187,788444,788451,788703,788752,788774,788819-788820,789013,789371,789387,789420,789527-789530,789704-789705,789788,789811,789896-789901,790074,790094,790134,790188,790294,790553,790637-790644,790868,791301,791354,791538,791753,791947,792007,792096,792183,792261-792265,792271,792604,792683-792685,792975,792985,793059,793570,794297,794396,794680,794728,794771,794778-794780,794892,795044,795104,795160,795583,795907,796022-796023,796352,796593,796741,796780,796994-796997,797117,797159,797192,797194,797231-797233

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?rev=797463&r1=797462&r2=797463&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
Fri Jul 24 14:02:28 2009
@@ -543,6 +543,8 @@
             return exchange.getInFaultMessage().getContent(Exception.class);
         } else if (exchange.getOutFaultMessage() != null) {
             return exchange.getOutFaultMessage().getContent(Exception.class);
+        } else if (exchange.getInMessage() != null) {
+            return exchange.getInMessage().getContent(Exception.class);
         }
         return null;
     }

Modified: cxf/branches/2.2.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java?rev=797463&r1=797462&r2=797463&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
(original)
+++ cxf/branches/2.2.x-fixes/systests/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
Fri Jul 24 14:02:28 2009
@@ -18,8 +18,7 @@
  */
 package org.apache.cxf.systest.jms;
 
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Proxy;
+import java.lang.Thread.State;
 import java.lang.reflect.UndeclaredThrowableException;
 import java.net.URL;
 import java.util.ArrayList;
@@ -35,6 +34,7 @@
 import javax.xml.ws.Endpoint;
 import javax.xml.ws.Holder;
 import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.soap.SOAPFaultException;
 
 
 import org.apache.cxf.endpoint.Client;
@@ -418,8 +418,7 @@
                 new GreeterImplQueueDecoupledOneWaysDeferredReply();
             replyEndpoint = Endpoint.publish("", replyServant);
             
-            InvocationHandler handler  = Proxy.getInvocationHandler(greeter);
-            BindingProvider  bp = (BindingProvider)handler;
+            BindingProvider  bp = (BindingProvider)greeter;
             Map<String, Object> requestContext = bp.getRequestContext();
             JMSMessageHeadersType requestHeader = new JMSMessageHeadersType();
             requestHeader.setJMSReplyTo("dynamicQueues/test.jmstransport.oneway.with.set.replyto.reply");
@@ -485,8 +484,7 @@
             
             Client client = ClientProxy.getClient(greeter);
             ((JMSConduit)client.getConduit()).getJmsConfig().setEnforceSpec(true);
-            InvocationHandler handler  = Proxy.getInvocationHandler(greeter);
-            BindingProvider  bp = (BindingProvider)handler;
+            BindingProvider  bp = (BindingProvider)greeter;
             Map<String, Object> requestContext = bp.getRequestContext();
             JMSMessageHeadersType requestHeader = new JMSMessageHeadersType();
             requestHeader.setJMSReplyTo("dynamicQueues/test.jmstransport.oneway.with.set.replyto.reply");
@@ -551,8 +549,7 @@
         
         public void run() {
             try {
-                InvocationHandler handler  = Proxy.getInvocationHandler(port);
-                BindingProvider  bp = (BindingProvider)handler;
+                BindingProvider  bp = (BindingProvider)port;
                 Map<String, Object> requestContext = bp.getRequestContext();
                 JMSMessageHeadersType requestHeader = new JMSMessageHeadersType();
                 requestContext.put(JMSConstants.JMS_CLIENT_REQUEST_HEADERS, requestHeader);
@@ -582,7 +579,6 @@
             }
         }
     }
-    
     @Test
     public void testTwoWayQueueAppCorrelationIDStaticPrefix() throws Exception {
         QName serviceName = getServiceName(new QName("http://cxf.apache.org/hello_world_jms",

@@ -624,7 +620,8 @@
         }
     
         for (Thread t : threads) {
-            t.join();
+            t.join(5000);
+            assertTrue("No terminated state: " + t.getState(), t.getState() == State.TERMINATED);
         }
 
         Throwable e = (engClient.getException() != null) 
@@ -681,16 +678,18 @@
             clients.add(client);
             thread.start();
         }
-    
-        for (Thread t : threads) {
-            t.join();
-        }
 
-        for (ClientRunnable client : clients) {
-            if (client.getException() != null 
-                && client.getException().getMessage().contains("Timeout")) {
-                // exceptions expected
-                return;
+        //Sleep for up to 10 seconds.   The timeout should be at 5 seconds so this
+        //should bail earlier
+        for (int x = 0; x < 10; x++) {
+            Thread.sleep(1000);
+
+            for (ClientRunnable client : clients) {
+                if (client.getException() != null 
+                    && client.getException().getMessage().contains("Timeout")) {
+                    // exceptions expected
+                    return;
+                }
             }
         }
        
@@ -763,7 +762,8 @@
         }
     
         for (Thread t : threads) {
-            t.join();
+            t.join(2000);
+            assertTrue("Not terminated state: " + t.getState(), t.getState() == State.TERMINATED);
         }
 
         for (ClientRunnable client : clients) {
@@ -805,7 +805,8 @@
         }
     
         for (Thread t : threads) {
-            t.join();
+            t.join(5000);
+            assertTrue("Not terminated state: " + t.getState(), t.getState() == State.TERMINATED);
         }
 
         for (ClientRunnable client : clients) {
@@ -815,7 +816,6 @@
         }
     }
 
-    
     @Test
     public void testContextPropogation() throws Exception {
         final String testReturnPropertyName = "Test_Prop";
@@ -831,52 +831,44 @@
 
         try {
             HelloWorldPortType greeter = service.getPort(portName, HelloWorldPortType.class);
-            InvocationHandler handler  = Proxy.getInvocationHandler(greeter);
-            BindingProvider  bp = null;
-            
-            if (handler instanceof BindingProvider) {
-                bp = (BindingProvider)handler;                
-                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(testReturnPropertyName);
-                propType.setValue("mustReturn");
-                requestHeader.getProperty().add(propType);
-                propType = new JMSPropertyType();
-                propType.setName(testIgnoredPropertyName);
-                propType.setValue("mustNotReturn");
-                requestContext.put(JMSConstants.JMS_CLIENT_REQUEST_HEADERS, requestHeader);
-            } 
+            Map<String, Object> requestContext = ((BindingProvider)greeter).getRequestContext();
+            JMSMessageHeadersType requestHeader = new JMSMessageHeadersType();
+            requestHeader.setJMSCorrelationID("JMS_SAMPLE_CORRELATION_ID");
+            requestHeader.setJMSExpiration(3600000L);
+            JMSPropertyType propType = new JMSPropertyType();
+            propType.setName(testReturnPropertyName);
+            propType.setValue("mustReturn");
+            requestHeader.getProperty().add(propType);
+            propType = new JMSPropertyType();
+            propType.setName(testIgnoredPropertyName);
+            propType.setValue("mustNotReturn");
+            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 property set in request
context.", 
-                           responseHdr.getProperty() != null);
-                
-                boolean found = false;
-                for (JMSPropertyType p : responseHdr.getProperty()) {
-                    if (testReturnPropertyName.equals(p.getName())) {
-                        found = true;
-                    }
+            Map<String, Object> responseContext = ((BindingProvider)greeter).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 property set in request context.",

+                       responseHdr.getProperty() != null);
+            
+            boolean found = false;
+            for (JMSPropertyType p : responseHdr.getProperty()) {
+                if (testReturnPropertyName.equals(p.getName())) {
+                    found = true;
                 }
-                assertTrue("response Headers must match the app property set in request context.",
-                             found);
             }
+            assertTrue("response Headers must match the app property set in request context.",
+                         found);
         } catch (UndeclaredThrowableException ex) {
             throw (Exception)ex.getCause();
         }



Mime
View raw message