Package org.company.recordshop.domain

Examples of org.company.recordshop.domain.Order


  /**
   * {@inheritDoc}
   */
  public void deleteOrder(OrderWithOrderLinesDto object) {
    Assert.notNull(object, "argument [object] may not be null");
    Order existing = orderServiceModelDomainService.readOrder(object
        .getId());
    orderServiceModelDomainService.deleteOrder(existing);
  }
View Full Code Here


    Assert.notNull(source, "argument [source] may not be null");
    Assert.isNull(source.getId(),
        "Can not translate a dto with existing id to a new domain object. Dto: "
            + source);
    Order target = new Order(source.getOrderNumber()

    );
    return fromDto(source, target, translated);

  }
View Full Code Here

    Assert.notNull(source, "argument [source] may not be null");
    Assert.isNull(source.getId(),
        "Can not translate a dto with existing id to a new domain object. Dto: "
            + source);
    Order target = new Order(source.getOrderNumber()

    );
    return fromDto(source, target, translated);

  }
View Full Code Here

     */
    @Test
    @ExpectedException(ConstraintViolationException.class)
    public void testDeleteWithOrders() {
        Customer customer = new Customer("John", "Stayshort", new DateTime("1980-01-01"), 12345);
        Order order = new Order("54321");
        customer.addToOrders(order);
        customerDao.add(customer);
        flush();
        clear();
        assertEquals(1, SimpleJdbcTestUtils.countRowsInTable(simpleJdbcTemplate, "Order_TABLE"));
View Full Code Here

     */
    @Test
    public void testAddWithOrders() {
        Customer customer = new Customer("Johannes", "Vermeer", date(), 2);

        Order order = new Order("AA111");
        order.addToOrderLines(new OrderLine(1, "verf"));
        order.addToOrderLines(new OrderLine(2, "kwast"));
        order.addToOrderLines(new OrderLine(3, "doek"));
        customer.addToOrders(order);

        order = new Order("AA222");
        order.addToOrderLines(new OrderLine(7, "rood"));
        order.addToOrderLines(new OrderLine(8, "penseel"));
        order.addToOrderLines(new OrderLine(9, "ezel"));
        customer.addToOrders(order);

        customerDao.add(customer);
        flush();

View Full Code Here

      } else {

        /* An existing object to be updated */
        if (target.getFromOrders(element.getId()) == null) {
          // Element is not in target yet, read it from the store and add to target
          Order original = orderDao.retrieve(element.getId());
          Order updated = orderWithOrderLinesDtoTranslator.fromDto(
              element, original, translated);
          target.addToOrders(updated);
        } else {
          // Element is in target already, use this object. No need to add to the collection
          orderWithOrderLinesDtoTranslator.fromDto(element, target
View Full Code Here

public class OrderDateDeliveryDateBusinessRuleValidationTest {

    @Test
    public void testOrderDateBeforeDeliveryDateSucceed() {

        Order order = new Order("123456789");

        try {
            order.setOrderDate(new DateTime());
            order.setDeliveryDateTime(new DateTime());

        } catch (BusinessRuleException e) {
            fail("No BusinessRuleException should be thrown." + e.getMessage());
        }
    }
View Full Code Here

    }
   
    @Test
    public void testOrderDateBeforeDeliveryDateFail() {

        Order order = new Order("123456789");

        try {
            order.setDeliveryDateTime(new DateTime(1));
            order.setOrderDate(new DateTime(2));
            fail("A BusinessRuleException should be thrown!");
       
        } catch (BusinessRuleException e) {
            assertTrue( e.getMessage().contains("may not preceed orderDate"));
        }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void validate(Object target, Errors errors) {

        Order order = (Order) target;

        if (order.getOrderDate() != null && order.getDeliveryDateTime() != null) {
            if (order.getOrderDate().isAfter(order.getDeliveryDateTime().getMillis())) {
                errors.rejectValue("deliveryDateTime", "businessrule.OrderDateBeforeDeliveryDate.not.valid", null, "deliveryDate: "
                        + order.getDeliveryDateTime() + " may not preceed orderDate: " + order.getOrderDate());
            }
        }
    }
View Full Code Here

  @Test
  public void testToDtoBiderectionalSucceed() {

    Customer cust = new Customer("Herman", "Bread", new DateTime(
        "2009-11-06"), 4321);
    Order order = new Order("1111");
    cust.addToOrders(order);

    SimpleCustomerDto customerDto = simpleCustomerDtoTranslator.toDto(cust);

    assertEquals(Integer.valueOf(4321), customerDto.getCustomerNr());
View Full Code Here

TOP

Related Classes of org.company.recordshop.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.