cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1060572 - in /cxf/trunk/rt/frontend/jaxws/src: main/java/org/apache/cxf/jaxws/ServiceImpl.java test/java/org/apache/cxf/jaxws/ServiceImplTest.java
Date Tue, 18 Jan 2011 20:52:08 GMT
Author: dkulp
Date: Tue Jan 18 20:52:07 2011
New Revision: 1060572

URL: http://svn.apache.org/viewvc?rev=1060572&view=rev
Log:
[CXF-3257] Simplify the portInfo collections to a single map
Make sure getPorts returns all the ports.

Modified:
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ServiceImplTest.java

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?rev=1060572&r1=1060571&r2=1060572&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java Tue Jan
18 20:52:07 2011
@@ -24,9 +24,7 @@ import java.net.URI;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -115,7 +113,6 @@ public class ServiceImpl extends Service
     private QName serviceName;
     private Class<?> clazz;
 
-    private final Collection<QName> ports = new HashSet<QName>();
     private Map<QName, PortInfoImpl> portInfos = new HashMap<QName, PortInfoImpl>();
     private WebServiceFeature serviceFeatures[];
 
@@ -198,7 +195,6 @@ public class ServiceImpl extends Service
                         address = ((SOAPAddress)e).getLocationURI();                    
   
                     }
                 }
-                this.ports.add(name);
                 addPort(name, bindingID, address);
             }
         } catch (WebServiceException e) {
@@ -208,7 +204,6 @@ public class ServiceImpl extends Service
             Service service = sf.create();
             for (ServiceInfo si : service.getServiceInfos()) { 
                 for (EndpointInfo ei : si.getEndpoints()) {
-                    this.ports.add(ei.getName());
                     String bindingID = BindingID.getJaxwsBindingID(ei.getTransportId());
                     addPort(ei.getName(), bindingID, ei.getAddress());
                 }
@@ -328,7 +323,7 @@ public class ServiceImpl extends Service
             throw new WebServiceException(BUNDLE.getString("PORT_NAME_NULL_EXC"));
         }
         
-        if (!ports.contains(portName) && !portInfos.containsKey(portName)) {
+        if (!portInfos.containsKey(portName)) {
             throw new WebServiceException(new Message("INVALID_PORT", BUNDLE, portName).toString());
         }
         
@@ -371,7 +366,7 @@ public class ServiceImpl extends Service
     } 
     
     public Iterator<QName> getPorts() {
-        return ports.iterator();
+        return portInfos.keySet().iterator();
     }
 
     public QName getServiceName() {
@@ -494,8 +489,9 @@ public class ServiceImpl extends Service
         hc.addAll(handlerResolver.getHandlerChain(portInfos.get(portName)));
         jaxwsEndpoint.getJaxwsBinding().setHandlerChain(hc);
         LOG.log(Level.FINE, "created proxy", obj);
-
-        ports.add(portName);
+        if (portInfo == null) {
+            addPort(portName, clientFac.getBindingId(), clientFac.getAddress());
+        }
         return serviceEndpointInterface.cast(obj);
     }
     

Modified: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ServiceImplTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ServiceImplTest.java?rev=1060572&r1=1060571&r2=1060572&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ServiceImplTest.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ServiceImplTest.java Tue
Jan 18 20:52:07 2011
@@ -70,6 +70,19 @@ public class ServiceImplTest extends Abs
     
     private boolean isClientProxyFactoryBeanConfigured;
     
+    
+    @Test
+    public void testAddPort() throws Exception {
+        QName sName = new QName("service");
+        QName pName = new QName("port");
+        
+        javax.xml.ws.Service service = Service.create(sName);
+        service.addPort(pName, SOAPBinding.SOAP11HTTP_BINDING, "http://mysite.org/test");
+        
+        Iterator<QName> ports = service.getPorts(); 
+        assertTrue(ports.hasNext());
+    }
+    
     @Test
     public void testServiceImpl() throws Exception {
         SOAPService service = new SOAPService();



Mime
View raw message