RM-5012 - fix unit tests and cleanedup merge request

This commit is contained in:
Ana Bozianu
2017-05-17 16:04:54 +03:00
parent 77b875c232
commit c8e47639a3
8 changed files with 29 additions and 44 deletions

View File

@@ -510,22 +510,6 @@ public class RecordServiceImpl extends BaseBehaviourBean
}, AuthenticationUtil.getSystemUserName());
}
@Behaviour
(
kind = BehaviourKind.ASSOCIATION,
policy = "alf:onCreateChildAssociation",
type = "rma:recordFolder",
notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT
)
public void onCreateChildAssociationOnCommit(ChildAssociationRef childAssocRef, boolean bNew)
{
NodeRef record = childAssocRef.getChildRef();
if(nodeService.exists(record) && dictionaryService.isSubClass(nodeService.getType(record), ContentModel.TYPE_CONTENT))
{
generateRecordIdentifier(nodeService, identifierService, record);
}
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#disablePropertyEditableCheck()
*/

View File

@@ -617,13 +617,6 @@ public class FilePlanComponentsApiUtils
QName typeQName = nodes.createQName(type);
newNodeRef = fileFolderService.create(parentNodeRef, name, typeQName).getNodeRef();
// If electronic record create empty content
if (!typeQName.equals(RecordsManagementModel.TYPE_NON_ELECTRONIC_DOCUMENT)
&& dictionaryService.isSubClass(typeQName, ContentModel.TYPE_CONTENT))
{
writeContent(newNodeRef, name, new ByteArrayInputStream("".getBytes()), false);
}
// Set the provided properties if any
Map<QName, Serializable> qnameProperties = mapToNodeProperties(properties);
if (qnameProperties != null)
@@ -631,6 +624,13 @@ public class FilePlanComponentsApiUtils
nodeService.addProperties(newNodeRef, qnameProperties);
}
// If electronic record create empty content
if (!typeQName.equals(RecordsManagementModel.TYPE_NON_ELECTRONIC_DOCUMENT)
&& dictionaryService.isSubClass(typeQName, ContentModel.TYPE_CONTENT))
{
writeContent(newNodeRef, name, new ByteArrayInputStream("".getBytes()), false);
}
// Add the provided aspects if any
if (aspects != null)
{

View File

@@ -179,7 +179,6 @@ public class MultipleSchedulesTest extends BaseRMTestCase
// Create a record filed under category A and linked to category B.
record = fileFolderService.create(folderA, RECORD_NAME, ContentModel.TYPE_CONTENT).getNodeRef();
recordService.file(record);
recordService.link(record, folderB);
})
.when(() -> {
@@ -213,7 +212,6 @@ public class MultipleSchedulesTest extends BaseRMTestCase
setUpFilePlan();
// Create a record filed under category B and linked to category A.
record = fileFolderService.create(folderB, RECORD_NAME, ContentModel.TYPE_CONTENT).getNodeRef();
recordService.file(record);
recordService.link(record, folderA);
})
.when(() -> {
@@ -245,7 +243,6 @@ public class MultipleSchedulesTest extends BaseRMTestCase
setUpFilePlan();
// Create a record filed under category A and linked to category B and C.
record = fileFolderService.create(folderA, RECORD_NAME, ContentModel.TYPE_CONTENT).getNodeRef();
recordService.file(record);
recordService.link(record, folderB);
recordService.link(record, folderC);
// Cut off the record.

View File

@@ -123,7 +123,6 @@ public class UpdateDispositionScheduleTest extends BaseRMTestCase
// Create a folder containing a record within the category.
folder = recordFolderService.createRecordFolder(category, FOLDER_NAME);
record = fileFolderService.create(folder, RECORD_NAME, ContentModel.TYPE_CONTENT).getNodeRef();
recordService.file(record);
dispositionService.cutoffDisposableItem(record);
// Ensure the update has been applied to the record.

View File

@@ -524,9 +524,7 @@ public class InplaceRecordPermissionTest extends BaseRMTestCase
// create record folder and file record
NodeRef recordFolder = recordFolderService.createRecordFolder(recordCategory, GUID.generate());
fileFolderService.move(dmDocument, recordFolder, null);
})
.perform(() ->
{
// cut off record
rmActionService.executeRecordsManagementAction(dmDocument, DeclareRecordAction.NAME);
utils.completeEvent(dmDocument, CommonRMTestUtils.DEFAULT_EVENT_NAME);

View File

@@ -27,6 +27,7 @@
package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock;
@@ -203,6 +204,9 @@ public class RecordFolderTypeUnitTest extends BaseUnitTest
when(mockedDictionaryService.isSubClass(type, TYPE_FOLDER)).thenReturn(true);
when(mockedNodeService.hasAspect(nodeRef, ASPECT_HIDDEN)).thenReturn(true);
ChildAssociationRef mockedPrimaryParentAssoc = mock(ChildAssociationRef.class);
when(mockedNodeService.getPrimaryParent(nodeRef)).thenReturn(mockedPrimaryParentAssoc);
ChildAssociationRef childAssocRef = generateChildAssociationRef(recordFolderNodeRef, nodeRef);
recordFolderType.onCreateChildAssociationOnCommit(childAssocRef, true);
}
@@ -220,6 +224,9 @@ public class RecordFolderTypeUnitTest extends BaseUnitTest
when(mockedDictionaryService.isSubClass(type, TYPE_FOLDER)).thenReturn(false);
ChildAssociationRef mockedPrimaryParentAssoc = mock(ChildAssociationRef.class);
when(mockedNodeService.getPrimaryParent(nodeRef)).thenReturn(mockedPrimaryParentAssoc);
ChildAssociationRef childAssocRef = generateChildAssociationRef(recordFolderNodeRef, nodeRef);
recordFolderType.onCreateChildAssociationOnCommit(childAssocRef, true);
}