Search in sources :

Example 11 with GetCustomersByName

use of com.example.customerservice.GetCustomersByName in project camel by apache.

the class SoapCxfServerTest method testFault.

@Test
public void testFault() {
    GetCustomersByName request = new GetCustomersByName();
    request.setName("none");
    try {
        customerServiceProxy.getCustomersByName(request);
        Assert.fail("NoSuchCustomerException expected");
    } catch (NoSuchCustomerException e) {
        NoSuchCustomer info = e.getFaultInfo();
        Assert.assertEquals("none", info.getCustomerId());
    }
}
Also used : GetCustomersByName(com.example.customerservice.GetCustomersByName) NoSuchCustomer(com.example.customerservice.NoSuchCustomer) NoSuchCustomerException(com.example.customerservice.NoSuchCustomerException) Test(org.junit.Test)

Example 12 with GetCustomersByName

use of com.example.customerservice.GetCustomersByName in project camel by apache.

the class SoapMarshalTest method testMarshalNormalObject.

/**
     * Test Soap marshalling by sending a GetCustomerByName object and checking
     * against a xml file.
     * 
     * @throws IOException
     * @throws InterruptedException
     */
@Test
public void testMarshalNormalObject() throws IOException, InterruptedException {
    InputStream in = this.getClass().getResourceAsStream("SoapMarshalTestExpectedResult.xml");
    resultEndpoint.expectedMessageCount(1);
    resultEndpoint.expectedBodiesReceived(TestUtil.readStream(in));
    GetCustomersByName request = new GetCustomersByName();
    request.setName("Smith");
    producer.sendBody(request);
    resultEndpoint.assertIsSatisfied();
}
Also used : InputStream(java.io.InputStream) GetCustomersByName(com.example.customerservice.GetCustomersByName) Test(org.junit.Test)

Aggregations

GetCustomersByName (com.example.customerservice.GetCustomersByName)12 Test (org.junit.Test)12 Exchange (org.apache.camel.Exchange)5 NoSuchCustomer (com.example.customerservice.NoSuchCustomer)4 InputStream (java.io.InputStream)4 Customer (com.example.customerservice.Customer)3 GetCustomersByNameResponse (com.example.customerservice.GetCustomersByNameResponse)3 NoSuchCustomerException (com.example.customerservice.NoSuchCustomerException)2 SaveCustomer (com.example.customerservice.SaveCustomer)1