@Test public void anAssetBlobCanBeDeletedWhileTheSystemIsInspected() { AssetBlob missingAssetBlob = mockAssetBlob(mock(AssetBlob.class)); when(asset.blob()).thenReturn(Optional.of(missingAssetBlob)); FluentAsset reloadedAsset = createAsset(assetBlob); Blob reloadedBlob = mock(Blob.class); when(reloadedBlob.getMetrics()).thenReturn(blobMetrics); BlobId missingBlobId = reloadedAsset.blob().get().blobRef().getBlobId(); when(blobStore.get(missingBlobId)).thenReturn(reloadedBlob); mockAssetBrowse(); mockAssetReload(reloadedAsset); when(reloadedBlob.getMetrics()).thenReturn(blobMetrics); when(reloadedBlob.getInputStream()).thenThrow(new BlobStoreException("Blob has been deleted", new BlobId("foo"))); List<DeadBlobResult<Asset>> result = deadBlobFinder.find(repository, true); assertThat(result, hasSize(1)); assertThat(result.get(0).getResultState(), is(DELETED)); }
@Override public List<DeadBlobResult<Asset>> find(@NotNull final Repository repository, final boolean ignoreMissingBlobRefs) { checkNotNull(repository); List<DeadBlobResult<Asset>> deadBlobCandidates = identifySuspects(repository, ignoreMissingBlobRefs); return verifySuspects(deadBlobCandidates, repository); }
DatastoreDeadBlobFinder extends ComponentSupport implements DeadBlobFinder<Asset> { @Override public List<DeadBlobResult<Asset>> find(@NotNull final Repository repository, final boolean ignoreMissingBlobRefs) { checkNotNull(repository); List<DeadBlobResult<Asset>> deadBlobCandidates = identifySuspects(repository, ignoreMissingBlobRefs); return verifySuspects(deadBlobCandidates, repository); } }
DatastoreDeadBlobFinder extends ComponentSupport implements DeadBlobFinder<Asset> { @Override public List<DeadBlobResult<Asset>> find(@NotNull final Repository repository, final boolean ignoreMissingBlobRefs) { checkNotNull(repository); List<DeadBlobResult<Asset>> deadBlobCandidates = identifySuspects(repository, ignoreMissingBlobRefs); return verifySuspects(deadBlobCandidates, repository); } @Inject  DatastoreDeadBlobFinder(final BlobStoreManager blobStoreManager); }
DatastoreDeadBlobFinder extends ComponentSupport implements DeadBlobFinder<Asset> { @Override public List<DeadBlobResult<Asset>> find(@NotNull final Repository repository, final boolean ignoreMissingBlobRefs) { checkNotNull(repository); List<DeadBlobResult<Asset>> deadBlobCandidates = identifySuspects(repository, ignoreMissingBlobRefs); return verifySuspects(deadBlobCandidates, repository); } @Inject  DatastoreDeadBlobFinder(final BlobStoreManager blobStoreManager); @Override List<DeadBlobResult<Asset>> find(@NotNull final Repository repository, final boolean ignoreMissingBlobRefs); }
DatastoreDeadBlobFinder extends ComponentSupport implements DeadBlobFinder<Asset> { @Override public List<DeadBlobResult<Asset>> find(@NotNull final Repository repository, final boolean ignoreMissingBlobRefs) { checkNotNull(repository); List<DeadBlobResult<Asset>> deadBlobCandidates = identifySuspects(repository, ignoreMissingBlobRefs); return verifySuspects(deadBlobCandidates, repository); } @Inject  DatastoreDeadBlobFinder(final BlobStoreManager blobStoreManager); @Override List<DeadBlobResult<Asset>> find(@NotNull final Repository repository, final boolean ignoreMissingBlobRefs);  }