use of org.alfresco.service.cmr.repository.ChildAssociationRef in project records-management by Alfresco.
the class FilePlanTypeUnitTest method testCreateMultipleHoldContainers.
/**
* Having the Fileplan container with a child of type TYPE_HOLD_CONTAINER
* When adding another child of type TYPE_HOLD_CONTAINER
* Then an error should be thrown
*/
@Test(expected = IntegrityException.class)
public void testCreateMultipleHoldContainers() {
ChildAssociationRef existingHoldAssoc = createFileplanContainerChild(TYPE_HOLD_CONTAINER);
ChildAssociationRef childAssoc = createFileplanContainerChild(TYPE_HOLD_CONTAINER);
when(mockedNodeService.getChildAssocs(filePlanContainer, Sets.newHashSet(TYPE_HOLD_CONTAINER))).thenReturn(Arrays.asList(existingHoldAssoc, childAssoc));
filePlanType.onCreateChildAssociation(childAssoc, true);
}
use of org.alfresco.service.cmr.repository.ChildAssociationRef in project records-management by Alfresco.
the class FilePlanTypeUnitTest method testCreateMultipleUnfiledRecordsContainers.
/**
* Having the Fileplan container with a child of type TYPE_UNFILED_RECORD_CONTAINER
* When adding another child of type TYPE_UNFILED_RECORD_CONTAINER
* Then an error should be thrown
*/
@Test(expected = IntegrityException.class)
public void testCreateMultipleUnfiledRecordsContainers() {
ChildAssociationRef existingHoldAssoc = createFileplanContainerChild(TYPE_UNFILED_RECORD_CONTAINER);
ChildAssociationRef childAssoc = createFileplanContainerChild(TYPE_UNFILED_RECORD_CONTAINER);
when(mockedNodeService.getChildAssocs(filePlanContainer, Sets.newHashSet(TYPE_UNFILED_RECORD_CONTAINER))).thenReturn(Arrays.asList(existingHoldAssoc, childAssoc));
filePlanType.onCreateChildAssociation(childAssoc, true);
}
use of org.alfresco.service.cmr.repository.ChildAssociationRef in project records-management by Alfresco.
the class FilePlanTypeUnitTest method testAddCategoriesToFileplan.
/**
* Having the Fileplan container
* When adding multiple child of type TYPE_RECORD_CATEGORY
* Then child associations should be created
*/
@Test
public void testAddCategoriesToFileplan() {
// add the first child
ChildAssociationRef childAssoc1 = createFileplanContainerChild(TYPE_RECORD_CATEGORY);
filePlanType.onCreateChildAssociation(childAssoc1, true);
// add the second child
ChildAssociationRef childAssoc2 = createFileplanContainerChild(TYPE_RECORD_CATEGORY);
filePlanType.onCreateChildAssociation(childAssoc2, true);
}
use of org.alfresco.service.cmr.repository.ChildAssociationRef in project records-management by Alfresco.
the class HoldContainerTypeUnitTest method testAddNonHoldTypeToHoldContainer.
/**
* Given that we try to add a non "rma:hold" type to hold container,
* Then IntegrityException is thrown.
*/
@Test(expected = IntegrityException.class)
public void testAddNonHoldTypeToHoldContainer() {
QName type = AlfMock.generateQName();
when(mockedDictionaryService.isSubClass(type, TYPE_HOLD)).thenReturn(false);
NodeRef nodeRef = AlfMock.generateNodeRef(mockedNodeService, type);
NodeRef holdContainer = generateNodeRef(TYPE_HOLD_CONTAINER, true);
ChildAssociationRef mockedChildAssoc = mock(ChildAssociationRef.class);
when(mockedChildAssoc.getChildRef()).thenReturn(nodeRef);
when(mockedChildAssoc.getParentRef()).thenReturn(holdContainer);
holdContainerType.onCreateChildAssociation(mockedChildAssoc, true);
}
use of org.alfresco.service.cmr.repository.ChildAssociationRef in project records-management by Alfresco.
the class HoldContainerTypeUnitTest method testAddHoldTypeToHoldContainer.
/**
* Given that we try to add "rma:hold" type to hold container,
* Then the operation is successful.
*/
@Test
public void testAddHoldTypeToHoldContainer() {
QName type = AlfMock.generateQName();
when(mockedDictionaryService.isSubClass(type, TYPE_HOLD)).thenReturn(true);
NodeRef holdFolder = AlfMock.generateNodeRef(mockedNodeService, type);
NodeRef holdContainer = generateNodeRef(TYPE_HOLD_CONTAINER, true);
ChildAssociationRef mockedChildAssoc = mock(ChildAssociationRef.class);
when(mockedChildAssoc.getChildRef()).thenReturn(holdFolder);
when(mockedChildAssoc.getParentRef()).thenReturn(holdContainer);
holdContainerType.onCreateChildAssociation(mockedChildAssoc, true);
}
Aggregations