mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-6873 adding code review changes
This commit is contained in:
@@ -42,7 +42,6 @@ import java.util.Set;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper;
|
||||
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||
import org.alfresco.rest.framework.core.exceptions.PermissionDeniedException;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
@@ -90,9 +89,6 @@ public class FrozenAspectUnitTest
|
||||
@Mock
|
||||
private ChildAssociationRef mockOldRef;
|
||||
|
||||
@Mock
|
||||
private ChildAssociationRef mockNewRef;
|
||||
|
||||
@Mock
|
||||
private Set mockSet;
|
||||
|
||||
@@ -116,11 +112,11 @@ public class FrozenAspectUnitTest
|
||||
when(mockNodeService.hasAspect(folder, ASPECT_HELD_CHILDREN)).thenReturn(true);
|
||||
when(mockNodeService.getProperty(folder, PROP_HELD_CHILDREN_COUNT)).thenReturn(1);
|
||||
when(mockApplicationContext.getBean("dbNodeService")).thenReturn(mockNodeService);
|
||||
when(mockNodeService.exists(content)).thenReturn(true);
|
||||
when(mockFreezeService.isFrozen(content)).thenReturn(false);
|
||||
children.add(mockChildRef);
|
||||
when(mockNodeService.getChildAssocs(content)).thenReturn(children);
|
||||
when(mockChildRef.isPrimary()).thenReturn(true);
|
||||
when(mockNodeService.hasAspect(record, ASPECT_RECORD)).thenReturn(true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,7 +125,6 @@ public class FrozenAspectUnitTest
|
||||
@Test
|
||||
public void testRemoveAspectForRecords()
|
||||
{
|
||||
when(mockNodeService.hasAspect(record, ASPECT_RECORD)).thenReturn(true);
|
||||
when(mockNodeService.getPrimaryParent(record)).thenReturn(mockChildAssociationRef);
|
||||
when(mockChildAssociationRef.getParentRef()).thenReturn(folder);
|
||||
frozenAspect.onRemoveAspect(record, null);
|
||||
@@ -151,7 +146,7 @@ public class FrozenAspectUnitTest
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the remove code is only ran for records or active content
|
||||
* Test that the remove code is only run for records or active content
|
||||
*/
|
||||
@Test
|
||||
public void testRemoveAspectForContentDoesntUpdateForOtherTypes()
|
||||
@@ -201,7 +196,6 @@ public class FrozenAspectUnitTest
|
||||
@Test
|
||||
public void testOnAddAspectForRecord()
|
||||
{
|
||||
when(mockNodeService.getType(record)).thenReturn(ContentModel.TYPE_CONTENT);
|
||||
when(mockNodeService.getPrimaryParent(record)).thenReturn(mockParentRef);
|
||||
when(mockParentRef.getParentRef()).thenReturn(parent);
|
||||
when(mockNodeService.hasAspect(parent, ASPECT_HELD_CHILDREN)).thenReturn(true);
|
||||
@@ -211,17 +205,17 @@ public class FrozenAspectUnitTest
|
||||
}
|
||||
|
||||
/**
|
||||
* Test on add for a content node
|
||||
* Test on add aspect for a content node
|
||||
*/
|
||||
@Test
|
||||
public void testOnAddAspectForContent()
|
||||
{
|
||||
when(mockNodeService.getType(record)).thenReturn(ContentModel.TYPE_CONTENT);
|
||||
when(mockNodeService.getPrimaryParent(record)).thenReturn(mockParentRef);
|
||||
when(mockNodeService.getType(content)).thenReturn(ContentModel.TYPE_CONTENT);
|
||||
when(mockNodeService.getPrimaryParent(content)).thenReturn(mockParentRef);
|
||||
when(mockParentRef.getParentRef()).thenReturn(parent);
|
||||
when(mockNodeService.hasAspect(parent, ASPECT_HELD_CHILDREN)).thenReturn(false);
|
||||
when(mockNodeService.getType(parent)).thenReturn(ContentModel.TYPE_FOLDER);
|
||||
frozenAspect.onAddAspect(record, null);
|
||||
frozenAspect.onAddAspect(content, null);
|
||||
verify(mockNodeService, times(1)).addAspect(any(NodeRef.class), any(QName.class), anyMap());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user