Search in sources :

Example 21 with WrapThreadContextClassLoader

use of org.jboss.wsf.test.WrapThreadContextClassLoader in project jbossws-cxf by jbossws.

the class WSReliableMessagingWithAPITestCase method testWithFeatureProperty.

@Test
@RunAsClient
@WrapThreadContextClassLoader
public void testWithFeatureProperty() throws Exception {
    final Bus bus = BusFactory.newInstance().createBus();
    BusFactory.setThreadDefaultBus(bus);
    try {
        QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wsrm", "SimpleService");
        URL wsdlURL = getResourceURL("jaxws/samples/wsrm/WEB-INF/wsdl/SimpleService.wsdl");
        Service service = Service.create(wsdlURL, serviceName);
        SimpleService proxy = (SimpleService) service.getPort(SimpleService.class);
        ClientConfigurer configurer = ClientConfigUtil.resolveClientConfigurer();
        configurer.setConfigProperties(proxy, "META-INF/jaxws-client-config.xml", "Custom Client Config");
        ((BindingProvider) proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, baseURL + "/jaxws-samples-wsrm-api/SimpleService");
        // request response call
        assertEquals("Hello World!", proxy.echo("Hello World!"));
        // one way call
        proxy.ping();
    } finally {
        bus.shutdown(true);
    }
}
Also used : Bus(org.apache.cxf.Bus) QName(javax.xml.namespace.QName) SimpleService(org.jboss.test.ws.jaxws.samples.wsrm.generated.SimpleService) Service(javax.xml.ws.Service) SimpleService(org.jboss.test.ws.jaxws.samples.wsrm.generated.SimpleService) ClientConfigurer(org.jboss.ws.api.configuration.ClientConfigurer) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest) WrapThreadContextClassLoader(org.jboss.wsf.test.WrapThreadContextClassLoader)

Example 22 with WrapThreadContextClassLoader

use of org.jboss.wsf.test.WrapThreadContextClassLoader in project jbossws-cxf by jbossws.

the class UDPEndpointAPITestCase method testClientSide.

@Test
@RunAsClient
@WrapThreadContextClassLoader
public void testClientSide() throws Exception {
    if (!isProperNetworkSetup()) {
        // IPv6 does not support broadcast, so some IPv4 nonloopback interface with broacast is required
        System.out.println("Skipping broadcast test: no non-loopback IPv4 interface available");
        return;
    }
    Bus bus = BusFactory.newInstance().createBus();
    BusFactory.setThreadDefaultBus(bus);
    Object implementor = new HelloWorldImpl();
    Endpoint ep = Endpoint.publish("soap.udp://:9436", implementor);
    try {
        final QName serviceName = new QName("http://org.jboss.ws/jaxws/cxf/udp", "HelloWorldService");
        final QName udpPortName = new QName("http://org.jboss.ws/jaxws/cxf/udp", "UDPHelloWorldImplPort");
        Service service = Service.create(serviceName);
        service.addPort(udpPortName, "http://schemas.xmlsoap.org/soap/", "soap.udp://:9436");
        HelloWorld proxy = (HelloWorld) service.getPort(udpPortName, HelloWorld.class);
        assertEquals("Hi", proxy.echo("Hi"));
    } finally {
        ep.stop();
        bus.shutdown(true);
    }
}
Also used : Bus(org.apache.cxf.Bus) Endpoint(javax.xml.ws.Endpoint) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest) WrapThreadContextClassLoader(org.jboss.wsf.test.WrapThreadContextClassLoader)

Example 23 with WrapThreadContextClassLoader

use of org.jboss.wsf.test.WrapThreadContextClassLoader in project jbossws-cxf by jbossws.

the class AnnotatedSignEncryptTestCase method test.

