@Test void testFileContent() throws Exception { final BinaryService service = new FileBinaryService(); try (final InputStream input = FileBinaryService.class.getResourceAsStream("/test.txt")) { final String doc = uncheckedToString(input); assertNotNull(doc); assertEquals(doc, service.get(file).thenApply(Binary::getContent) .thenApply(FileBinaryServiceTest::uncheckedToString).toCompletableFuture().join(), "Incorrect content when fetching from a file!"); } }
@Override public CompletionStage<Binary> get(final IRI identifier) { return supplyAsync(() -> new FileBinary(getFileFromIdentifier(identifier))); }
FileBinaryService implements BinaryService { @Override public CompletionStage<Binary> get(final IRI identifier) { return supplyAsync(() -> new FileBinary(getFileFromIdentifier(identifier))); } }
FileBinaryService implements BinaryService { @Override public CompletionStage<Binary> get(final IRI identifier) { return supplyAsync(() -> new FileBinary(getFileFromIdentifier(identifier))); } FileBinaryService(); @Inject  FileBinaryService(final IdentifierService idService);  FileBinaryService(final IdentifierService idService, final String basePath,
            final int hierarchy, final int length); private  FileBinaryService(final IdentifierService idService, final Config config); }
FileBinaryService implements BinaryService { @Override public CompletionStage<Binary> get(final IRI identifier) { return supplyAsync(() -> new FileBinary(getFileFromIdentifier(identifier))); } FileBinaryService(); @Inject  FileBinaryService(final IdentifierService idService);  FileBinaryService(final IdentifierService idService, final String basePath,
            final int hierarchy, final int length); private  FileBinaryService(final IdentifierService idService, final Config config); @Override CompletionStage<Binary> get(final IRI identifier); @Override CompletionStage<Void> purgeContent(final IRI identifier); @Override CompletionStage<Void> setContent(final BinaryMetadata metadata, final InputStream stream); @Override String generateIdentifier(final IRI identifier); }
FileBinaryService implements BinaryService { @Override public CompletionStage<Binary> get(final IRI identifier) { return supplyAsync(() -> new FileBinary(getFileFromIdentifier(identifier))); } FileBinaryService(); @Inject  FileBinaryService(final IdentifierService idService);  FileBinaryService(final IdentifierService idService, final String basePath,
            final int hierarchy, final int length); private  FileBinaryService(final IdentifierService idService, final Config config); @Override CompletionStage<Binary> get(final IRI identifier); @Override CompletionStage<Void> purgeContent(final IRI identifier); @Override CompletionStage<Void> setContent(final BinaryMetadata metadata, final InputStream stream); @Override String generateIdentifier(final IRI identifier); static final String CONFIG_FILE_BINARY_PATH; static final String CONFIG_FILE_BINARY_HIERARCHY; static final String CONFIG_FILE_BINARY_LENGTH; }