@Test public void testResetOriginalValues() throws Exception { if (!PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) { return; } DLFileEntryMetadata newDLFileEntryMetadata = addDLFileEntryMetadata(); _persistence.clearCache(); DLFileEntryMetadataModelImpl existingDLFileEntryMetadataModelImpl = (DLFileEntryMetadataModelImpl) _persistence.findByPrimaryKey(newDLFileEntryMetadata.getPrimaryKey()); Assert.assertEquals( existingDLFileEntryMetadataModelImpl.getDDMStructureId(), existingDLFileEntryMetadataModelImpl.getOriginalDDMStructureId()); Assert.assertEquals( existingDLFileEntryMetadataModelImpl.getFileVersionId(), existingDLFileEntryMetadataModelImpl.getOriginalFileVersionId()); Assert.assertEquals( existingDLFileEntryMetadataModelImpl.getFileEntryId(), existingDLFileEntryMetadataModelImpl.getOriginalFileEntryId()); Assert.assertEquals( existingDLFileEntryMetadataModelImpl.getFileVersionId(), existingDLFileEntryMetadataModelImpl.getOriginalFileVersionId()); }
@Test public void testFetchByPrimaryKeyExisting() throws Exception { DLFileEntryMetadata newDLFileEntryMetadata = addDLFileEntryMetadata(); DLFileEntryMetadata existingDLFileEntryMetadata = _persistence.fetchByPrimaryKey(newDLFileEntryMetadata.getPrimaryKey()); Assert.assertEquals(existingDLFileEntryMetadata, newDLFileEntryMetadata); }
@Test public void testCreate() throws Exception { long pk = ServiceTestUtil.nextLong(); DLFileEntryMetadata dlFileEntryMetadata = _persistence.create(pk); Assert.assertNotNull(dlFileEntryMetadata); Assert.assertEquals(dlFileEntryMetadata.getPrimaryKey(), pk); }
@Test public void testRemove() throws Exception { DLFileEntryMetadata newDLFileEntryMetadata = addDLFileEntryMetadata(); _persistence.remove(newDLFileEntryMetadata); DLFileEntryMetadata existingDLFileEntryMetadata = _persistence.fetchByPrimaryKey(newDLFileEntryMetadata.getPrimaryKey()); Assert.assertNull(existingDLFileEntryMetadata); }
@Test public void testUpdateExisting() throws Exception { long pk = ServiceTestUtil.nextLong(); DLFileEntryMetadata newDLFileEntryMetadata = _persistence.create(pk); newDLFileEntryMetadata.setUuid(ServiceTestUtil.randomString()); newDLFileEntryMetadata.setDDMStorageId(ServiceTestUtil.nextLong()); newDLFileEntryMetadata.setDDMStructureId(ServiceTestUtil.nextLong()); newDLFileEntryMetadata.setFileEntryTypeId(ServiceTestUtil.nextLong()); newDLFileEntryMetadata.setFileEntryId(ServiceTestUtil.nextLong()); newDLFileEntryMetadata.setFileVersionId(ServiceTestUtil.nextLong()); _persistence.update(newDLFileEntryMetadata, false); DLFileEntryMetadata existingDLFileEntryMetadata = _persistence.findByPrimaryKey(newDLFileEntryMetadata.getPrimaryKey()); Assert.assertEquals(existingDLFileEntryMetadata.getUuid(), newDLFileEntryMetadata.getUuid()); Assert.assertEquals( existingDLFileEntryMetadata.getFileEntryMetadataId(), newDLFileEntryMetadata.getFileEntryMetadataId()); Assert.assertEquals( existingDLFileEntryMetadata.getDDMStorageId(), newDLFileEntryMetadata.getDDMStorageId()); Assert.assertEquals( existingDLFileEntryMetadata.getDDMStructureId(), newDLFileEntryMetadata.getDDMStructureId()); Assert.assertEquals( existingDLFileEntryMetadata.getFileEntryTypeId(), newDLFileEntryMetadata.getFileEntryTypeId()); Assert.assertEquals( existingDLFileEntryMetadata.getFileEntryId(), newDLFileEntryMetadata.getFileEntryId()); Assert.assertEquals( existingDLFileEntryMetadata.getFileVersionId(), newDLFileEntryMetadata.getFileVersionId()); }