protected DLFileEntryMetadata addDLFileEntryMetadata() throws Exception {
    long pk = ServiceTestUtil.nextLong();

    DLFileEntryMetadata dlFileEntryMetadata = _persistence.create(pk);

    dlFileEntryMetadata.setUuid(ServiceTestUtil.randomString());

    dlFileEntryMetadata.setDDMStorageId(ServiceTestUtil.nextLong());

    dlFileEntryMetadata.setDDMStructureId(ServiceTestUtil.nextLong());

    dlFileEntryMetadata.setFileEntryTypeId(ServiceTestUtil.nextLong());

    dlFileEntryMetadata.setFileEntryId(ServiceTestUtil.nextLong());

    dlFileEntryMetadata.setFileVersionId(ServiceTestUtil.nextLong());

    _persistence.update(dlFileEntryMetadata, false);

    return dlFileEntryMetadata;
  }
  @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());
  }