@Test public void getContainerObjectTest() throws StorageNotFoundException, StorageServerClientException, IOException { final StorageClient client = StorageClientFactory.getInstance().getClient(); assertNotNull(client); final InputStream stream = client.getContainerAsync("strategyId", "guid", DataCategory.OBJECT, AccessLogUtils.getNoLogAccessLog()) .readEntity(InputStream.class); final InputStream stream2 = StreamUtils.toInputStream(StorageClientMock.MOCK_GET_FILE_CONTENT); assertNotNull(stream); assertTrue(IOUtils.contentEquals(stream, stream2)); }
@Override public Response getContainerAsync(String strategyId, String guid, DataCategory type, AccessLogInfoModel logInfo) throws StorageServerClientException, StorageNotFoundException { if (null != guid && guid.endsWith(".rng")) { try { return new FakeInboundResponse(Status.OK, PropertiesUtils.getResourceAsStream("profile/profil_ok.rng"), MediaType.APPLICATION_OCTET_STREAM_TYPE, null); } catch (FileNotFoundException e) { throw new StorageNotFoundException(e); } } else { return new FakeInboundResponse(Status.OK, IOUtils.toInputStream(MOCK_GET_FILE_CONTENT, Charset.defaultCharset()), MediaType.APPLICATION_OCTET_STREAM_TYPE, null); } }
StorageClientMock extends AbstractMockClient implements StorageClient { @Override public Response getContainerAsync(String strategyId, String guid, DataCategory type, AccessLogInfoModel logInfo) throws StorageServerClientException, StorageNotFoundException { if (null != guid && guid.endsWith(".rng")) { try { return new FakeInboundResponse(Status.OK, PropertiesUtils.getResourceAsStream("profile/profil_ok.rng"), MediaType.APPLICATION_OCTET_STREAM_TYPE, null); } catch (FileNotFoundException e) { throw new StorageNotFoundException(e); } } else { return new FakeInboundResponse(Status.OK, IOUtils.toInputStream(MOCK_GET_FILE_CONTENT, Charset.defaultCharset()), MediaType.APPLICATION_OCTET_STREAM_TYPE, null); } } }
StorageClientMock extends AbstractMockClient implements StorageClient { @Override public Response getContainerAsync(String strategyId, String guid, DataCategory type, AccessLogInfoModel logInfo) throws StorageServerClientException, StorageNotFoundException { if (null != guid && guid.endsWith(".rng")) { try { return new FakeInboundResponse(Status.OK, PropertiesUtils.getResourceAsStream("profile/profil_ok.rng"), MediaType.APPLICATION_OCTET_STREAM_TYPE, null); } catch (FileNotFoundException e) { throw new StorageNotFoundException(e); } } else { return new FakeInboundResponse(Status.OK, IOUtils.toInputStream(MOCK_GET_FILE_CONTENT, Charset.defaultCharset()), MediaType.APPLICATION_OCTET_STREAM_TYPE, null); } }  }
StorageClientMock extends AbstractMockClient implements StorageClient { @Override public Response getContainerAsync(String strategyId, String guid, DataCategory type, AccessLogInfoModel logInfo) throws StorageServerClientException, StorageNotFoundException { if (null != guid && guid.endsWith(".rng")) { try { return new FakeInboundResponse(Status.OK, PropertiesUtils.getResourceAsStream("profile/profil_ok.rng"), MediaType.APPLICATION_OCTET_STREAM_TYPE, null); } catch (FileNotFoundException e) { throw new StorageNotFoundException(e); } } else { return new FakeInboundResponse(Status.OK, IOUtils.toInputStream(MOCK_GET_FILE_CONTENT, Charset.defaultCharset()), MediaType.APPLICATION_OCTET_STREAM_TYPE, null); } }  @Override JsonNode getStorageInformation(String strategyId); @Override List<String> getOffers(String strategyId); @Override StoredInfoResult storeFileFromWorkspace(String strategyId, DataCategory type, String guid,
        ObjectDescription description); @Override boolean delete(String strategyId, DataCategory type, String guid); @Override boolean delete(String strategyId, DataCategory type, String guid, List<String> offerIds); @Override boolean existsContainer(String strategyId); @Override Map<String, Boolean> exists(String strategyId, DataCategory type, String guid, List<String> offerIds); @Override BulkObjectStoreResponse bulkStoreFilesFromWorkspace(String strategyId,
        BulkObjectStoreRequest bulkObjectStoreRequest); @Override Response getContainerAsync(String strategyId, String guid, DataCategory type, AccessLogInfoModel logInfo); @Override CloseableIterator<ObjectEntry> listContainer(String strategyId, DataCategory type); @Override RequestResponseOK storageAccessLogBackup(); @Override RequestResponseOK storageLogBackup(); @Override RequestResponseOK storageLogTraceability(); @Override JsonNode getInformation(String strategyId, DataCategory type, String guid, List<String> offerIds, boolean noCache); @Override RequestResponse<BatchObjectInformationResponse> getBatchObjectInformation(String strategyId, DataCategory type, Collection<String> offerIds,
        Collection<String> objectIds); @Override RequestResponseOK copyObjectToOneOfferAnother(String objectId, DataCategory category, String source,
        String destination, String strategyId); @Override RequestResponseOK create(String strategyId, String objectId, DataCategory category, InputStream inputStream,
        Long inputStreamSize, List<String> offerIds); @Override RequestResponse<OfferLog> getOfferLogs(String strategyId, DataCategory type, Long offset, int limit,
        Order order); @Override RequestResponse<StorageStrategy> getStorageStrategies(); }
