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);
}
Aggregations