use of org.alfresco.repo.content.filestore.FileContentReader in project records-management by Alfresco.
the class EagerContentStoreCleanerUnitTest method contentRequiresCleaning.
/**
* Given that the content requires cleansing
* When the content is deleted from the store
* Then the content is cleansed first
*/
@Test
public void contentRequiresCleaning() {
String contentURL = AlfMock.generateText();
Set<Object> mockedSet = new HashSet<Object>(Arrays.asList(contentURL));
when(mockedTransactionalResourceHelper.getSet(EagerContentStoreCleaner.KEY_POST_COMMIT_CLEANSING_URLS)).thenReturn(mockedSet);
FileContentReader mockedReader = mock(FileContentReader.class);
when(mockedReader.exists()).thenReturn(true);
File mockedFile = mock(File.class);
when(mockedReader.getFile()).thenReturn(mockedFile);
ContentStore mockedContentStore = mock(ContentStore.class);
when(mockedContentStore.getReader(contentURL)).thenReturn(mockedReader);
eagerContentStoreCleaner.deleteFromStore(contentURL, mockedContentStore);
verify(mockedContentCleanser).cleanse(mockedFile);
}
Aggregations