Search in sources :

Example 1 with GetCustomersByNameResponse

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

the class SoapClientTest method testRoundTripGetCustomersByName.

@Test
public void testRoundTripGetCustomersByName() throws Exception {
    GetCustomersByNameResponse response = customerService.getCustomersByName(new GetCustomersByName());
    assertEquals(1, response.getReturn().size());
    Customer firstCustomer = response.getReturn().get(0);
    assertEquals(100000.0, firstCustomer.getRevenue(), 0.0D);
}
Also used : GetCustomersByNameResponse(com.example.customerservice.GetCustomersByNameResponse) Customer(com.example.customerservice.Customer) GetCustomersByName(com.example.customerservice.GetCustomersByName) Test(org.junit.Test)

Example 2 with GetCustomersByNameResponse

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

the class SoapCxfServerTest method testSuccess.

@Test
public void testSuccess() throws NoSuchCustomerException {
    GetCustomersByName request = new GetCustomersByName();
    request.setName("test");
    GetCustomersByNameResponse response = customerServiceProxy.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) GetCustomersByName(com.example.customerservice.GetCustomersByName) Test(org.junit.Test)

Example 3 with GetCustomersByNameResponse

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

the class CustomerServiceImpl method getCustomersByName.

/**
     * If the request.name is "none" a NoSuchCustomerException is thrown in any
     * other case a dummy customer is returned that has the same name as the
     * request
     */
public GetCustomersByNameResponse getCustomersByName(GetCustomersByName request) throws NoSuchCustomerException {
    if ("none".equals(request.getName())) {
        NoSuchCustomer noSuchCustomer = new NoSuchCustomer();
        noSuchCustomer.setCustomerId(request.getName());
        throw new NoSuchCustomerException("Customer not found", noSuchCustomer);
    }
    GetCustomersByNameResponse response = new GetCustomersByNameResponse();
    Customer customer = new Customer();
    customer.setName(request.getName());
    customer.setRevenue(100000);
    response.getReturn().add(customer);
    return response;
}
Also used : GetCustomersByNameResponse(com.example.customerservice.GetCustomersByNameResponse) Customer(com.example.customerservice.Customer) NoSuchCustomer(com.example.customerservice.NoSuchCustomer) SaveCustomer(com.example.customerservice.SaveCustomer) NoSuchCustomer(com.example.customerservice.NoSuchCustomer) NoSuchCustomerException(com.example.customerservice.NoSuchCustomerException)

Example 4 with GetCustomersByNameResponse

use of com.example.customerservice.GetCustomersByNameResponse 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

Customer (com.example.customerservice.Customer)4 GetCustomersByNameResponse (com.example.customerservice.GetCustomersByNameResponse)4 GetCustomersByName (com.example.customerservice.GetCustomersByName)3 NoSuchCustomer (com.example.customerservice.NoSuchCustomer)3 Test (org.junit.Test)3 SaveCustomer (com.example.customerservice.SaveCustomer)2 NoSuchCustomerException (com.example.customerservice.NoSuchCustomerException)1