@Test(expected = ContentAddressableStorageNotFoundException.class) public void givenContainerNotFoundWhenUnzipObjectThenRaiseAnException() throws IOException, Exception { storage.uncompressObject(CONTAINER_NAME, SIP_FOLDER, CommonMediaType.ZIP, getInputStream("sip.zip")); }
@Override public void uncompressObject(String containerName, String folderName, String archiveMimeType, InputStream inputStreamObject) throws ContentAddressableStorageException { ParametersChecker.checkParameter(ErrorMessage.CONTAINER_OBJECT_NAMES_ARE_A_MANDATORY_PARAMETER.getMessage(), containerName, folderName); if (!isExistingContainer(containerName)) { throw new ContentAddressableStorageNotFoundException(ErrorMessage.CONTAINER_NOT_FOUND.getMessage()); } if (inputStreamObject == null) { throw new ContentAddressableStorageException(ErrorMessage.STREAM_IS_NULL.getMessage()); } if (isExistingFolder(containerName, folderName)) { LOGGER.error(ErrorMessage.FOLDER_ALREADY_EXIST.getMessage() + " : folderName " + folderName); throw new ContentAddressableStorageAlreadyExistException(ErrorMessage.FOLDER_ALREADY_EXIST.getMessage()); } createFolder(containerName, folderName); extractArchiveInputStreamOnContainer(containerName, folderName, CommonMediaType.valueOf(archiveMimeType), inputStreamObject); }
WorkspaceFileSystem implements WorkspaceContentAddressableStorage { @Override public void uncompressObject(String containerName, String folderName, String archiveMimeType, InputStream inputStreamObject) throws ContentAddressableStorageException { ParametersChecker.checkParameter(ErrorMessage.CONTAINER_OBJECT_NAMES_ARE_A_MANDATORY_PARAMETER.getMessage(), containerName, folderName); if (!isExistingContainer(containerName)) { throw new ContentAddressableStorageNotFoundException(ErrorMessage.CONTAINER_NOT_FOUND.getMessage()); } if (inputStreamObject == null) { throw new ContentAddressableStorageException(ErrorMessage.STREAM_IS_NULL.getMessage()); } if (isExistingFolder(containerName, folderName)) { LOGGER.error(ErrorMessage.FOLDER_ALREADY_EXIST.getMessage() + " : folderName " + folderName); throw new ContentAddressableStorageAlreadyExistException(ErrorMessage.FOLDER_ALREADY_EXIST.getMessage()); } createFolder(containerName, folderName); extractArchiveInputStreamOnContainer(containerName, folderName, CommonMediaType.valueOf(archiveMimeType), inputStreamObject); } }
WorkspaceFileSystem implements WorkspaceContentAddressableStorage { @Override public void uncompressObject(String containerName, String folderName, String archiveMimeType, InputStream inputStreamObject) throws ContentAddressableStorageException { ParametersChecker.checkParameter(ErrorMessage.CONTAINER_OBJECT_NAMES_ARE_A_MANDATORY_PARAMETER.getMessage(), containerName, folderName); if (!isExistingContainer(containerName)) { throw new ContentAddressableStorageNotFoundException(ErrorMessage.CONTAINER_NOT_FOUND.getMessage()); } if (inputStreamObject == null) { throw new ContentAddressableStorageException(ErrorMessage.STREAM_IS_NULL.getMessage()); } if (isExistingFolder(containerName, folderName)) { LOGGER.error(ErrorMessage.FOLDER_ALREADY_EXIST.getMessage() + " : folderName " + folderName); throw new ContentAddressableStorageAlreadyExistException(ErrorMessage.FOLDER_ALREADY_EXIST.getMessage()); } createFolder(containerName, folderName); extractArchiveInputStreamOnContainer(containerName, folderName, CommonMediaType.valueOf(archiveMimeType), inputStreamObject); } WorkspaceFileSystem(StorageConfiguration configuration); }
WorkspaceFileSystem implements WorkspaceContentAddressableStorage { @Override public void uncompressObject(String containerName, String folderName, String archiveMimeType, InputStream inputStreamObject) throws ContentAddressableStorageException { ParametersChecker.checkParameter(ErrorMessage.CONTAINER_OBJECT_NAMES_ARE_A_MANDATORY_PARAMETER.getMessage(), containerName, folderName); if (!isExistingContainer(containerName)) { throw new ContentAddressableStorageNotFoundException(ErrorMessage.CONTAINER_NOT_FOUND.getMessage()); } if (inputStreamObject == null) { throw new ContentAddressableStorageException(ErrorMessage.STREAM_IS_NULL.getMessage()); } if (isExistingFolder(containerName, folderName)) { LOGGER.error(ErrorMessage.FOLDER_ALREADY_EXIST.getMessage() + " : folderName " + folderName); throw new ContentAddressableStorageAlreadyExistException(ErrorMessage.FOLDER_ALREADY_EXIST.getMessage()); } createFolder(containerName, folderName); extractArchiveInputStreamOnContainer(containerName, folderName, CommonMediaType.valueOf(archiveMimeType), inputStreamObject); } WorkspaceFileSystem(StorageConfiguration configuration); void checkWorkspaceFile(String... paths); @Override void createContainer(String containerName); @Override void purgeContainer(String containerName); @Override void purgeOldFilesInContainer(String containerName, TimeToLive timeToLive); @Override void deleteContainer(String containerName, boolean recursive); @Override boolean isExistingContainer(String containerName); @Override void createFolder(String containerName, String folderName); @Override void deleteFolder(String containerName, String folderName); @Override boolean isExistingFolder(String containerName, String folderName); @Override List<URI> getListUriDigitalObjectFromFolder(String containerName, String folderName); @Override void uncompressObject(String containerName, String folderName, String archiveMimeType,
        InputStream inputStreamObject); @Override void putObject(String containerName, String objectName, InputStream stream); @Override void putAtomicObject(String containerName, String objectName, InputStream stream, long size); @Override Response getObject(String containerName, String objectName, Long chunkOffset,
        Long maxChunkSize); @Override void deleteObject(String containerName, String objectName); @Override boolean isExistingObject(String containerName, String objectName); @Override String computeObjectDigest(String containerName, String objectName, DigestType algo); @Override ContainerInformation getContainerInformation(String containerName); @Override JsonNode getObjectInformation(String containerName, String objectName); @Override long countObjects(String containerName); void compress(String containerName, List<String> folderNames, String zipName,
        String outputContainer); }
