use of com.consol.citrus.annotations.CitrusTest in project citrus-samples by christophd.
the class GetImageIT method testGetImageMtomInline.
@Test
@CitrusTest
public void testGetImageMtomInline() {
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("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().payload("<image:getImageResponse xmlns:image=\"http://www.citrusframework.org/imageService\">" + "<image:image>citrus:readFile(image/logo.base64)</image:image>" + "</image:getImageResponse>");
}
use of com.consol.citrus.annotations.CitrusTest in project citrus-samples by christophd.
the class PlaceBulkOrderIT method placeBulkCookieOrder.
@CitrusTest
public void placeBulkCookieOrder() {
echo("Add 1000+ order and receive mail");
variable("orderType", "chocolate");
variable("orderId", Functions.randomNumber(10L, null));
variable("amount", 1001L);
send(bakeryOrderEndpoint).payload("<order><type>${orderType}</type><id>${orderId}</id><amount>${amount}</amount></order>");
echo("Receive report mail for 1000+ order");
receive(mailServer).payload(new ClassPathResource("templates/mail.xml")).header(CitrusMailMessageHeaders.MAIL_SUBJECT, "Congratulations!").header(CitrusMailMessageHeaders.MAIL_FROM, "cookie-report@example.com").header(CitrusMailMessageHeaders.MAIL_TO, "stakeholders@example.com");
send(mailServer).payload(new ClassPathResource("templates/mail_response.xml"));
echo("Receive report with 1000+ order");
http().client(reportingClient).send().get("/reporting/json");
http().client(reportingClient).receive().response(HttpStatus.OK).messageType(MessageType.JSON).payload("{\"caramel\": \"@ignore@\",\"blueberry\": \"@ignore@\",\"chocolate\": \"@greaterThan(1000)@\"}");
}
use of com.consol.citrus.annotations.CitrusTest in project citrus-samples by christophd.
the class PlaceOrdersHttpIT method placeCaramelCookieOrder.
@CitrusTest
public void placeCaramelCookieOrder() {
variable("orderId", Functions.randomNumber(10L, null));
http().client(bakeryClient).send().post("/order").contentType(ContentType.APPLICATION_JSON.getMimeType()).payload("{ \"order\": { \"type\": \"caramel\", \"id\": ${orderId}, \"amount\": 1}}");
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}"));
http().client(bakeryClient).receive().response(HttpStatus.OK).messageType(MessageType.PLAINTEXT);
}
use of com.consol.citrus.annotations.CitrusTest in project citrus-samples by christophd.
the class PlaceOrdersHttpIT method placeBlueberryCookieOrder.
@CitrusTest
public void placeBlueberryCookieOrder() {
variable("orderId", Functions.randomNumber(10L, null));
http().client(bakeryClient).send().post("/order").contentType(ContentType.APPLICATION_JSON.getMimeType()).payload("{ \"order\": { \"type\": \"blueberry\", \"id\": ${orderId}, \"amount\": 1}}");
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}"));
http().client(bakeryClient).receive().response(HttpStatus.OK).messageType(MessageType.PLAINTEXT);
}
use of com.consol.citrus.annotations.CitrusTest in project citrus-samples by christophd.
the class ReportOrderMailIT method shouldSendMail.
@CitrusTest
public void shouldSendMail() {
echo("Add 1000+ order and receive mail");
variable("orderType", "chocolate");
http().client(reportingClient).send().put("/reporting").queryParam("id", "citrus:randomNumber(10)").queryParam("name", "${orderType}").queryParam("amount", "1001");
http().client(reportingClient).receive().response(HttpStatus.OK);
echo("Receive report mail for 1000+ order");
receive(mailServer).payload(new ClassPathResource("templates/mail.xml")).header(CitrusMailMessageHeaders.MAIL_SUBJECT, "Congratulations!").header(CitrusMailMessageHeaders.MAIL_FROM, "cookie-report@example.com").header(CitrusMailMessageHeaders.MAIL_TO, "stakeholders@example.com");
send(mailServer).payload(new ClassPathResource("templates/mail_response.xml"));
echo("Receive report with 1000+ order");
http().client(reportingClient).send().get("/reporting/json");
http().client(reportingClient).receive().response(HttpStatus.OK).messageType(MessageType.JSON).payload("{\"caramel\": \"@ignore@\",\"blueberry\": \"@ignore@\",\"chocolate\": \"@greaterThan(1000)@\"}");
}
Aggregations