Search in sources :

Example 6 with GetCustomersByName

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

the class SoapSpringRoundtripTest method testRoundTrip.

@Test
public void testRoundTrip() throws IOException, InterruptedException {
    resultEndpoint.expectedMessageCount(1);
    GetCustomersByName request = new GetCustomersByName();
    request.setName("Mueller");
    producer.sendBody(request);
    resultEndpoint.assertIsSatisfied();
    Exchange exchange = resultEndpoint.getExchanges().get(0);
    GetCustomersByName received = exchange.getIn().getBody(GetCustomersByName.class);
    Assert.assertNotNull(received);
    Assert.assertEquals("Mueller", received.getName());
}
Also used : Exchange(org.apache.camel.Exchange) GetCustomersByName(com.example.customerservice.GetCustomersByName) Test(org.junit.Test)

Example 7 with GetCustomersByName

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

the class SoapUnMarshalTest method testUnMarshalSoap.

@Test
public void testUnMarshalSoap() throws IOException, InterruptedException {
    resultEndpoint.expectedMessageCount(1);
    InputStream in = this.getClass().getResourceAsStream("request.xml");
    producer.sendBody(in);
    resultEndpoint.assertIsSatisfied();
    Exchange exchange = resultEndpoint.getExchanges().get(0);
    Object body = exchange.getIn().getBody();
    assertEquals(GetCustomersByName.class, body.getClass());
    GetCustomersByName request = (GetCustomersByName) body;
    assertEquals("Smith", request.getName());
}
Also used : Exchange(org.apache.camel.Exchange) InputStream(java.io.InputStream) GetCustomersByName(com.example.customerservice.GetCustomersByName) Test(org.junit.Test)

Example 8 with GetCustomersByName

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

the class Soap12MarshalTest method testMarshalNormalObject.

/**
     * Test Soap marshalling by sending a GetCustomerByName object and checking
     * against a xml file.
     *
     * @throws java.io.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)

Example 9 with GetCustomersByName

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

the class Soap12SpringRoundtripTest method testRoundTrip.

@Test
public void testRoundTrip() throws IOException, InterruptedException {
    resultEndpoint.expectedMessageCount(1);
    GetCustomersByName request = new GetCustomersByName();
    request.setName("Mueller");
    producer.sendBody(request);
    resultEndpoint.assertIsSatisfied();
    Exchange exchange = resultEndpoint.getExchanges().get(0);
    GetCustomersByName received = exchange.getIn().getBody(GetCustomersByName.class);
    Assert.assertNotNull(received);
    Assert.assertEquals("Mueller", received.getName());
}
Also used : Exchange(org.apache.camel.Exchange) GetCustomersByName(com.example.customerservice.GetCustomersByName) Test(org.junit.Test)

Example 10 with GetCustomersByName

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

the class SoapCxfClientTest method testSuccess.

@Test
public void testSuccess() throws NoSuchCustomerException {
    GetCustomersByName request = new GetCustomersByName();
    request.setName("test");
    GetCustomersByNameResponse response = customerService.getCustomersByName(request);
    Assert.assertNotNull(response);
    List<Customer> customers = response.getReturn();
    Assert.assertEquals(1, customers.size());
    Assert.assertEquals("test", customers.get(0).getName());
}
Also used : GetCustomersByNameResponse(com.example.customerservice.GetCustomersByNameResponse) Customer(com.example.customerservice.Customer) NoSuchCustomer(com.example.customerservice.NoSuchCustomer) SaveCustomer(com.example.customerservice.SaveCustomer) 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