RM-2045 Fix references to "document" to refer to "content".

We can use the same API to classify documents and records.

+review RM-25

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@102160 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tom Page
2015-04-20 09:04:01 +00:00
parent 037e492cc9
commit 96dbe7c160
5 changed files with 31 additions and 34 deletions

View File

@@ -260,8 +260,8 @@ public class ClassificationServiceImplUnitTest
assertEquals("Expected an empty list when the target level is not found.", 0, actual.size());
}
/** Classify a document with a couple of reasons and check the NodeService is called correctly. */
@Test public void addClassificationToDocument_success()
/** Classify a piece of content with a couple of reasons and check the NodeService is called correctly. */
@Test public void classifyContent_success()
{
// Create a level and two reasons.
ClassificationLevel level = new ClassificationLevel("levelId1", "displayLabelKey");
@@ -271,15 +271,15 @@ public class ClassificationServiceImplUnitTest
doReturn(level).when(mockLevelManager).findLevelById("levelId1");
doReturn(reason1).when(mockReasonManager).findReasonById("reasonId1");
doReturn(reason2).when(mockReasonManager).findReasonById("reasonId2");
// Create a document node.
NodeRef document = new NodeRef("fake://document/");
doReturn(ContentModel.TYPE_CONTENT).when(mockNodeService).getType(document);
// Create a content node.
NodeRef content = new NodeRef("fake://content/");
doReturn(ContentModel.TYPE_CONTENT).when(mockNodeService).getType(content);
// Call the method under test.
classificationServiceImpl.addClassificationToDocument("levelId1", "classificationAuthority",
Sets.newHashSet("reasonId1", "reasonId2"), document);
classificationServiceImpl.classifyContent("levelId1", "classificationAuthority",
Sets.newHashSet("reasonId1", "reasonId2"), content);
verify(mockNodeService).addAspect(eq(document), eq(ClassifiedContentModel.ASPECT_CLASSIFIED),
verify(mockNodeService).addAspect(eq(content), eq(ClassifiedContentModel.ASPECT_CLASSIFIED),
propertiesCaptor.capture());
// Check the properties that were received.
Map<QName, Serializable> properties = propertiesCaptor.getValue();
@@ -295,19 +295,16 @@ public class ClassificationServiceImplUnitTest
assertEquals("Unexpected set of reasons.", expectedReasonIds, properties.get(ClassifiedContentModel.PROP_CLASSIFICATION_REASONS));
}
/**
* Classify a folder using the <code>addClassificationToDocument</code> method and check that an exception is
* raised.
*/
/** Classify a folder using the <code>classifyContent</code> method and check that an exception is raised. */
@Test(expected = InvalidNode.class)
public void addClassificationToDocument_notDocument()
public void classifyContent_notContent()
{
// Create a folder node.
NodeRef notADocument = new NodeRef("not://a/document/");
doReturn(ContentModel.TYPE_FOLDER).when(mockNodeService).getType(notADocument);
NodeRef notAPieceOfContent = new NodeRef("not://a/piece/of/content/");
doReturn(ContentModel.TYPE_FOLDER).when(mockNodeService).getType(notAPieceOfContent);
// Call the method under test.
classificationServiceImpl.addClassificationToDocument("levelId1", "classificationAuthority",
Sets.newHashSet("reasonId1", "reasonId2"), notADocument);
classificationServiceImpl.classifyContent("levelId1", "classificationAuthority",
Sets.newHashSet("reasonId1", "reasonId2"), notAPieceOfContent);
}
}

View File

@@ -116,7 +116,7 @@ public class ClassifyContentPostTest extends BaseWebScriptUnitTest
assertEquals(getStringValueFromJSONObject(json, SUCCESS), Boolean.TRUE.toString());
// Verify that the classify content method was called
verify(mockedClassificationService, times(1)).addClassificationToDocument(LEVEL_ID, AUTHORITY, newHashSet(REASON1_ID, REASON2_ID), record);
verify(mockedClassificationService, times(1)).classifyContent(LEVEL_ID, AUTHORITY, newHashSet(REASON1_ID, REASON2_ID), record);
}
/**