use of org.broadleafcommerce.profile.core.domain.Customer in project BroadleafCommerce by BroadleafCommerce.
the class CustomerDataProvider method createCustomers.
@DataProvider(name = "setupCustomers")
public static Object[][] createCustomers() {
Customer customer1 = new CustomerImpl();
customer1.setPassword("customer1Password");
customer1.setUsername("customer1");
Customer customer2 = new CustomerImpl();
customer2.setPassword("customer2Password");
customer2.setUsername("customer2");
return new Object[][] { new Object[] { customer1 }, new Object[] { customer2 } };
}
use of org.broadleafcommerce.profile.core.domain.Customer in project BroadleafCommerce by BroadleafCommerce.
the class OrderTest method getOrdersForCustomer.
@Test(groups = { "getOrdersForCustomer" }, dependsOnGroups = { "readCustomer", "findCurrentCartForCustomer" })
@Transactional
public void getOrdersForCustomer() {
String username = "customer1";
Customer customer = customerService.readCustomerByUsername(username);
List<Order> orders = orderService.findOrdersForCustomer(customer);
assert orders != null;
assert orders.size() > 0;
}
use of org.broadleafcommerce.profile.core.domain.Customer in project BroadleafCommerce by BroadleafCommerce.
the class OrderTest method findNamedOrderForCustomer.
@Test(groups = { "findNamedOrderForCustomer" }, dependsOnGroups = { "findOrderByOrderNumber" })
@Transactional
public void findNamedOrderForCustomer() throws PricingException {
Customer customer = customerService.createCustomerFromId(null);
Order order = orderService.createNewCartForCustomer(customer);
order.setStatus(OrderStatus.NAMED);
order.setName("COOL ORDER");
order = orderService.save(order, false);
Long orderId = order.getId();
Order newOrder = orderService.findNamedOrderForCustomer("COOL ORDER", customer);
assert newOrder.getId().equals(orderId);
}
use of org.broadleafcommerce.profile.core.domain.Customer in project BroadleafCommerce by BroadleafCommerce.
the class OrderTest method createCartForCustomer.
@Test(groups = { "createCartForCustomer" }, dependsOnGroups = { "readCustomer", "createPhone" })
@Transactional
@Rollback(false)
public void createCartForCustomer() {
String userName = "customer1";
Customer customer = customerService.readCustomerByUsername(userName);
Order order = orderService.createNewCartForCustomer(customer);
assert order != null;
assert order.getId() != null;
this.orderId = order.getId();
}
use of org.broadleafcommerce.profile.core.domain.Customer in project BroadleafCommerce by BroadleafCommerce.
the class OrderTest method findOrderByOrderNumber.
@Test(groups = { "findOrderByOrderNumber" }, dependsOnGroups = { "findCartForAnonymousCustomer" })
@Transactional
public void findOrderByOrderNumber() throws PricingException {
Customer customer = customerService.createCustomerFromId(null);
Order order = orderService.createNewCartForCustomer(customer);
order.setOrderNumber("3456");
order = orderService.save(order, false);
Long orderId = order.getId();
Order newOrder = orderService.findOrderByOrderNumber("3456");
assert newOrder.getId().equals(orderId);
Order nullOrder = orderService.findOrderByOrderNumber(null);
assert nullOrder == null;
nullOrder = orderService.findOrderByOrderNumber("");
assert nullOrder == null;
}
Aggregations