Package com.ibatis.jpetstore.domain

Examples of com.ibatis.jpetstore.domain.Order


  public void testShouldSwitchOrderListPagesBackAndForth() {
    Mock accountServiceMock = mock(AccountService.class);
    Mock orderServiceMock = mock(OrderService.class);
    PaginatedArrayList orderList = new PaginatedArrayList(2);
    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


  public void testShouldClearAllFields() {
    Mock accountServiceMock = mock(AccountService.class);
    Mock orderServiceMock = mock(OrderService.class);
    OrderBean bean = new OrderBean((AccountService)accountServiceMock.proxy(), (OrderService)orderServiceMock.proxy());
    Order order = new Order();
    bean.setOrder(order);
    bean.setShippingAddressRequired(true);
    bean.setOrderId(4);
    bean.setConfirmed(true);
    bean.setPageDirection("not null");
View Full Code Here

    accountBean.setUsername("user");
    sessionMap.put("accountBean", accountBean);

    Mock accountServiceMock = mock(AccountService.class);
    Mock orderServiceMock = mock(OrderService.class);
    Order order = new Order();
    order.setUsername("user");
    orderServiceMock.expects(once())
        .method("getOrder")
        .with(NOT_NULL)
        .will(returnValue(order));
    OrderBean bean = new OrderBean((AccountService)accountServiceMock.proxy(), (OrderService)orderServiceMock.proxy());
View Full Code Here

    accountBean.setUsername("not proper user");
    sessionMap.put("accountBean", accountBean);

    Mock accountServiceMock = mock(AccountService.class);
    Mock orderServiceMock = mock(OrderService.class);
    Order order = new Order();
    order.setUsername("user");
    orderServiceMock.expects(once())
        .method("getOrder")
        .with(NOT_NULL)
        .will(returnValue(order));
    OrderBean bean = new OrderBean((AccountService)accountServiceMock.proxy(), (OrderService)orderServiceMock.proxy());
View Full Code Here

  private static final String USERNAME = "NewUsername";
  private static final String SEQUENCE_NAME = "ordernum";

  public void testShouldInsertNewOrderWithLineItems () {
    Order expected = DomainFixture.newTestOrder();
    int nextId = 900001;
    expected.setOrderId(nextId);
    orderDao.insertOrder(expected);
    Order actual = orderDao.getOrder(nextId);
    assertNotNull(actual);
    assertEquals(1, actual.getLineItems().size());
    assertEquals(new BigDecimal("99.99"), actual.getTotalPrice());
  }
View Full Code Here

    assertEquals(1, actual.getLineItems().size());
    assertEquals(new BigDecimal("99.99"), actual.getTotalPrice());
  }

  public void testShouldListASingleOrderForAUser () {
    Order expected = DomainFixture.newTestOrder();
    int nextId = 900002;
    expected.setOrderId(nextId);
    expected.setUsername(USERNAME);
    orderDao.insertOrder(expected);
    assertEquals(1, orderDao.getOrdersByUsername(USERNAME).size());
  }
View Full Code Here

  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

      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

  }

  /* Constructors */

  public OrderBean() {
    this.order = new Order();
    this.shippingAddressRequired = false;
    this.confirmed = false;
  }
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

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.