Package com.ibatis.jpetstore.domain

Examples of com.ibatis.jpetstore.domain.Item


    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


    } 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) {
      ActionContext.getActionContext().setSimpleMessage("Attempted to remove null CartItem from Cart.");
      return "failure";
    } else {
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

        } 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

  public void testShouldPopulateItemByIdForViewing() {
    Mock catalogServiceMock = mock(CatalogService.class);
    catalogServiceMock.expects(once())
        .method("getItem")
        .with(NOT_NULL)
        .will(returnValue(new Item()));
    CatalogBean bean = new CatalogBean((CatalogService) catalogServiceMock.proxy());
    bean.setItemId("FS-SW-1");
    assertEquals(AbstractBean.SUCCESS, bean.viewItem());
    assertNotNull(bean.getItem());
  }
View Full Code Here

  public void testShouldSwitchItemPageBackAndForth() {
    Mock catalogServiceMock = mock(CatalogService.class);
    CatalogBean bean = new CatalogBean((CatalogService) catalogServiceMock.proxy());
    PaginatedList itemList = new PaginatedArrayList(2);
    itemList.add(new Item());
    itemList.add(new Item());
    itemList.add(new Item());
    itemList.add(new Item());
    itemList.add(new Item());
    bean.setItemList(itemList);

    bean.setPageDirection("next");
    assertEquals(AbstractBean.SUCCESS, bean.switchItemListPage());
    assertEquals(1, itemList.getPageIndex());
View Full Code Here

    bean.setCategoryId("not null");
    bean.setProductId("not null");
    bean.setItemId("not null");
    bean.setCategory(new Category());
    bean.setProduct(new Product());
    bean.setItem(new Item());
    bean.setCategoryList(new PaginatedArrayList(2));
    bean.setProductList(new PaginatedArrayList(2));
    bean.setItemList(new PaginatedArrayList(2));
    bean.clear();
    assertNull(bean.getKeyword());
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.