@Test
@RunAsClient
@WrapThreadContextClassLoader
public void test() throws Exception {
    try {
        QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "AnnotatedSecurityService");
        URL wsdlURL = new URL(baseURL + "/AnnotatedSecurityService?wsdl");
        Service service = Service.create(wsdlURL, serviceName);
        AnnotatedServiceIface proxy = (AnnotatedServiceIface) service.getPort(AnnotatedServiceIface.class);
        setupWsse(proxy);
        ((BindingProvider) proxy).getRequestContext().put(Message.RECEIVE_TIMEOUT, 120000);
        assertEquals("Secure Hello World!", proxy.sayHello());
    } catch (Exception e) {
        throw CryptoCheckHelper.checkAndWrapException(e);
    }
}
Also used : QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest) WrapThreadContextClassLoader(org.jboss.wsf.test.WrapThreadContextClassLoader)

Example 24 with WrapThreadContextClassLoader

use of org.jboss.wsf.test.WrapThreadContextClassLoader in project jbossws-cxf by jbossws.

the class MultipleClientsSignEncryptTestCase method testAlice.

@Test
@RunAsClient
@WrapThreadContextClassLoader
public void testAlice() throws Exception {
    QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
    URL wsdlURL = new URL(baseURL + "/SecurityService?wsdl");
    Service service = Service.create(wsdlURL, serviceName);
    ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
    setupWsse(proxy, "alice");
    try {
        assertEquals("Multiple Clients Secure Hello World!", proxy.sayHello());
    } catch (SOAPFaultException e) {
        throw new Exception("Error " + e.getMessage() + " - please check that the Bouncy Castle provider is installed.", e);
    }
}
Also used : QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) URL(java.net.URL) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest) WrapThreadContextClassLoader(org.jboss.wsf.test.WrapThreadContextClassLoader)

Example 25 with WrapThreadContextClassLoader

use of org.jboss.wsf.test.WrapThreadContextClassLoader in project jbossws-cxf by jbossws.

the class FastInfosetTestCase method testInfosetUsingFeatureProperties2.

@Test
@RunAsClient
@WrapThreadContextClassLoader
@OperateOnDeployment(DEP2)
public void testInfosetUsingFeatureProperties2() throws Exception {
    URL wsdlURL = new URL(baseURL + "HelloWorldService?wsdl");
    QName serviceName = new QName("http://org.jboss.ws/jaxws/cxf/fastinfoset", "HelloWorldService");
    QName portQName = new QName("http://org.jboss.ws/jaxws/cxf/fastinfoset", "HelloWorldImplPort");
    internalTestInfosetUsingFeatureProperties(wsdlURL, serviceName, portQName);
}
Also used : QName(javax.xml.namespace.QName) URL(java.net.URL) OperateOnDeployment(org.jboss.arquillian.container.test.api.OperateOnDeployment) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest) WrapThreadContextClassLoader(org.jboss.wsf.test.WrapThreadContextClassLoader)

Aggregations

QName (javax.xml.namespace.QName)41 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)41 JBossWSTest (org.jboss.wsf.test.JBossWSTest)41 WrapThreadContextClassLoader (org.jboss.wsf.test.WrapThreadContextClassLoader)41 Test (org.junit.Test)41 URL (java.net.URL)40 Service (javax.xml.ws.Service)39 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)15 Bus (org.apache.cxf.Bus)13 BindingProvider (javax.xml.ws.BindingProvider)6 ActAsServiceIface (org.jboss.test.ws.jaxws.samples.wsse.policy.trust.actas.ActAsServiceIface)6 OnBehalfOfServiceIface (org.jboss.test.ws.jaxws.samples.wsse.policy.trust.onbehalfof.OnBehalfOfServiceIface)6 ServiceIface (org.jboss.test.ws.jaxws.samples.wsse.policy.trust.service.ServiceIface)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 PrintWriter (java.io.PrintWriter)2 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)2 LoggingInInterceptor (org.apache.cxf.interceptor.LoggingInInterceptor)2 UseThreadBusFeature (org.jboss.wsf.stack.cxf.client.UseThreadBusFeature)2 Endpoint (javax.xml.ws.Endpoint)1 HelloResponse (org.jboss.test.ws.jaxws.samples.schemavalidation.types.HelloResponse)1