Java Code Examples for org.apache.camel.util.StringHelper#removeQuotes()

The following examples show how to use org.apache.camel.util.StringHelper#removeQuotes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OrderServiceTest.java    From camelinaction2 with Apache License 2.0 6 votes vote down vote up
@Test
public void testCreateAndGetOrder() throws Exception {
    String json = "{\"partName\":\"motor\",\"amount\":1,\"customerName\":\"honda\"}";

    log.info("Sending order using json payload: {}", json);

    // use http component to send the order
    String id = template.requestBody("http://localhost:8080/orders", json, String.class);
    assertNotNull(id);

    log.info("Created new order with id " + id);

    // should create a new order with id 3 (json format so its enclosed in quotes)
    assertEquals("\"3\"", id);

    // remove quoutes
    id = StringHelper.removeQuotes(id);

    // use http component to get the order
    String response = template.requestBody("http://localhost:8080/orders/" + id, null, String.class);
    log.info("Response: {}", response);
}
 
Example 2
Source File: SpringOrderServiceTest.java    From camelinaction2 with Apache License 2.0 6 votes vote down vote up
@Test
public void testCreateAndGetOrder() throws Exception {
    String json = "{\"partName\":\"motor\",\"amount\":1,\"customerName\":\"honda\"}";

    log.info("Sending order using json payload: {}", json);

    // use http component to send the order
    String id = template.requestBody("http://localhost:8080/orders", json, String.class);
    assertNotNull(id);

    log.info("Created new order with id " + id);

    // should create a new order with id 3 (json format so its enclosed in quotes)
    assertEquals("\"3\"", id);

    // remove quoutes
    id = StringHelper.removeQuotes(id);

    // use http component to get the order
    String response = template.requestBody("http://localhost:8080/orders/" + id, null, String.class);
    log.info("Response: {}", response);
}