use of com.consol.citrus.annotations.CitrusTest in project citrus-samples by christophd.
the class TodoListIT method testJsonValidationWithFileResource.
@Test
@CitrusTest
public void testJsonValidationWithFileResource() {
variable("todoId", "citrus:randomUUID()");
variable("todoName", "citrus:concat('todo_', citrus:randomNumber(4))");
variable("todoDescription", "Description: ${todoName}");
http().client(todoClient).send().post("/api/todolist").messageType(MessageType.JSON).contentType(ContentType.APPLICATION_JSON.getMimeType()).payload(new ClassPathResource("templates/todo.json"));
http().client(todoClient).receive().response(HttpStatus.OK).messageType(MessageType.PLAINTEXT).payload("${todoId}");
http().client(todoClient).send().get("/api/todo/${todoId}").accept(ContentType.APPLICATION_JSON.getMimeType());
http().client(todoClient).receive().response(HttpStatus.OK).messageType(MessageType.JSON).payload(new ClassPathResource("templates/todo.json"));
}
use of com.consol.citrus.annotations.CitrusTest in project citrus-samples by christophd.
the class TodoListIT method testAddTodoEntry.
@Test
@CitrusTest
public void testAddTodoEntry() {
variable("todoName", "citrus:concat('todo_', citrus:randomNumber(4))");
variable("todoDescription", "Description: ${todoName}");
soap().client(todoClient).send().soapAction("addTodoEntry").payload(new ClassPathResource("templates/addTodoEntryRequest.xml"));
soap().client(todoClient).receive().payload(new ClassPathResource("templates/addTodoEntryResponse.xml"));
soap().client(todoClient).send().soapAction("getTodoList").payload(new ClassPathResource("templates/getTodoListRequest.xml"));
soap().client(todoClient).receive().payload(new ClassPathResource("templates/getTodoListResponse.xml"));
}
use of com.consol.citrus.annotations.CitrusTest in project citrus-samples by christophd.
the class AddImageIT method testAddImageMtom.
@Test
@CitrusTest
public void testAddImageMtom() {
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("addImage").payload("<image:addImage xmlns:image=\"http://www.citrusframework.org/imageService\">" + "<image:id>logo</image:id>" + "<image:image>cid:IMAGE</image:image>" + "</image:addImage>").attachment(attachment).mtomEnabled(true);
soap().server(imageServer).receive().soapAction("addImage").schemaValidation(false).payload("<image:addImage xmlns:image=\"http://www.citrusframework.org/imageService\">" + "<image:id>logo</image:id>" + "<image:image>" + "<xop:Include xmlns:xop=\"http://www.w3.org/2004/08/xop/include\" href=\"cid:IMAGE\"/>" + "</image:image>" + "</image:addImage>").attachmentValidator(new BinarySoapAttachmentValidator()).attachment(attachment);
soap().server(imageServer).send().payload("<image:addImageResponse xmlns:image=\"http://www.citrusframework.org/imageService\">" + "<image:success>true</image:success>" + "</image:addImageResponse>");
soap().client(imageClient).receive().payload("<image:addImageResponse xmlns:image=\"http://www.citrusframework.org/imageService\">" + "<image:success>true</image:success>" + "</image:addImageResponse>");
}
use of com.consol.citrus.annotations.CitrusTest in project citrus-samples by christophd.
the class AddImageIT method testAddImageMtomInline.
@Test
@CitrusTest
public void testAddImageMtomInline() {
SoapAttachment attachment = new SoapAttachment();
attachment.setContentId("IMAGE");
attachment.setContentType("image/png");
attachment.setCharsetName("utf-8");
attachment.setContentResourcePath("image/logo.png");
attachment.setMtomInline(true);
soap().client(imageClient).send().fork(true).soapAction("addImage").payload("<image:addImage xmlns:image=\"http://www.citrusframework.org/imageService\">" + "<image:id>logo</image:id>" + "<image:image>cid:IMAGE</image:image>" + "</image:addImage>").attachment(attachment).mtomEnabled(true);
soap().server(imageServer).receive().soapAction("addImage").payload("<image:addImage xmlns:image=\"http://www.citrusframework.org/imageService\">" + "<image:id>logo</image:id>" + "<image:image>citrus:readFile(image/logo.base64)</image:image>" + "</image:addImage>");
soap().server(imageServer).send().payload("<image:addImageResponse xmlns:image=\"http://www.citrusframework.org/imageService\">" + "<image:success>true</image:success>" + "</image:addImageResponse>");
soap().client(imageClient).receive().payload("<image:addImageResponse xmlns:image=\"http://www.citrusframework.org/imageService\">" + "<image:success>true</image:success>" + "</image:addImageResponse>");
}
use of com.consol.citrus.annotations.CitrusTest in project citrus-samples by christophd.
the class TodoListIT method testMailReportXml.
@Test
@CitrusTest
public void testMailReportXml() {
variable("todoId", "citrus:randomUUID()");
variable("todoName", "citrus:concat('todo_', citrus:randomNumber(4))");
variable("todoDescription", "Description: ${todoName}");
mailServer.getMarshaller().setType(MessageType.XML.name());
clearTodoList();
http().client(todoClient).send().post("/api/todolist").messageType(MessageType.JSON).contentType(ContentType.APPLICATION_JSON.getMimeType()).payload("{ \"id\": \"${todoId}\", \"title\": \"${todoName}\", \"description\": \"${todoDescription}\"}");
http().client(todoClient).receive().response(HttpStatus.OK).messageType(MessageType.PLAINTEXT).payload("${todoId}");
variable("entryCount", "1");
http().client(todoClient).send().get("/api/reporting/mail");
echo("Receive reporting mail");
receive(mailServer).payload(new ClassPathResource("templates/mail.xml")).header(CitrusMailMessageHeaders.MAIL_SUBJECT, "ToDo report");
send(mailServer).payload(new ClassPathResource("templates/mail-response.xml"));
http().client(todoClient).receive().response(HttpStatus.OK);
}
Aggregations