Search in sources :

Example 6 with Incident

use of org.apache.camel.component.servicenow.model.Incident in project camel by apache.

the class ServiceNowTest method testRequestResponseModels.

@Test
public void testRequestResponseModels() throws Exception {
    MockEndpoint mock = getMockEndpoint("mock:servicenow");
    mock.reset();
    mock.expectedMessageCount(1);
    Incident incident = new Incident();
    incident.setDescription("my incident");
    incident.setShortDescription("An incident");
    incident.setSeverity(1);
    incident.setImpact(1);
    template().sendBodyAndHeaders("direct:servicenow", incident, kvBuilder().put(ServiceNowConstants.RESOURCE, ServiceNowConstants.RESOURCE_TABLE).put(ServiceNowConstants.ACTION, ServiceNowConstants.ACTION_CREATE).put(ServiceNowConstants.REQUEST_MODEL, Incident.class).put(ServiceNowConstants.RESPONSE_MODEL, JsonNode.class).put(ServiceNowParams.PARAM_TABLE_NAME, "incident").build());
    mock.assertIsSatisfied();
    Object body = mock.getExchanges().get(0).getIn().getBody();
    assertNotNull(body);
    assertTrue(body instanceof JsonNode);
}
Also used : MockEndpoint(org.apache.camel.component.mock.MockEndpoint) JsonNode(com.fasterxml.jackson.databind.JsonNode) Incident(org.apache.camel.component.servicenow.model.Incident) Test(org.junit.Test)

Aggregations

MockEndpoint (org.apache.camel.component.mock.MockEndpoint)6 Incident (org.apache.camel.component.servicenow.model.Incident)6 Test (org.junit.Test)6 Exchange (org.apache.camel.Exchange)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 List (java.util.List)1 CamelExecutionException (org.apache.camel.CamelExecutionException)1