@Test(expected = StorageDriverException.class) public void getObjectMetadataTestInternalServerError() throws StorageDriverException { when(mock.get()).thenReturn(Response.status(Status.INTERNAL_SERVER_ERROR).build()); final StorageGetMetadataRequest request = new StorageGetMetadataRequest(tenant, DataCategory.OBJECT.getFolder(), "guid", false); try (Connection connection = driver.connect(offer.getId())) { connection.getMetadatas(request); } }
@Override public StorageMetadataResult getMetadatas(StorageGetMetadataRequest request) throws StorageDriverException { ParametersChecker.checkParameter(REQUEST_IS_A_MANDATORY_PARAMETER, request); ParametersChecker.checkParameter(TENANT_IS_A_MANDATORY_PARAMETER, request.getTenantId()); ParametersChecker.checkParameter(FOLDER_IS_A_MANDATORY_PARAMETER, request.getType()); ParametersChecker.checkParameter(GUID_IS_A_MANDATORY_PARAMETER, request.getGuid()); VitamRequestBuilder requestBuilder = get() .withPath( OBJECTS_PATH + "/" + DataCategory.getByFolder(request.getType()) + "/" + request.getGuid() + METADATAS) .withHeader(GlobalDataRest.X_TENANT_ID, request.getTenantId()) .withHeader(GlobalDataRest.X_OFFER_NO_CACHE, request.isNoCache()) .withJsonAccept(); try (Response response = make(requestBuilder)) { checkStorageException(response); return response.readEntity(StorageMetadataResult.class); } catch (VitamClientInternalException e) { LOGGER.error(VitamCodeHelper.getLogMessage(VitamCode.STORAGE_TECHNICAL_INTERNAL_ERROR), e); throw new StorageDriverException(getDriverName(), VitamCodeHelper.getLogMessage(VitamCode.STORAGE_TECHNICAL_INTERNAL_ERROR), true, e); } }
ConnectionImpl extends AbstractConnection { @Override public StorageMetadataResult getMetadatas(StorageGetMetadataRequest request) throws StorageDriverException { ParametersChecker.checkParameter(REQUEST_IS_A_MANDATORY_PARAMETER, request); ParametersChecker.checkParameter(TENANT_IS_A_MANDATORY_PARAMETER, request.getTenantId()); ParametersChecker.checkParameter(FOLDER_IS_A_MANDATORY_PARAMETER, request.getType()); ParametersChecker.checkParameter(GUID_IS_A_MANDATORY_PARAMETER, request.getGuid()); VitamRequestBuilder requestBuilder = get() .withPath( OBJECTS_PATH + "/" + DataCategory.getByFolder(request.getType()) + "/" + request.getGuid() + METADATAS) .withHeader(GlobalDataRest.X_TENANT_ID, request.getTenantId()) .withHeader(GlobalDataRest.X_OFFER_NO_CACHE, request.isNoCache()) .withJsonAccept(); try (Response response = make(requestBuilder)) { checkStorageException(response); return response.readEntity(StorageMetadataResult.class); } catch (VitamClientInternalException e) { LOGGER.error(VitamCodeHelper.getLogMessage(VitamCode.STORAGE_TECHNICAL_INTERNAL_ERROR), e); throw new StorageDriverException(getDriverName(), VitamCodeHelper.getLogMessage(VitamCode.STORAGE_TECHNICAL_INTERNAL_ERROR), true, e); } } }
ConnectionImpl extends AbstractConnection { @Override public StorageMetadataResult getMetadatas(StorageGetMetadataRequest request) throws StorageDriverException { ParametersChecker.checkParameter(REQUEST_IS_A_MANDATORY_PARAMETER, request); ParametersChecker.checkParameter(TENANT_IS_A_MANDATORY_PARAMETER, request.getTenantId()); ParametersChecker.checkParameter(FOLDER_IS_A_MANDATORY_PARAMETER, request.getType()); ParametersChecker.checkParameter(GUID_IS_A_MANDATORY_PARAMETER, request.getGuid()); VitamRequestBuilder requestBuilder = get() .withPath( OBJECTS_PATH + "/" + DataCategory.getByFolder(request.getType()) + "/" + request.getGuid() + METADATAS) .withHeader(GlobalDataRest.X_TENANT_ID, request.getTenantId()) .withHeader(GlobalDataRest.X_OFFER_NO_CACHE, request.isNoCache()) .withJsonAccept(); try (Response response = make(requestBuilder)) { checkStorageException(response); return response.readEntity(StorageMetadataResult.class); } catch (VitamClientInternalException e) { LOGGER.error(VitamCodeHelper.getLogMessage(VitamCode.STORAGE_TECHNICAL_INTERNAL_ERROR), e); throw new StorageDriverException(getDriverName(), VitamCodeHelper.getLogMessage(VitamCode.STORAGE_TECHNICAL_INTERNAL_ERROR), true, e); } } ConnectionImpl(String driverName, VitamClientFactoryInterface<? extends AbstractConnection> factory); }
ConnectionImpl extends AbstractConnection { @Override public StorageMetadataResult getMetadatas(StorageGetMetadataRequest request) throws StorageDriverException { ParametersChecker.checkParameter(REQUEST_IS_A_MANDATORY_PARAMETER, request); ParametersChecker.checkParameter(TENANT_IS_A_MANDATORY_PARAMETER, request.getTenantId()); ParametersChecker.checkParameter(FOLDER_IS_A_MANDATORY_PARAMETER, request.getType()); ParametersChecker.checkParameter(GUID_IS_A_MANDATORY_PARAMETER, request.getGuid()); VitamRequestBuilder requestBuilder = get() .withPath( OBJECTS_PATH + "/" + DataCategory.getByFolder(request.getType()) + "/" + request.getGuid() + METADATAS) .withHeader(GlobalDataRest.X_TENANT_ID, request.getTenantId()) .withHeader(GlobalDataRest.X_OFFER_NO_CACHE, request.isNoCache()) .withJsonAccept(); try (Response response = make(requestBuilder)) { checkStorageException(response); return response.readEntity(StorageMetadataResult.class); } catch (VitamClientInternalException e) { LOGGER.error(VitamCodeHelper.getLogMessage(VitamCode.STORAGE_TECHNICAL_INTERNAL_ERROR), e); throw new StorageDriverException(getDriverName(), VitamCodeHelper.getLogMessage(VitamCode.STORAGE_TECHNICAL_INTERNAL_ERROR), 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 StorageMetadataResult getMetadatas(StorageGetMetadataRequest request) throws StorageDriverException { ParametersChecker.checkParameter(REQUEST_IS_A_MANDATORY_PARAMETER, request); ParametersChecker.checkParameter(TENANT_IS_A_MANDATORY_PARAMETER, request.getTenantId()); ParametersChecker.checkParameter(FOLDER_IS_A_MANDATORY_PARAMETER, request.getType()); ParametersChecker.checkParameter(GUID_IS_A_MANDATORY_PARAMETER, request.getGuid()); VitamRequestBuilder requestBuilder = get() .withPath( OBJECTS_PATH + "/" + DataCategory.getByFolder(request.getType()) + "/" + request.getGuid() + METADATAS) .withHeader(GlobalDataRest.X_TENANT_ID, request.getTenantId()) .withHeader(GlobalDataRest.X_OFFER_NO_CACHE, request.isNoCache()) .withJsonAccept(); try (Response response = make(requestBuilder)) { checkStorageException(response); return response.readEntity(StorageMetadataResult.class); } catch (VitamClientInternalException e) { LOGGER.error(VitamCodeHelper.getLogMessage(VitamCode.STORAGE_TECHNICAL_INTERNAL_ERROR), e); throw new StorageDriverException(getDriverName(), VitamCodeHelper.getLogMessage(VitamCode.STORAGE_TECHNICAL_INTERNAL_ERROR), 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);  }