@Test public void deleteExistingObject() throws Exception { doReturn(true) .when(objectReferentialRepository).delete(any()); tapeLibraryContentAddressableStorage.deleteObject("containerName", "objectName"); ArgumentCaptor<TapeLibraryObjectReferentialId> idArgumentCaptor = ArgumentCaptor.forClass(TapeLibraryObjectReferentialId.class); verify(objectReferentialRepository).delete(idArgumentCaptor.capture()); assertThat(idArgumentCaptor.getValue().getContainerName()).isEqualTo("containerName"); assertThat(idArgumentCaptor.getValue().getObjectName()).isEqualTo("objectName"); Mockito.verifyNoMoreInteractions(basicFileStorage, objectReferentialRepository, archiveReferentialRepository, fileBucketTarCreatorManager, readWriteQueueRepository, tapeCatalogService); }
@Override public void deleteObject(String containerName, String objectName) throws ContentAddressableStorageServerException, ContentAddressableStorageNotFoundException { LOGGER.debug(String.format("Delete object %s from container %s", objectName, containerName)); try { boolean objectDeleted = this.objectReferentialRepository.delete( new TapeLibraryObjectReferentialId(containerName, objectName)); if (!objectDeleted) { throw new ContentAddressableStorageNotFoundException(ErrorMessage.OBJECT_NOT_FOUND + objectName); } } catch (ObjectReferentialException e) { throw new ContentAddressableStorageServerException( "Error on deleting object " + containerName + "/" + objectName); } }
TapeLibraryContentAddressableStorage implements ContentAddressableStorage { @Override public void deleteObject(String containerName, String objectName) throws ContentAddressableStorageServerException, ContentAddressableStorageNotFoundException { LOGGER.debug(String.format("Delete object %s from container %s", objectName, containerName)); try { boolean objectDeleted = this.objectReferentialRepository.delete( new TapeLibraryObjectReferentialId(containerName, objectName)); if (!objectDeleted) { throw new ContentAddressableStorageNotFoundException(ErrorMessage.OBJECT_NOT_FOUND + objectName); } } catch (ObjectReferentialException e) { throw new ContentAddressableStorageServerException( "Error on deleting object " + containerName + "/" + objectName); } } }
TapeLibraryContentAddressableStorage implements ContentAddressableStorage { @Override public void deleteObject(String containerName, String objectName) throws ContentAddressableStorageServerException, ContentAddressableStorageNotFoundException { LOGGER.debug(String.format("Delete object %s from container %s", objectName, containerName)); try { boolean objectDeleted = this.objectReferentialRepository.delete( new TapeLibraryObjectReferentialId(containerName, objectName)); if (!objectDeleted) { throw new ContentAddressableStorageNotFoundException(ErrorMessage.OBJECT_NOT_FOUND + objectName); } } catch (ObjectReferentialException e) { throw new ContentAddressableStorageServerException( "Error on deleting object " + containerName + "/" + objectName); } } TapeLibraryContentAddressableStorage(
        BasicFileStorage basicFileStorage,
        ObjectReferentialRepository objectReferentialRepository,
        ArchiveReferentialRepository archiveReferentialRepository,
        ReadRequestReferentialRepository readRequestReferentialRepository,
        FileBucketTarCreatorManager fileBucketTarCreatorManager,
        QueueRepository readWriteQueue, TapeCatalogService tapeCatalogService,
        String outputTarStorageFolder,
        ArchiveOutputRetentionPolicy archiveOutputRetentionPolicy); }
TapeLibraryContentAddressableStorage implements ContentAddressableStorage { @Override public void deleteObject(String containerName, String objectName) throws ContentAddressableStorageServerException, ContentAddressableStorageNotFoundException { LOGGER.debug(String.format("Delete object %s from container %s", objectName, containerName)); try { boolean objectDeleted = this.objectReferentialRepository.delete( new TapeLibraryObjectReferentialId(containerName, objectName)); if (!objectDeleted) { throw new ContentAddressableStorageNotFoundException(ErrorMessage.OBJECT_NOT_FOUND + objectName); } } catch (ObjectReferentialException e) { throw new ContentAddressableStorageServerException( "Error on deleting object " + containerName + "/" + objectName); } } TapeLibraryContentAddressableStorage(
        BasicFileStorage basicFileStorage,
        ObjectReferentialRepository objectReferentialRepository,
        ArchiveReferentialRepository archiveReferentialRepository,
        ReadRequestReferentialRepository readRequestReferentialRepository,
        FileBucketTarCreatorManager fileBucketTarCreatorManager,
        QueueRepository readWriteQueue, TapeCatalogService tapeCatalogService,
        String outputTarStorageFolder,
        ArchiveOutputRetentionPolicy archiveOutputRetentionPolicy); @Override void createContainer(String containerName); @Override boolean isExistingContainer(String containerName); @Override String putObject(String containerName, String objectName, InputStream stream, DigestType digestType,
        Long size); @Override ObjectContent getObject(String containerName, String objectName); @Override String createReadOrderRequest(String containerName, List<String> objectsIds); @Override void removeReadOrderRequest(String readRequestID); @Override void deleteObject(String containerName, String objectName); @Override boolean isExistingObject(String containerName, String objectName); @Override String getObjectDigest(String containerName, String objectName, DigestType algo, boolean noCache); @Override ContainerInformation getContainerInformation(String containerName); @Override MetadatasObject getObjectMetadata(String containerName, String objectName, boolean noCache); @Override void listContainer(String containerName, ObjectListingListener objectListingListener); @Override void close(); }
TapeLibraryContentAddressableStorage implements ContentAddressableStorage { @Override public void deleteObject(String containerName, String objectName) throws ContentAddressableStorageServerException, ContentAddressableStorageNotFoundException { LOGGER.debug(String.format("Delete object %s from container %s", objectName, containerName)); try { boolean objectDeleted = this.objectReferentialRepository.delete( new TapeLibraryObjectReferentialId(containerName, objectName)); if (!objectDeleted) { throw new ContentAddressableStorageNotFoundException(ErrorMessage.OBJECT_NOT_FOUND + objectName); } } catch (ObjectReferentialException e) { throw new ContentAddressableStorageServerException( "Error on deleting object " + containerName + "/" + objectName); } } TapeLibraryContentAddressableStorage(
        BasicFileStorage basicFileStorage,
        ObjectReferentialRepository objectReferentialRepository,
        ArchiveReferentialRepository archiveReferentialRepository,
        ReadRequestReferentialRepository readRequestReferentialRepository,
        FileBucketTarCreatorManager fileBucketTarCreatorManager,
        QueueRepository readWriteQueue, TapeCatalogService tapeCatalogService,
        String outputTarStorageFolder,
        ArchiveOutputRetentionPolicy archiveOutputRetentionPolicy); @Override void createContainer(String containerName); @Override boolean isExistingContainer(String containerName); @Override String putObject(String containerName, String objectName, InputStream stream, DigestType digestType,
        Long size); @Override ObjectContent getObject(String containerName, String objectName); @Override String createReadOrderRequest(String containerName, List<String> objectsIds); @Override void removeReadOrderRequest(String readRequestID); @Override void deleteObject(String containerName, String objectName); @Override boolean isExistingObject(String containerName, String objectName); @Override String getObjectDigest(String containerName, String objectName, DigestType algo, boolean noCache); @Override ContainerInformation getContainerInformation(String containerName); @Override MetadatasObject getObjectMetadata(String containerName, String objectName, boolean noCache); @Override void listContainer(String containerName, ObjectListingListener objectListingListener); @Override void close();  }