Package org.apache.camel.dataformat.soap.name

Examples of org.apache.camel.dataformat.soap.name.ServiceInterfaceStrategy


    }

    @Test
    public void testWithNonWebservice() {
        try {
            new ServiceInterfaceStrategy(Object.class, true);
            Assert.fail("Should throw an exception for a class that is no webservice");
        } catch (IllegalArgumentException e) {
            LOG.debug("Caught expected message: " + e.getMessage());
        }
    }
View Full Code Here


       
        String soapAction = getSoapActionFromExchange(exchange);
       
        // Determine the method name for an eventual BeanProcessor in the route
        if (soapAction != null && elementNameStrategy instanceof ServiceInterfaceStrategy) {
            ServiceInterfaceStrategy strategy = (ServiceInterfaceStrategy) elementNameStrategy;
            String methodName = strategy.getMethodForSoapAction(soapAction);
            exchange.getOut().setHeader(Exchange.BEAN_METHOD_NAME, methodName);
        }
       
        // Store soap action for an eventual later marshal step.
        // This is necessary as the soap action in the message may get lost on the way
View Full Code Here

public class ServiceInterfaceStrategyTest extends Assert {
    private static final Logger LOG = LoggerFactory.getLogger(ServiceInterfaceStrategyTest.class);

    @Test
    public void testServiceInterfaceStrategyWithClient() {
        ServiceInterfaceStrategy strategy = new ServiceInterfaceStrategy(CustomerService.class, true);
        QName elName = strategy.findQNameForSoapActionOrType("", GetCustomersByName.class);
        assertEquals("http://customerservice.example.com/", elName.getNamespaceURI());
        assertEquals("getCustomersByName", elName.getLocalPart());

        QName elName2 = strategy.findQNameForSoapActionOrType("getCustomersByName", GetCustomersByName.class);
        assertEquals("http://customerservice.example.com/", elName2.getNamespaceURI());
        assertEquals("getCustomersByName", elName2.getLocalPart());

        // Tests the case where the soap action is found but the in type is null
        QName elName3 = strategy.findQNameForSoapActionOrType("http://customerservice.example.com/getAllCustomers",
                null);
        assertNull(elName3);

        try {
            elName = strategy.findQNameForSoapActionOrType("test", Class.class);
            fail();
        } catch (RuntimeCamelException e) {
            LOG.debug("Caught expected message: " + e.getMessage());
        }
    }
View Full Code Here

        }
    }

    @Test
    public void testServiceInterfaceStrategyWithServer() {
        ServiceInterfaceStrategy strategy = new ServiceInterfaceStrategy(CustomerService.class, false);

        // Tests the case where the action is not found but the type is
        QName elName = strategy.findQNameForSoapActionOrType("", GetCustomersByNameResponse.class);
        assertEquals("http://customerservice.example.com/", elName.getNamespaceURI());
        assertEquals("getCustomersByNameResponse", elName.getLocalPart());

        // Tests the case where the soap action is found
        QName elName2 = strategy.findQNameForSoapActionOrType("http://customerservice.example.com/getCustomersByName",
                GetCustomersByName.class);
        assertEquals("http://customerservice.example.com/", elName2.getNamespaceURI());
        assertEquals("getCustomersByNameResponse", elName2.getLocalPart());

        // this tests the case that the soap action as well as the type are not
        // found
        try {
            elName = strategy.findQNameForSoapActionOrType("test", Class.class);
            fail();
        } catch (RuntimeCamelException e) {
            LOG.debug("Caught expected message: " + e.getMessage());
        }
    }
View Full Code Here

        }
    }

    @Test
    public void testServiceInterfaceStrategyWithRequestWrapperAndClient() {
        ServiceInterfaceStrategy strategy = new ServiceInterfaceStrategy(
                com.example.customerservice2.CustomerService.class, true);
        QName elName = strategy.findQNameForSoapActionOrType("", com.example.customerservice2.GetCustomersByName.class);
        assertEquals("http://customerservice2.example.com/", elName.getNamespaceURI());
        assertEquals("getCustomersByName", elName.getLocalPart());

        try {
            elName = strategy.findQNameForSoapActionOrType("test", Class.class);
            fail();
        } catch (RuntimeCamelException e) {
            LOG.debug("Caught expected message: " + e.getMessage());
        }
    }
