RemoteBlobProcessor implements BlobProcessor { @Override public void processBinary(Blob b) throws InterruptedException { if (b instanceof SegmentBlob) { fetchBinary((SegmentBlob) b); } else { throw new BlobTypeUnknownException(); } } RemoteBlobProcessor(BlobStore blobStore, BlobDownloader blobDownloader); @Override void processBinary(Blob b);  }
@Test public void inMemoryBinaryShouldNotBeDownloaded() throws Exception { SegmentNodeStore store = SegmentNodeStoreBuilders.builder(fileStore.fileStore()).build(); NodeBuilder root = store.getRoot().builder(); root.setProperty("b", root.createBlob(new NullInputStream(SegmentTestConstants.MEDIUM_LIMIT))); store.merge(root, EmptyHook.INSTANCE, CommitInfo.EMPTY); RemoteBlobProcessor processor = new RemoteBlobProcessor(blobStore.blobStore(), blobId -> { Assert.fail("In-memory binaries should not be downloaded"); return null; }); processor.processBinary(store.getRoot().getProperty("b").getValue(Type.BINARY)); }
@Test public void inlineBinaryShouldNotBeDownloaded() throws Exception { SegmentNodeStore store = SegmentNodeStoreBuilders.builder(fileStore.fileStore()).build(); NodeBuilder root = store.getRoot().builder(); root.setProperty("b", root.createBlob(new NullInputStream(SegmentTestConstants.MEDIUM_LIMIT - 1))); store.merge(root, EmptyHook.INSTANCE, CommitInfo.EMPTY); RemoteBlobProcessor processor = new RemoteBlobProcessor(blobStore.blobStore(), blobId -> { Assert.fail("Inline binaries should not be downloaded"); return null; }); processor.processBinary(store.getRoot().getProperty("b").getValue(Type.BINARY)); }