mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM-6873 adding changes from update branch and updating tests
This commit is contained in:
@@ -43,6 +43,7 @@ import org.alfresco.model.ContentModel;
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService;
|
import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper;
|
import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper;
|
||||||
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
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.dictionary.DictionaryService;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
@@ -165,7 +166,7 @@ public class FrozenAspectUnitTest
|
|||||||
/**
|
/**
|
||||||
* Test before delete throws an error if a node is frozen
|
* Test before delete throws an error if a node is frozen
|
||||||
*/
|
*/
|
||||||
@Test(expected = AccessDeniedException.class)
|
@Test(expected = PermissionDeniedException.class)
|
||||||
public void testBeforeDeleteNodeThrowsExceptionIfNodeFrozen()
|
public void testBeforeDeleteNodeThrowsExceptionIfNodeFrozen()
|
||||||
{
|
{
|
||||||
when(mockFreezeService.isFrozen(content)).thenReturn(true);
|
when(mockFreezeService.isFrozen(content)).thenReturn(true);
|
||||||
@@ -186,7 +187,7 @@ public class FrozenAspectUnitTest
|
|||||||
/**
|
/**
|
||||||
* Test before delete throws an error for a node with frozen children
|
* Test before delete throws an error for a node with frozen children
|
||||||
*/
|
*/
|
||||||
@Test (expected = AccessDeniedException.class)
|
@Test (expected = PermissionDeniedException.class)
|
||||||
public void testBeforeDeleteThrowsExceptionForFrozenChild()
|
public void testBeforeDeleteThrowsExceptionForFrozenChild()
|
||||||
{
|
{
|
||||||
when(mockChildRef.getChildRef()).thenReturn(child);
|
when(mockChildRef.getChildRef()).thenReturn(child);
|
||||||
@@ -225,22 +226,22 @@ public class FrozenAspectUnitTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test on move throws an error for a frozen node
|
* Test before move throws an error for a frozen node
|
||||||
*/
|
*/
|
||||||
@Test(expected = AccessDeniedException.class)
|
@Test(expected = PermissionDeniedException.class)
|
||||||
public void testOnMoveThrowsExceptionForFrozenNode()
|
public void testBeforeMoveThrowsExceptionForFrozenNode()
|
||||||
{
|
{
|
||||||
when(mockNewRef.getParentRef()).thenReturn(parent);
|
when(mockOldRef.getParentRef()).thenReturn(parent);
|
||||||
when(mockNewRef.getChildRef()).thenReturn(child);
|
when(mockOldRef.getChildRef()).thenReturn(child);
|
||||||
when(mockNodeService.exists(parent)).thenReturn(true);
|
|
||||||
when(mockNodeService.exists(child)).thenReturn(true);
|
when(mockNodeService.exists(child)).thenReturn(true);
|
||||||
frozenAspect.onMoveNode(mockOldRef, mockNewRef);
|
when(mockFreezeService.isFrozen(child)).thenReturn(true);
|
||||||
|
frozenAspect.beforeMoveNode(mockOldRef, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test update properties throws an error for frozen nodes
|
* Test update properties throws an error for frozen nodes
|
||||||
*/
|
*/
|
||||||
@Test(expected = AccessDeniedException.class)
|
@Test(expected = PermissionDeniedException.class)
|
||||||
public void testUpdatePropertiesThrowsExceptionForFrozenNode()
|
public void testUpdatePropertiesThrowsExceptionForFrozenNode()
|
||||||
{
|
{
|
||||||
when(mockFreezeService.isFrozen(content)).thenReturn(true);
|
when(mockFreezeService.isFrozen(content)).thenReturn(true);
|
||||||
@@ -248,24 +249,4 @@ public class FrozenAspectUnitTest
|
|||||||
when(mockSet.contains("frozen")).thenReturn(false);
|
when(mockSet.contains("frozen")).thenReturn(false);
|
||||||
frozenAspect.onUpdateProperties(content, null, null);
|
frozenAspect.onUpdateProperties(content, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test on content update throws an error for frozen nodes
|
|
||||||
*/
|
|
||||||
@Test(expected = AccessDeniedException.class)
|
|
||||||
public void testOnContentUpdateThrowsExceptionForFrozenNode()
|
|
||||||
{
|
|
||||||
when(mockFreezeService.isFrozen(content)).thenReturn(true);
|
|
||||||
frozenAspect.onContentUpdate(content, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test before copy throws an error for frozen node
|
|
||||||
*/
|
|
||||||
@Test(expected = AccessDeniedException.class)
|
|
||||||
public void testBeforeCopyThrowsExceptionForFrozenNode()
|
|
||||||
{
|
|
||||||
when(mockFreezeService.isFrozen(content)).thenReturn(true);
|
|
||||||
frozenAspect.beforeCopy(null, content, null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user