@Test(expected = StorageDriverNotFoundException.class) public void getStorageCapacityNotFoundException() throws Exception { when(mock.head()).thenReturn(Response.status(Status.NOT_FOUND).build()); try (Connection connection = driver.connect(offer.getId())) { connection.getStorageCapacity(0); } }
@Override public StorageCapacityResult getStorageCapacity(Integer tenantId) throws StorageDriverPreconditionFailedException, StorageDriverNotFoundException, StorageDriverException { ParametersChecker.checkParameter(TENANT_IS_A_MANDATORY_PARAMETER, tenantId); VitamRequestBuilder request = head() .withPath(OBJECTS_PATH + "/" + DataCategory.OBJECT) .withHeader(GlobalDataRest.X_TENANT_ID, tenantId) .withJsonAccept(); try (Response response = make(request)) { checkStorageException(response); return new StorageCapacityResult(tenantId, getAvailableSpace(response)); } catch (final VitamClientInternalException e) { throw new StorageDriverException(getDriverName(), VitamCode.STORAGE_TECHNICAL_INTERNAL_ERROR.getMessage(), true, e); } }
ConnectionImpl extends AbstractConnection { @Override public StorageCapacityResult getStorageCapacity(Integer tenantId) throws StorageDriverPreconditionFailedException, StorageDriverNotFoundException, StorageDriverException { ParametersChecker.checkParameter(TENANT_IS_A_MANDATORY_PARAMETER, tenantId); VitamRequestBuilder request = head() .withPath(OBJECTS_PATH + "/" + DataCategory.OBJECT) .withHeader(GlobalDataRest.X_TENANT_ID, tenantId) .withJsonAccept(); try (Response response = make(request)) { checkStorageException(response); return new StorageCapacityResult(tenantId, getAvailableSpace(response)); } catch (final VitamClientInternalException e) { throw new StorageDriverException(getDriverName(), VitamCode.STORAGE_TECHNICAL_INTERNAL_ERROR.getMessage(), true, e); } } }
ConnectionImpl extends AbstractConnection { @Override public StorageCapacityResult getStorageCapacity(Integer tenantId) throws StorageDriverPreconditionFailedException, StorageDriverNotFoundException, StorageDriverException { ParametersChecker.checkParameter(TENANT_IS_A_MANDATORY_PARAMETER, tenantId); VitamRequestBuilder request = head() .withPath(OBJECTS_PATH + "/" + DataCategory.OBJECT) .withHeader(GlobalDataRest.X_TENANT_ID, tenantId) .withJsonAccept(); try (Response response = make(request)) { checkStorageException(response); return new StorageCapacityResult(tenantId, getAvailableSpace(response)); } catch (final VitamClientInternalException e) { throw new StorageDriverException(getDriverName(), VitamCode.STORAGE_TECHNICAL_INTERNAL_ERROR.getMessage(), true, e); } } ConnectionImpl(String driverName, VitamClientFactoryInterface<? extends AbstractConnection> factory); }
ConnectionImpl extends AbstractConnection { @Override public StorageCapacityResult getStorageCapacity(Integer tenantId) throws StorageDriverPreconditionFailedException, StorageDriverNotFoundException, StorageDriverException { ParametersChecker.checkParameter(TENANT_IS_A_MANDATORY_PARAMETER, tenantId); VitamRequestBuilder request = head() .withPath(OBJECTS_PATH + "/" + DataCategory.OBJECT) .withHeader(GlobalDataRest.X_TENANT_ID, tenantId) .withJsonAccept(); try (Response response = make(request)) { checkStorageException(response); return new StorageCapacityResult(tenantId, getAvailableSpace(response)); } catch (final VitamClientInternalException e) { throw new StorageDriverException(getDriverName(), VitamCode.STORAGE_TECHNICAL_INTERNAL_ERROR.getMessage(), 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 StorageCapacityResult getStorageCapacity(Integer tenantId) throws StorageDriverPreconditionFailedException, StorageDriverNotFoundException, StorageDriverException { ParametersChecker.checkParameter(TENANT_IS_A_MANDATORY_PARAMETER, tenantId); VitamRequestBuilder request = head() .withPath(OBJECTS_PATH + "/" + DataCategory.OBJECT) .withHeader(GlobalDataRest.X_TENANT_ID, tenantId) .withJsonAccept(); try (Response response = make(request)) { checkStorageException(response); return new StorageCapacityResult(tenantId, getAvailableSpace(response)); } catch (final VitamClientInternalException e) { throw new StorageDriverException(getDriverName(), VitamCode.STORAGE_TECHNICAL_INTERNAL_ERROR.getMessage(), 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);  }