Author: dandiep
Date: Thu Apr 26 15:41:24 2007
New Revision: 532895

URL: http://svn.apache.org/viewvc?view=rev&rev=532895
Log:
Fix ServiceImpl so it throws a WebServiceException if the port doesn't exist,
and fix the corresponding unit tests which depend on this broken functionality.


Modified:
    
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
    
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java
    
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ServiceImplTest.java
    
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/ManualHttpMulitplexClientServerTest.java

Modified: 
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: 
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?view=diff&rev=532895&r1=532894&r2=532895
==============================================================================
--- 
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
 (original)
+++ 
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
 Thu Apr 26 15:41:24 2007
@@ -228,6 +228,11 @@
         if (portName == null) {
             throw new 
WebServiceException(BUNDLE.getString("PORT_NAME_NULL_EXC"));
         }
+        
+        if (!ports.contains(portName) && !portInfos.containsKey(portName)) {
+            throw new WebServiceException(new Message("INVALID_PORT", BUNDLE, 
portName).toString());
+        }
+        
         try {
             return createPort(portName, null, type);
         } catch (ServiceConstructionException e) {

Modified: 
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java
URL: 
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java?view=diff&rev=532895&r1=532894&r2=532895
==============================================================================
--- 
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java
 (original)
+++ 
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java
 Thu Apr 26 15:41:24 2007
@@ -158,12 +158,13 @@
         EndpointImpl ep = new EndpointImpl(getBus(), serviceImpl, (String) 
null);
         ep.publish("local://localhost:9090/hello");
         
-        QName serviceName = new QName("http://service.jaxws.cxf.apache.org";, 
"Hello");
-        QName portName = new QName("http://service.jaxws.cxf.apache.org";, 
"HelloPortType");
+        QName serviceName = new QName("http://service.jaxws.cxf.apache.org/";, 
"HelloService");
+        QName portName = new QName("http://service.jaxws.cxf.apache.org/";, 
"HelloPort");
         
         // need to set the same bus with service , so use the ServiceImpl
         ServiceImpl service = new ServiceImpl(getBus(), (URL)null, 
serviceName, null);
         service.addPort(portName, "http://schemas.xmlsoap.org/soap/";, 
"local://localhost:9090/hello"); 
+        
         HelloInterface proxy = service.getPort(portName, HelloInterface.class);
         assertEquals("Get the wrong result", "hello", proxy.sayHi("hello"));
         //now the client side can't unmarshal the complex type without binding 
types annoutation 

Modified: 
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ServiceImplTest.java
URL: 
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ServiceImplTest.java?view=diff&rev=532895&r1=532894&r2=532895
==============================================================================
--- 
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ServiceImplTest.java
 (original)
+++ 
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ServiceImplTest.java
 Thu Apr 26 15:41:24 2007
@@ -41,7 +41,6 @@
 import org.apache.cxf.frontend.ClientProxy;
 import org.apache.hello_world_soap_http.Greeter;
 import org.apache.hello_world_soap_http.SOAPService;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class ServiceImplTest extends AbstractJaxWsTest {
@@ -61,7 +60,7 @@
         Client client = ClientProxy.getClient(proxy);
         assertEquals("bar", client.getEndpoint().get("foo"));
     }
-
+    
     @Override
     protected Bus createBus() throws BusException {
         SpringBusFactory bf = new SpringBusFactory();
@@ -98,7 +97,6 @@
     }
 
     @Test
-    @Ignore
     public void testGetBadPort() {
         URL wsdl1 = getClass().getResource("/wsdl/calculator.wsdl");
         assertNotNull(wsdl1);

Modified: 
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/ManualHttpMulitplexClientServerTest.java
URL: 
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/ManualHttpMulitplexClientServerTest.java?view=diff&rev=532895&r1=532894&r2=532895
==============================================================================
--- 
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/ManualHttpMulitplexClientServerTest.java
 (original)
+++ 
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/ManualHttpMulitplexClientServerTest.java
 Thu Apr 26 15:41:24 2007
@@ -28,6 +28,7 @@
 import javax.xml.ws.Endpoint;
 import javax.xml.ws.Service;
 
+import org.apache.cxf.binding.soap.SoapBindingFactory;
 import org.apache.cxf.factory_pattern.IsEvenResponse;
 import org.apache.cxf.factory_pattern.Number;
 import org.apache.cxf.factory_pattern.NumberFactory;
@@ -39,7 +40,6 @@
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.wsdl.EndpointReferenceUtils;
-
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -85,13 +85,13 @@
         // use the epr info only
         // no wsdl so default generated soap/http binding will be used
         // address url must come from the calling context
-        //
         QName serviceName = EndpointReferenceUtils.getServiceName(epr);
         Service numService = Service.create(serviceName);
         
         String portString = EndpointReferenceUtils.getPortName(epr);
         QName portName = new QName(serviceName.getNamespaceURI(), portString); 
               
-        Number num =  (Number)numService.getPort(portName, Number.class);
+        numService.addPort(portName, SoapBindingFactory.SOAP_11_BINDING, 
"http://foo";);
+        Number num = (Number)numService.getPort(portName, Number.class);
 
         setupContextWithEprAddress(epr, num);
         


Reply via email to