cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreasm...@apache.org
Subject svn commit: r534387 - in /incubator/cxf/trunk/rt/ws/rm/src: main/java/org/apache/cxf/ws/rm/Proxy.java test/java/org/apache/cxf/ws/rm/ProxyTest.java
Date Wed, 02 May 2007 11:17:55 GMT
Author: andreasmyth
Date: Wed May  2 04:17:54 2007
New Revision: 534387

URL: http://svn.apache.org/viewvc?view=rev&rev=534387
Log:
Workaround PMD bug.

Modified:
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java?view=diff&rev=534387&r1=534386&r2=534387
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java Wed May  2
04:17:54 2007
@@ -31,6 +31,7 @@
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.ClientImpl;
+import org.apache.cxf.endpoint.ConduitSelector;
 import org.apache.cxf.endpoint.DeferredConduitSelector;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.message.Message;
@@ -200,32 +201,32 @@
     }
     
     protected Client createClient(Bus bus, Endpoint endpoint, Conduit conduit,
-                                  org.apache.cxf.ws.addressing.EndpointReferenceType address)
{
-        return new RMClient(bus, endpoint, conduit, address);
+                                  final org.apache.cxf.ws.addressing.EndpointReferenceType
address) {
+        ConduitSelector cs = new DeferredConduitSelector(conduit) {
+            @Override
+            public Conduit selectConduit(Message message) {
+                Conduit conduit = null;
+                EndpointInfo endpointInfo = getEndpoint().getEndpointInfo();
+                org.apache.cxf.ws.addressing.EndpointReferenceType original = 
+                    endpointInfo.getTarget();
+                try {
+                    if (null != address) {
+                        endpointInfo.setAddress(address);
+                    }
+                    conduit = super.selectConduit(message);
+                } finally {
+                    endpointInfo.setAddress(original);
+                }
+                return conduit;
+            }
+        };  
+        return new RMClient(bus, endpoint, cs);
     }
     
     class RMClient extends ClientImpl {
 
-        RMClient(Bus bus, Endpoint endpoint, Conduit conduit,
-                 final org.apache.cxf.ws.addressing.EndpointReferenceType a) {
-            super(bus, endpoint, new DeferredConduitSelector(conduit) {
-                @Override
-                public Conduit selectConduit(Message message) {
-                    Conduit conduit = null;
-                    EndpointInfo endpointInfo = getEndpoint().getEndpointInfo();
-                    org.apache.cxf.ws.addressing.EndpointReferenceType original = 
-                        endpointInfo.getTarget();
-                    try {
-                        if (null != a) {
-                            endpointInfo.setAddress(a);
-                        }
-                        conduit = super.selectConduit(message);
-                    } finally {
-                        endpointInfo.setAddress(original);
-                    }
-                    return conduit;
-                }
-            });  
+        RMClient(Bus bus, Endpoint endpoint, ConduitSelector cs) {
+            super(bus, endpoint, cs);  
         }
 
         @Override

Modified: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java?view=diff&rev=534387&r1=534386&r2=534387
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java Wed May
 2 04:17:54 2007
@@ -28,8 +28,10 @@
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.endpoint.ConduitSelector;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.jaxb.DatatypeFactory;
+import org.apache.cxf.message.Message;
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.EndpointInfo;
@@ -242,14 +244,10 @@
         Bus bus = control.createMock(Bus.class);
         Endpoint endpoint = control.createMock(Endpoint.class);
         Conduit conduit = control.createMock(Conduit.class);
-        org.apache.cxf.ws.addressing.EndpointReferenceType address = 
-            control.createMock(org.apache.cxf.ws.addressing.EndpointReferenceType.class);
-        Proxy.RMClient client = proxy.new RMClient(bus, endpoint, conduit, address);
-        EndpointInfo endpointInfo = control.createMock(EndpointInfo.class);
-        EasyMock.expect(endpoint.getEndpointInfo()).andReturn(endpointInfo).anyTimes();
-        endpointInfo.setAddress(address);
-        EasyMock.expectLastCall();
+        ConduitSelector cs = control.createMock(ConduitSelector.class);
+        EasyMock.expect(cs.selectConduit(EasyMock.isA(Message.class))).andReturn(conduit);
         control.replay();
+        Proxy.RMClient client = proxy.new RMClient(bus, endpoint, cs);
         assertSame(conduit, client.getConduit());    
     }
     



Mime
View raw message