Author: jim.ma
Date: 2014-05-26 20:48:30 -0400 (Mon, 26 May 2014)
New Revision: 18697
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/AsyncClientTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/Endpoint.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/EndpointImpl.java
Log:
[JBWS-3630]:Add more test cases
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/AsyncClientTestCase.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/AsyncClientTestCase.java 2014-05-26
15:53:21 UTC (rev 18696)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/AsyncClientTestCase.java 2014-05-27
00:48:30 UTC (rev 18697)
@@ -28,11 +28,11 @@
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
+import junit.framework.Test;
+
import org.jboss.wsf.test.JBossWSCXFTestSetup;
import org.jboss.wsf.test.JBossWSTest;
-import junit.framework.Test;
-
/**
* @author <a href="mailto:ema@redhat.com">Jim Ma</a>
*
@@ -40,7 +40,7 @@
public class AsyncClientTestCase extends JBossWSTest
{
private String endpointAddress = "http://" + getServerHost() +
":8080/jaxws-cxf-asyncclient";
-
+
public static Test suite()
{
return new JBossWSCXFTestSetup(AsyncClientTestCase.class,
"jaxws-cxf-asyncclient.war");
@@ -48,14 +48,40 @@
public void testAsycClienWithHCAddress() throws Exception
{
- QName serviceName = new QName("http://org.jboss.ws/cxf/asyncclient",
"EndpointImplService");
- URL wsdlURL = new URL(endpointAddress + "?wsdl");
- Service service = Service.create(wsdlURL, serviceName);
- Endpoint proxy = service.getPort(Endpoint.class);
+
+ Endpoint proxy = initPort();
BindingProvider provider = (BindingProvider)proxy;
Map<String, Object> requestContext = provider.getRequestContext();
requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "hc://" +
endpointAddress);
assertEquals("Echo:1000", proxy.echo(1000));
}
+
+ public void testAsycClienWithMsgProp() throws Exception
+ {
+ Endpoint proxy = initPort();
+ BindingProvider provider = (BindingProvider)proxy;
+ Map<String, Object> requestContext = provider.getRequestContext();
+ requestContext.put("use.async.http.conduit", Boolean.TRUE);
+ assertEquals("Echo:1000", proxy.echo(1000));
+ }
+
+ public void testAsycClienAsyncOperation() throws Exception
+ {
+ Endpoint proxy = initPort();
+ BindingProvider provider = (BindingProvider)proxy;
+ Map<String, Object> requestContext = provider.getRequestContext();
+ requestContext.put("use.async.http.conduit", Boolean.TRUE);
+ assertEquals("Echo:1000", proxy.echoAsync(1000).get());
+ }
+
+ private Endpoint initPort() throws Exception {
+ QName serviceName = new QName("http://org.jboss.ws/cxf/asyncclient",
"EndpointImplService");
+ URL wsdlURL = new URL(endpointAddress + "?wsdl");
+ Service service = Service.create(wsdlURL, serviceName);
+ Endpoint proxy = service.getPort(Endpoint.class);
+ return proxy;
+ }
+
+
}
\ No newline at end of file
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/Endpoint.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/Endpoint.java 2014-05-26
15:53:21 UTC (rev 18696)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/Endpoint.java 2014-05-27
00:48:30 UTC (rev 18697)
@@ -21,17 +21,27 @@
*/
package org.jboss.test.ws.jaxws.cxf.asyncclient;
+import java.util.concurrent.Future;
+
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Response;
/**
* @author <a href="mailto:ema@redhat.com">Jim Ma</a>
*
*/
@WebService(name = "EndpointService", targetNamespace =
"http://org.jboss.ws/cxf/asyncclient")
-@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL,
parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
+@SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL)
public interface Endpoint
{
@WebMethod
public String echo(long time);
+
+ @WebMethod(operationName = "echo")
+ public Response<String> echoAsync(long time);
+
+ @WebMethod(operationName = "echo")
+ public Future<String> echoAsync(long time, AsyncHandler<String> handler);
}
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/EndpointImpl.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/EndpointImpl.java 2014-05-26
15:53:21 UTC (rev 18696)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/asyncclient/EndpointImpl.java 2014-05-27
00:48:30 UTC (rev 18697)
@@ -21,9 +21,13 @@
*/
package org.jboss.test.ws.jaxws.cxf.asyncclient;
+import java.util.concurrent.Future;
+
import javax.annotation.Resource;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Response;
import javax.xml.ws.WebServiceContext;
import org.apache.cxf.continuations.Continuation;
@@ -33,7 +37,7 @@
*
*/
@WebService(name = "EndpointService", targetNamespace =
"http://org.jboss.ws/cxf/asyncclient")
-@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL,
parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
+@SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL)
public class EndpointImpl
{
@Resource
@@ -54,5 +58,13 @@
return "Echo:" + time;
}
+ public Response<String> echoAsync(long time)
+ {
+ return null;
+ }
+ public Future<String> echoAsync(final long time, final
AsyncHandler<String> handler) {
+ return null;
+ }
+
}
Show replies by date