protected ShoppingOrder addShoppingOrder() throws Exception { long pk = RandomTestUtil.nextLong(); ShoppingOrder shoppingOrder = _persistence.create(pk); shoppingOrder.setGroupId(RandomTestUtil.nextLong()); shoppingOrder.setCompanyId(RandomTestUtil.nextLong()); shoppingOrder.setUserId(RandomTestUtil.nextLong()); shoppingOrder.setUserName(RandomTestUtil.randomString()); shoppingOrder.setCreateDate(RandomTestUtil.nextDate()); shoppingOrder.setModifiedDate(RandomTestUtil.nextDate()); shoppingOrder.setNumber(RandomTestUtil.randomString()); shoppingOrder.setTax(RandomTestUtil.nextDouble()); shoppingOrder.setShipping(RandomTestUtil.nextDouble()); shoppingOrder.setAltShipping(RandomTestUtil.randomString()); shoppingOrder.setRequiresShipping(RandomTestUtil.randomBoolean()); shoppingOrder.setInsure(RandomTestUtil.randomBoolean()); shoppingOrder.setInsurance(RandomTestUtil.nextDouble()); shoppingOrder.setCouponCodes(RandomTestUtil.randomString()); shoppingOrder.setCouponDiscount(RandomTestUtil.nextDouble()); shoppingOrder.setBillingFirstName(RandomTestUtil.randomString()); shoppingOrder.setBillingLastName(RandomTestUtil.randomString()); shoppingOrder.setBillingEmailAddress(RandomTestUtil.randomString()); shoppingOrder.setBillingCompany(RandomTestUtil.randomString()); shoppingOrder.setBillingStreet(RandomTestUtil.randomString()); shoppingOrder.setBillingCity(RandomTestUtil.randomString()); shoppingOrder.setBillingState(RandomTestUtil.randomString()); shoppingOrder.setBillingZip(RandomTestUtil.randomString()); shoppingOrder.setBillingCountry(RandomTestUtil.randomString()); shoppingOrder.setBillingPhone(RandomTestUtil.randomString()); shoppingOrder.setShipToBilling(RandomTestUtil.randomBoolean()); shoppingOrder.setShippingFirstName(RandomTestUtil.randomString()); shoppingOrder.setShippingLastName(RandomTestUtil.randomString()); shoppingOrder.setShippingEmailAddress(RandomTestUtil.randomString()); shoppingOrder.setShippingCompany(RandomTestUtil.randomString()); shoppingOrder.setShippingStreet(RandomTestUtil.randomString()); shoppingOrder.setShippingCity(RandomTestUtil.randomString()); shoppingOrder.setShippingState(RandomTestUtil.randomString()); shoppingOrder.setShippingZip(RandomTestUtil.randomString()); shoppingOrder.setShippingCountry(RandomTestUtil.randomString()); shoppingOrder.setShippingPhone(RandomTestUtil.randomString()); shoppingOrder.setCcName(RandomTestUtil.randomString()); shoppingOrder.setCcType(RandomTestUtil.randomString()); shoppingOrder.setCcNumber(RandomTestUtil.randomString()); shoppingOrder.setCcExpMonth(RandomTestUtil.nextInt()); shoppingOrder.setCcExpYear(RandomTestUtil.nextInt()); shoppingOrder.setCcVerNumber(RandomTestUtil.randomString()); shoppingOrder.setComments(RandomTestUtil.randomString()); shoppingOrder.setPpTxnId(RandomTestUtil.randomString()); shoppingOrder.setPpPaymentStatus(RandomTestUtil.randomString()); shoppingOrder.setPpPaymentGross(RandomTestUtil.nextDouble()); shoppingOrder.setPpReceiverEmail(RandomTestUtil.randomString()); shoppingOrder.setPpPayerEmail(RandomTestUtil.randomString()); shoppingOrder.setSendOrderEmail(RandomTestUtil.randomBoolean()); shoppingOrder.setSendShippingEmail(RandomTestUtil.randomBoolean()); _shoppingOrders.add(_persistence.update(shoppingOrder)); return shoppingOrder; }
@Test public void testUpdateExisting() throws Exception { long pk = RandomTestUtil.nextLong(); ShoppingOrder newShoppingOrder = _persistence.create(pk); newShoppingOrder.setGroupId(RandomTestUtil.nextLong()); newShoppingOrder.setCompanyId(RandomTestUtil.nextLong()); newShoppingOrder.setUserId(RandomTestUtil.nextLong()); newShoppingOrder.setUserName(RandomTestUtil.randomString()); newShoppingOrder.setCreateDate(RandomTestUtil.nextDate()); newShoppingOrder.setModifiedDate(RandomTestUtil.nextDate()); newShoppingOrder.setNumber(RandomTestUtil.randomString()); newShoppingOrder.setTax(RandomTestUtil.nextDouble()); newShoppingOrder.setShipping(RandomTestUtil.nextDouble()); newShoppingOrder.setAltShipping(RandomTestUtil.randomString()); newShoppingOrder.setRequiresShipping(RandomTestUtil.randomBoolean()); newShoppingOrder.setInsure(RandomTestUtil.randomBoolean()); newShoppingOrder.setInsurance(RandomTestUtil.nextDouble()); newShoppingOrder.setCouponCodes(RandomTestUtil.randomString()); newShoppingOrder.setCouponDiscount(RandomTestUtil.nextDouble()); newShoppingOrder.setBillingFirstName(RandomTestUtil.randomString()); newShoppingOrder.setBillingLastName(RandomTestUtil.randomString()); newShoppingOrder.setBillingEmailAddress(RandomTestUtil.randomString()); newShoppingOrder.setBillingCompany(RandomTestUtil.randomString()); newShoppingOrder.setBillingStreet(RandomTestUtil.randomString()); newShoppingOrder.setBillingCity(RandomTestUtil.randomString()); newShoppingOrder.setBillingState(RandomTestUtil.randomString()); newShoppingOrder.setBillingZip(RandomTestUtil.randomString()); newShoppingOrder.setBillingCountry(RandomTestUtil.randomString()); newShoppingOrder.setBillingPhone(RandomTestUtil.randomString()); newShoppingOrder.setShipToBilling(RandomTestUtil.randomBoolean()); newShoppingOrder.setShippingFirstName(RandomTestUtil.randomString()); newShoppingOrder.setShippingLastName(RandomTestUtil.randomString()); newShoppingOrder.setShippingEmailAddress(RandomTestUtil.randomString()); newShoppingOrder.setShippingCompany(RandomTestUtil.randomString()); newShoppingOrder.setShippingStreet(RandomTestUtil.randomString()); newShoppingOrder.setShippingCity(RandomTestUtil.randomString()); newShoppingOrder.setShippingState(RandomTestUtil.randomString()); newShoppingOrder.setShippingZip(RandomTestUtil.randomString()); newShoppingOrder.setShippingCountry(RandomTestUtil.randomString()); newShoppingOrder.setShippingPhone(RandomTestUtil.randomString()); newShoppingOrder.setCcName(RandomTestUtil.randomString()); newShoppingOrder.setCcType(RandomTestUtil.randomString()); newShoppingOrder.setCcNumber(RandomTestUtil.randomString()); newShoppingOrder.setCcExpMonth(RandomTestUtil.nextInt()); newShoppingOrder.setCcExpYear(RandomTestUtil.nextInt()); newShoppingOrder.setCcVerNumber(RandomTestUtil.randomString()); newShoppingOrder.setComments(RandomTestUtil.randomString()); newShoppingOrder.setPpTxnId(RandomTestUtil.randomString()); newShoppingOrder.setPpPaymentStatus(RandomTestUtil.randomString()); newShoppingOrder.setPpPaymentGross(RandomTestUtil.nextDouble()); newShoppingOrder.setPpReceiverEmail(RandomTestUtil.randomString()); newShoppingOrder.setPpPayerEmail(RandomTestUtil.randomString()); newShoppingOrder.setSendOrderEmail(RandomTestUtil.randomBoolean()); newShoppingOrder.setSendShippingEmail(RandomTestUtil.randomBoolean()); _shoppingOrders.add(_persistence.update(newShoppingOrder)); ShoppingOrder existingShoppingOrder = _persistence.findByPrimaryKey(newShoppingOrder.getPrimaryKey()); Assert.assertEquals(existingShoppingOrder.getOrderId(), newShoppingOrder.getOrderId()); Assert.assertEquals(existingShoppingOrder.getGroupId(), newShoppingOrder.getGroupId()); Assert.assertEquals(existingShoppingOrder.getCompanyId(), newShoppingOrder.getCompanyId()); Assert.assertEquals(existingShoppingOrder.getUserId(), newShoppingOrder.getUserId()); Assert.assertEquals(existingShoppingOrder.getUserName(), newShoppingOrder.getUserName()); Assert.assertEquals( Time.getShortTimestamp(existingShoppingOrder.getCreateDate()), Time.getShortTimestamp(newShoppingOrder.getCreateDate())); Assert.assertEquals( Time.getShortTimestamp(existingShoppingOrder.getModifiedDate()), Time.getShortTimestamp(newShoppingOrder.getModifiedDate())); Assert.assertEquals(existingShoppingOrder.getNumber(), newShoppingOrder.getNumber()); AssertUtils.assertEquals(existingShoppingOrder.getTax(), newShoppingOrder.getTax()); AssertUtils.assertEquals(existingShoppingOrder.getShipping(), newShoppingOrder.getShipping()); Assert.assertEquals(existingShoppingOrder.getAltShipping(), newShoppingOrder.getAltShipping()); Assert.assertEquals( existingShoppingOrder.getRequiresShipping(), newShoppingOrder.getRequiresShipping()); Assert.assertEquals(existingShoppingOrder.getInsure(), newShoppingOrder.getInsure()); AssertUtils.assertEquals(existingShoppingOrder.getInsurance(), newShoppingOrder.getInsurance()); Assert.assertEquals(existingShoppingOrder.getCouponCodes(), newShoppingOrder.getCouponCodes()); AssertUtils.assertEquals( existingShoppingOrder.getCouponDiscount(), newShoppingOrder.getCouponDiscount()); Assert.assertEquals( existingShoppingOrder.getBillingFirstName(), newShoppingOrder.getBillingFirstName()); Assert.assertEquals( existingShoppingOrder.getBillingLastName(), newShoppingOrder.getBillingLastName()); Assert.assertEquals( existingShoppingOrder.getBillingEmailAddress(), newShoppingOrder.getBillingEmailAddress()); Assert.assertEquals( existingShoppingOrder.getBillingCompany(), newShoppingOrder.getBillingCompany()); Assert.assertEquals( existingShoppingOrder.getBillingStreet(), newShoppingOrder.getBillingStreet()); Assert.assertEquals(existingShoppingOrder.getBillingCity(), newShoppingOrder.getBillingCity()); Assert.assertEquals( existingShoppingOrder.getBillingState(), newShoppingOrder.getBillingState()); Assert.assertEquals(existingShoppingOrder.getBillingZip(), newShoppingOrder.getBillingZip()); Assert.assertEquals( existingShoppingOrder.getBillingCountry(), newShoppingOrder.getBillingCountry()); Assert.assertEquals( existingShoppingOrder.getBillingPhone(), newShoppingOrder.getBillingPhone()); Assert.assertEquals( existingShoppingOrder.getShipToBilling(), newShoppingOrder.getShipToBilling()); Assert.assertEquals( existingShoppingOrder.getShippingFirstName(), newShoppingOrder.getShippingFirstName()); Assert.assertEquals( existingShoppingOrder.getShippingLastName(), newShoppingOrder.getShippingLastName()); Assert.assertEquals( existingShoppingOrder.getShippingEmailAddress(), newShoppingOrder.getShippingEmailAddress()); Assert.assertEquals( existingShoppingOrder.getShippingCompany(), newShoppingOrder.getShippingCompany()); Assert.assertEquals( existingShoppingOrder.getShippingStreet(), newShoppingOrder.getShippingStreet()); Assert.assertEquals( existingShoppingOrder.getShippingCity(), newShoppingOrder.getShippingCity()); Assert.assertEquals( existingShoppingOrder.getShippingState(), newShoppingOrder.getShippingState()); Assert.assertEquals(existingShoppingOrder.getShippingZip(), newShoppingOrder.getShippingZip()); Assert.assertEquals( existingShoppingOrder.getShippingCountry(), newShoppingOrder.getShippingCountry()); Assert.assertEquals( existingShoppingOrder.getShippingPhone(), newShoppingOrder.getShippingPhone()); Assert.assertEquals(existingShoppingOrder.getCcName(), newShoppingOrder.getCcName()); Assert.assertEquals(existingShoppingOrder.getCcType(), newShoppingOrder.getCcType()); Assert.assertEquals(existingShoppingOrder.getCcNumber(), newShoppingOrder.getCcNumber()); Assert.assertEquals(existingShoppingOrder.getCcExpMonth(), newShoppingOrder.getCcExpMonth()); Assert.assertEquals(existingShoppingOrder.getCcExpYear(), newShoppingOrder.getCcExpYear()); Assert.assertEquals(existingShoppingOrder.getCcVerNumber(), newShoppingOrder.getCcVerNumber()); Assert.assertEquals(existingShoppingOrder.getComments(), newShoppingOrder.getComments()); Assert.assertEquals(existingShoppingOrder.getPpTxnId(), newShoppingOrder.getPpTxnId()); Assert.assertEquals( existingShoppingOrder.getPpPaymentStatus(), newShoppingOrder.getPpPaymentStatus()); AssertUtils.assertEquals( existingShoppingOrder.getPpPaymentGross(), newShoppingOrder.getPpPaymentGross()); Assert.assertEquals( existingShoppingOrder.getPpReceiverEmail(), newShoppingOrder.getPpReceiverEmail()); Assert.assertEquals( existingShoppingOrder.getPpPayerEmail(), newShoppingOrder.getPpPayerEmail()); Assert.assertEquals( existingShoppingOrder.getSendOrderEmail(), newShoppingOrder.getSendOrderEmail()); Assert.assertEquals( existingShoppingOrder.getSendShippingEmail(), newShoppingOrder.getSendShippingEmail()); }