Ejemplo n.º 1
0
  /**
   * Test method for {@link
   * com.google.code.magja.service.order.OrderRemoteServiceImpl#addComment(com.google.code.magja.model.order.Order,
   * java.lang.String, java.lang.String, java.lang.Boolean)}.
   */
  @Test
  public void testAddComment() {

    Order order = new Order();
    order.setId(100000001);

    try {
      service.addComment(order, "pending", "Hello World", false);
    } catch (ServiceException e) {
      fail(e.getMessage());
    }
  }
Ejemplo n.º 2
0
  /**
   * Test method for {@link
   * com.google.code.magja.service.order.OrderRemoteServiceImpl#cancel(com.google.code.magja.model.order.Order)}.
   */
  @Test
  public void testCancel() {

    Order order = new Order();
    order.setId(100000001);

    try {
      service.cancel(order);
    } catch (ServiceException e) {
      fail(e.getMessage());
    }
  }
  /*
   * (non-Javadoc)
   *
   * @see com.google.code.magja.service.product.ProductAttributeRemoteService#
   * listAllAttributes()
   */
  public List<ProductAttribute> listAllAttributes() throws ServiceException {
    List<ProductAttribute> allProductAttributes = new ArrayList<ProductAttribute>();

    try {
      List<ProductAttributeSet> allProductAttributeSets = listAllProductAttributeSet();
      for (ProductAttributeSet productAttributeSet : allProductAttributeSets) {
        List<ProductAttribute> listProductAttributes = listByAttributeSet(productAttributeSet);
        for (ProductAttribute productAttribute : listProductAttributes) {
          allProductAttributes.add(productAttribute);
        }
      }
    } catch (ServiceException e) {
      if (debug) e.printStackTrace();
      throw new ServiceException(e.getMessage());
    }

    return allProductAttributes;
  }
Ejemplo n.º 4
0
  /**
   * Test method for {@link
   * com.google.code.magja.service.order.OrderRemoteServiceImpl#getById(java.lang.Integer)}.
   */
  @Test
  public void testGetById() {

    try {
      Order order = service.getById(100000001);
      // System.out.println(order.toString());

      // System.out.println(order.getCustomer().toString());
      // System.out.println(order.getShippingAddress().toString());
      // System.out.println(order.getBillingAddress().toString());

      // for (OrderItem item : order.getItems())
      //	System.out.println(item.toString());

      assertTrue(order != null);

    } catch (ServiceException e) {
      fail(e.getMessage());
    }
  }
Ejemplo n.º 5
0
  /**
   * Test method for {@link
   * com.google.code.magja.service.order.OrderRemoteServiceImpl#list(com.google.code.magja.model.order.OrderFilter)}.
   */
  @Test
  public void testList() {
    try {

      List<Order> list = service.list(null);
      for (Order order : list) System.out.println(order.toString());

      // TODO: is not working tha find with filter
      // make sure to have a order with billing_name = Joao da Silva
      OrderFilter filter = new OrderFilter();
      filter.getItems().add(new OrderFilterItem("billing_name", "like", "%Silva%"));
      // filter.getItems().add(new OrderFilterItem("billing_lastname", "=", "Martins"));

      List<Order> filtered = service.list(filter);
      for (Order order : filtered) System.out.println(order.toString());

    } catch (ServiceException e) {
      fail(e.getMessage());
    }
  }