use of io.syndesis.qe.util.servicenow.model.Incident in project syndesis-qe by syndesisio.
the class ServiceNowValidationSteps method sendIncidentToQueueAndVerifyItWasCreatedInSN.
@When("send {string} incident to {string} queue and verify it was created in SN")
public void sendIncidentToQueueAndVerifyItWasCreatedInSN(String incidentNumber, String queue) {
incidentNumber = snUtils.modifySNNumber(incidentNumber);
final String description = "CRTDINC01" + UUID.randomUUID().toString().substring(0, 8);
Incident i = Incident.getSampleIncident();
i.setNumber(incidentNumber);
i.setDescription(description);
JMSUtils.sendMessage(JMSUtils.Destination.valueOf("QUEUE"), queue, ServiceNow.getIncidentJson(i));
// wait till message gets through integration
TestUtils.sleepForJenkinsDelayIfHigher(5);
List<Incident> list = ServiceNow.getFilteredIncidents("number=" + incidentNumber, 1);
Assertions.assertThat(list).isNotEmpty();
Incident created = list.get(0);
ServiceNow.deleteIncident(created.getSysId());
Assertions.assertThat(created.getNumber()).isEqualToIgnoringCase(i.getNumber());
Assertions.assertThat(created.getDescription()).contains(description);
}
use of io.syndesis.qe.util.servicenow.model.Incident in project syndesis-qe by syndesisio.
the class ServiceNowValidationSteps method createIncidentWithNumber.
@When("create incident with {string} number")
public void createIncidentWithNumber(String number) {
Incident i = Incident.getSampleIncident();
i.setNumber(snUtils.modifySNNumber(number));
i.setDescription("Automated create incident test-updated");
i.setSeverity(BigInteger.valueOf(2));
incidentId = ServiceNow.createIncident(i).getSysId();
}
use of io.syndesis.qe.util.servicenow.model.Incident in project syndesis-qe by syndesisio.
the class ServiceNow method parseResponse.
/**
* Service-Now API returns single object when there is 1 record, but list of records when there are more records.
*
* @param response json response
* @return list of records
*/
private static List<Incident> parseResponse(String response) {
List<Incident> incidents = new ArrayList<>();
try {
IncidentRecordList irl = om.readValue(response, IncidentRecordList.class);
incidents.addAll(irl.getRecords());
return incidents;
} catch (IOException e) {
// Try to parse it as single record response
try {
incidents.add(om.readValue(response, IncidentSingleResponse.class).getRecord());
return incidents;
} catch (IOException e1) {
fail("Unable to unmarshall incident response", e);
}
}
return null;
}
use of io.syndesis.qe.util.servicenow.model.Incident in project syndesis-qe by syndesisio.
the class ServiceNowValidationSteps method verifyIncidentsWithNumber.
@Then("verify that incident with {string} number has {string} description")
public void verifyIncidentsWithNumber(String numbers, String description) {
List<Incident> list = ServiceNow.getFilteredIncidents("number=" + snUtils.modifySNNumber(numbers), 1);
Assertions.assertThat(list).isNotEmpty();
Incident created = list.get(0);
Assertions.assertThat(created.getDescription()).contains(description);
}
Aggregations