Author: alessio.soldano(a)jboss.com
Date: 2013-01-25 13:20:19 -0500 (Fri, 25 Jan 2013)
New Revision: 17259
Modified:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Helper.java
Log:
[JBWS-3592] Adding testcase
Modified:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java
===================================================================
---
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java 2013-01-25
18:19:52 UTC (rev 17258)
+++
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/ClientConfigurationTestCase.java 2013-01-25
18:20:19 UTC (rev 17259)
@@ -71,6 +71,14 @@
assertEquals("1",
runTestInContainer("testCustomClientConfigurationFromFile"));
}
+ public void testCustomClientConfigurationFromFileUsingFeature() throws Exception {
+ assertTrue(getHelper().testCustomClientConfigurationFromFile());
+ }
+
+ public void testCustomClientConfigurationFromFileUsingFeatureInContainer() throws
Exception {
+ assertEquals("1",
runTestInContainer("testCustomClientConfigurationFromFileUsingFeature"));
+ }
+
/**
* Verifies a client configuration can be changed after another one has been set
*
@@ -104,6 +112,10 @@
assertEquals("1",
runTestInContainer("testCustomClientConfiguration"));
}
+ public void testCustomClientConfigurationUsingFeatureInContainer() throws Exception {
+ assertEquals("1",
runTestInContainer("testCustomClientConfigurationUsingFeature"));
+ }
+
// -------------------------
private Helper getHelper() {
Modified:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Helper.java
===================================================================
---
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Helper.java 2013-01-25
18:19:52 UTC (rev 17258)
+++
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/clientConfig/Helper.java 2013-01-25
18:20:19 UTC (rev 17259)
@@ -30,6 +30,7 @@
import javax.xml.ws.handler.Handler;
import org.jboss.test.helper.ClientHelper;
+import org.jboss.ws.api.configuration.ClientConfigFeature;
import org.jboss.ws.api.configuration.ClientConfigUtil;
import org.jboss.ws.api.configuration.ClientConfigurer;
@@ -72,6 +73,24 @@
return
("Kermit|RoutOut|CustomOut|UserOut|LogOut|endpoint|LogIn|UserIn|CustomIn|RoutIn".equals(resStr));
}
+ public boolean testCustomClientConfigurationFromFileUsingFeature() throws Exception
+ {
+ QName serviceName = new
QName("http://clientConfig.jaxws.ws.test.jboss.org/",
"EndpointImplService");
+ URL wsdlURL = new URL(address + "?wsdl");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ Endpoint port = (Endpoint)service.getPort(Endpoint.class, new
ClientConfigFeature("META-INF/jaxws-client-config.xml", "Custom Client
Config"));
+
+ BindingProvider bp = (BindingProvider)port;
+ @SuppressWarnings("rawtypes")
+ List<Handler> hc = bp.getBinding().getHandlerChain();
+ hc.add(new UserHandler());
+ bp.getBinding().setHandlerChain(hc);
+
+ String resStr = port.echo("Kermit");
+ return
("Kermit|RoutOut|CustomOut|UserOut|LogOut|endpoint|LogIn|UserIn|CustomIn|RoutIn".equals(resStr));
+ }
+
public boolean testConfigurationChange() throws Exception
{
QName serviceName = new
QName("http://clientConfig.jaxws.ws.test.jboss.org/",
"EndpointImplService");
@@ -180,6 +199,38 @@
}
}
+ public boolean testCustomClientConfigurationUsingFeature() throws Exception
+ {
+ QName serviceName = new
QName("http://clientConfig.jaxws.ws.test.jboss.org/",
"EndpointImplService");
+ URL wsdlURL = new URL(address + "?wsdl");
+
+ final String testConfigName = "MyTestConfig";
+ try
+ {
+ //-- add test client configuration
+ TestUtils.addTestCaseClientConfiguration(testConfigName);
+ // --
+
+ Service service = Service.create(wsdlURL, serviceName);
+ Endpoint port = (Endpoint)service.getPort(Endpoint.class, new
ClientConfigFeature(null, testConfigName));
+
+ BindingProvider bp = (BindingProvider)port;
+ @SuppressWarnings("rawtypes")
+ List<Handler> hc = bp.getBinding().getHandlerChain();
+ hc.add(new UserHandler());
+ bp.getBinding().setHandlerChain(hc);
+
+ String resStr = port.echo("Kermit");
+ return
("Kermit|RoutOut|UserOut|endpoint|UserIn|RoutIn".equals(resStr));
+ }
+ finally
+ {
+ // -- remove test client configuration --
+ TestUtils.removeTestCaseClientConfiguration(testConfigName);
+ // --
+ }
+ }
+
@Override
public void setTargetEndpoint(String address)
{