Package com.ibatis.jpetstore.domain

Examples of com.ibatis.jpetstore.domain.Item


    } else {
      // isInStock is a "real-time" property that must be updated
      // every time an item is added to the cart, even if other
      // item details are cached.
      boolean isInStock = catalogService.isItemInStock(workingItemId);
      Item item = catalogService.getItem(workingItemId);
      cart.addItem(item, isInStock);
    }

    return SUCCESS;
  }
View Full Code Here


    return SUCCESS;
  }

  public String removeItemFromCart() {

    Item item = cart.removeItemById(workingItemId);

    if (item == null) {
      setMessage("Attempted to remove null CartItem from Cart.");
      return FAILURE;
    } else {
View Full Code Here

    Mock mock = mock(ItemDao.class);

    mock.expects(once())
        .method("getItem")
        .with(NOT_NULL)
        .will(returnValue(new Item()));

    CatalogService service = new CatalogService(null, (ItemDao) mock.proxy(), null);
    service.getItem("EST-1");

  }
View Full Code Here

    CartBean bean = new CartBean((CatalogService) catalogServiceMock.proxy());
    assertEquals(AbstractBean.SUCCESS, bean.viewCart());

    Cart cart = new Cart();
    for (int i = 0; i < cart.getCartItemList().getPageSize() * 2; i++) {
      cart.getCartItemList().add(new Item());
    }
    bean.setCart(cart);
    bean.setPageDirection("next");
    assertEquals(AbstractBean.SUCCESS, bean.switchCartPage());
    assertEquals(1, cart.getCartItemList().getPageIndex());
View Full Code Here

    Mock catalogServiceMock = mock(CatalogService.class);
    catalogServiceMock.expects(atLeastOnce())
        .method("isItemInStock")
        .with(NOT_NULL)
        .will(returnValue(true));
    Item item = new Item();
    item.setItemId("AnID");
    catalogServiceMock.expects(atLeastOnce())
        .method("getItem")
        .with(NOT_NULL)
        .will(returnValue(item));
    CartBean bean = new CartBean((CatalogService) catalogServiceMock.proxy());
View Full Code Here

    Mock catalogServiceMock = mock(CatalogService.class);
    catalogServiceMock.expects(atLeastOnce())
        .method("isItemInStock")
        .with(NOT_NULL)
        .will(returnValue(true));
    Item item = new Item();
    item.setItemId("AnID");
    catalogServiceMock.expects(atLeastOnce())
        .method("getItem")
        .with(NOT_NULL)
        .will(returnValue(item));
    CartBean bean = new CartBean((CatalogService) catalogServiceMock.proxy());
View Full Code Here

    Mock catalogServiceMock = mock(CatalogService.class);
    catalogServiceMock.expects(atLeastOnce())
        .method("isItemInStock")
        .with(NOT_NULL)
        .will(returnValue(true));
    Item item = new Item();
    item.setItemId("AnID");
    catalogServiceMock.expects(atLeastOnce())
        .method("getItem")
        .with(NOT_NULL)
        .will(returnValue(item));
    CartBean bean = new CartBean((CatalogService) catalogServiceMock.proxy());
View Full Code Here

    itemDao.updateAllQuantitiesFromOrder(order);
    assertFalse("Expected item to be out of stock.", itemDao.isItemInStock(MUTABLE_ITEM_ID));
  }

  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

    return queryForPaginatedList("getItemListByProduct", productId, PAGE_SIZE);
  }

  public Item getItem(String itemId) {
    Integer i = (Integer) queryForObject("getInventoryQuantity", itemId);
    Item item = (Item) queryForObject("getItem", itemId);
    item.setQuantity(i.intValue());
    return item;
  }
View Full Code Here

    return queryForPaginatedList("getItemListByProduct", productId, PAGE_SIZE);
  }

  public Item getItem(String itemId) {
    Integer i = (Integer) queryForObject("getInventoryQuantity", itemId);
    Item item = (Item) queryForObject("getItem", itemId);
    item.setQuantity(i.intValue());
    return item;
  }
View Full Code Here

TOP

Related Classes of com.ibatis.jpetstore.domain.Item

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.