Search in sources :

Example 1 with Customer

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

the class CustomerServiceImpl method getAllCustomers.

/**
     * This method is to test a call without input parameter
     */
public GetAllCustomersResponse getAllCustomers() {
    GetAllCustomersResponse response = new GetAllCustomersResponse();
    Customer customer = new Customer();
    customer.setName("Smith");
    customer.setRevenue(100000);
    response.getReturn().add(customer);
    return response;
}
Also used : GetAllCustomersResponse(com.example.customerservice.GetAllCustomersResponse) Customer(com.example.customerservice.Customer) NoSuchCustomer(com.example.customerservice.NoSuchCustomer) SaveCustomer(com.example.customerservice.SaveCustomer)

Example 2 with Customer

use of com.example.customerservice.Customer 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 3 with Customer

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

the class SoapCxfClientTest method testRoundTripGetAllCustomers.

@Test
public void testRoundTripGetAllCustomers() throws Exception {
    GetAllCustomersResponse response = customerService.getAllCustomers();
    Assert.assertEquals(1, response.getReturn().size());
    Customer firstCustomer = response.getReturn().get(0);
    Assert.assertEquals(100000.0, firstCustomer.getRevenue(), 0.00001);
}
Also used : GetAllCustomersResponse(com.example.customerservice.GetAllCustomersResponse) Customer(com.example.customerservice.Customer) NoSuchCustomer(com.example.customerservice.NoSuchCustomer) SaveCustomer(com.example.customerservice.SaveCustomer) Test(org.junit.Test)

Example 4 with Customer

use of com.example.customerservice.Customer 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 5 with Customer

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

Aggregations

Customer (com.example.customerservice.Customer)8 NoSuchCustomer (com.example.customerservice.NoSuchCustomer)7 SaveCustomer (com.example.customerservice.SaveCustomer)6 Test (org.junit.Test)5 GetCustomersByNameResponse (com.example.customerservice.GetCustomersByNameResponse)4 GetCustomersByName (com.example.customerservice.GetCustomersByName)3 GetAllCustomersResponse (com.example.customerservice.GetAllCustomersResponse)2 GetAllAmericanCustomersResponse (com.example.customerservice.GetAllAmericanCustomersResponse)1 NoSuchCustomerException (com.example.customerservice.NoSuchCustomerException)1