Author: asoldano
Date: 2015-03-11 17:43:27 -0400 (Wed, 11 Mar 2015)
New Revision: 19552
Modified:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsrm/client/SimpleServiceTestCase.java
Log:
Fix WS-RM SimpleServiceTestCase and enrich it with feature based example
Modified:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsrm/client/SimpleServiceTestCase.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsrm/client/SimpleServiceTestCase.java 2015-03-11
20:28:46 UTC (rev 19551)
+++
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsrm/client/SimpleServiceTestCase.java 2015-03-11
21:43:27 UTC (rev 19552)
@@ -28,6 +28,11 @@
import javax.xml.ws.Service;
import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.ws.rm.feature.RMFeature;
+import org.apache.cxf.ws.rm.manager.AcksPolicyType;
+import org.apache.cxf.ws.rm.manager.DestinationPolicyType;
+import org.apache.cxf.ws.rmp.v200502.RMAssertion;
+import org.apache.cxf.ws.rmp.v200502.RMAssertion.AcknowledgementInterval;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
@@ -37,6 +42,7 @@
import org.jboss.test.ws.jaxws.samples.wsrm.generated.SimpleService;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestHelper;
+import org.jboss.wsf.test.WrapThreadContextClassLoader;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -74,6 +80,7 @@
@Test
@RunAsClient
+ @WrapThreadContextClassLoader
public void test() throws Exception
{
SimpleService proxy = null;
@@ -91,4 +98,37 @@
}
}
+ @Test
+ @RunAsClient
+ public void testWithFeature() throws Exception
+ {
+ SimpleService proxy = null;
+ try {
+ QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wsrm",
"SimpleService");
+ URL wsdlURL = new URL("http://" + getServerHost() + ":" +
getServerPort() + "/jaxws-samples-wsrm/SimpleService?wsdl");
+ RMFeature feature = new RMFeature();
+ RMAssertion rma = new RMAssertion();
+ RMAssertion.BaseRetransmissionInterval bri = new
RMAssertion.BaseRetransmissionInterval();
+ bri.setMilliseconds(4000L);
+ rma.setBaseRetransmissionInterval(bri);
+ AcknowledgementInterval ai = new AcknowledgementInterval();
+ ai.setMilliseconds(2000L);
+ rma.setAcknowledgementInterval(ai);
+ feature.setRMAssertion(rma);
+ DestinationPolicyType dp = new DestinationPolicyType();
+ AcksPolicyType ap = new AcksPolicyType();
+ ap.setIntraMessageThreshold(0);
+ dp.setAcksPolicy(ap);
+ feature.setDestinationPolicy(dp);
+ Service service = Service.create(wsdlURL, serviceName);
+ proxy = (SimpleService)service.getPort(SimpleService.class, feature);
+ assertEquals("Hello World2!", proxy.echo("Hello World2!"));
// request responce call
+ proxy.ping(); // one way call
+ } finally {
+ if (proxy != null) {
+ ((Client)proxy).destroy();
+ }
+ }
+ }
+
}