コード例 #1
0
  protected Address addAddress() throws Exception {
    long pk = RandomTestUtil.nextLong();

    Address address = _persistence.create(pk);

    address.setMvccVersion(RandomTestUtil.nextLong());

    address.setUuid(RandomTestUtil.randomString());

    address.setCompanyId(RandomTestUtil.nextLong());

    address.setUserId(RandomTestUtil.nextLong());

    address.setUserName(RandomTestUtil.randomString());

    address.setCreateDate(RandomTestUtil.nextDate());

    address.setModifiedDate(RandomTestUtil.nextDate());

    address.setClassNameId(RandomTestUtil.nextLong());

    address.setClassPK(RandomTestUtil.nextLong());

    address.setStreet1(RandomTestUtil.randomString());

    address.setStreet2(RandomTestUtil.randomString());

    address.setStreet3(RandomTestUtil.randomString());

    address.setCity(RandomTestUtil.randomString());

    address.setZip(RandomTestUtil.randomString());

    address.setRegionId(RandomTestUtil.nextLong());

    address.setCountryId(RandomTestUtil.nextLong());

    address.setTypeId(RandomTestUtil.nextLong());

    address.setMailing(RandomTestUtil.randomBoolean());

    address.setPrimary(RandomTestUtil.randomBoolean());

    address.setLastPublishDate(RandomTestUtil.nextDate());

    _addresses.add(_persistence.update(address));

    return address;
  }
コード例 #2
0
  @Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    Address newAddress = _persistence.create(pk);

    newAddress.setMvccVersion(RandomTestUtil.nextLong());

    newAddress.setUuid(RandomTestUtil.randomString());

    newAddress.setCompanyId(RandomTestUtil.nextLong());

    newAddress.setUserId(RandomTestUtil.nextLong());

    newAddress.setUserName(RandomTestUtil.randomString());

    newAddress.setCreateDate(RandomTestUtil.nextDate());

    newAddress.setModifiedDate(RandomTestUtil.nextDate());

    newAddress.setClassNameId(RandomTestUtil.nextLong());

    newAddress.setClassPK(RandomTestUtil.nextLong());

    newAddress.setStreet1(RandomTestUtil.randomString());

    newAddress.setStreet2(RandomTestUtil.randomString());

    newAddress.setStreet3(RandomTestUtil.randomString());

    newAddress.setCity(RandomTestUtil.randomString());

    newAddress.setZip(RandomTestUtil.randomString());

    newAddress.setRegionId(RandomTestUtil.nextLong());

    newAddress.setCountryId(RandomTestUtil.nextLong());

    newAddress.setTypeId(RandomTestUtil.nextLong());

    newAddress.setMailing(RandomTestUtil.randomBoolean());

    newAddress.setPrimary(RandomTestUtil.randomBoolean());

    newAddress.setLastPublishDate(RandomTestUtil.nextDate());

    _addresses.add(_persistence.update(newAddress));

    Address existingAddress = _persistence.findByPrimaryKey(newAddress.getPrimaryKey());

    Assert.assertEquals(existingAddress.getMvccVersion(), newAddress.getMvccVersion());
    Assert.assertEquals(existingAddress.getUuid(), newAddress.getUuid());
    Assert.assertEquals(existingAddress.getAddressId(), newAddress.getAddressId());
    Assert.assertEquals(existingAddress.getCompanyId(), newAddress.getCompanyId());
    Assert.assertEquals(existingAddress.getUserId(), newAddress.getUserId());
    Assert.assertEquals(existingAddress.getUserName(), newAddress.getUserName());
    Assert.assertEquals(
        Time.getShortTimestamp(existingAddress.getCreateDate()),
        Time.getShortTimestamp(newAddress.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingAddress.getModifiedDate()),
        Time.getShortTimestamp(newAddress.getModifiedDate()));
    Assert.assertEquals(existingAddress.getClassNameId(), newAddress.getClassNameId());
    Assert.assertEquals(existingAddress.getClassPK(), newAddress.getClassPK());
    Assert.assertEquals(existingAddress.getStreet1(), newAddress.getStreet1());
    Assert.assertEquals(existingAddress.getStreet2(), newAddress.getStreet2());
    Assert.assertEquals(existingAddress.getStreet3(), newAddress.getStreet3());
    Assert.assertEquals(existingAddress.getCity(), newAddress.getCity());
    Assert.assertEquals(existingAddress.getZip(), newAddress.getZip());
    Assert.assertEquals(existingAddress.getRegionId(), newAddress.getRegionId());
    Assert.assertEquals(existingAddress.getCountryId(), newAddress.getCountryId());
    Assert.assertEquals(existingAddress.getTypeId(), newAddress.getTypeId());
    Assert.assertEquals(existingAddress.getMailing(), newAddress.getMailing());
    Assert.assertEquals(existingAddress.getPrimary(), newAddress.getPrimary());
    Assert.assertEquals(
        Time.getShortTimestamp(existingAddress.getLastPublishDate()),
        Time.getShortTimestamp(newAddress.getLastPublishDate()));
  }