Package org.books.domain

Examples of org.books.domain.Order


    public void onMessage(Message message) {
        try {
            String id = ((TextMessage) message).getText();

            Order order = entityManager.find(Order.class, Long.parseLong(id));
            order.setStatus(Order.Status.InProgress);

            //timerService.createTimer(500, id); // 20100102, jb: Timer works, but embedded container is not shut down properly
        } catch (JMSException e) {
            throw new EJBException(e);
        }
View Full Code Here


    }

    @Timeout
    public void closeOrder(Timer timer) throws EJBException {
        String msg = (String) timer.getInfo();
        Order order = entityManager.find(Order.class, Long.parseLong(msg));
        order.setStatus(Order.Status.Closed);
    }
View Full Code Here

    public void createOrder(List<LineItem> lineItems, Address address, PaymentInfo paymentInfo) throws Exception {

        double price = priceCalculator.getTotalPrice(lineItems, address, paymentInfo);

        Order order = new Order();
        for (LineItem lineItem : lineItems) {
            order.getLineItems().add(lineItem);
        }
        order.setPrice(price);

        orderDao.addOrder(order);

        sendOrder(order.getId());
    }
View Full Code Here

    @Then("^an order should be created with total price (.+)$")
    public void checkOrderCreationAndPrice(double price) {

        List<Order> orders = orderDao.getOrders();
        assertEquals(1, orders.size());
        Order order = orders.get(0);
        assertEquals(price, order.getPrice(), 0);
    }
View Full Code Here

    public void theOrderStateShouldBe(String state) {
        Order.Status status = Order.Status.valueOf(state);

        List<Order> orders = orderDao.getOrders();
        assertEquals(1, orders.size());
        Order order = orders.get(0);
        assertEquals(status, order.getStatus());
    }
View Full Code Here

TOP

Related Classes of org.books.domain.Order

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.