Package org.apache.camel.component.cxf

Examples of org.apache.camel.component.cxf.CxfEndpoint


       
    }
   
    @Test
    public void testPropertiesSettingOnCxfClient() throws Exception {
        CxfEndpoint clientEndpoint = ctx.getBean("clientEndpoint", CxfEndpoint.class);
        CxfProducer producer = (CxfProducer) clientEndpoint.createProducer();
        // need to start the producer to get the client
        producer.start();
        Client client = producer.getClient();
        HTTPConduit conduit = (HTTPConduit)client.getConduit();
        assertEquals("Got the wrong user name", "test", conduit.getAuthorization().getUserName());
View Full Code Here


        return new String[]{"org/apache/camel/component/cxf/spring/CxfEndpointBeansRouter.xml"};
    }

    @Test
    public void testCxfEndpointBeanDefinitionParser() {
        CxfEndpoint routerEndpoint = ctx.getBean("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());
    }
View Full Code Here

   
    @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());
    }
View Full Code Here

    @Test
    public void testCxfBeanWithCamelPropertiesHolder() throws Exception {
        // get the camelContext from application context
        CamelContext camelContext = ctx.getBean("camel", CamelContext.class);
        CxfEndpoint testEndpoint = camelContext.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:9000/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());
    }
View Full Code Here

    }
   
    @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());
    }
View Full Code Here

        fail("Could not find the LoggingInInterceptor on the bus. " + endpoint.getBus().getInInterceptors());
    }
   
    @Test
    public void testCxfEndpointBeanDefinitionParser() {
        CxfEndpoint routerEndpoint = ctx.getBean("routerEndpoint", CxfEndpoint.class);
        assertEquals("Got the wrong endpoint address", "http://localhost:" + port1
                     + "/CxfEndpointBeanWithBusTest/router/", routerEndpoint.getAddress());
        assertEquals("Got the wrong endpont service class",
                     "org.apache.camel.component.cxf.HelloService",
                     routerEndpoint.getServiceClass().getName());
       
    }
View Full Code Here

   
    @Test
    public void testBusInjectedBySpring() throws Exception {
        CamelContext camelContext = (CamelContext) ctx.getBean("camel");
       
        CxfEndpoint endpoint = camelContext.getEndpoint("cxf:bean:routerEndpoint", CxfEndpoint.class);
        assertEquals("Get a wrong endpoint uri", "cxf://bean:routerEndpoint", endpoint.getEndpointUri());      
        Bus cxf1 = endpoint.getBus();
       
        assertEquals(cxf1, ctx.getBean("cxf1"));
        assertEquals(cxf1, endpoint.getBus());
        assertEquals("barf", endpoint.getBus().getProperty("foo"));
       
        endpoint = camelContext.getEndpoint("cxf:bean:serviceEndpoint", CxfEndpoint.class);
        assertEquals("Get a wrong endpoint uri", "cxf://bean:serviceEndpoint", endpoint.getEndpointUri());
        Bus cxf2 = endpoint.getBus();
       
        assertEquals(cxf2, ctx.getBean("cxf2"));
        assertEquals(cxf2, endpoint.getBus());
        assertEquals("snarf", endpoint.getBus().getProperty("foo"));
       
    }
View Full Code Here

        return new String[]{"org/apache/camel/component/cxf/spring/CxfEndpointBeans.xml"};
    }

    @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));

        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()));
       
    }
View Full Code Here

public class CamelEndpointSpringConfigureTest extends CamelSpringTestSupport {
   
    @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);       
View Full Code Here

        return (CxfEndpoint)new CxfComponent(context).createEndpoint(uri);
    }

    @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);
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.component.cxf.CxfEndpoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.