DuraStoreStitchingRetrievalSource extends DuraStoreRetrievalSource { @Override public String getSourceChecksum(ContentItem contentItem) { if (chunkUtil.isChunkManifest(contentItem.getContentId())) { ChunksManifest manifest; try { manifest = stitcher.getManifest(contentItem.getSpaceId(), contentItem.getContentId()); return manifest.getHeader().getSourceMD5(); } catch (Exception e) { throw new RuntimeException( "Unable to get checksum for " + contentItem.toString() + " due to: " + e.getMessage()); } } else { return super.getSourceChecksum(contentItem); } } DuraStoreStitchingRetrievalSource(ContentStore store,
                                             List<String> spaces,
                                             boolean allSpaces); @Override synchronized ContentItem getNextContentItem(); @Override String getSourceChecksum(ContentItem contentItem);  }
@Test public void testGetSourceChecksum() throws Exception { final String contentId = getContentId(0); final String expectedMd5 = createMd5(0); createGetSourceChecksumMocks(contentId, expectedMd5); replayMocks(); retrievalSource = new DuraStoreStitchingRetrievalSource(store, spaces, allSpaces); ContentItem item = new ContentItem(spaceId0, contentId); String md5 = retrievalSource.getSourceChecksum(item); Assert.assertNotNull(md5); Assert.assertEquals(expectedMd5, md5); }