use of com.example.customerservice.multipart.Company in project camel by apache.
the class MultiPartCustomerServiceImpl method saveCustomer.
@Override
public void saveCustomer(SaveCustomer parameters, Product product, Holder<Company> company) {
if (product == null) {
throw new IllegalArgumentException("product may not be null.");
}
if (company == null) {
throw new IllegalArgumentException("company may not be null.");
}
Company returnCompany = new Company();
returnCompany.setName("MultipartSoft");
returnCompany.setPresident("Dr. Multipart");
company.value = returnCompany;
lastSavedCustomer = parameters.getCustomer();
}
use of com.example.customerservice.multipart.Company in project camel by apache.
the class MultiPartCxfServerTest method testSendRequestWithInAndInOutParts.
@Test
public void testSendRequestWithInAndInOutParts() throws Exception {
Exchange exchange = producerTemplate.send("direct:start", new Processor() {
public void process(Exchange exchange) throws Exception {
BeanInvocation beanInvocation = new BeanInvocation();
beanInvocation.setMethod(MultiPartCustomerService.class.getMethod("saveCustomer", SaveCustomer.class, Product.class, Holder.class));
Customer customer = new Customer();
customer.setName("TestCustomer");
customer.setRevenue(50000);
SaveCustomer saveCustomer = new SaveCustomer();
saveCustomer.setCustomer(customer);
Product product = new Product();
product.setName("Multiuse Product");
product.setDescription("Useful for lots of things.");
Holder<Company> holder = new Holder<Company>();
Object[] args = new Object[] { saveCustomer, product, holder };
beanInvocation.setArgs(args);
exchange.getIn().setBody(beanInvocation);
}
});
if (exchange.getException() != null) {
throw exchange.getException();
}
@SuppressWarnings("unchecked") List<Object> headers = (List<Object>) exchange.getOut().getHeader(SoapJaxbDataFormat.SOAP_UNMARSHALLED_HEADER_LIST);
assertTrue(headers.size() == 1);
Object companyHeaderObj = headers.get(0);
assertTrue(companyHeaderObj instanceof Company);
assertTrue(((Company) companyHeaderObj).getName().equals("MultipartSoft"));
}
use of com.example.customerservice.multipart.Company in project camel by apache.
the class MultiPartCxfServerTest method testSendRequestWithReusedInAndInOutParts.
/**
* This test validates the end-to-end behavior of the service interface mapping when a parameter type
* is defined with a different QName in two different Web method. It also tests the case where a
* QName and type are directly reused across methods.
*/
@Test
public void testSendRequestWithReusedInAndInOutParts() throws Exception {
Exchange exchange = producerTemplate.send("direct:start", new Processor() {
public void process(Exchange exchange) throws Exception {
BeanInvocation beanInvocation = new BeanInvocation();
beanInvocation.setMethod(MultiPartCustomerService.class.getMethod("saveCustomerToo", SaveCustomer.class, Product.class, Holder.class));
Customer customer = new Customer();
customer.setName("TestCustomerToo");
customer.setRevenue(50000);
SaveCustomer saveCustomer = new SaveCustomer();
saveCustomer.setCustomer(customer);
Product product = new Product();
product.setName("Multiuse Product");
product.setDescription("Useful for lots of things.");
Holder<Company> holder = new Holder<Company>();
Object[] args = new Object[] { saveCustomer, product, holder };
beanInvocation.setArgs(args);
exchange.getIn().setBody(beanInvocation);
}
});
if (exchange.getException() != null) {
throw exchange.getException();
}
@SuppressWarnings("unchecked") List<Object> headers = (List<Object>) exchange.getOut().getHeader(SoapJaxbDataFormat.SOAP_UNMARSHALLED_HEADER_LIST);
assertTrue(headers.size() == 1);
Object companyHeaderObj = headers.get(0);
assertTrue(companyHeaderObj instanceof Company);
assertTrue(((Company) companyHeaderObj).getName().equals("MultipartSoft"));
}
use of com.example.customerservice.multipart.Company in project camel by apache.
the class MultiPartCustomerServiceImpl method saveCustomerToo.
@Override
public void saveCustomerToo(SaveCustomer parameters, Product product, Holder<Company> company) {
if (product == null) {
throw new IllegalArgumentException("product may not be null.");
}
if (company == null) {
throw new IllegalArgumentException("company may not be null.");
}
Company returnCompany = new Company();
returnCompany.setName("MultipartSoft");
returnCompany.setPresident("Dr. Multipart");
company.value = returnCompany;
lastSavedCustomer = parameters.getCustomer();
}
Aggregations