Fixed the version number in java and js files

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@112228 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2015-09-16 11:22:19 +00:00
parent 51389d58a0
commit fe3491ea84
3 changed files with 131 additions and 131 deletions

View File

@@ -49,33 +49,33 @@ import org.alfresco.util.GUID;
* Acceptance criteria for content destruction and content cleansing. * Acceptance criteria for content destruction and content cleansing.
* *
* @author Roy Wetherall * @author Roy Wetherall
* @Author 3.0.a * @since 2.4.a
*/ */
public class DestroyContentTest extends BaseRMTestCase public class DestroyContentTest extends BaseRMTestCase
{ {
private static final String BEAN_NAME_CONTENT_CLEANSER = "contentCleanser.test"; private static final String BEAN_NAME_CONTENT_CLEANSER = "contentCleanser.test";
private ContentStore contentStore; private ContentStore contentStore;
private TestContentCleanser contentCleanser; private TestContentCleanser contentCleanser;
private EagerContentStoreCleaner eagerContentStoreCleaner; private EagerContentStoreCleaner eagerContentStoreCleaner;
private ContentDestructionComponent contentDestructionComponent; private ContentDestructionComponent contentDestructionComponent;
@SuppressWarnings("unused") @SuppressWarnings("unused")
private RenditionService renditionService; private RenditionService renditionService;
@Override @Override
protected void initServices() protected void initServices()
{ {
super.initServices(); super.initServices();
contentStore = (ContentStore)applicationContext.getBean("fileContentStore"); contentStore = (ContentStore)applicationContext.getBean("fileContentStore");
contentCleanser = (TestContentCleanser)applicationContext.getBean(BEAN_NAME_CONTENT_CLEANSER); contentCleanser = (TestContentCleanser)applicationContext.getBean(BEAN_NAME_CONTENT_CLEANSER);
eagerContentStoreCleaner = (EagerContentStoreCleaner)applicationContext.getBean("eagerContentStoreCleaner"); eagerContentStoreCleaner = (EagerContentStoreCleaner)applicationContext.getBean("eagerContentStoreCleaner");
contentDestructionComponent = (ContentDestructionComponent)applicationContext.getBean("contentDestructionComponent"); contentDestructionComponent = (ContentDestructionComponent)applicationContext.getBean("contentDestructionComponent");
renditionService = (RenditionService)applicationContext.getBean("renditionService"); renditionService = (RenditionService)applicationContext.getBean("renditionService");
// set the test content store cleaner // set the test content store cleaner
eagerContentStoreCleaner.setContentCleanser(contentCleanser); eagerContentStoreCleaner.setContentCleanser(contentCleanser);
} }
/** /**
* Given that a record folder is eligible for destruction * Given that a record folder is eligible for destruction
* And record ghosting is applied * And record ghosting is applied
@@ -87,48 +87,48 @@ public class DestroyContentTest extends BaseRMTestCase
public void testRecordFolderDestroy() throws Exception public void testRecordFolderDestroy() throws Exception
{ {
doBehaviourDrivenTest(new BehaviourDrivenTest() doBehaviourDrivenTest(new BehaviourDrivenTest()
{ {
private NodeRef recordCategoryFolderLevel; private NodeRef recordCategoryFolderLevel;
private NodeRef destroyableFolder; private NodeRef destroyableFolder;
private NodeRef subRecord; private NodeRef subRecord;
public void given() throws Exception public void given() throws Exception
{ {
// create destroyable record folder that contains a record // create destroyable record folder that contains a record
recordCategoryFolderLevel = filePlanService.createRecordCategory(filePlan, GUID.generate()); recordCategoryFolderLevel = filePlanService.createRecordCategory(filePlan, GUID.generate());
utils.createBasicDispositionSchedule( utils.createBasicDispositionSchedule(
recordCategoryFolderLevel, recordCategoryFolderLevel,
CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS,
CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY,
false, false,
true); true);
destroyableFolder = recordFolderService.createRecordFolder(recordCategoryFolderLevel, GUID.generate()); destroyableFolder = recordFolderService.createRecordFolder(recordCategoryFolderLevel, GUID.generate());
Map<QName, Serializable> props = new HashMap<QName, Serializable>(1); Map<QName, Serializable> props = new HashMap<QName, Serializable>(1);
props.put(ContentModel.PROP_TITLE, GUID.generate()); props.put(ContentModel.PROP_TITLE, GUID.generate());
InputStream is = System.class.getResourceAsStream("/alfresco/test/content/Image.jpg"); InputStream is = System.class.getResourceAsStream("/alfresco/test/content/Image.jpg");
subRecord = utils.createRecord(destroyableFolder, GUID.generate(), props, MimetypeMap.MIMETYPE_IMAGE_JPEG, is); subRecord = utils.createRecord(destroyableFolder, GUID.generate(), props, MimetypeMap.MIMETYPE_IMAGE_JPEG, is);
// Commented out, because Bamboo doesn't currently support rendition creation // Commented out, because Bamboo doesn't currently support rendition creation
// TODO figure out a way to create renditions that is supported on Bamboo // TODO figure out a way to create renditions that is supported on Bamboo
/* /*
renditionService.render(subRecord, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "medium")); renditionService.render(subRecord, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "medium"));
*/ */
utils.completeRecord(subRecord); utils.completeRecord(subRecord);
utils.completeEvent(destroyableFolder, CommonRMTestUtils.DEFAULT_EVENT_NAME); utils.completeEvent(destroyableFolder, CommonRMTestUtils.DEFAULT_EVENT_NAME);
rmActionService.executeRecordsManagementAction(destroyableFolder, CutOffAction.NAME); rmActionService.executeRecordsManagementAction(destroyableFolder, CutOffAction.NAME);
// assert things are as we expect // assert things are as we expect
assertEquals(DestroyAction.NAME, dispositionService.getNextDispositionAction(destroyableFolder).getName()); assertEquals(DestroyAction.NAME, dispositionService.getNextDispositionAction(destroyableFolder).getName());
assertTrue(dispositionService.isNextDispositionActionEligible(destroyableFolder)); assertTrue(dispositionService.isNextDispositionActionEligible(destroyableFolder));
// reset test content cleanser // reset test content cleanser
contentCleanser.reset(); contentCleanser.reset();
assertFalse(contentDestructionComponent.isCleansingEnabled()); assertFalse(contentDestructionComponent.isCleansingEnabled());
} }
public void when() throws Exception public void when() throws Exception
{ {
// destroy the folder // destroy the folder
@@ -142,21 +142,21 @@ public class DestroyContentTest extends BaseRMTestCase
assertTrue(nodeService.hasAspect(destroyableFolder, ASPECT_GHOSTED)); assertTrue(nodeService.hasAspect(destroyableFolder, ASPECT_GHOSTED));
assertTrue(nodeService.exists(subRecord)); assertTrue(nodeService.exists(subRecord));
assertTrue(nodeService.hasAspect(subRecord, ASPECT_GHOSTED)); assertTrue(nodeService.hasAspect(subRecord, ASPECT_GHOSTED));
// record content is destroyed // record content is destroyed
ContentReader reader = contentService.getReader(subRecord, PROP_CONTENT); ContentReader reader = contentService.getReader(subRecord, PROP_CONTENT);
assertNull(reader); assertNull(reader);
// content cleansing hasn't taken place // content cleansing hasn't taken place
assertFalse(contentCleanser.hasCleansed()); assertFalse(contentCleanser.hasCleansed());
// ensure the record isn't in the archive store // ensure the record isn't in the archive store
NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, subRecord.getId()); NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, subRecord.getId());
assertFalse(nodeService.exists(archiveNodeRef)); assertFalse(nodeService.exists(archiveNodeRef));
} }
}); });
} }
/** /**
* Given that a record is eligible for destruction * Given that a record is eligible for destruction
* And record ghosting is applied * And record ghosting is applied
@@ -168,36 +168,36 @@ public class DestroyContentTest extends BaseRMTestCase
public void testRecordDestroy() throws Exception public void testRecordDestroy() throws Exception
{ {
doBehaviourDrivenTest(new BehaviourDrivenTest() doBehaviourDrivenTest(new BehaviourDrivenTest()
{ {
private NodeRef recordCategoryRecordLevel; private NodeRef recordCategoryRecordLevel;
private NodeRef recordFolder; private NodeRef recordFolder;
private NodeRef destroyableRecord; private NodeRef destroyableRecord;
public void given() throws Exception public void given() throws Exception
{ {
// create destroyable record // create destroyable record
recordCategoryRecordLevel = filePlanService.createRecordCategory(filePlan, GUID.generate()); recordCategoryRecordLevel = filePlanService.createRecordCategory(filePlan, GUID.generate());
utils.createBasicDispositionSchedule( utils.createBasicDispositionSchedule(
recordCategoryRecordLevel, recordCategoryRecordLevel,
CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS,
CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY,
true, true,
true); true);
recordFolder = recordFolderService.createRecordFolder(recordCategoryRecordLevel, GUID.generate()); recordFolder = recordFolderService.createRecordFolder(recordCategoryRecordLevel, GUID.generate());
destroyableRecord = utils.createRecord(recordFolder, GUID.generate(), GUID.generate()); destroyableRecord = utils.createRecord(recordFolder, GUID.generate(), GUID.generate());
utils.completeRecord(destroyableRecord); utils.completeRecord(destroyableRecord);
utils.completeEvent(destroyableRecord, CommonRMTestUtils.DEFAULT_EVENT_NAME); utils.completeEvent(destroyableRecord, CommonRMTestUtils.DEFAULT_EVENT_NAME);
rmActionService.executeRecordsManagementAction(destroyableRecord, CutOffAction.NAME); rmActionService.executeRecordsManagementAction(destroyableRecord, CutOffAction.NAME);
// assert things are as we expect // assert things are as we expect
assertEquals(DestroyAction.NAME, dispositionService.getNextDispositionAction(destroyableRecord).getName()); assertEquals(DestroyAction.NAME, dispositionService.getNextDispositionAction(destroyableRecord).getName());
assertTrue(dispositionService.isNextDispositionActionEligible(destroyableRecord)); assertTrue(dispositionService.isNextDispositionActionEligible(destroyableRecord));
// reset test content cleanser // reset test content cleanser
contentCleanser.reset(); contentCleanser.reset();
assertFalse(contentDestructionComponent.isCleansingEnabled()); assertFalse(contentDestructionComponent.isCleansingEnabled());
} }
public void when() throws Exception public void when() throws Exception
{ {
// destroy the folder // destroy the folder
@@ -206,25 +206,25 @@ public class DestroyContentTest extends BaseRMTestCase
public void then() throws Exception public void then() throws Exception
{ {
// show that record still exists and has the ghosted aspect applied // show that record still exists and has the ghosted aspect applied
assertTrue(nodeService.exists(destroyableRecord)); assertTrue(nodeService.exists(destroyableRecord));
assertTrue(nodeService.hasAspect(destroyableRecord, ASPECT_GHOSTED)); assertTrue(nodeService.hasAspect(destroyableRecord, ASPECT_GHOSTED));
// record content is destroyed // record content is destroyed
ContentReader reader = contentService.getReader(destroyableRecord, PROP_CONTENT); ContentReader reader = contentService.getReader(destroyableRecord, PROP_CONTENT);
assertNull(reader); assertNull(reader);
// content cleansing hasn't taken place // content cleansing hasn't taken place
assertFalse(contentCleanser.hasCleansed()); assertFalse(contentCleanser.hasCleansed());
// ensure the record isn't in the archive store // ensure the record isn't in the archive store
NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, destroyableRecord.getId()); NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, destroyableRecord.getId());
assertFalse(nodeService.exists(archiveNodeRef)); assertFalse(nodeService.exists(archiveNodeRef));
} }
}); });
} }
/** /**
* Given that a record is eligible for destruction * Given that a record is eligible for destruction
* And record ghosting is applied * And record ghosting is applied
@@ -238,37 +238,37 @@ public class DestroyContentTest extends BaseRMTestCase
public void testRecordDestroyAndCleanse() throws Exception public void testRecordDestroyAndCleanse() throws Exception
{ {
doBehaviourDrivenTest(new BehaviourDrivenTest() doBehaviourDrivenTest(new BehaviourDrivenTest()
{ {
private NodeRef recordCategoryRecordLevel; private NodeRef recordCategoryRecordLevel;
private NodeRef recordFolder; private NodeRef recordFolder;
private NodeRef destroyableRecord; private NodeRef destroyableRecord;
public void given() throws Exception public void given() throws Exception
{ {
// create destroyable record // create destroyable record
recordCategoryRecordLevel = filePlanService.createRecordCategory(filePlan, GUID.generate()); recordCategoryRecordLevel = filePlanService.createRecordCategory(filePlan, GUID.generate());
utils.createBasicDispositionSchedule( utils.createBasicDispositionSchedule(
recordCategoryRecordLevel, recordCategoryRecordLevel,
CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS, CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS,
CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY, CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY,
true, true,
true); true);
recordFolder = recordFolderService.createRecordFolder(recordCategoryRecordLevel, GUID.generate()); recordFolder = recordFolderService.createRecordFolder(recordCategoryRecordLevel, GUID.generate());
destroyableRecord = utils.createRecord(recordFolder, GUID.generate(), GUID.generate()); destroyableRecord = utils.createRecord(recordFolder, GUID.generate(), GUID.generate());
utils.completeRecord(destroyableRecord); utils.completeRecord(destroyableRecord);
utils.completeEvent(destroyableRecord, CommonRMTestUtils.DEFAULT_EVENT_NAME); utils.completeEvent(destroyableRecord, CommonRMTestUtils.DEFAULT_EVENT_NAME);
rmActionService.executeRecordsManagementAction(destroyableRecord, CutOffAction.NAME); rmActionService.executeRecordsManagementAction(destroyableRecord, CutOffAction.NAME);
// assert things are as we expect // assert things are as we expect
assertEquals(DestroyAction.NAME, dispositionService.getNextDispositionAction(destroyableRecord).getName()); assertEquals(DestroyAction.NAME, dispositionService.getNextDispositionAction(destroyableRecord).getName());
assertTrue(dispositionService.isNextDispositionActionEligible(destroyableRecord)); assertTrue(dispositionService.isNextDispositionActionEligible(destroyableRecord));
// reset test content cleanser and configure on // reset test content cleanser and configure on
contentCleanser.reset(); contentCleanser.reset();
contentDestructionComponent.setCleansingEnabled(true); contentDestructionComponent.setCleansingEnabled(true);
assertTrue(contentDestructionComponent.isCleansingEnabled()); assertTrue(contentDestructionComponent.isCleansingEnabled());
} }
public void when() throws Exception public void when() throws Exception
{ {
// destroy the folder // destroy the folder
@@ -277,30 +277,30 @@ public class DestroyContentTest extends BaseRMTestCase
public void then() throws Exception public void then() throws Exception
{ {
// show that record still exists and has the ghosted aspect applied // show that record still exists and has the ghosted aspect applied
assertTrue(nodeService.exists(destroyableRecord)); assertTrue(nodeService.exists(destroyableRecord));
assertTrue(nodeService.hasAspect(destroyableRecord, ASPECT_GHOSTED)); assertTrue(nodeService.hasAspect(destroyableRecord, ASPECT_GHOSTED));
// record content is destroyed // record content is destroyed
ContentReader reader = contentService.getReader(destroyableRecord, PROP_CONTENT); ContentReader reader = contentService.getReader(destroyableRecord, PROP_CONTENT);
assertNull(reader); assertNull(reader);
// content cleansing has taken place // content cleansing has taken place
assertTrue(contentCleanser.hasCleansed()); assertTrue(contentCleanser.hasCleansed());
// ensure the record isn't in the archive store // ensure the record isn't in the archive store
NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, destroyableRecord.getId()); NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, destroyableRecord.getId());
assertFalse(nodeService.exists(archiveNodeRef)); assertFalse(nodeService.exists(archiveNodeRef));
} }
public void after() throws Exception public void after() throws Exception
{ {
// reset cleansing to default // reset cleansing to default
contentDestructionComponent.setCleansingEnabled(false); contentDestructionComponent.setCleansingEnabled(false);
} }
}); });
} }
/** /**
* When the a record is deleted * When the a record is deleted
* Then the content is destroyed * Then the content is destroyed
@@ -309,12 +309,12 @@ public class DestroyContentTest extends BaseRMTestCase
public void testRecordDelete() throws Exception public void testRecordDelete() throws Exception
{ {
doBehaviourDrivenTest(new BehaviourDrivenTest() doBehaviourDrivenTest(new BehaviourDrivenTest()
{ {
private NodeRef recordCategoryRecordLevel; private NodeRef recordCategoryRecordLevel;
private NodeRef recordFolder; private NodeRef recordFolder;
private NodeRef deleteableRecord; private NodeRef deleteableRecord;
private ContentData contentData; private ContentData contentData;
public void given() throws Exception public void given() throws Exception
{ {
// create destroyable record // create destroyable record
@@ -322,16 +322,16 @@ public class DestroyContentTest extends BaseRMTestCase
recordFolder = recordFolderService.createRecordFolder(recordCategoryRecordLevel, GUID.generate()); recordFolder = recordFolderService.createRecordFolder(recordCategoryRecordLevel, GUID.generate());
deleteableRecord = utils.createRecord(recordFolder, GUID.generate(), GUID.generate()); deleteableRecord = utils.createRecord(recordFolder, GUID.generate(), GUID.generate());
contentData = (ContentData)nodeService.getProperty(deleteableRecord, PROP_CONTENT); contentData = (ContentData)nodeService.getProperty(deleteableRecord, PROP_CONTENT);
// assert things are as we expect // assert things are as we expect
assertNotNull(contentData); assertNotNull(contentData);
assertTrue(contentStore.exists(contentData.getContentUrl())); assertTrue(contentStore.exists(contentData.getContentUrl()));
// reset test content cleanser // reset test content cleanser
contentCleanser.reset(); contentCleanser.reset();
assertFalse(contentDestructionComponent.isCleansingEnabled()); assertFalse(contentDestructionComponent.isCleansingEnabled());
} }
public void when() throws Exception public void when() throws Exception
{ {
// delete the record // delete the record
@@ -340,20 +340,20 @@ public class DestroyContentTest extends BaseRMTestCase
public void then() throws Exception public void then() throws Exception
{ {
// record destroyed // record destroyed
assertFalse(nodeService.exists(deleteableRecord)); assertFalse(nodeService.exists(deleteableRecord));
assertFalse(contentStore.exists(contentData.getContentUrl())); assertFalse(contentStore.exists(contentData.getContentUrl()));
// content cleansing hasn't taken place // content cleansing hasn't taken place
assertFalse(contentCleanser.hasCleansed()); assertFalse(contentCleanser.hasCleansed());
// ensure the record isn't in the archive store // ensure the record isn't in the archive store
NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, deleteableRecord.getId()); NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, deleteableRecord.getId());
assertFalse(nodeService.exists(archiveNodeRef)); assertFalse(nodeService.exists(archiveNodeRef));
} }
}); });
} }
/** /**
* Given cleansing is configured on * Given cleansing is configured on
* When the a record is deleted * When the a record is deleted
@@ -364,12 +364,12 @@ public class DestroyContentTest extends BaseRMTestCase
public void testRecordDeleteAndCleanse() throws Exception public void testRecordDeleteAndCleanse() throws Exception
{ {
doBehaviourDrivenTest(new BehaviourDrivenTest() doBehaviourDrivenTest(new BehaviourDrivenTest()
{ {
private NodeRef recordCategoryRecordLevel; private NodeRef recordCategoryRecordLevel;
private NodeRef recordFolder; private NodeRef recordFolder;
private NodeRef deleteableRecord; private NodeRef deleteableRecord;
private ContentData contentData; private ContentData contentData;
public void given() throws Exception public void given() throws Exception
{ {
// create destroyable record // create destroyable record
@@ -377,17 +377,17 @@ public class DestroyContentTest extends BaseRMTestCase
recordFolder = recordFolderService.createRecordFolder(recordCategoryRecordLevel, GUID.generate()); recordFolder = recordFolderService.createRecordFolder(recordCategoryRecordLevel, GUID.generate());
deleteableRecord = utils.createRecord(recordFolder, GUID.generate(), GUID.generate()); deleteableRecord = utils.createRecord(recordFolder, GUID.generate(), GUID.generate());
contentData = (ContentData)nodeService.getProperty(deleteableRecord, PROP_CONTENT); contentData = (ContentData)nodeService.getProperty(deleteableRecord, PROP_CONTENT);
// assert things are as we expect // assert things are as we expect
assertNotNull(contentData); assertNotNull(contentData);
assertTrue(contentStore.exists(contentData.getContentUrl())); assertTrue(contentStore.exists(contentData.getContentUrl()));
// reset test content cleanser and configure on // reset test content cleanser and configure on
contentCleanser.reset(); contentCleanser.reset();
contentDestructionComponent.setCleansingEnabled(true); contentDestructionComponent.setCleansingEnabled(true);
assertTrue(contentDestructionComponent.isCleansingEnabled()); assertTrue(contentDestructionComponent.isCleansingEnabled());
} }
public void when() throws Exception public void when() throws Exception
{ {
// delete the record // delete the record
@@ -396,26 +396,26 @@ public class DestroyContentTest extends BaseRMTestCase
public void then() throws Exception public void then() throws Exception
{ {
// record destroyed // record destroyed
assertFalse(nodeService.exists(deleteableRecord)); assertFalse(nodeService.exists(deleteableRecord));
assertFalse(contentStore.exists(contentData.getContentUrl())); assertFalse(contentStore.exists(contentData.getContentUrl()));
// content cleansing has taken place // content cleansing has taken place
assertTrue(contentCleanser.hasCleansed()); assertTrue(contentCleanser.hasCleansed());
// ensure the record isn't in the archive store // ensure the record isn't in the archive store
NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, deleteableRecord.getId()); NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, deleteableRecord.getId());
assertFalse(nodeService.exists(archiveNodeRef)); assertFalse(nodeService.exists(archiveNodeRef));
} }
public void after() throws Exception public void after() throws Exception
{ {
// reset cleansing to default // reset cleansing to default
contentDestructionComponent.setCleansingEnabled(false); contentDestructionComponent.setCleansingEnabled(false);
} }
}); });
} }
/** /**
* When classified content (non-record) is deleted * When classified content (non-record) is deleted
* Then it is destroyed * Then it is destroyed
@@ -424,10 +424,10 @@ public class DestroyContentTest extends BaseRMTestCase
public void testClassifiedContentDelete() throws Exception public void testClassifiedContentDelete() throws Exception
{ {
doBehaviourDrivenTest(new BehaviourDrivenTest() doBehaviourDrivenTest(new BehaviourDrivenTest()
{ {
private NodeRef deleteableContent; private NodeRef deleteableContent;
private ContentData contentData; private ContentData contentData;
public void given() throws Exception public void given() throws Exception
{ {
// create deletable classified content // create deletable classified content
@@ -437,26 +437,26 @@ public class DestroyContentTest extends BaseRMTestCase
writer.setEncoding("UTF-8"); writer.setEncoding("UTF-8");
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
writer.putContent(GUID.generate()); writer.putContent(GUID.generate());
// classify the content // classify the content
ClassificationAspectProperties properties = new ClassificationAspectProperties(); ClassificationAspectProperties properties = new ClassificationAspectProperties();
properties.setClassificationLevelId("level1"); properties.setClassificationLevelId("level1");
properties.setClassifiedBy("me"); properties.setClassifiedBy("me");
properties.setClassificationReasonIds(Collections.singleton("Test Reason 1")); properties.setClassificationReasonIds(Collections.singleton("Test Reason 1"));
contentClassificationService.classifyContent(properties, deleteableContent); contentClassificationService.classifyContent(properties, deleteableContent);
// grab the content data // grab the content data
contentData = (ContentData)nodeService.getProperty(deleteableContent, PROP_CONTENT); contentData = (ContentData)nodeService.getProperty(deleteableContent, PROP_CONTENT);
// assert things are as we expect // assert things are as we expect
assertNotNull(contentData); assertNotNull(contentData);
assertTrue(contentStore.exists(contentData.getContentUrl())); assertTrue(contentStore.exists(contentData.getContentUrl()));
// reset test content cleanser // reset test content cleanser
contentCleanser.reset(); contentCleanser.reset();
assertFalse(contentDestructionComponent.isCleansingEnabled()); assertFalse(contentDestructionComponent.isCleansingEnabled());
} }
public void when() throws Exception public void when() throws Exception
{ {
// delete the content // delete the content
@@ -465,20 +465,20 @@ public class DestroyContentTest extends BaseRMTestCase
public void then() throws Exception public void then() throws Exception
{ {
// content destroyed // content destroyed
assertFalse(nodeService.exists(deleteableContent)); assertFalse(nodeService.exists(deleteableContent));
assertFalse(contentStore.exists(contentData.getContentUrl())); assertFalse(contentStore.exists(contentData.getContentUrl()));
// content cleansing hasn't taken place // content cleansing hasn't taken place
assertFalse(contentCleanser.hasCleansed()); assertFalse(contentCleanser.hasCleansed());
// ensure the record isn't in the archive store // ensure the record isn't in the archive store
NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, deleteableContent.getId()); NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, deleteableContent.getId());
assertFalse(nodeService.exists(archiveNodeRef)); assertFalse(nodeService.exists(archiveNodeRef));
} }
}); });
} }
/** /**
* Given data cleansing is configured on * Given data cleansing is configured on
* When classified content (non-record) is deleted * When classified content (non-record) is deleted
@@ -489,10 +489,10 @@ public class DestroyContentTest extends BaseRMTestCase
public void testClassifiedContentDeleteAndCleanse() throws Exception public void testClassifiedContentDeleteAndCleanse() throws Exception
{ {
doBehaviourDrivenTest(new BehaviourDrivenTest() doBehaviourDrivenTest(new BehaviourDrivenTest()
{ {
private NodeRef deleteableContent; private NodeRef deleteableContent;
private ContentData contentData; private ContentData contentData;
public void given() throws Exception public void given() throws Exception
{ {
// create deletable classified content // create deletable classified content
@@ -502,27 +502,27 @@ public class DestroyContentTest extends BaseRMTestCase
writer.setEncoding("UTF-8"); writer.setEncoding("UTF-8");
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
writer.putContent(GUID.generate()); writer.putContent(GUID.generate());
// classify the content // classify the content
ClassificationAspectProperties properties = new ClassificationAspectProperties(); ClassificationAspectProperties properties = new ClassificationAspectProperties();
properties.setClassificationLevelId("level1"); properties.setClassificationLevelId("level1");
properties.setClassifiedBy("me"); properties.setClassifiedBy("me");
properties.setClassificationReasonIds(Collections.singleton("Test Reason 1")); properties.setClassificationReasonIds(Collections.singleton("Test Reason 1"));
contentClassificationService.classifyContent(properties, deleteableContent); contentClassificationService.classifyContent(properties, deleteableContent);
// grab the content data // grab the content data
contentData = (ContentData)nodeService.getProperty(deleteableContent, PROP_CONTENT); contentData = (ContentData)nodeService.getProperty(deleteableContent, PROP_CONTENT);
// assert things are as we expect // assert things are as we expect
assertNotNull(contentData); assertNotNull(contentData);
assertTrue(contentStore.exists(contentData.getContentUrl())); assertTrue(contentStore.exists(contentData.getContentUrl()));
// reset test content cleanser and configure on // reset test content cleanser and configure on
contentCleanser.reset(); contentCleanser.reset();
contentDestructionComponent.setCleansingEnabled(true); contentDestructionComponent.setCleansingEnabled(true);
assertTrue(contentDestructionComponent.isCleansingEnabled()); assertTrue(contentDestructionComponent.isCleansingEnabled());
} }
public void when() throws Exception public void when() throws Exception
{ {
// delete the content // delete the content
@@ -531,26 +531,26 @@ public class DestroyContentTest extends BaseRMTestCase
public void then() throws Exception public void then() throws Exception
{ {
// content destroyed // content destroyed
assertFalse(nodeService.exists(deleteableContent)); assertFalse(nodeService.exists(deleteableContent));
assertFalse(contentStore.exists(contentData.getContentUrl())); assertFalse(contentStore.exists(contentData.getContentUrl()));
// content cleansing has taken place // content cleansing has taken place
assertTrue(contentCleanser.hasCleansed()); assertTrue(contentCleanser.hasCleansed());
// ensure the record isn't in the archive store // ensure the record isn't in the archive store
NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, deleteableContent.getId()); NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, deleteableContent.getId());
assertFalse(nodeService.exists(archiveNodeRef)); assertFalse(nodeService.exists(archiveNodeRef));
} }
public void after() throws Exception public void after() throws Exception
{ {
// reset cleansing to default // reset cleansing to default
contentDestructionComponent.setCleansingEnabled(false); contentDestructionComponent.setCleansingEnabled(false);
} }
}); });
} }
/** /**
* When a unclassified document (non-record) is deleted * When a unclassified document (non-record) is deleted
* Then it is deleted but the the content is not immediately destroyed * Then it is deleted but the the content is not immediately destroyed
@@ -559,10 +559,10 @@ public class DestroyContentTest extends BaseRMTestCase
public void testContentDelete() throws Exception public void testContentDelete() throws Exception
{ {
doBehaviourDrivenTest(new BehaviourDrivenTest() doBehaviourDrivenTest(new BehaviourDrivenTest()
{ {
private NodeRef deleteableContent; private NodeRef deleteableContent;
private ContentData contentData; private ContentData contentData;
public void given() throws Exception public void given() throws Exception
{ {
// create deletable content // create deletable content
@@ -572,18 +572,18 @@ public class DestroyContentTest extends BaseRMTestCase
writer.setEncoding("UTF-8"); writer.setEncoding("UTF-8");
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
writer.putContent(GUID.generate()); writer.putContent(GUID.generate());
contentData = (ContentData)nodeService.getProperty(deleteableContent, PROP_CONTENT); contentData = (ContentData)nodeService.getProperty(deleteableContent, PROP_CONTENT);
// assert things are as we expect // assert things are as we expect
assertNotNull(contentData); assertNotNull(contentData);
assertTrue(contentStore.exists(contentData.getContentUrl())); assertTrue(contentStore.exists(contentData.getContentUrl()));
// reset test content cleanser // reset test content cleanser
contentCleanser.reset(); contentCleanser.reset();
assertFalse(contentDestructionComponent.isCleansingEnabled()); assertFalse(contentDestructionComponent.isCleansingEnabled());
} }
public void when() throws Exception public void when() throws Exception
{ {
// delete the content // delete the content
@@ -594,14 +594,14 @@ public class DestroyContentTest extends BaseRMTestCase
{ {
// content deleted but not destroyed // content deleted but not destroyed
assertFalse(nodeService.exists(deleteableContent)); assertFalse(nodeService.exists(deleteableContent));
assertTrue(contentStore.exists(contentData.getContentUrl())); assertTrue(contentStore.exists(contentData.getContentUrl()));
// content cleansing hasn't taken place // content cleansing hasn't taken place
assertFalse(contentCleanser.hasCleansed()); assertFalse(contentCleanser.hasCleansed());
// ensure the content is in the archive store // ensure the content is in the archive store
NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, deleteableContent.getId()); NodeRef archiveNodeRef = new NodeRef(StoreRef.STORE_REF_ARCHIVE_SPACESSTORE, deleteableContent.getId());
assertTrue(nodeService.exists(archiveNodeRef)); assertTrue(nodeService.exists(archiveNodeRef));
} }
}); });
} }

View File

@@ -40,7 +40,7 @@ import org.mockito.MockitoAnnotations;
* Unit tests for {@link MetadataReferral}. * Unit tests for {@link MetadataReferral}.
* *
* @author Neil Mc Erlean * @author Neil Mc Erlean
* @since 3.0.a * @since 2.4.a
*/ */
public class MetadataReferralUnitTest public class MetadataReferralUnitTest
{ {

View File

@@ -55,7 +55,7 @@ import java.util.Map;
* Unit tests for {@link ReferredMetadataServiceImpl}. * Unit tests for {@link ReferredMetadataServiceImpl}.
* *
* @author Neil Mc Erlean * @author Neil Mc Erlean
* @since 3.0.a * @since 2.4.a
*/ */
public class ReferredMetadataServiceImplUnitTest public class ReferredMetadataServiceImplUnitTest
{ {