use of org.apache.camel.component.cxf.CxfEndpoint in project camel by apache.
the class CxfEndpointBeansTest 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() + "/CxfEndpointBeansRouterTest/router");
assertEquals("Got the wrong endpont service class", "org.apache.camel.component.cxf.HelloService", routerEndpoint.getServiceClass().getName());
}
use of org.apache.camel.component.cxf.CxfEndpoint in project camel by apache.
the class CxfEndpointBeansTest method testCreateCxfEndpointFromURI.
@Test
public void testCreateCxfEndpointFromURI() throws Exception {
CxfEndpoint endpoint1 = context.getEndpoint("cxf:bean:routerEndpoint?address=http://localhost:9000/test1", CxfEndpoint.class);
CxfEndpoint endpoint2 = context.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());
}
use of org.apache.camel.component.cxf.CxfEndpoint in project camel by apache.
the class CxfEndpointUtilsTest method testGetProperties.
@Test
public void testGetProperties() throws Exception {
CxfEndpoint endpoint = createEndpoint(getEndpointURI());
QName service = endpoint.getServiceName();
assertEquals("We should get the right service name", service, SERVICE_NAME);
}
use of org.apache.camel.component.cxf.CxfEndpoint in project camel by apache.
the class CxfEndpointUtilsTest method testCheckServiceClassConsumer.
@Test
public void testCheckServiceClassConsumer() throws Exception {
CxfEndpoint endpoint = createEndpoint(getNoServiceClassURI());
try {
endpoint.createConsumer(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
// noop
}
});
fail("Should have thrown exception");
} catch (IllegalArgumentException exception) {
assertNotNull("Should get a CamelException here", exception);
assertTrue(exception.getMessage().startsWith("serviceClass must be specified"));
}
}
use of org.apache.camel.component.cxf.CxfEndpoint in project camel by apache.
the class CamelEndpointSpringConfigureTest method testCreateDestinationFromSpring.
@Test
public void testCreateDestinationFromSpring() throws Exception {
CxfEndpoint cxfEndpoint = context.getEndpoint("cxf:bean:serviceEndpoint", CxfEndpoint.class);
CxfProducer producer = (CxfProducer) cxfEndpoint.createProducer();
assertNotNull("The producer should not be null", producer);
producer.start();
CamelConduit conduit = (CamelConduit) producer.getClient().getConduit();
assertTrue("we should get SpringCamelContext here", conduit.getCamelContext() instanceof SpringCamelContext);
assertEquals("The context id should be camel_conduit", "camel_conduit", conduit.getCamelContext().getName());
cxfEndpoint = context.getEndpoint("cxf:bean:routerEndpoint", CxfEndpoint.class);
CxfConsumer consumer = (CxfConsumer) cxfEndpoint.createConsumer(new Processor() {
public void process(Exchange exchange) throws Exception {
// do nothing here
}
});
assertNotNull("The consumer should not be null", consumer);
consumer.start();
CamelDestination destination = (CamelDestination) consumer.getServer().getDestination();
assertTrue("we should get SpringCamelContext here", destination.getCamelContext() instanceof SpringCamelContext);
assertEquals("The context id should be camel_destination", "camel_destination", destination.getCamelContext().getName());
}
Aggregations