コード例 #1
0
  protected Release addRelease() throws Exception {
    long pk = ServiceTestUtil.nextLong();

    Release release = _persistence.create(pk);

    release.setMvccVersion(ServiceTestUtil.nextLong());

    release.setCreateDate(ServiceTestUtil.nextDate());

    release.setModifiedDate(ServiceTestUtil.nextDate());

    release.setServletContextName(ServiceTestUtil.randomString());

    release.setBuildNumber(ServiceTestUtil.nextInt());

    release.setBuildDate(ServiceTestUtil.nextDate());

    release.setVerified(ServiceTestUtil.randomBoolean());

    release.setState(ServiceTestUtil.nextInt());

    release.setTestString(ServiceTestUtil.randomString());

    _persistence.update(release);

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

    Release newRelease = _persistence.create(pk);

    newRelease.setMvccVersion(ServiceTestUtil.nextLong());

    newRelease.setCreateDate(ServiceTestUtil.nextDate());

    newRelease.setModifiedDate(ServiceTestUtil.nextDate());

    newRelease.setServletContextName(ServiceTestUtil.randomString());

    newRelease.setBuildNumber(ServiceTestUtil.nextInt());

    newRelease.setBuildDate(ServiceTestUtil.nextDate());

    newRelease.setVerified(ServiceTestUtil.randomBoolean());

    newRelease.setState(ServiceTestUtil.nextInt());

    newRelease.setTestString(ServiceTestUtil.randomString());

    _persistence.update(newRelease);

    Release existingRelease = _persistence.findByPrimaryKey(newRelease.getPrimaryKey());

    Assert.assertEquals(existingRelease.getMvccVersion(), newRelease.getMvccVersion());
    Assert.assertEquals(existingRelease.getReleaseId(), newRelease.getReleaseId());
    Assert.assertEquals(
        Time.getShortTimestamp(existingRelease.getCreateDate()),
        Time.getShortTimestamp(newRelease.getCreateDate()));
    Assert.assertEquals(
        Time.getShortTimestamp(existingRelease.getModifiedDate()),
        Time.getShortTimestamp(newRelease.getModifiedDate()));
    Assert.assertEquals(
        existingRelease.getServletContextName(), newRelease.getServletContextName());
    Assert.assertEquals(existingRelease.getBuildNumber(), newRelease.getBuildNumber());
    Assert.assertEquals(
        Time.getShortTimestamp(existingRelease.getBuildDate()),
        Time.getShortTimestamp(newRelease.getBuildDate()));
    Assert.assertEquals(existingRelease.getVerified(), newRelease.getVerified());
    Assert.assertEquals(existingRelease.getState(), newRelease.getState());
    Assert.assertEquals(existingRelease.getTestString(), newRelease.getTestString());
  }