use of org.jboss.wsf.spi.metadata.config.ClientConfig in project jbossws-cxf by jbossws.
the class Helper method testDefaultClientConfigurationOnDispatch.
public boolean testDefaultClientConfigurationOnDispatch() throws Exception {
final String reqString = "<ns1:echo xmlns:ns1=\"http://clientConfig.jaxws.ws.test.jboss.org/\"><arg0>Kermit</arg0></ns1:echo>";
QName serviceName = new QName("http://clientConfig.jaxws.ws.test.jboss.org/", "EndpointImplService");
QName portName = new QName("http://clientConfig.jaxws.ws.test.jboss.org/", "EndpointPort");
URL wsdlURL = new URL(address + "?wsdl");
final ClientConfig defaultClientConfig = TestUtils.getAndVerifyDefaultClientConfiguration();
// -- modify default conf --
try {
TestUtils.changeDefaultClientConfiguration();
// --
Service service = Service.create(wsdlURL, serviceName);
Dispatch<Source> dispatch = service.createDispatch(portName, Source.class, Mode.PAYLOAD);
BindingProvider bp = (BindingProvider) dispatch;
@SuppressWarnings("rawtypes") List<Handler> hc = bp.getBinding().getHandlerChain();
hc.add(new UserHandler());
bp.getBinding().setHandlerChain(hc);
Source resSource = dispatch.invoke(new DOMSource(DOMUtils.parse(reqString)));
resSource = dispatch.invoke(new DOMSource(DOMUtils.parse(reqString)));
resSource = dispatch.invoke(new DOMSource(DOMUtils.parse(reqString)));
String resStr = DOMUtils.getTextContent(DOMUtils.sourceToElement(resSource).getElementsByTagName("return").item(0));
return ("Kermit|UserOut|LogOut|endpoint|LogIn|UserIn".equals(resStr));
} finally {
// -- restore default conf --
TestUtils.setClientConfigAndReload(defaultClientConfig);
// --
}
}
use of org.jboss.wsf.spi.metadata.config.ClientConfig in project jbossws-cxf by jbossws.
the class TestUtils method addTestCaseClientConfiguration.
public static void addTestCaseClientConfiguration(String testConfigName) {
UnifiedHandlerMetaData handler = new UnifiedHandlerMetaData("org.jboss.test.ws.jaxws.clientConfig.RoutingHandler", "Routing Handler", null, null, null, null);
UnifiedHandlerChainMetaData uhcmd = new UnifiedHandlerChainMetaData(null, null, null, Collections.singletonList(handler), false, null);
List<UnifiedHandlerChainMetaData> preHC = new LinkedList<UnifiedHandlerChainMetaData>();
preHC.add(uhcmd);
setClientConfigAndReload(new ClientConfig(testConfigName, preHC, null, null, null));
}
use of org.jboss.wsf.spi.metadata.config.ClientConfig in project jbossws-cxf by jbossws.
the class Helper method testDefaultClientConfiguration.
/**
* This test hacks the current ServerConfig temporarily adding a property into the AS default client configuration,
* verifies the handler is picked up and finally restores the original default client configuration.
*
* @return
* @throws Exception
*/
public boolean testDefaultClientConfiguration() throws Exception {
final URL wsdlURL = new URL(address + "?wsdl");
final ClientConfig defaultClientConfig = TestUtils.getAndVerifyDefaultClientConfiguration();
// -- modify default conf --
try {
final Map<String, String> props = new HashMap<String, String>();
props.put("propA", "valueA");
TestUtils.registerClientConfigAndReload(new ClientConfig(defaultClientConfig.getConfigName(), null, null, props, null));
// --
Service service = Service.create(wsdlURL, serviceName);
Endpoint port = (Endpoint) service.getPort(Endpoint.class);
return (ClientProxy.getClient(port).getEndpoint().get("propA").equals("valueA"));
} finally {
// -- restore default conf --
TestUtils.registerClientConfigAndReload(defaultClientConfig);
// --
}
}
use of org.jboss.wsf.spi.metadata.config.ClientConfig in project jbossws-cxf by jbossws.
the class TestUtils method addTestCaseClientConfiguration.
public static void addTestCaseClientConfiguration(String testConfigName) {
ClientConfig config = new ClientConfig(testConfigName, null, null, Collections.singletonMap("propT", "valueT"), null);
registerClientConfigAndReload(config);
}
Aggregations