AwsAssetDatabaseImpl implements AwsAssetDatabase { @Override public void deleteMapping(StoragePath path) throws AwsAssetDatabaseException { AwsAssetMappingDto.deleteMappping(emf.createEntityManager(), path); }  @Activate void activate(ComponentContext cc); @Deactivate void deactivate(ComponentContext cc); @Reference(name = "entityManagerFactory", target = "(osgi.unit.name=org.opencastproject.assetmanager.aws.persistence)") void setEntityManagerFactory(EntityManagerFactory emf); @Override AwsAssetMapping storeMapping(StoragePath path, String objectKey, String objectVersion); @Override void deleteMapping(StoragePath path); @Override AwsAssetMapping findMapping(StoragePath path); @Override List<AwsAssetMapping> findMappingsByKey(String objectKey); @Override List<AwsAssetMapping> findMappingsByMediaPackageAndVersion(StoragePath path); @Override List<AwsAssetMapping> findAllByMediaPackage(String mpId); static final String PERSISTENCE_UNIT; }
@Test public void testDeleteMapping() throws Exception { StoragePath path = new StoragePath(ORG, MP_ID, new VersionImpl(1L), ASSET1_ID); database.storeMapping(path, "archive_path/" + ASSET1_ID, AWS_VERSION_1); AwsAssetMapping mapping = database.findMapping(path); Assert.assertNotNull(mapping); database.deleteMapping(path); mapping = database.findMapping(path); Assert.assertNull(mapping); List<AwsAssetMapping> mappings = database.findAllByMediaPackage(MP_ID); Assert.assertEquals(1, mappings.size()); Assert.assertNotNull(mappings.get(0).getDeletionDate()); }