use of com.consol.citrus.annotations.CitrusTest in project citrus-samples by christophd.
the class PlaceOrdersJmsIT method placeBlueberryCookieOrder.
@CitrusTest
public void placeBlueberryCookieOrder() {
variable("orderId", Functions.randomNumber(10L, null));
send(bakeryOrderEndpoint).payload("<order><type>blueberry</type><id>${orderId}</id><amount>1</amount></order>");
repeatOnError().until(new IteratingConditionExpression() {
@Override
public boolean evaluate(int index, TestContext context) {
return index > 20;
}
}).autoSleep(100L).actions(http().client(reportingClient).send().get("/reporting/order").queryParam("id", "${orderId}"), http().client(reportingClient).receive().response(HttpStatus.OK).messageType(MessageType.JSON).payload("{\"status\": true}"));
}
use of com.consol.citrus.annotations.CitrusTest in project citrus-samples by christophd.
the class IncidentManager_Http_IT method testIncidentManager_Http_SchemaInvalid.
@CitrusTest(name = "IncidentManager_Http_SchemaInvalid_IT")
public void testIncidentManager_Http_SchemaInvalid() {
OpenIncident incident = new OpenIncident();
incident.setIncident(new IncidentType());
incident.getIncident().setCaptured(Calendar.getInstance());
incident.getIncident().setComponent(ComponentType.SOFTWARE);
incident.getIncident().setState(StateType.NEW);
incident.getIncident().setDescription("Something missing!");
assertSoapFault().faultCode("{http://schemas.xmlsoap.org/soap/envelope/}Client").faultString("@startsWith('Unmarshalling Error')@").when(send(incidentHttpClient).payloadModel(incident).header(SoapMessageHeaders.SOAP_ACTION, "/IncidentManager/openIncident"));
}
use of com.consol.citrus.annotations.CitrusTest in project citrus-samples by christophd.
the class IncidentManager_Jms_IT method testIncidentManager_Jms_SchemaInvalid.
@CitrusTest(name = "IncidentManager_Jms_SchemaInvalid_IT")
public void testIncidentManager_Jms_SchemaInvalid() {
OpenIncident incident = new OpenIncident();
incident.setIncident(new IncidentType());
incident.getIncident().setCaptured(Calendar.getInstance());
incident.getIncident().setComponent(ComponentType.SOFTWARE);
incident.getIncident().setState(StateType.NEW);
incident.getIncident().setDescription("Something missing!");
send(incidentJmsEndpoint).payloadModel(incident).header(SoapMessageHeaders.SOAP_ACTION, "/IncidentManager/openIncident");
receive(incidentJmsEndpoint).payload("<SOAP-ENV:Fault xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">" + "<faultcode>@contains('Client')@</faultcode>" + "<faultstring>@startsWith('Unmarshalling Error')@</faultstring>" + "</SOAP-ENV:Fault>").header("SOAPJMS_isFault", "true");
}
use of com.consol.citrus.annotations.CitrusTest in project citrus-samples by christophd.
the class TodoListIT method testObjectMarshalling.
@Test
@CitrusTest
public void testObjectMarshalling() {
final UUID uuid = UUID.randomUUID();
variable("todoId", uuid.toString());
variable("todoName", "citrus:concat('todo_', citrus:randomNumber(4))");
variable("todoDescription", "Description: ${todoName}");
http().client(todoClient).send().post("/api/todolist").contentType(ContentType.APPLICATION_XML.getMimeType()).payload(new TodoEntry(uuid, "${todoName}", "${todoDescription}"), marshaller);
http().client(todoClient).receive().response(HttpStatus.OK).messageType(MessageType.PLAINTEXT).payload("${todoId}");
http().client(todoClient).send().get("/api/todo/${todoId}").accept(ContentType.APPLICATION_XML.getMimeType());
http().client(todoClient).receive().response(HttpStatus.OK).validationCallback(new XmlMarshallingValidationCallback<TodoEntry>(marshaller) {
@Override
public void validate(TodoEntry todoEntry, Map<String, Object> headers, TestContext context) {
Assert.assertNotNull(todoEntry);
Assert.assertEquals(todoEntry.getId(), uuid);
}
});
}
use of com.consol.citrus.annotations.CitrusTest in project citrus-samples by christophd.
the class GetImageIT method testGetImageMtom.
@Test
@CitrusTest
public void testGetImageMtom() {
SoapAttachment attachment = new SoapAttachment();
attachment.setContentId("IMAGE");
attachment.setContentType("image/png");
attachment.setCharsetName("utf-8");
attachment.setContentResourcePath("image/logo.png");
soap().client(imageClient).send().fork(true).soapAction("getImage").payload("<image:getImage xmlns:image=\"http://www.citrusframework.org/imageService\">" + "<image:id>IMAGE</image:id>" + "</image:getImage>");
soap().server(imageServer).receive().soapAction("getImage").payload("<image:getImage xmlns:image=\"http://www.citrusframework.org/imageService\">" + "<image:id>IMAGE</image:id>" + "</image:getImage>");
soap().server(imageServer).send().payload("<image:getImageResponse xmlns:image=\"http://www.citrusframework.org/imageService\">" + "<image:image>cid:IMAGE</image:image>" + "</image:getImageResponse>").attachment(attachment).mtomEnabled(true);
soap().client(imageClient).receive().schemaValidation(false).payload("<image:getImageResponse xmlns:image=\"http://www.citrusframework.org/imageService\">" + "<image:image>" + "<xop:Include xmlns:xop=\"http://www.w3.org/2004/08/xop/include\" href=\"cid:IMAGE\"/>" + "</image:image>" + "</image:getImageResponse>").attachmentValidator(new BinarySoapAttachmentValidator()).attachment(attachment);
}
Aggregations