Package org.apache.camel.component.cxf.jaxrs.testbean

Examples of org.apache.camel.component.cxf.jaxrs.testbean.Customer


            Exchange.HTTP_METHOD, "POST", String.class);
    }

    @Test
    public void testRestServerDirectlyAddCustomerWithExceptionsTurnedOff() {
        Customer input = new Customer();
        input.setName("Donald Duck");

        String response = template.requestBodyAndHeader("cxfrs:http://localhost:9002/wrongurl?throwExceptionOnFailure=false", input,
            Exchange.HTTP_METHOD, "POST", String.class);

        assertNotNull(response);
View Full Code Here


            }
           
        });
    
        // get the response message
        Customer response = (Customer) exchange.getOut().getBody();
       
        assertNotNull("The response should not be null ", response);
        assertEquals("Get a wrong customer id ", String.valueOf(response.getId()), "123");
        assertEquals("Get a wrong customer name", response.getName(), "John");
        // END SNIPPET: ProxyExample    
    }
View Full Code Here

            }
           
        });
    
        // get the response message
        Customer response = (Customer) exchange.getOut().getBody();
       
        assertNotNull("The response should not be null ", response);
        assertEquals("Get a wrong customer id ", String.valueOf(response.getId()), "123");
        assertEquals("Get a wrong customer name", response.getName(), "John");
        // END SNIPPET: HttpExample
    }
View Full Code Here

            }
           
        });
    
        // get the response message
        Customer response = (Customer) exchange.getOut().getBody();
       
        assertNotNull("The response should not be null ", response);
        assertEquals("Get a wrong customer id ", String.valueOf(response.getId()), "123");
        assertEquals("Get a wrong customer name", response.getName(), "John");
       
    }
View Full Code Here

                // set the relative path
                inMessage.setHeader(Exchange.HTTP_PATH, "/customerservice/customersUniqueResponseCode");               
                // put the response's entity into out message body
                inMessage.setHeader(CxfConstants.CAMEL_CXF_RS_RESPONSE_CLASS, Customer.class);
                // create a new customer object
                Customer customer = new Customer();
                customer.setId(8888);
                customer.setName("Willem");
                inMessage.setBody(customer);               
            }
           
        });
       
        // get the response message
        Customer response = (Customer) exchange.getOut().getBody();
       
        assertNotNull("The response should not be null ", response);
        assertTrue("Get a wrong customer id ", response.getId() != 8888);
        assertEquals("Get a wrong customer name", response.getName(), "Willem");
    }
View Full Code Here

                        if ("getCustomer".equals(operationName)) {
                            String httpMethod = inMessage.getHeader(Exchange.HTTP_METHOD, String.class);
                            assertEquals("Get a wrong http method", "GET", httpMethod);
                            String uri = inMessage.getHeader(Exchange.HTTP_URI, String.class);
                            if ("/customerservice/customers/126".equals(uri)) {                           
                                Customer customer = new Customer();
                                customer.setId(Long.parseLong(id));
                                customer.setName("Willem");
                                // We just put the response Object into the out message body
                                exchange.getOut().setBody(customer);
                            } else {
                                Response r = Response.status(404).entity("Can't found the customer with uri " + uri).build();
                                throw new WebApplicationException(r);
View Full Code Here

            }
           
        });
    
        // get the response message
        Customer response = (Customer) exchange.getOut().getBody();
       
        assertNotNull("The response should not be null ", response);
        assertEquals("Get a wrong customer id ", String.valueOf(response.getId()), "123");
        assertEquals("Get a wrong customer name", response.getName(), "John");
        // END SNIPPET: ProxyExample    
    }
View Full Code Here

            }
           
        });
    
        // get the response message
        Customer response = (Customer) exchange.getOut().getBody();
       
        assertNotNull("The response should not be null ", response);
        assertEquals("Get a wrong customer id ", String.valueOf(response.getId()), "123");
        assertEquals("Get a wrong customer name", response.getName(), "John");
        // END SNIPPET: HttpExample
    }
View Full Code Here

            }
           
        });
    
        // get the response message
        Customer response = (Customer) exchange.getOut().getBody();
       
        assertNotNull("The response should not be null ", response);
        assertEquals("Get a wrong customer id ", String.valueOf(response.getId()), "123");
        assertEquals("Get a wrong customer name", response.getName(), "John");
       
    }
View Full Code Here

                        if ("getCustomer".equals(operationName)) {
                            String httpMethod = inMessage.getHeader(Exchange.HTTP_METHOD, String.class);
                            assertEquals("Get a wrong http method", "GET", httpMethod);
                            String uri = inMessage.getHeader(Exchange.HTTP_URI, String.class);                           
                            assertEquals("Get a wrong http uri", "/customerservice/customers/126", uri);
                            Customer customer = new Customer();
                            customer.setId(Long.parseLong(id));
                            customer.setName("Willem");
                            // We just put the response Object into the out message body
                            exchange.getOut().setBody(customer);
                        }
                    }
                   
View Full Code Here

TOP

Related Classes of org.apache.camel.component.cxf.jaxrs.testbean.Customer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.