use of com.example.customerservice.multipart.GetCustomersByNameResponse in project camel by apache.
the class MultiPartCustomerServiceImpl method getCustomersByName.
@Override
public GetCustomersByNameResponse getCustomersByName(GetCustomersByName parameters, Product product) {
if (product == null) {
throw new IllegalArgumentException("product may not be null");
}
GetCustomersByNameResponse response = new GetCustomersByNameResponse();
Customer customer = new Customer();
customer.setName(product.getName());
customer.setRevenue(100000);
response.getReturn().add(customer);
return response;
}
use of com.example.customerservice.multipart.GetCustomersByNameResponse in project camel by apache.
the class MultiPartCxfServerTest method testSendRequestWithInPart.
@Test
public void testSendRequestWithInPart() throws Exception {
Exchange exchange = producerTemplate.send("direct:start", new Processor() {
public void process(Exchange exchange) throws Exception {
BeanInvocation beanInvocation = new BeanInvocation();
GetCustomersByName getCustomersByName = new GetCustomersByName();
getCustomersByName.setName("Dr. Multipart");
beanInvocation.setMethod(MultiPartCustomerService.class.getMethod("getCustomersByName", GetCustomersByName.class, com.example.customerservice.multipart.Product.class));
Product product = new Product();
product.setName("Multipart Product");
product.setDescription("Useful for lots of things.");
Object[] args = new Object[] { getCustomersByName, product };
beanInvocation.setArgs(args);
exchange.getIn().setBody(beanInvocation);
}
});
if (exchange.getException() != null) {
throw exchange.getException();
}
Object responseObj = exchange.getOut().getBody();
assertTrue(responseObj instanceof GetCustomersByNameResponse);
GetCustomersByNameResponse response = (GetCustomersByNameResponse) responseObj;
assertTrue(response.getReturn().get(0).getName().equals("Multipart Product"));
}
Aggregations