@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()); }
protected ServiceComponent addServiceComponent() throws Exception { long pk = RandomTestUtil.nextLong(); ServiceComponent serviceComponent = _persistence.create(pk); serviceComponent.setMvccVersion(RandomTestUtil.nextLong()); serviceComponent.setBuildNamespace(RandomTestUtil.randomString()); serviceComponent.setBuildNumber(RandomTestUtil.nextLong()); serviceComponent.setBuildDate(RandomTestUtil.nextLong()); serviceComponent.setData(RandomTestUtil.randomString()); _serviceComponents.add(_persistence.update(serviceComponent)); return serviceComponent; }