jelmini commented on code in PR #800: URL: https://github.com/apache/jackrabbit-oak/pull/800#discussion_r1054418036
########## oak-segment-azure/src/test/java/org/apache/jackrabbit/oak/segment/azure/AzureArchiveManagerTest.java: ########## @@ -400,6 +400,40 @@ public void testCachingPersistenceTarRecovery() throws URISyntaxException, Inval assertFalse(container.getDirectoryReference("oak/data00000a.tar.ro.bak").listBlobs().iterator().hasNext()); } + @Test + public void testCollectBlobReferencesForReadOnlyFileStore() throws URISyntaxException, InvalidFileStoreVersionException, IOException, CommitFailedException, StorageException { + AzurePersistence rwPersistence = new AzurePersistence(container.getDirectoryReference("oak")); + FileStore rwFileStore = FileStoreBuilder.fileStoreBuilder(new File("target")).withCustomPersistence(rwPersistence).build(); + SegmentNodeStore segmentNodeStore = SegmentNodeStoreBuilders.builder(rwFileStore).build(); + NodeBuilder builder = segmentNodeStore.getRoot().builder(); + builder.setProperty("foo", "bar"); + segmentNodeStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY); + rwFileStore.flush(); + + assertTrue(container.getDirectoryReference("oak/data00000a.tar").listBlobs().iterator().hasNext()); + // create read-only FS + AzurePersistence roPersistence = new AzurePersistence(container.getDirectoryReference("oak")); + ReadOnlyFileStore roFileStore = FileStoreBuilder.fileStoreBuilder(new File("target")).withCustomPersistence(roPersistence).buildReadOnly(); + + PropertyState fooProperty = SegmentNodeStoreBuilders.builder(roFileStore).build() + .getRoot() + .getProperty("foo"); + + assertThat(fooProperty, not(nullValue())); + assertThat(fooProperty.getValue(Type.STRING), equalTo("bar")); + + //exception should not be thrown + try { + roFileStore.collectBlobReferences(s -> {}); + } catch (Exception e){ + fail(); Review Comment: I would add a message to `fail()` for better diagnostics. For example: ```java fail("Unexpected exception: " + e); ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@jackrabbit.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org