Author: alessio.soldano(a)jboss.com
Date: 2010-09-29 09:36:18 -0400 (Wed, 29 Sep 2010)
New Revision: 13045
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsa/AddressingTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsa/ServiceImpl.java
Log:
Update ws-addressing sample to use addressing policy
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2010-09-29
13:35:19 UTC (rev 13044)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2010-09-29
13:36:18 UTC (rev 13045)
@@ -102,12 +102,6 @@
<include
name="org/jboss/test/ws/jaxws/samples/wsa/Service*.class"/>
<include
name="org/jboss/test/ws/jaxws/samples/wsa/jaxws/*.class"/>
</classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxws/samples/wsa/WEB-INF">
- <include name="jbossws-cxf.xml"/>
- </webinf>
- <zipfileset
-
dir="${tests.output.dir}/test-resources/jaxws/samples/wsa/WEB-INF/wsdl"
- prefix="WEB-INF/wsdl"/>
</war>
<!-- jaxws-samples-wsrm -->
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsa/AddressingTestCase.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsa/AddressingTestCase.java 2010-09-29
13:35:19 UTC (rev 13044)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsa/AddressingTestCase.java 2010-09-29
13:36:18 UTC (rev 13045)
@@ -23,6 +23,7 @@
import java.net.URL;
import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
import javax.xml.ws.soap.AddressingFeature;
@@ -44,15 +45,39 @@
return new JBossWSTestSetup(AddressingTestCase.class,
"jaxws-samples-wsa.war");
}
- public void test() throws Exception
+ /**
+ * This tests the invocation using the local copy of the service contract; that does
not have any ws-addressing
+ * policy, so the addressing feature needs to be explicitly provided.
+ *
+ * @throws Exception
+ */
+ public void testUsingLocalContract() throws Exception
{
// construct proxy
QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wsaddressing",
"AddressingService");
- URL wsdlURL = new URL(serviceURL + "?wsdl");
+ URL wsdlURL =
getResourceURL("jaxws/samples/wsa/WEB-INF/wsdl/AddressingService.wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class, new
AddressingFeature());
+
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
serviceURL);
// invoke method
assertEquals("Hello World!", proxy.sayHello());
}
+ /**
+ * This tests the invocation using the service contract published by the endpoint.
That should have the
+ * ws-addressing policy in it, hence no need to explicitly configure addressing, the
policy engine takes care of that.
+ *
+ * @throws Exception
+ */
+ public void testUsingContractFromDeployedEndpoint() throws Exception
+ {
+ // construct proxy
+ QName serviceName = new
QName("http://www.jboss.org/jbossws/ws-extensions/wsaddressing",
"AddressingService");
+ URL wsdlURL = new URL(serviceURL + "?wsdl");
+ Service service = Service.create(wsdlURL, serviceName);
+ ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
+ // invoke method
+ assertEquals("Hello World!", proxy.sayHello());
+ }
+
}
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsa/ServiceImpl.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsa/ServiceImpl.java 2010-09-29
13:35:19 UTC (rev 13044)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsa/ServiceImpl.java 2010-09-29
13:36:18 UTC (rev 13045)
@@ -28,7 +28,7 @@
(
portName = "AddressingServicePort",
serviceName = "AddressingService",
- wsdlLocation = "WEB-INF/wsdl/AddressingService.wsdl",
+// wsdlLocation = "WEB-INF/wsdl/AddressingService.wsdl", //do not provide the
wsdl and let the endpoint publish the proper one with addressing policy
targetNamespace =
"http://www.jboss.org/jbossws/ws-extensions/wsaddressing",
endpointInterface = "org.jboss.test.ws.jaxws.samples.wsa.ServiceIface"
)