@Test
  public void testUpdateExisting() throws Exception {
    long pk = RandomTestUtil.nextLong();

    ServiceComponent newServiceComponent = _persistence.create(pk);

    newServiceComponent.setMvccVersion(RandomTestUtil.nextLong());

    newServiceComponent.setBuildNamespace(RandomTestUtil.randomString());

    newServiceComponent.setBuildNumber(RandomTestUtil.nextLong());

    newServiceComponent.setBuildDate(RandomTestUtil.nextLong());

    newServiceComponent.setData(RandomTestUtil.randomString());

    _serviceComponents.add(_persistence.update(newServiceComponent));

    ServiceComponent existingServiceComponent =
        _persistence.findByPrimaryKey(newServiceComponent.getPrimaryKey());

    Assert.assertEquals(
        existingServiceComponent.getMvccVersion(), newServiceComponent.getMvccVersion());
    Assert.assertEquals(
        existingServiceComponent.getServiceComponentId(),
        newServiceComponent.getServiceComponentId());
    Assert.assertEquals(
        existingServiceComponent.getBuildNamespace(), newServiceComponent.getBuildNamespace());
    Assert.assertEquals(
        existingServiceComponent.getBuildNumber(), newServiceComponent.getBuildNumber());
    Assert.assertEquals(
        existingServiceComponent.getBuildDate(), newServiceComponent.getBuildDate());
    Assert.assertEquals(existingServiceComponent.getData(), newServiceComponent.getData());
  }
  @Test
  public void testResetOriginalValues() throws Exception {
    ServiceComponent newServiceComponent = addServiceComponent();

    _persistence.clearCache();

    ServiceComponent existingServiceComponent =
        _persistence.findByPrimaryKey(newServiceComponent.getPrimaryKey());

    Assert.assertTrue(
        Validator.equals(
            existingServiceComponent.getBuildNamespace(),
            ReflectionTestUtil.invoke(
                existingServiceComponent, "getOriginalBuildNamespace", new Class<?>[0])));
    Assert.assertEquals(
        Long.valueOf(existingServiceComponent.getBuildNumber()),
        ReflectionTestUtil.<Long>invoke(
            existingServiceComponent, "getOriginalBuildNumber", new Class<?>[0]));
  }