@Test public void deleteObjectTestIllegalArgument() throws Exception { try (Connection connection = driver.connect(offer.getId())) { assertThatThrownBy(() -> connection.removeObject(null)) .isInstanceOf(IllegalArgumentException.class); assertThatThrownBy(() -> connection.removeObject(getStorageRemoveRequest(false, true, true))) .isInstanceOf(IllegalArgumentException.class); assertThatThrownBy(() -> connection.removeObject(getStorageRemoveRequest(true, false, true))) .isInstanceOf(IllegalArgumentException.class); assertThatThrownBy(() -> connection.removeObject(getStorageRemoveRequest(true, true, false))) .isInstanceOf(IllegalArgumentException.class); } }
@Override public StorageRemoveResult removeObject(StorageRemoveRequest request) throws StorageDriverException { ParametersChecker.checkParameter(REQUEST_IS_A_MANDATORY_PARAMETER, request); ParametersChecker.checkParameter(GUID_IS_A_MANDATORY_PARAMETER, request.getGuid()); ParametersChecker.checkParameter(TENANT_IS_A_MANDATORY_PARAMETER, request.getTenantId()); ParametersChecker.checkParameter(FOLDER_IS_A_MANDATORY_PARAMETER, request.getType()); ParametersChecker.checkParameter(FOLDER_IS_NOT_VALID, DataCategory.getByFolder(request.getType())); VitamRequestBuilder requestBuilder = delete() .withPath(OBJECTS_PATH + "/" + DataCategory.getByFolder(request.getType()) + "/" + request.getGuid()) .withHeader(GlobalDataRest.X_TENANT_ID, request.getTenantId()) .withJsonAccept(); try (Response response = make(requestBuilder)) { checkStorageException(response); final JsonNode json = response.readEntity(JsonNode.class); return new StorageRemoveResult(request.getTenantId(), request.getType(), request.getGuid(), Status.OK.toString().equals(json.get("status").asText())); } catch (final VitamClientInternalException e) { LOGGER.error(VitamCodeHelper.getLogMessage(VitamCode.STORAGE_TECHNICAL_INTERNAL_ERROR), e); throw new StorageDriverException(getDriverName(), true, e); } }
ConnectionImpl extends AbstractConnection { @Override public StorageRemoveResult removeObject(StorageRemoveRequest request) throws StorageDriverException { ParametersChecker.checkParameter(REQUEST_IS_A_MANDATORY_PARAMETER, request); ParametersChecker.checkParameter(GUID_IS_A_MANDATORY_PARAMETER, request.getGuid()); ParametersChecker.checkParameter(TENANT_IS_A_MANDATORY_PARAMETER, request.getTenantId()); ParametersChecker.checkParameter(FOLDER_IS_A_MANDATORY_PARAMETER, request.getType()); ParametersChecker.checkParameter(FOLDER_IS_NOT_VALID, DataCategory.getByFolder(request.getType())); VitamRequestBuilder requestBuilder = delete() .withPath(OBJECTS_PATH + "/" + DataCategory.getByFolder(request.getType()) + "/" + request.getGuid()) .withHeader(GlobalDataRest.X_TENANT_ID, request.getTenantId()) .withJsonAccept(); try (Response response = make(requestBuilder)) { checkStorageException(response); final JsonNode json = response.readEntity(JsonNode.class); return new StorageRemoveResult(request.getTenantId(), request.getType(), request.getGuid(), Status.OK.toString().equals(json.get("status").asText())); } catch (final VitamClientInternalException e) { LOGGER.error(VitamCodeHelper.getLogMessage(VitamCode.STORAGE_TECHNICAL_INTERNAL_ERROR), e); throw new StorageDriverException(getDriverName(), true, e); } } }
ConnectionImpl extends AbstractConnection { @Override public StorageRemoveResult removeObject(StorageRemoveRequest request) throws StorageDriverException { ParametersChecker.checkParameter(REQUEST_IS_A_MANDATORY_PARAMETER, request); ParametersChecker.checkParameter(GUID_IS_A_MANDATORY_PARAMETER, request.getGuid()); ParametersChecker.checkParameter(TENANT_IS_A_MANDATORY_PARAMETER, request.getTenantId()); ParametersChecker.checkParameter(FOLDER_IS_A_MANDATORY_PARAMETER, request.getType()); ParametersChecker.checkParameter(FOLDER_IS_NOT_VALID, DataCategory.getByFolder(request.getType())); VitamRequestBuilder requestBuilder = delete() .withPath(OBJECTS_PATH + "/" + DataCategory.getByFolder(request.getType()) + "/" + request.getGuid()) .withHeader(GlobalDataRest.X_TENANT_ID, request.getTenantId()) .withJsonAccept(); try (Response response = make(requestBuilder)) { checkStorageException(response); final JsonNode json = response.readEntity(JsonNode.class); return new StorageRemoveResult(request.getTenantId(), request.getType(), request.getGuid(), Status.OK.toString().equals(json.get("status").asText())); } catch (final VitamClientInternalException e) { LOGGER.error(VitamCodeHelper.getLogMessage(VitamCode.STORAGE_TECHNICAL_INTERNAL_ERROR), e); throw new StorageDriverException(getDriverName(), true, e); } } ConnectionImpl(String driverName, VitamClientFactoryInterface<? extends AbstractConnection> factory); }
ConnectionImpl extends AbstractConnection { @Override public StorageRemoveResult removeObject(StorageRemoveRequest request) throws StorageDriverException { ParametersChecker.checkParameter(REQUEST_IS_A_MANDATORY_PARAMETER, request); ParametersChecker.checkParameter(GUID_IS_A_MANDATORY_PARAMETER, request.getGuid()); ParametersChecker.checkParameter(TENANT_IS_A_MANDATORY_PARAMETER, request.getTenantId()); ParametersChecker.checkParameter(FOLDER_IS_A_MANDATORY_PARAMETER, request.getType()); ParametersChecker.checkParameter(FOLDER_IS_NOT_VALID, DataCategory.getByFolder(request.getType())); VitamRequestBuilder requestBuilder = delete() .withPath(OBJECTS_PATH + "/" + DataCategory.getByFolder(request.getType()) + "/" + request.getGuid()) .withHeader(GlobalDataRest.X_TENANT_ID, request.getTenantId()) .withJsonAccept(); try (Response response = make(requestBuilder)) { checkStorageException(response); final JsonNode json = response.readEntity(JsonNode.class); return new StorageRemoveResult(request.getTenantId(), request.getType(), request.getGuid(), Status.OK.toString().equals(json.get("status").asText())); } catch (final VitamClientInternalException e) { LOGGER.error(VitamCodeHelper.getLogMessage(VitamCode.STORAGE_TECHNICAL_INTERNAL_ERROR), e); throw new StorageDriverException(getDriverName(), true, e); } } ConnectionImpl(String driverName, VitamClientFactoryInterface<? extends AbstractConnection> factory); @Override StorageCapacityResult getStorageCapacity(Integer tenantId); @Override StorageGetResult getObject(StorageObjectRequest request); @Override RequestResponse<TapeReadRequestReferentialEntity> createReadOrderRequest(StorageObjectRequest request); @Override RequestResponse<TapeReadRequestReferentialEntity> getReadOrderRequest(String readOrderRequestId, int tenant); @Override void removeReadOrderRequest(String readOrderRequestId, int tenant); @Override StoragePutResult putObject(StoragePutRequest request); @Override StorageBulkPutResult bulkPutObjects(StorageBulkPutRequest request); @Override StorageRemoveResult removeObject(StorageRemoveRequest request); @Override boolean objectExistsInOffer(StorageObjectRequest request); @Override StorageMetadataResult getMetadatas(StorageGetMetadataRequest request); @Override CloseableIterator<ObjectEntry> listObjects(StorageListRequest request); @Override RequestResponse<OfferLog> getOfferLogs(StorageOfferLogRequest storageGetOfferLogRequest); }
ConnectionImpl extends AbstractConnection { @Override public StorageRemoveResult removeObject(StorageRemoveRequest request) throws StorageDriverException { ParametersChecker.checkParameter(REQUEST_IS_A_MANDATORY_PARAMETER, request); ParametersChecker.checkParameter(GUID_IS_A_MANDATORY_PARAMETER, request.getGuid()); ParametersChecker.checkParameter(TENANT_IS_A_MANDATORY_PARAMETER, request.getTenantId()); ParametersChecker.checkParameter(FOLDER_IS_A_MANDATORY_PARAMETER, request.getType()); ParametersChecker.checkParameter(FOLDER_IS_NOT_VALID, DataCategory.getByFolder(request.getType())); VitamRequestBuilder requestBuilder = delete() .withPath(OBJECTS_PATH + "/" + DataCategory.getByFolder(request.getType()) + "/" + request.getGuid()) .withHeader(GlobalDataRest.X_TENANT_ID, request.getTenantId()) .withJsonAccept(); try (Response response = make(requestBuilder)) { checkStorageException(response); final JsonNode json = response.readEntity(JsonNode.class); return new StorageRemoveResult(request.getTenantId(), request.getType(), request.getGuid(), Status.OK.toString().equals(json.get("status").asText())); } catch (final VitamClientInternalException e) { LOGGER.error(VitamCodeHelper.getLogMessage(VitamCode.STORAGE_TECHNICAL_INTERNAL_ERROR), e); throw new StorageDriverException(getDriverName(), true, e); } } ConnectionImpl(String driverName, VitamClientFactoryInterface<? extends AbstractConnection> factory); @Override StorageCapacityResult getStorageCapacity(Integer tenantId); @Override StorageGetResult getObject(StorageObjectRequest request); @Override RequestResponse<TapeReadRequestReferentialEntity> createReadOrderRequest(StorageObjectRequest request); @Override RequestResponse<TapeReadRequestReferentialEntity> getReadOrderRequest(String readOrderRequestId, int tenant); @Override void removeReadOrderRequest(String readOrderRequestId, int tenant); @Override StoragePutResult putObject(StoragePutRequest request); @Override StorageBulkPutResult bulkPutObjects(StorageBulkPutRequest request); @Override StorageRemoveResult removeObject(StorageRemoveRequest request); @Override boolean objectExistsInOffer(StorageObjectRequest request); @Override StorageMetadataResult getMetadatas(StorageGetMetadataRequest request); @Override CloseableIterator<ObjectEntry> listObjects(StorageListRequest request); @Override RequestResponse<OfferLog> getOfferLogs(StorageOfferLogRequest storageGetOfferLogRequest);  }