id = new FacesRequest("/checkout.xhtml", id) {
@Override
protected void invokeApplication() throws Exception {
invokeAction("#{checkout.createOrder}");
Order order = (Order) getValue("#{currentOrder}");
assert order!=null;
}
}.run();
id = new NonFacesRequest("/confirm.xhtml", id) {
}.run();
final Wrapper<Long> orderId = new Wrapper<Long>();
id = new FacesRequest("/confirm.xhtml", id) {
protected void invokeApplication() throws Exception {
invokeAction("#{checkout.submitOrder}");
}
@Override
protected void renderResponse() throws Exception {
Order order = (Order) getValue("#{completedOrder}");
assert order!=null;
assert order.getCustomer().getUserName().equals("user1");
assert order.getStatus().equals(Status.OPEN);
orderId.setValue(order.getOrderId());
}
}.run();
return orderId.getValue();
}