StorageClientMock extends AbstractMockClient implements StorageClient { @Override public Response getContainerAsync(String strategyId, String guid, DataCategory type, AccessLogInfoModel logInfo) throws StorageServerClientException, StorageNotFoundException { if (null != guid && guid.endsWith(".rng")) { try { return new FakeInboundResponse(Status.OK, PropertiesUtils.getResourceAsStream("profile/profil_ok.rng"), MediaType.APPLICATION_OCTET_STREAM_TYPE, null); } catch (FileNotFoundException e) { throw new StorageNotFoundException(e); } } else { return new FakeInboundResponse(Status.OK, IOUtils.toInputStream(MOCK_GET_FILE_CONTENT, Charset.defaultCharset()), MediaType.APPLICATION_OCTET_STREAM_TYPE, null); } }  @Override JsonNode getStorageInformation(String strategyId); @Override List<String> getOffers(String strategyId); @Override StoredInfoResult storeFileFromWorkspace(String strategyId, DataCategory type, String guid,
        ObjectDescription description); @Override boolean delete(String strategyId, DataCategory type, String guid); @Override boolean delete(String strategyId, DataCategory type, String guid, List<String> offerIds); @Override boolean existsContainer(String strategyId); @Override Map<String, Boolean> exists(String strategyId, DataCategory type, String guid, List<String> offerIds); @Override BulkObjectStoreResponse bulkStoreFilesFromWorkspace(String strategyId,
        BulkObjectStoreRequest bulkObjectStoreRequest); @Override Response getContainerAsync(String strategyId, String guid, DataCategory type, AccessLogInfoModel logInfo); @Override CloseableIterator<ObjectEntry> listContainer(String strategyId, DataCategory type); @Override RequestResponseOK storageAccessLogBackup(); @Override RequestResponseOK storageLogBackup(); @Override RequestResponseOK storageLogTraceability(); @Override JsonNode getInformation(String strategyId, DataCategory type, String guid, List<String> offerIds, boolean noCache); @Override RequestResponse<BatchObjectInformationResponse> getBatchObjectInformation(String strategyId, DataCategory type, Collection<String> offerIds,
        Collection<String> objectIds); @Override RequestResponseOK copyObjectToOneOfferAnother(String objectId, DataCategory category, String source,
        String destination, String strategyId); @Override RequestResponseOK create(String strategyId, String objectId, DataCategory category, InputStream inputStream,
        Long inputStreamSize, List<String> offerIds); @Override RequestResponse<OfferLog> getOfferLogs(String strategyId, DataCategory type, Long offset, int limit,
        Order order); @Override RequestResponse<StorageStrategy> getStorageStrategies();  }