protected DLFileShortcut addDLFileShortcut() throws Exception { long pk = RandomTestUtil.nextLong(); DLFileShortcut dlFileShortcut = _persistence.create(pk); dlFileShortcut.setUuid(RandomTestUtil.randomString()); dlFileShortcut.setGroupId(RandomTestUtil.nextLong()); dlFileShortcut.setCompanyId(RandomTestUtil.nextLong()); dlFileShortcut.setUserId(RandomTestUtil.nextLong()); dlFileShortcut.setUserName(RandomTestUtil.randomString()); dlFileShortcut.setCreateDate(RandomTestUtil.nextDate()); dlFileShortcut.setModifiedDate(RandomTestUtil.nextDate()); dlFileShortcut.setRepositoryId(RandomTestUtil.nextLong()); dlFileShortcut.setFolderId(RandomTestUtil.nextLong()); dlFileShortcut.setToFileEntryId(RandomTestUtil.nextLong()); dlFileShortcut.setTreePath(RandomTestUtil.randomString()); dlFileShortcut.setActive(RandomTestUtil.randomBoolean()); dlFileShortcut.setStatus(RandomTestUtil.nextInt()); dlFileShortcut.setStatusByUserId(RandomTestUtil.nextLong()); dlFileShortcut.setStatusByUserName(RandomTestUtil.randomString()); dlFileShortcut.setStatusDate(RandomTestUtil.nextDate()); _dlFileShortcuts.add(_persistence.update(dlFileShortcut)); return dlFileShortcut; }
@Test public void testUpdateExisting() throws Exception { long pk = RandomTestUtil.nextLong(); DLFileShortcut newDLFileShortcut = _persistence.create(pk); newDLFileShortcut.setUuid(RandomTestUtil.randomString()); newDLFileShortcut.setGroupId(RandomTestUtil.nextLong()); newDLFileShortcut.setCompanyId(RandomTestUtil.nextLong()); newDLFileShortcut.setUserId(RandomTestUtil.nextLong()); newDLFileShortcut.setUserName(RandomTestUtil.randomString()); newDLFileShortcut.setCreateDate(RandomTestUtil.nextDate()); newDLFileShortcut.setModifiedDate(RandomTestUtil.nextDate()); newDLFileShortcut.setRepositoryId(RandomTestUtil.nextLong()); newDLFileShortcut.setFolderId(RandomTestUtil.nextLong()); newDLFileShortcut.setToFileEntryId(RandomTestUtil.nextLong()); newDLFileShortcut.setTreePath(RandomTestUtil.randomString()); newDLFileShortcut.setActive(RandomTestUtil.randomBoolean()); newDLFileShortcut.setStatus(RandomTestUtil.nextInt()); newDLFileShortcut.setStatusByUserId(RandomTestUtil.nextLong()); newDLFileShortcut.setStatusByUserName(RandomTestUtil.randomString()); newDLFileShortcut.setStatusDate(RandomTestUtil.nextDate()); _dlFileShortcuts.add(_persistence.update(newDLFileShortcut)); DLFileShortcut existingDLFileShortcut = _persistence.findByPrimaryKey(newDLFileShortcut.getPrimaryKey()); Assert.assertEquals(existingDLFileShortcut.getUuid(), newDLFileShortcut.getUuid()); Assert.assertEquals( existingDLFileShortcut.getFileShortcutId(), newDLFileShortcut.getFileShortcutId()); Assert.assertEquals(existingDLFileShortcut.getGroupId(), newDLFileShortcut.getGroupId()); Assert.assertEquals(existingDLFileShortcut.getCompanyId(), newDLFileShortcut.getCompanyId()); Assert.assertEquals(existingDLFileShortcut.getUserId(), newDLFileShortcut.getUserId()); Assert.assertEquals(existingDLFileShortcut.getUserName(), newDLFileShortcut.getUserName()); Assert.assertEquals( Time.getShortTimestamp(existingDLFileShortcut.getCreateDate()), Time.getShortTimestamp(newDLFileShortcut.getCreateDate())); Assert.assertEquals( Time.getShortTimestamp(existingDLFileShortcut.getModifiedDate()), Time.getShortTimestamp(newDLFileShortcut.getModifiedDate())); Assert.assertEquals( existingDLFileShortcut.getRepositoryId(), newDLFileShortcut.getRepositoryId()); Assert.assertEquals(existingDLFileShortcut.getFolderId(), newDLFileShortcut.getFolderId()); Assert.assertEquals( existingDLFileShortcut.getToFileEntryId(), newDLFileShortcut.getToFileEntryId()); Assert.assertEquals(existingDLFileShortcut.getTreePath(), newDLFileShortcut.getTreePath()); Assert.assertEquals(existingDLFileShortcut.getActive(), newDLFileShortcut.getActive()); Assert.assertEquals(existingDLFileShortcut.getStatus(), newDLFileShortcut.getStatus()); Assert.assertEquals( existingDLFileShortcut.getStatusByUserId(), newDLFileShortcut.getStatusByUserId()); Assert.assertEquals( existingDLFileShortcut.getStatusByUserName(), newDLFileShortcut.getStatusByUserName()); Assert.assertEquals( Time.getShortTimestamp(existingDLFileShortcut.getStatusDate()), Time.getShortTimestamp(newDLFileShortcut.getStatusDate())); }