Author: dkulp
Date: Mon Feb 25 10:08:28 2008
New Revision: 630951
URL: http://svn.apache.org/viewvc?rev=630951&view=rev
Log:
Test case for CXF-885
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMixedStyleTest.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ServerMixedStyle.java
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMixedStyleTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMixedStyleTest.java?rev=630951&r1=630950&r2=630951&view=diff
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMixedStyleTest.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMixedStyleTest.java
Mon Feb 25 10:08:28 2008
@@ -20,10 +20,14 @@
package org.apache.cxf.systest.jaxws;
import java.lang.reflect.UndeclaredThrowableException;
+import java.net.URL;
import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+import org.apache.cxf.systest.jaxws.ServerMixedStyle.MixedTest;
import org.apache.cxf.testutil.common.AbstractClientServerTestBase;
import org.apache.hello_world_mixedstyle.Greeter;
import org.apache.hello_world_mixedstyle.SOAPService;
@@ -60,9 +64,51 @@
String reply = greeter.sayHi();
assertNotNull("no response received from service", reply);
assertEquals("Bonjour", reply);
+
+ try {
+ greeter.pingMe();
+ fail("expected exception not caught");
+ } catch (org.apache.hello_world_mixedstyle.PingMeFault f) {
+ //ignore, expected
+ }
} catch (UndeclaredThrowableException ex) {
throw (Exception)ex.getCause();
}
+ }
+ @Test
+ public void testCXF885() throws Exception {
+ Service serv = Service.create(new QName("http://example.com",
"MixedTest"));
+ MixedTest test = serv.getPort(MixedTest.class);
+
((BindingProvider)test).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+
"http://localhost:9027/cxf885");
+ String ret = test.hello("A", "B");
+ assertEquals("Hello A and B", ret);
+
+ String ret2 = test.simple("Dan");
+ assertEquals("Hello Dan", ret2);
+
+ String ret3 = test.tripple("A", "B", "C");
+ assertEquals("Tripple: A B C", ret3);
+
+ String ret4 = test.simple2(24);
+ assertEquals("Int: 24", ret4);
+
+ serv = Service.create(new URL("http://localhost:9027/cxf885?wsdl"),
+ new QName("http://example.com",
"MixedTestImplService"));
+ test = serv.getPort(new QName("http://example.com",
"MixedTestImplPort"),
+ MixedTest.class);
+
+ ret = test.hello("A", "B");
+ assertEquals("Hello A and B", ret);
+
+ ret2 = test.simple("Dan");
+ assertEquals("Hello Dan", ret2);
+
+ ret3 = test.tripple("A", "B", "C");
+ assertEquals("Tripple: A B C", ret3);
+
+ ret4 = test.simple2(24);
+ assertEquals("Int: 24", ret4);
}
}
Modified:
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ServerMixedStyle.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ServerMixedStyle.java?rev=630951&r1=630950&r2=630951&view=diff
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ServerMixedStyle.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ServerMixedStyle.java
Mon Feb 25 10:08:28 2008
@@ -19,6 +19,11 @@
package org.apache.cxf.systest.jaxws;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
import javax.xml.ws.Endpoint;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
@@ -31,6 +36,8 @@
Object implementor = new GreeterImplMixedStyle();
String address = "http://localhost:9027/SoapContext/SoapPort";
Endpoint.publish(address, implementor);
+
+ Endpoint.publish("http://localhost:9027/cxf885", new MixedTestImpl());
}
public static void main(String[] args) {
@@ -42,6 +49,51 @@
System.exit(-1);
} finally {
System.out.println("done!");
+ }
+ }
+
+ @WebService(targetNamespace = "http://example.com")
+ public static interface MixedTest {
+ @WebMethod(operationName = "Simple")
+ @WebResult(name = "SimpleResponse", targetNamespace =
"http://example.com")
+ @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+ String simple(@WebParam(name = "Simple") String req);
+
+ @WebMethod(operationName = "Hello")
+ @WebResult(name = "Result")
+ @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
+ String hello(@WebParam(name = "A") String a,
+ @WebParam(name = "B") String b);
+
+ @WebMethod(operationName = "Simple2")
+ @WebResult(name = "Simple2Response", targetNamespace =
"http://example.com")
+ @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+ String simple2(@WebParam(name = "Simple2") int a);
+
+ @WebMethod(operationName = "Tripple")
+ @WebResult(name = "Result")
+ @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
+ String tripple(@WebParam(name = "A") String a,
+ @WebParam(name = "B") String b,
+ @WebParam(name = "C") String c);
+ }
+ @WebService(targetNamespace = "http://example.com")
+ public class MixedTestImpl implements MixedTest {
+
+ public String hello(String a, String b) {
+ return "Hello " + a + " and " + b;
+ }
+
+ public String simple(String req) {
+ return "Hello " + req;
+ }
+
+ public String simple2(int a) {
+ return "Int: " + a;
+ }
+
+ public String tripple(String a, String b, String c) {
+ return "Tripple: " + a + " " + b + " " + c;
}
}
}