Search in sources :

Example 1 with Endpoint

use of org.wildfly.camel.test.common.types.Endpoint in project wildfly-camel by wildfly-extras.

the class CXFWSConsumerIntegrationTest method testCXFConsumer.

@Test
public void testCXFConsumer() throws Exception {
    CamelContext camelctx = contextRegistry.getCamelContext("cxfws-undertow");
    Assert.assertNotNull("Expected cxfws-undertow to not be null", camelctx);
    Assert.assertEquals(ServiceStatus.Started, camelctx.getStatus());
    QName qname = new QName("http://wildfly.camel.test.cxf", "EndpointService");
    Service service = Service.create(new URL("http://localhost:8080/EndpointService/EndpointPort?wsdl"), qname);
    Endpoint endpoint = service.getPort(Endpoint.class);
    Assert.assertNotNull("Endpoint not null", endpoint);
    Assert.assertEquals("Hello Kermit", endpoint.echo("Kermit"));
}
Also used : CamelContext(org.apache.camel.CamelContext) Endpoint(org.wildfly.camel.test.common.types.Endpoint) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) URL(java.net.URL) Test(org.junit.Test)

Example 2 with Endpoint

use of org.wildfly.camel.test.common.types.Endpoint in project wildfly-camel by wildfly-extras.

the class CXFWSProducerIntegrationTest method testSimpleWar.

@Test
public void testSimpleWar() throws Exception {
    deployer.deploy(SIMPLE_WAR);
    try {
        QName serviceName = new QName("http://wildfly.camel.test.cxf", "EndpointService");
        Service service = Service.create(getWsdl("/simple"), serviceName);
        Endpoint port = service.getPort(Endpoint.class);
        Assert.assertEquals("Hello Foo", port.echo("Foo"));
    } finally {
        deployer.undeploy(SIMPLE_WAR);
    }
}
Also used : Endpoint(org.wildfly.camel.test.common.types.Endpoint) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) Test(org.junit.Test)

Example 3 with Endpoint

use of org.wildfly.camel.test.common.types.Endpoint in project wildfly-camel by wildfly-extras.

the class CXFWSInterceptorTest method testCXFInterceptor.

@Test
public void testCXFInterceptor() throws Exception {
    CountDownLatch latch = new CountDownLatch(1);
    CamelContext camelctx = new DefaultCamelContext();
    CxfComponent component = new CxfComponent(camelctx);
    CxfEndpoint cxfEndpoint = new CxfEndpoint("http://localhost:8080/EndpointService/EndpointPort", component);
    cxfEndpoint.setServiceClass(Endpoint.class);
    List<Interceptor<? extends Message>> inInterceptors = cxfEndpoint.getInInterceptors();
    inInterceptors.add(new CountDownInterceptor(latch));
    camelctx.addRoutes(new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            from(cxfEndpoint).setBody(constant("Hello ${body}"));
        }
    });
    camelctx.start();
    try {
        QName qname = new QName("http://wildfly.camel.test.cxf", "EndpointService");
        Service service = Service.create(new URL("http://localhost:8080/EndpointService/EndpointPort?wsdl"), qname);
        Endpoint endpoint = service.getPort(Endpoint.class);
        endpoint.echo("Kermit");
        Assert.assertTrue("Gave up waiting for CXF interceptor handleMessage", latch.await(5, TimeUnit.SECONDS));
    } finally {
        camelctx.stop();
    }
}
Also used : DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) CamelContext(org.apache.camel.CamelContext) Message(org.apache.cxf.message.Message) RouteBuilder(org.apache.camel.builder.RouteBuilder) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) CxfEndpoint(org.apache.camel.component.cxf.CxfEndpoint) CountDownLatch(java.util.concurrent.CountDownLatch) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) URL(java.net.URL) Endpoint(org.wildfly.camel.test.common.types.Endpoint) CxfEndpoint(org.apache.camel.component.cxf.CxfEndpoint) CxfComponent(org.apache.camel.component.cxf.CxfComponent) AbstractPhaseInterceptor(org.apache.cxf.phase.AbstractPhaseInterceptor) Interceptor(org.apache.cxf.interceptor.Interceptor) Test(org.junit.Test)

Example 4 with Endpoint

use of org.wildfly.camel.test.common.types.Endpoint in project wildfly-camel by wildfly-extras.

the class CXFEndpointTest method testEndpoint.

@Test
public void testEndpoint() throws Exception {
    QName qname = new QName("http://wildfly.camel.test.cxf", "EndpointService");
    Service service = Service.create(new URL("http://" + wildflyIp + ":8080/EndpointService/EndpointPort?wsdl"), qname);
    Endpoint endpoint = service.getPort(Endpoint.class);
    Assert.assertNotNull("Endpoint not null", endpoint);
    Assert.assertEquals("Hello Kermit", endpoint.echo("Kermit"));
}
Also used : Endpoint(org.wildfly.camel.test.common.types.Endpoint) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) URL(java.net.URL) Test(org.junit.Test)

Aggregations

QName (javax.xml.namespace.QName)4 Service (javax.xml.ws.Service)4 Test (org.junit.Test)4 Endpoint (org.wildfly.camel.test.common.types.Endpoint)4 URL (java.net.URL)3 CamelContext (org.apache.camel.CamelContext)2 CountDownLatch (java.util.concurrent.CountDownLatch)1 RouteBuilder (org.apache.camel.builder.RouteBuilder)1 CxfComponent (org.apache.camel.component.cxf.CxfComponent)1 CxfEndpoint (org.apache.camel.component.cxf.CxfEndpoint)1 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)1 Interceptor (org.apache.cxf.interceptor.Interceptor)1 Message (org.apache.cxf.message.Message)1 AbstractPhaseInterceptor (org.apache.cxf.phase.AbstractPhaseInterceptor)1