WorkspaceFileSystem implements WorkspaceContentAddressableStorage { @Override public void uncompressObject(String containerName, String folderName, String archiveMimeType, InputStream inputStreamObject) throws ContentAddressableStorageException { ParametersChecker.checkParameter(ErrorMessage.CONTAINER_OBJECT_NAMES_ARE_A_MANDATORY_PARAMETER.getMessage(), containerName, folderName); if (!isExistingContainer(containerName)) { throw new ContentAddressableStorageNotFoundException(ErrorMessage.CONTAINER_NOT_FOUND.getMessage()); } if (inputStreamObject == null) { throw new ContentAddressableStorageException(ErrorMessage.STREAM_IS_NULL.getMessage()); } if (isExistingFolder(containerName, folderName)) { LOGGER.error(ErrorMessage.FOLDER_ALREADY_EXIST.getMessage() + " : folderName " + folderName); throw new ContentAddressableStorageAlreadyExistException(ErrorMessage.FOLDER_ALREADY_EXIST.getMessage()); } createFolder(containerName, folderName); extractArchiveInputStreamOnContainer(containerName, folderName, CommonMediaType.valueOf(archiveMimeType), inputStreamObject); } WorkspaceFileSystem(StorageConfiguration configuration); void checkWorkspaceFile(String... paths); @Override void createContainer(String containerName); @Override void purgeContainer(String containerName); @Override void purgeOldFilesInContainer(String containerName, TimeToLive timeToLive); @Override void deleteContainer(String containerName, boolean recursive); @Override boolean isExistingContainer(String containerName); @Override void createFolder(String containerName, String folderName); @Override void deleteFolder(String containerName, String folderName); @Override boolean isExistingFolder(String containerName, String folderName); @Override List<URI> getListUriDigitalObjectFromFolder(String containerName, String folderName); @Override void uncompressObject(String containerName, String folderName, String archiveMimeType,
        InputStream inputStreamObject); @Override void putObject(String containerName, String objectName, InputStream stream); @Override void putAtomicObject(String containerName, String objectName, InputStream stream, long size); @Override Response getObject(String containerName, String objectName, Long chunkOffset,
        Long maxChunkSize); @Override void deleteObject(String containerName, String objectName); @Override boolean isExistingObject(String containerName, String objectName); @Override String computeObjectDigest(String containerName, String objectName, DigestType algo); @Override ContainerInformation getContainerInformation(String containerName); @Override JsonNode getObjectInformation(String containerName, String objectName); @Override long countObjects(String containerName); void compress(String containerName, List<String> folderNames, String zipName,
        String outputContainer);  }