public void testFetchByPrimaryKeyExisting() throws Exception { SCFrameworkVersion newSCFrameworkVersion = addSCFrameworkVersion(); SCFrameworkVersion existingSCFrameworkVersion = _persistence.fetchByPrimaryKey(newSCFrameworkVersion.getPrimaryKey()); assertEquals(existingSCFrameworkVersion, newSCFrameworkVersion); }
public void testCreate() throws Exception { long pk = nextLong(); SCFrameworkVersion scFrameworkVersion = _persistence.create(pk); assertNotNull(scFrameworkVersion); assertEquals(scFrameworkVersion.getPrimaryKey(), pk); }
public void testRemove() throws Exception { SCFrameworkVersion newSCFrameworkVersion = addSCFrameworkVersion(); _persistence.remove(newSCFrameworkVersion); SCFrameworkVersion existingSCFrameworkVersion = _persistence.fetchByPrimaryKey(newSCFrameworkVersion.getPrimaryKey()); assertNull(existingSCFrameworkVersion); }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } SCFrameworkVersion scFrameworkVersion = null; try { scFrameworkVersion = (SCFrameworkVersion) obj; } catch (ClassCastException cce) { return false; } long primaryKey = scFrameworkVersion.getPrimaryKey(); if (getPrimaryKey() == primaryKey) { return true; } else { return false; } }
public void testUpdateExisting() throws Exception { long pk = nextLong(); SCFrameworkVersion newSCFrameworkVersion = _persistence.create(pk); newSCFrameworkVersion.setGroupId(nextLong()); newSCFrameworkVersion.setCompanyId(nextLong()); newSCFrameworkVersion.setUserId(nextLong()); newSCFrameworkVersion.setUserName(randomString()); newSCFrameworkVersion.setCreateDate(nextDate()); newSCFrameworkVersion.setModifiedDate(nextDate()); newSCFrameworkVersion.setName(randomString()); newSCFrameworkVersion.setUrl(randomString()); newSCFrameworkVersion.setActive(randomBoolean()); newSCFrameworkVersion.setPriority(nextInt()); _persistence.update(newSCFrameworkVersion, false); SCFrameworkVersion existingSCFrameworkVersion = _persistence.findByPrimaryKey(newSCFrameworkVersion.getPrimaryKey()); assertEquals( existingSCFrameworkVersion.getFrameworkVersionId(), newSCFrameworkVersion.getFrameworkVersionId()); assertEquals(existingSCFrameworkVersion.getGroupId(), newSCFrameworkVersion.getGroupId()); assertEquals(existingSCFrameworkVersion.getCompanyId(), newSCFrameworkVersion.getCompanyId()); assertEquals(existingSCFrameworkVersion.getUserId(), newSCFrameworkVersion.getUserId()); assertEquals(existingSCFrameworkVersion.getUserName(), newSCFrameworkVersion.getUserName()); assertEquals( Time.getShortTimestamp(existingSCFrameworkVersion.getCreateDate()), Time.getShortTimestamp(newSCFrameworkVersion.getCreateDate())); assertEquals( Time.getShortTimestamp(existingSCFrameworkVersion.getModifiedDate()), Time.getShortTimestamp(newSCFrameworkVersion.getModifiedDate())); assertEquals(existingSCFrameworkVersion.getName(), newSCFrameworkVersion.getName()); assertEquals(existingSCFrameworkVersion.getUrl(), newSCFrameworkVersion.getUrl()); assertEquals(existingSCFrameworkVersion.getActive(), newSCFrameworkVersion.getActive()); assertEquals(existingSCFrameworkVersion.getPriority(), newSCFrameworkVersion.getPriority()); }