cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r984845 - /cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
Date Thu, 12 Aug 2010 16:06:49 GMT
Author: dkulp
Date: Thu Aug 12 16:06:48 2010
New Revision: 984845

URL: http://svn.apache.org/viewvc?rev=984845&view=rev
Log:
[CXF-2384] Add another test that tests a port open, but no service there

Modified:
    cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java

Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java?rev=984845&r1=984844&r2=984845&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
(original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
Thu Aug 12 16:06:48 2010
@@ -168,7 +168,45 @@ public class DispatchClientServerTest ex
         }
         
     }
+    @Test
+    public void test404() throws Exception {
+        //CXF-2384
+        URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
+        assertNotNull(wsdl);
 
+        //pick one of the other service/ports that would have an address
+        //without a service running
+        QName otherServiceName = new QName("http://apache.org/hello_world_soap_http",
+                "SOAPProviderService");
+        QName otherPortName = new QName("http://apache.org/hello_world_soap_http", "SoapProviderPort");
+        
+        
+        SOAPService service = new SOAPService(wsdl, otherServiceName);
+        assertNotNull(service);
+
+        Dispatch<SOAPMessage> disp = service
+            .createDispatch(otherPortName, SOAPMessage.class, Service.Mode.MESSAGE);
+        disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+                                     "http://localhost:" 
+                                     + greeterPort
+                                     + "/SomePlaceWithNoServiceRunning/SoapDispatchPort");
+        
+        InputStream is = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq.xml");
+        SOAPMessage soapReqMsg = MessageFactory.newInstance().createMessage(null, is);
+        assertNotNull(soapReqMsg);
+        
+        try {
+            disp.invoke(soapReqMsg);
+            fail("Should have faulted");
+        } catch (SOAPFaultException ex) {
+            fail("should not be a SOAPFaultException");
+        } catch (WebServiceException ex) {
+            //expected
+            assertTrue(ex.getCause().getClass().getName(),
+                       ex.getCause() instanceof java.io.IOException);
+        }
+        
+    }
     @Test
     public void testSOAPMessage() throws Exception {
 



Mime
View raw message