View Full Code Here

    }

    @Test
    public void testWithNonWebservice() {
        try {
            new ServiceInterfaceStrategy(Object.class, true);
            fail("Should throw an exception for a class that is no webservice");
        } catch (IllegalArgumentException e) {
            LOG.debug("Caught expected message: " + e.getMessage());
        }
    }
View Full Code Here

        }
    }
   
    @Test
    public void testMultiPart() {
        ServiceInterfaceStrategy strategy = new ServiceInterfaceStrategy(MultiPartCustomerService.class, true);
        QName custNameQName = strategy.findQNameForSoapActionOrType("http://multipart.customerservice.example.com/getCustomersByName",
                                                                    com.example.customerservice.multipart.GetCustomersByName.class);
        QName custTypeQName = strategy.findQNameForSoapActionOrType("http://multipart.customerservice.example.com/getCustomersByName",
                                                                    com.example.customerservice.multipart.Product.class);
       
        assertEquals("http://multipart.customerservice.example.com/", custNameQName.getNamespaceURI());
        assertEquals("getCustomersByName", custNameQName.getLocalPart());
View Full Code Here

       
        String soapAction = getSoapActionFromExchange(exchange);
       
        // Determine the method name for an eventual BeanProcessor in the route
        if (soapAction != null && elementNameStrategy instanceof ServiceInterfaceStrategy) {
            ServiceInterfaceStrategy strategy = (ServiceInterfaceStrategy) elementNameStrategy;
            String methodName = strategy.getMethodForSoapAction(soapAction);
            exchange.getOut().setHeader(Exchange.BEAN_METHOD_NAME, methodName);
        }
       
        // Store soap action for an eventual later marshal step.
        // This is necessary as the soap action in the message may get lost on the way
View Full Code Here

public class ServiceInterfaceStrategyTest extends Assert {
    private static final Logger LOG = LoggerFactory.getLogger(ServiceInterfaceStrategyTest.class);

    @Test
    public void testServiceInterfaceStrategyWithClient() {
        ServiceInterfaceStrategy strategy = new ServiceInterfaceStrategy(CustomerService.class, true);
        QName elName = strategy.findQNameForSoapActionOrType("", GetCustomersByName.class);
        assertEquals("http://customerservice.example.com/", elName.getNamespaceURI());
        assertEquals("getCustomersByName", elName.getLocalPart());

        QName elName2 = strategy.findQNameForSoapActionOrType("getCustomersByName", GetCustomersByName.class);
        assertEquals("http://customerservice.example.com/", elName2.getNamespaceURI());
        assertEquals("getCustomersByName", elName2.getLocalPart());

        // Tests the case where the soap action is found but the in type is null
        QName elName3 = strategy.findQNameForSoapActionOrType("http://customerservice.example.com/getAllCustomers",
                null);
        assertNull(elName3);
       
        QName elName4 = strategy.findQNameForSoapActionOrType("http://customerservice.example.com/getAllAmericanCustomers",
                null);
        assertNull(elName4);

        try {
            elName = strategy.findQNameForSoapActionOrType("test", Class.class);
            fail();
        } catch (RuntimeCamelException e) {
            LOG.debug("Caught expected message: " + e.getMessage());
        }
    }
View Full Code Here

        }
    }

    @Test
    public void testServiceInterfaceStrategyWithServer() {
        ServiceInterfaceStrategy strategy = new ServiceInterfaceStrategy(CustomerService.class, false);

        // Tests the case where the action is not found but the type is
        QName elName = strategy.findQNameForSoapActionOrType("", GetCustomersByNameResponse.class);
        assertEquals("http://customerservice.example.com/", elName.getNamespaceURI());
        assertEquals("getCustomersByNameResponse", elName.getLocalPart());

        // Tests the case where the soap action is found
        QName elName2 = strategy.findQNameForSoapActionOrType("http://customerservice.example.com/getCustomersByName",
                GetCustomersByName.class);
        assertEquals("http://customerservice.example.com/", elName2.getNamespaceURI());
        assertEquals("getCustomersByNameResponse", elName2.getLocalPart());

        // this tests the case that the soap action as well as the type are not
        // found
        try {
            elName = strategy.findQNameForSoapActionOrType("test", Class.class);
            fail();
        } catch (RuntimeCamelException e) {
            LOG.debug("Caught expected message: " + e.getMessage());
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.dataformat.soap.name.ServiceInterfaceStrategy

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.