Package com.ibatis.jpetstore.domain

Examples of com.ibatis.jpetstore.domain.Order


    public PaginatedList getOrdersByUsername(String username) {
        return queryForPaginatedList("getOrdersByUsername", username, 10);
    }

    public Order getOrder(int orderId) {
        Order order = null;
        Object parameterObject = new Integer(orderId);
        order = (Order) queryForObject("getOrder", parameterObject);
        order.setLineItems(queryForList("getLineItemsByOrderId", new Integer(order.getOrderId())));
        return order;
    }
View Full Code Here


    public OrderBean() {
        this(new AccountService(), new OrderService());
    }

    public OrderBean(AccountService accountService, OrderService orderService) {
        order = new Order();
        shippingAddressRequired = false;
        confirmed = false;
        this.accountService = accountService;
        this.orderService = orderService;
    }
View Full Code Here

    public void reset() {
        shippingAddressRequired = false;
    }

    public void clear() {
        order = new Order();
        orderId = 0;
        shippingAddressRequired = false;
        confirmed = false;
        orderList = null;
        pageDirection = null;
View Full Code Here

            daoManager.endTransaction();
        }
    }

    public Order getOrder(int orderId) {
        Order order = null;

        try {
            daoManager.startTransaction();

            order = orderDao.getOrder(orderId);

            for (int i = 0; i < order.getLineItems().size(); i++) {
                LineItem lineItem = (LineItem) order.getLineItems().get(i);
                lineItem.setItem(itemDao.getItem(lineItem.getItemId()));
            }

            daoManager.commitTransaction();
        } finally {
View Full Code Here

  public OrderBean() {
    this(new AccountService(), new OrderService());
  }

  public OrderBean(AccountService accountService, OrderService orderService) {
    order = new Order();
    shippingAddressRequired = false;
    confirmed = false;
    this.accountService = accountService;
    this.orderService = orderService;
  }
View Full Code Here

  public void reset() {
    shippingAddressRequired = false;
  }

  public void clear() {
    order = new Order();
    orderId = 0;
    shippingAddressRequired = false;
    confirmed = false;
    orderList = null;
    pageDirection = null;
View Full Code Here

    Mock orderDao = mock(OrderDao.class);
    orderDao.expects(once())
        .method("getOrder")
        .with(NOT_NULL)
        .will(returnValue(new Order()));

    Mock daoManager = mock(DaoManager.class);
    daoManager.expects(once())
        .method("startTransaction")
        .withNoArguments();
View Full Code Here

  public void testShouldVerifyItemIsInStock() {
    assertTrue("Expected item to be in stock.", itemDao.isItemInStock(READ_ONLY_ITEM_ID));
  }

  public void testShouldVerifyItemIsOutOfStock() {
    Order order = DomainFixture.newTestOrder();
    itemDao.updateAllQuantitiesFromOrder(order);
    assertFalse("Expected item to be out of stock.", itemDao.isItemInStock(MUTABLE_ITEM_ID));
  }
View Full Code Here

  }

  public void testShouldUpdateInventoryForItem() {
    Item item = itemDao.getItem(MUTABLE_ITEM_ID);
    int inventory = item.getQuantity();
    Order order = DomainFixture.newTestOrder();
    inventory -= ((LineItem)order.getLineItems().get(0)).getQuantity();
    itemDao.updateAllQuantitiesFromOrder(order);
    item = itemDao.getItem(MUTABLE_ITEM_ID);
    assertEquals(inventory, item.getQuantity());
  }
View Full Code Here

  public void testListListOrdersByUsername() {
    Mock accountServiceMock = mock(AccountService.class);
    Mock orderServiceMock = mock(OrderService.class);
    PaginatedArrayList orderList = new PaginatedArrayList(5);
    orderList.add(new Order());
    orderList.add(new Order());
    orderList.add(new Order());
    orderServiceMock.expects(once())
        .method("getOrdersByUsername")
        .with(NOT_NULL)
        .will(returnValue(orderList));
    Map sessionMap = ActionContext.getActionContext().getSessionMap();
View Full Code Here

TOP

Related Classes of com.ibatis.jpetstore.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.