Search in sources :

Example 16 with CxfEndpoint

use of org.apache.camel.component.cxf.CxfEndpoint in project camel by apache.

the class CxfConsumerSoap12Test method testCxfEndpointBeanDefinitionParser.

@Test
public void testCxfEndpointBeanDefinitionParser() {
    CxfEndpoint routerEndpoint = context.getEndpoint("routerEndpoint", CxfEndpoint.class);
    assertEquals("Got the wrong endpoint address", routerEndpoint.getAddress(), "http://localhost:" + CXFTestSupport.getPort1() + "/CxfConsumerSoap12Test/router");
    assertEquals("Got the wrong endpont service class", "org.apache.hello_world_soap_http.Greeter", routerEndpoint.getServiceClass().getName());
    BindingConfiguration binding = routerEndpoint.getBindingConfig();
    assertTrue("Got no soap binding", binding instanceof SoapBindingConfiguration);
    assertEquals("Got the wrong soap version", "http://schemas.xmlsoap.org/wsdl/soap12/", ((SoapBindingConfiguration) binding).getVersion().getBindingId());
    assertTrue("Mtom not enabled", ((SoapBindingConfiguration) binding).isMtomEnabled());
}
Also used : SoapBindingConfiguration(org.apache.cxf.binding.soap.SoapBindingConfiguration) CxfEndpoint(org.apache.camel.component.cxf.CxfEndpoint) SoapBindingConfiguration(org.apache.cxf.binding.soap.SoapBindingConfiguration) BindingConfiguration(org.apache.cxf.binding.BindingConfiguration) Test(org.junit.Test)

Example 17 with CxfEndpoint

use of org.apache.camel.component.cxf.CxfEndpoint in project camel by apache.

the class CxfEndpointBeansTest method testCxfBusInjection.

@Test
public void testCxfBusInjection() {
    CxfEndpoint serviceEndpoint = context.getEndpoint("cxf:bean:serviceEndpoint", CxfEndpoint.class);
    CxfEndpoint routerEndpoint = context.getEndpoint("cxf:bean:routerEndpoint", CxfEndpoint.class);
    assertEquals("These endpoints don't share the same bus", serviceEndpoint.getBus().getId(), routerEndpoint.getBus().getId());
}
Also used : CxfEndpoint(org.apache.camel.component.cxf.CxfEndpoint) Test(org.junit.Test)

Example 18 with CxfEndpoint

use of org.apache.camel.component.cxf.CxfEndpoint in project camel by apache.

the class CxfEndpointBeansTest method testCxfFeatureSetting.

@Test
public void testCxfFeatureSetting() {
    CxfEndpoint routerEndpoint = context.getEndpoint("cxf:bean:routerEndpoint", CxfEndpoint.class);
    assertEquals("Get a wrong size of features.", 1, routerEndpoint.getFeatures().size());
    assertTrue("Get a wrong feature instance.", routerEndpoint.getFeatures().get(0) instanceof FailoverFeature);
}
Also used : FailoverFeature(org.apache.cxf.clustering.FailoverFeature) CxfEndpoint(org.apache.camel.component.cxf.CxfEndpoint) Test(org.junit.Test)

Example 19 with CxfEndpoint

use of org.apache.camel.component.cxf.CxfEndpoint in project camel by apache.

the class CxfEndpointBeansTest method testCxfBeanWithCamelPropertiesHolder.

@Test
public void testCxfBeanWithCamelPropertiesHolder() throws Exception {
    // get the camelContext from application context
    CxfEndpoint testEndpoint = context.getEndpoint("cxf:bean:testEndpoint", CxfEndpoint.class);
    QName endpointName = QName.valueOf("{http://org.apache.camel.component.cxf}myEndpoint");
    QName serviceName = QName.valueOf("{http://org.apache.camel.component.cxf}myService");
    assertEquals("Got a wrong address", "http://localhost:" + CXFTestSupport.getPort3() + "/testEndpoint", testEndpoint.getAddress());
    assertEquals("Got a wrong bindingId", "http://schemas.xmlsoap.org/wsdl/soap12/", testEndpoint.getBindingId());
    assertEquals("Got a wrong transportId", "http://cxf.apache.org/transports/http", testEndpoint.getTransportId());
    assertEquals("Got a wrong endpointName", endpointName, testEndpoint.getPortName());
    assertEquals("Got a wrong WsdlURL", "wsdl/test.wsdl", testEndpoint.getWsdlURL());
    assertEquals("Got a wrong serviceName", serviceName, testEndpoint.getServiceName());
}
Also used : QName(javax.xml.namespace.QName) CxfEndpoint(org.apache.camel.component.cxf.CxfEndpoint) Test(org.junit.Test)

Example 20 with CxfEndpoint

use of org.apache.camel.component.cxf.CxfEndpoint in project camel by apache.

the class CxfMessageHeadersRelayTest method testMessageHeadersRelaysSpringContext.

@Test
public void testMessageHeadersRelaysSpringContext() throws Exception {
    CxfEndpoint endpoint = context.getEndpoint("cxf:bean:serviceExtraRelays?headerFilterStrategy=#customMessageFilterStrategy", CxfEndpoint.class);
    CxfHeaderFilterStrategy strategy = (CxfHeaderFilterStrategy) endpoint.getHeaderFilterStrategy();
    List<MessageHeaderFilter> filters = strategy.getMessageHeaderFilters();
    assertEquals("Expected number of filters ", 2, filters.size());
    Map<String, MessageHeaderFilter> messageHeaderFilterMap = strategy.getMessageHeaderFiltersMap();
    for (String ns : new CustomHeaderFilter().getActivationNamespaces()) {
        assertEquals("Expected a filter class for namespace: " + ns, CustomHeaderFilter.class, messageHeaderFilterMap.get(ns).getClass());
    }
}
Also used : MessageHeaderFilter(org.apache.camel.component.cxf.common.header.MessageHeaderFilter) CxfHeaderFilterStrategy(org.apache.camel.component.cxf.common.header.CxfHeaderFilterStrategy) CxfEndpoint(org.apache.camel.component.cxf.CxfEndpoint) Test(org.junit.Test)

Aggregations

CxfEndpoint (org.apache.camel.component.cxf.CxfEndpoint)32 Test (org.junit.Test)30 CamelContext (org.apache.camel.CamelContext)10 QName (javax.xml.namespace.QName)4 RouteBuilder (org.apache.camel.builder.RouteBuilder)4 CxfComponent (org.apache.camel.component.cxf.CxfComponent)4 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)4 Endpoint (org.wildfly.camel.test.common.types.Endpoint)3 Exchange (org.apache.camel.Exchange)2 Processor (org.apache.camel.Processor)2 ProducerTemplate (org.apache.camel.ProducerTemplate)2 CxfProducer (org.apache.camel.component.cxf.CxfProducer)2 SoapBindingConfiguration (org.apache.cxf.binding.soap.SoapBindingConfiguration)2 Interceptor (org.apache.cxf.interceptor.Interceptor)2 Message (org.apache.cxf.message.Message)2 URL (java.net.URL)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 CountDownLatch (java.util.concurrent.CountDownLatch)1