Search in sources :

Example 1 with ContentStore

use of org.alfresco.repo.content.ContentStore 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);
}
Also used : FileContentReader(org.alfresco.repo.content.filestore.FileContentReader) File(java.io.File) HashSet(java.util.HashSet) ContentStore(org.alfresco.repo.content.ContentStore) Test(org.junit.Test) BaseUnitTest(org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest)

Aggregations

File (java.io.File)1 HashSet (java.util.HashSet)1 BaseUnitTest (org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest)1 ContentStore (org.alfresco.repo.content.ContentStore)1 FileContentReader (org.alfresco.repo.content.filestore.FileContentReader)1 Test (org.junit.Test)1