use of org.jboss.wsf.spi.metadata.config.ClientConfig in project wildfly by wildfly.
the class XTSClientIntegrationService method start.
@Override
public void start(final StartContext context) {
final List<UnifiedHandlerChainMetaData> postHandlerChainsList = new ArrayList<>();
postHandlerChainsList.add(postHandlerChains.get());
ClientConfig wrapper = new ClientConfig(null, null, postHandlerChainsList, null, null);
((ServerConfigImpl) (serverConfig.get())).setClientConfigWrapper(wrapper, true);
}
use of org.jboss.wsf.spi.metadata.config.ClientConfig in project jbossws-cxf by jbossws.
the class Helper method modifyDefaultConfiguration.
protected static void modifyDefaultConfiguration(final boolean client) {
final Map<String, String> props = new HashMap<String, String>();
props.put("schema-validation-enabled", "true");
if (client) {
registerClientConfigAndReload(new ClientConfig(ClientConfig.STANDARD_CLIENT_CONFIG, null, null, props, null));
} else {
registerEndpointConfigAndReload(new EndpointConfig(EndpointConfig.STANDARD_ENDPOINT_CONFIG, null, null, props, null));
}
}
use of org.jboss.wsf.spi.metadata.config.ClientConfig in project jbossws-cxf by jbossws.
the class Helper method testDefaultClientValidation.
public boolean testDefaultClientValidation() throws Exception {
// first verify schema validation is not enabled yet: a wsdl with schema restrictions is used on client side,
// but schema validation is not enabled; the invoked endpoint does not have schema validation on
final QName serviceName = new QName("http://jboss.org/schemavalidation", "HelloService");
final QName portName = new QName("http://jboss.org/schemavalidation", "HelloPort");
final URL wsdlURL = Thread.currentThread().getContextClassLoader().getResource("validatingClient.wsdl");
Service service = Service.create(wsdlURL, serviceName);
Hello proxy = (Hello) service.getPort(portName, Hello.class);
((BindingProvider) proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, address);
HelloResponse hr = proxy.helloRequest("JBoss");
if (hr == null || hr.getReturn() != 2) {
return false;
}
hr = proxy.helloRequest("number");
if (hr == null || hr.getReturn() != 2) {
return false;
}
final ClientConfig defClientConfig = (ClientConfig) getAndVerifyDefaultConfiguration(true);
// then modify default conf to enable default client schema validation
try {
modifyDefaultConfiguration(true);
service = Service.create(wsdlURL, serviceName);
proxy = (Hello) service.getPort(portName, Hello.class);
((BindingProvider) proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, address);
hr = proxy.helloRequest("JBoss");
if (hr == null || hr.getReturn() != 2) {
return false;
}
try {
proxy.helloRequest("number");
return false;
} catch (Exception e) {
return e.getMessage().contains("is not facet-valid with respect to enumeration");
}
} finally {
// -- restore default conf --
registerClientConfigAndReload(defClientConfig);
// --
}
}
use of org.jboss.wsf.spi.metadata.config.ClientConfig in project jbossws-cxf by jbossws.
the class CXFClientConfigurerTest method testAddInterceptorsThroughSetConfigProperties.
@Test
public void testAddInterceptorsThroughSetConfigProperties() throws Exception {
Bus bus = null;
try {
bus = BusFactory.newInstance().createBus();
BusFactory.setThreadDefaultBus(bus);
Service service = Service.create(this.getClass().getResource("META-INF/TestService.wsdl"), new QName("http://www.openuri.org/2004/04/HelloWorld", "EndpointService"));
EndpointInterface port = service.getPort(new QName("http://www.openuri.org/2004/04/HelloWorld", "EndpointInterfacePort"), EndpointInterface.class);
Client client = ClientProxy.getClient(port);
Map<String, String> properties = new HashMap<String, String>();
properties.put("A", "1");
properties.put("B", "2");
properties.put("C", "3");
properties.put(Constants.CXF_IN_INTERCEPTORS_PROP, "org.jboss.wsf.stack.cxf.client.configuration.InterceptorA org.jboss.wsf.stack.cxf.client.configuration.InterceptorB");
properties.put(Constants.CXF_OUT_INTERCEPTORS_PROP, "org.jboss.wsf.stack.cxf.client.configuration.InterceptorC,org.jboss.wsf.stack.cxf.client.configuration.InterceptorD");
properties.put(Constants.CXF_IN_FAULT_INTERCEPTORS_PROP, "org.jboss.wsf.stack.cxf.client.configuration.InterceptorE,org.jboss.wsf.stack.cxf.client.configuration.InterceptorF");
properties.put(Constants.CXF_OUT_FAULT_INTERCEPTORS_PROP, "org.jboss.wsf.stack.cxf.client.configuration.InterceptorG org.jboss.wsf.stack.cxf.client.configuration.InterceptorH");
ClientConfig clientConfig = new ClientConfig("Foo", null, null, properties, null);
CXFClientConfigurer cfg = new CXFClientConfigurer();
cfg.setConfigProperties(port, clientConfig);
assertEquals("1", client.getEndpoint().get("A"));
assertEquals("2", client.getEndpoint().get("B"));
assertEquals("3", client.getEndpoint().get("C"));
List<String> interceptors = toNameList(client.getInInterceptors());
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorA"));
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorB"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorC"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorD"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorE"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorF"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorG"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorH"));
interceptors = toNameList(client.getOutInterceptors());
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorA"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorB"));
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorC"));
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorD"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorE"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorF"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorG"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorH"));
interceptors = toNameList(client.getInFaultInterceptors());
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorA"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorB"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorC"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorD"));
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorE"));
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorF"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorG"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorH"));
interceptors = toNameList(client.getOutFaultInterceptors());
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorA"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorB"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorC"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorD"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorE"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorF"));
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorG"));
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorH"));
ClientProxy.getClient(port).getInInterceptors().add(new InterceptorZ());
ClientProxy.getClient(port).getInFaultInterceptors().add(new InterceptorY());
properties = new HashMap<String, String>();
properties.put("E", "10");
properties.put("F", "20");
properties.put("G", "30");
properties.put(Constants.CXF_IN_INTERCEPTORS_PROP, "org.jboss.wsf.stack.cxf.client.configuration.InterceptorD, FooInterceptor");
properties.put(Constants.CXF_OUT_INTERCEPTORS_PROP, "org.jboss.wsf.stack.cxf.client.configuration.InterceptorB");
properties.put(Constants.CXF_IN_FAULT_INTERCEPTORS_PROP, "org.jboss.wsf.stack.cxf.client.configuration.InterceptorA, BarInterceptor");
properties.put(Constants.CXF_OUT_FAULT_INTERCEPTORS_PROP, "org.jboss.wsf.stack.cxf.client.configuration.InterceptorC");
clientConfig = new ClientConfig("Foo2", null, null, properties, null);
cfg.setConfigProperties(port, clientConfig);
assertEquals(null, client.getEndpoint().get("A"));
assertEquals(null, client.getEndpoint().get("B"));
assertEquals(null, client.getEndpoint().get("C"));
assertEquals(null, client.getEndpoint().get("D"));
assertEquals("10", client.getEndpoint().get("E"));
assertEquals("20", client.getEndpoint().get("F"));
assertEquals("30", client.getEndpoint().get("G"));
interceptors = toNameList(client.getInInterceptors());
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorA"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorB"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorC"));
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorD"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorE"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorF"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorG"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorH"));
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorZ"));
interceptors = toNameList(client.getOutInterceptors());
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorA"));
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorB"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorC"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorD"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorE"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorF"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorG"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorH"));
interceptors = toNameList(client.getInFaultInterceptors());
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorA"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorB"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorC"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorD"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorE"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorF"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorG"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorH"));
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorY"));
assertFalse(interceptors.contains("BarInterceptor"));
interceptors = toNameList(client.getOutFaultInterceptors());
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorA"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorB"));
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorC"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorD"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorE"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorF"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorG"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorH"));
properties = new HashMap<String, String>();
properties.put(Constants.CXF_IN_INTERCEPTORS_PROP, "");
properties.put(Constants.CXF_IN_FAULT_INTERCEPTORS_PROP, "");
clientConfig = new ClientConfig("Foo2", null, null, properties, null);
cfg.setConfigProperties(port, clientConfig);
assertEquals(null, client.getEndpoint().get("A"));
assertEquals(null, client.getEndpoint().get("B"));
assertEquals(null, client.getEndpoint().get("C"));
assertEquals(null, client.getEndpoint().get("D"));
assertEquals(null, client.getEndpoint().get("E"));
assertEquals(null, client.getEndpoint().get("F"));
assertEquals(null, client.getEndpoint().get("G"));
interceptors = toNameList(client.getInInterceptors());
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorA"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorB"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorC"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorD"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorE"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorF"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorG"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorH"));
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorZ"));
interceptors = toNameList(client.getOutInterceptors());
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorA"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorB"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorC"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorD"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorE"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorF"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorG"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorH"));
interceptors = toNameList(client.getInFaultInterceptors());
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorA"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorB"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorC"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorD"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorE"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorF"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorG"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorH"));
assertTrue(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorY"));
assertFalse(interceptors.contains("BarInterceptor"));
interceptors = toNameList(client.getOutFaultInterceptors());
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorA"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorB"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorC"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorD"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorE"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorF"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorG"));
assertFalse(interceptors.contains("org.jboss.wsf.stack.cxf.client.configuration.InterceptorH"));
} finally {
if (bus != null) {
bus.shutdown(true);
}
}
}
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 an handler from this testcase deployment
* 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 {
QName serviceName = new QName("http://clientConfig.jaxws.ws.test.jboss.org/", "EndpointImplService");
URL wsdlURL = new URL(address + "?wsdl");
final ClientConfig defaultClientConfig = TestUtils.getAndVerifyDefaultClientConfiguration();
// -- modify default conf --
try {
TestUtils.changeDefaultClientConfiguration();
// --
Service service = Service.create(wsdlURL, serviceName);
Endpoint port = (Endpoint) service.getPort(Endpoint.class);
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");
resStr = port.echo("Kermit");
resStr = port.echo("Kermit");
return ("Kermit|UserOut|LogOut|endpoint|LogIn|UserIn".equals(resStr));
} finally {
// -- restore default conf --
TestUtils.setClientConfigAndReload(defaultClientConfig);
// --
}
}
Aggregations