use of org.apache.camel.component.cxf.CxfEndpoint in project camel by apache.
the class CxfEndpointBeanBusSettingTest method testBusInjectionOnURI.
@Test
public void testBusInjectionOnURI() throws Exception {
CamelContext camelContext = (CamelContext) ctx.getBean("camel");
CxfEndpoint endpoint = camelContext.getEndpoint("cxf:bean:serviceEndpoint?bus=#cxf1", CxfEndpoint.class);
assertEquals(ctx.getBean("cxf1"), endpoint.getBus());
endpoint = camelContext.getEndpoint("cxf:http://localhost:" + port1 + "/CxfEndpointBeanBusSettingTest/router1?bus=#cxf1", CxfEndpoint.class);
assertEquals(ctx.getBean("cxf1"), endpoint.getBus());
}
use of org.apache.camel.component.cxf.CxfEndpoint in project camel by apache.
the class CxfEndpointBeanTest method testCxfEndpointBeanDefinitionParser.
@Test
public void testCxfEndpointBeanDefinitionParser() {
CxfEndpoint routerEndpoint = ctx.getBean("routerEndpoint", CxfEndpoint.class);
assertEquals("Got the wrong endpoint address", "http://localhost:" + port1 + "/CxfEndpointBeanTest/router", routerEndpoint.getAddress());
assertEquals("Got the wrong endpont service class", "org.apache.camel.component.cxf.HelloService", routerEndpoint.getServiceClass().getName());
assertEquals("loggingFeatureEnabled should be false", false, routerEndpoint.isLoggingFeatureEnabled());
assertEquals("loggingSizeLimit should not be set", 0, routerEndpoint.getLoggingSizeLimit());
assertEquals("Got the wrong handlers size", 1, routerEndpoint.getHandlers().size());
assertEquals("Got the wrong schemalocations size", 1, routerEndpoint.getSchemaLocations().size());
assertEquals("Got the wrong schemalocation", "classpath:wsdl/Message.xsd", routerEndpoint.getSchemaLocations().get(0));
assertEquals("Got the wrong continuationTimeout", 60000, routerEndpoint.getContinuationTimeout());
CxfEndpoint myEndpoint = ctx.getBean("myEndpoint", CxfEndpoint.class);
assertEquals("Got the wrong endpointName", endpointName, myEndpoint.getPortName());
assertEquals("Got the wrong serviceName", serviceName, myEndpoint.getServiceName());
assertEquals("loggingFeatureEnabled should be true", true, myEndpoint.isLoggingFeatureEnabled());
assertEquals("loggingSizeLimit should be set", 200, myEndpoint.getLoggingSizeLimit());
assertTrue("We should get a soap binding", myEndpoint.getBindingConfig() instanceof SoapBindingConfiguration);
SoapBindingConfiguration configuration = (SoapBindingConfiguration) myEndpoint.getBindingConfig();
assertEquals("We should get a right soap version", "1.2", String.valueOf(configuration.getVersion().getVersion()));
}
use of org.apache.camel.component.cxf.CxfEndpoint in project camel by apache.
the class CxfEndpointBeanTest method testCxfEndpointsWithCamelContext.
@Test
public void testCxfEndpointsWithCamelContext() {
CamelContext context = ctx.getBean("myCamelContext", CamelContext.class);
// try to create a new CxfEndpoint which could override the old bean's setting
CxfEndpoint myLocalCxfEndpoint = (CxfEndpoint) context.getEndpoint("cxf:bean:routerEndpoint?address=http://localhost:" + port1 + "/CxfEndpointBeanTest/myCamelContext/");
assertEquals("Got the wrong endpoint address", "http://localhost:" + port1 + "/CxfEndpointBeanTest/myCamelContext/", myLocalCxfEndpoint.getAddress());
CxfEndpoint routerEndpoint = ctx.getBean("routerEndpoint", CxfEndpoint.class);
assertEquals("Got the wrong endpoint address", "http://localhost:" + port1 + "/CxfEndpointBeanTest/router", routerEndpoint.getAddress());
}
use of org.apache.camel.component.cxf.CxfEndpoint in project camel by apache.
the class CxfEndpointBeanWithBusTest method testBusInjectedBySpring.
@Test
public void testBusInjectedBySpring() throws Exception {
CamelContext camelContext = ctx.getBean("camel", CamelContext.class);
CxfEndpoint endpoint = camelContext.getEndpoint("cxf:bean:routerEndpoint", CxfEndpoint.class);
// verify the interceptor that is added by the logging feature
// Spring 3.0.0 has an issue of SPR-6589 which will call the BusApplicationListener twice for the same event,
// so we will get more one InInterceptors here
assertTrue(endpoint.getBus().getInInterceptors().size() >= 1);
for (Interceptor<?> i : endpoint.getBus().getInInterceptors()) {
if (i instanceof LoggingInInterceptor) {
return;
}
}
fail("Could not find the LoggingInInterceptor on the bus. " + endpoint.getBus().getInInterceptors());
}
use of org.apache.camel.component.cxf.CxfEndpoint in project camel by apache.
the class CxfEndpointBeansRouterTest method testCreateCxfEndpointFromURI.
@Test
public void testCreateCxfEndpointFromURI() throws Exception {
CamelContext camelContext = ctx.getBean("camel", CamelContext.class);
CxfEndpoint endpoint1 = camelContext.getEndpoint("cxf:bean:routerEndpoint?address=http://localhost:9000/test1", CxfEndpoint.class);
CxfEndpoint endpoint2 = camelContext.getEndpoint("cxf:bean:routerEndpoint?address=http://localhost:8000/test2", CxfEndpoint.class);
assertEquals("Get a wrong endpoint address.", "http://localhost:9000/test1", endpoint1.getAddress());
assertEquals("Get a wrong endpoint address.", "http://localhost:8000/test2", endpoint2.getAddress());
// the uri will always be normalized
String uri1 = URISupport.normalizeUri("cxf://bean:routerEndpoint?address=http://localhost:9000/test1");
String uri2 = URISupport.normalizeUri("cxf://bean:routerEndpoint?address=http://localhost:8000/test2");
assertEquals("Get a wrong endpoint key.", uri1, endpoint1.getEndpointKey());
assertEquals("Get a wrong endpoint key.", uri2, endpoint2.getEndpointKey());
}
Aggregations