try {
System.out.println("Creating customer");
Customer customer = generateCustomer();
customerService.save(customer);
CustomerAddress shipAddr = generateAddress();
CustomerAddress billAddr = generateAddress();
shipAddr.setCustomer(customer);
shipAddr.setDefaultBilling(false);
shipAddr.setDefaultShipping(true);
billAddr.setCustomer(customer);
billAddr.setDefaultBilling(true);
billAddr.setDefaultShipping(false);
System.out.println("Creating default ship addr");
customerAddressService.save(shipAddr);
System.out.println("Creating default bill addr");
customerAddressService.save(billAddr);
System.out.println("Creating cart");
Cart cart = service.create(0);
System.out.println("Created cart " + cart);
System.out.println("Setting customer");
cart.setCustomer(customer);
service.setCustomer(cart);
System.out.println("Adding product");
Product p = new Product();
p.setSku("NI3TP"); //FIXME
p.setId(53); //FIXME
service.addProduct(cart, p, 1);
System.out.println("Setting cart addresses");
System.err.println(shipAddr.getAllProperties());
CartAddress cartShipAddr = CartAddress.fromAttributes(shipAddr.getAllProperties());
CartAddress cartBillAddr = CartAddress.fromAttributes(billAddr.getAllProperties());
cart.setBillingaddress(cartBillAddr);
cart.setShippingAddress(cartShipAddr);
service.setAddresses(cart);
System.out.println("Creating order");