mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-4327: changed InvalidParameterException with IntegrityException
This commit is contained in:
@@ -27,13 +27,13 @@
|
|||||||
|
|
||||||
package org.alfresco.module.org_alfresco_module_rm.model;
|
package org.alfresco.module.org_alfresco_module_rm.model;
|
||||||
|
|
||||||
import java.security.InvalidParameterException;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl;
|
import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl;
|
||||||
|
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||||
import org.alfresco.repo.policy.BehaviourFilter;
|
import org.alfresco.repo.policy.BehaviourFilter;
|
||||||
import org.alfresco.repo.policy.annotation.BehaviourRegistry;
|
import org.alfresco.repo.policy.annotation.BehaviourRegistry;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
@@ -99,9 +99,9 @@ public abstract class BaseBehaviourBean extends ServiceBaseImpl
|
|||||||
* @param childType the child node
|
* @param childType the child node
|
||||||
* @param acceptedUniqueChildType a list of node types that are accepted as children of the provided parent only once
|
* @param acceptedUniqueChildType a list of node types that are accepted as children of the provided parent only once
|
||||||
* @param acceptedMultipleChildType a list of node types that are accepted as children of the provided parent multiple times
|
* @param acceptedMultipleChildType a list of node types that are accepted as children of the provided parent multiple times
|
||||||
* @throws InvalidParameterException if the child association doesn't comply with the RM rules
|
* @throws IntegrityException if the child association doesn't comply with the RM rules
|
||||||
*/
|
*/
|
||||||
protected void validateNewChildAssociation(NodeRef parent, NodeRef child, List<QName> acceptedUniqueChildType, List<QName> acceptedMultipleChildType) throws InvalidParameterException
|
protected void validateNewChildAssociation(NodeRef parent, NodeRef child, List<QName> acceptedUniqueChildType, List<QName> acceptedMultipleChildType) throws IntegrityException
|
||||||
{
|
{
|
||||||
QName childType = getInternalNodeService().getType(child);
|
QName childType = getInternalNodeService().getType(child);
|
||||||
if(acceptedUniqueChildType.contains(childType))
|
if(acceptedUniqueChildType.contains(childType))
|
||||||
@@ -109,12 +109,12 @@ public abstract class BaseBehaviourBean extends ServiceBaseImpl
|
|||||||
// check the user is not trying to create multiple children of a type that is only accepted once
|
// check the user is not trying to create multiple children of a type that is only accepted once
|
||||||
if(nodeService.getChildAssocs(parent, Sets.newHashSet(childType)).size() > 1)
|
if(nodeService.getChildAssocs(parent, Sets.newHashSet(childType)).size() > 1)
|
||||||
{
|
{
|
||||||
throw new InvalidParameterException("Operation failed. Multiple children of this type are not allowed.");
|
throw new IntegrityException("Operation failed. Multiple children of this type are not allowed.", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!acceptedMultipleChildType.contains(childType))
|
else if(!acceptedMultipleChildType.contains(childType))
|
||||||
{
|
{
|
||||||
throw new InvalidParameterException("Operation failed. Children of type " + childType + " are not allowed");
|
throw new IntegrityException("Operation failed. Children of type " + childType + " are not allowed", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,9 +122,9 @@ public abstract class BaseBehaviourBean extends ServiceBaseImpl
|
|||||||
* Helper method that checks if the newly created child association is between the sub-types of accepted types.
|
* Helper method that checks if the newly created child association is between the sub-types of accepted types.
|
||||||
* @param childType the child node
|
* @param childType the child node
|
||||||
* @param acceptedMultipleChildType a list of node types that are accepted as children of the provided parent multiple times
|
* @param acceptedMultipleChildType a list of node types that are accepted as children of the provided parent multiple times
|
||||||
* @throws InvalidParameterException if the child association isn't between the sub-types of accepted types
|
* @throws IntegrityException if the child association isn't between the sub-types of accepted types
|
||||||
*/
|
*/
|
||||||
protected void validateNewChildAssociationSubTypesIncluded(NodeRef child, List<QName> acceptedMultipleChildType) throws InvalidParameterException
|
protected void validateNewChildAssociationSubTypesIncluded(NodeRef child, List<QName> acceptedMultipleChildType) throws IntegrityException
|
||||||
{
|
{
|
||||||
QName childType = getInternalNodeService().getType(child);
|
QName childType = getInternalNodeService().getType(child);
|
||||||
for(QName type : acceptedMultipleChildType)
|
for(QName type : acceptedMultipleChildType)
|
||||||
@@ -135,6 +135,6 @@ public abstract class BaseBehaviourBean extends ServiceBaseImpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//no match was found in sub-types of permitted types list
|
//no match was found in sub-types of permitted types list
|
||||||
throw new InvalidParameterException("Operation failed. Children of type " + childType + " are not allowed");
|
throw new IntegrityException("Operation failed. Children of type " + childType + " are not allowed", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -28,7 +28,6 @@
|
|||||||
package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
|
package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.security.InvalidParameterException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -41,6 +40,7 @@ import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
|
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService;
|
import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService;
|
||||||
import org.alfresco.repo.node.NodeServicePolicies;
|
import org.alfresco.repo.node.NodeServicePolicies;
|
||||||
|
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||||
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
||||||
import org.alfresco.repo.policy.annotation.Behaviour;
|
import org.alfresco.repo.policy.annotation.Behaviour;
|
||||||
import org.alfresco.repo.policy.annotation.BehaviourBean;
|
import org.alfresco.repo.policy.annotation.BehaviourBean;
|
||||||
@@ -343,14 +343,14 @@ public class RmSiteType extends BaseBehaviourBean
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void validateNewChildAssociation(NodeRef parent, NodeRef child, List<QName> acceptedUniqueChildType,
|
protected void validateNewChildAssociation(NodeRef parent, NodeRef child, List<QName> acceptedUniqueChildType,
|
||||||
List<QName> acceptedMultipleChildType) throws InvalidParameterException
|
List<QName> acceptedMultipleChildType) throws IntegrityException
|
||||||
{
|
{
|
||||||
super.validateNewChildAssociation(parent, child, acceptedUniqueChildType, acceptedMultipleChildType);
|
super.validateNewChildAssociation(parent, child, acceptedUniqueChildType, acceptedMultipleChildType);
|
||||||
|
|
||||||
// check the user is not trying to create more than 2 folders that are created by default.
|
// check the user is not trying to create more than 2 folders that are created by default.
|
||||||
if(nodeService.getChildAssocs(parent, Sets.newHashSet(ContentModel.TYPE_FOLDER)).size() > 2)
|
if(nodeService.getChildAssocs(parent, Sets.newHashSet(ContentModel.TYPE_FOLDER)).size() > 2)
|
||||||
{
|
{
|
||||||
throw new InvalidParameterException("Operation failed. Children of type " + ContentModel.TYPE_FOLDER + " are not allowed");
|
throw new IntegrityException("Operation failed. Children of type " + ContentModel.TYPE_FOLDER + " are not allowed", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -26,12 +26,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
|
package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
|
||||||
|
|
||||||
import java.security.InvalidParameterException;
|
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
|
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
|
||||||
import org.alfresco.repo.node.NodeServicePolicies;
|
import org.alfresco.repo.node.NodeServicePolicies;
|
||||||
|
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||||
import org.alfresco.repo.policy.annotation.Behaviour;
|
import org.alfresco.repo.policy.annotation.Behaviour;
|
||||||
import org.alfresco.repo.policy.annotation.BehaviourBean;
|
import org.alfresco.repo.policy.annotation.BehaviourBean;
|
||||||
import org.alfresco.repo.policy.annotation.BehaviourKind;
|
import org.alfresco.repo.policy.annotation.BehaviourKind;
|
||||||
@@ -84,7 +83,7 @@ public class TransferContainerType extends BaseBehaviourBean
|
|||||||
)
|
)
|
||||||
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew)
|
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew)
|
||||||
{
|
{
|
||||||
throw new InvalidParameterException("Operation failed. Creation is not allowed in Transfer Container");
|
throw new IntegrityException("Operation failed. Creation is not allowed in Transfer Container", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -27,10 +27,9 @@
|
|||||||
|
|
||||||
package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
|
package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
|
||||||
|
|
||||||
import java.security.InvalidParameterException;
|
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
|
import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean;
|
||||||
import org.alfresco.repo.node.NodeServicePolicies;
|
import org.alfresco.repo.node.NodeServicePolicies;
|
||||||
|
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||||
import org.alfresco.repo.policy.annotation.Behaviour;
|
import org.alfresco.repo.policy.annotation.Behaviour;
|
||||||
import org.alfresco.repo.policy.annotation.BehaviourBean;
|
import org.alfresco.repo.policy.annotation.BehaviourBean;
|
||||||
import org.alfresco.repo.policy.annotation.BehaviourKind;
|
import org.alfresco.repo.policy.annotation.BehaviourKind;
|
||||||
@@ -76,6 +75,6 @@ public class TransferType extends BaseBehaviourBean implements NodeServicePolici
|
|||||||
)
|
)
|
||||||
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode)
|
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode)
|
||||||
{
|
{
|
||||||
throw new InvalidParameterException("Operation failed. Creation is not allowed in Transfer Folders");
|
throw new IntegrityException("Operation failed. Creation is not allowed in Transfer Folders", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -27,11 +27,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.module.org_alfresco_module_rm.test.integration.issue;
|
package org.alfresco.module.org_alfresco_module_rm.test.integration.issue;
|
||||||
|
|
||||||
import java.security.InvalidParameterException;
|
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||||
|
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.security.AccessStatus;
|
import org.alfresco.service.cmr.security.AccessStatus;
|
||||||
|
|
||||||
@@ -78,7 +77,7 @@ public class RM3341Test extends BaseRMTestCase
|
|||||||
fileFolderService.create(holdContainer, "test file", ContentModel.TYPE_CONTENT);
|
fileFolderService.create(holdContainer, "test file", ContentModel.TYPE_CONTENT);
|
||||||
fail("This should have thrown an exception");
|
fail("This should have thrown an exception");
|
||||||
}
|
}
|
||||||
catch (InvalidParameterException e)
|
catch (IntegrityException e)
|
||||||
{
|
{
|
||||||
// ("Content can't be added to a hold container. Use record folders to file content.")
|
// ("Content can't be added to a hold container. Use record folders to file content.")
|
||||||
}
|
}
|
||||||
@@ -104,7 +103,7 @@ public class RM3341Test extends BaseRMTestCase
|
|||||||
fail("This should have thrown an exception");
|
fail("This should have thrown an exception");
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (InvalidParameterException e)
|
catch (IntegrityException e)
|
||||||
{
|
{
|
||||||
// ("Content can't be added to a transfer container. Use record folders to file content.")
|
// ("Content can't be added to a transfer container. Use record folders to file content.")
|
||||||
}
|
}
|
||||||
|
@@ -26,10 +26,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.module.org_alfresco_module_rm.test.integration.issue;
|
package org.alfresco.module.org_alfresco_module_rm.test.integration.issue;
|
||||||
|
|
||||||
import java.security.InvalidParameterException;
|
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.TestModel;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.TestModel;
|
||||||
|
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||||
import org.alfresco.util.GUID;
|
import org.alfresco.util.GUID;
|
||||||
import org.springframework.extensions.surf.util.I18NUtil;
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
@@ -50,7 +49,7 @@ public class RM3450Test extends BaseRMTestCase
|
|||||||
doTestInTransaction(new FailureTest
|
doTestInTransaction(new FailureTest
|
||||||
(
|
(
|
||||||
I18NUtil.getMessage(MSG_CANNOT_CAST_TO_RM_TYPE),
|
I18NUtil.getMessage(MSG_CANNOT_CAST_TO_RM_TYPE),
|
||||||
InvalidParameterException.class
|
IntegrityException.class
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
@@ -29,11 +29,11 @@ package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
|
|||||||
|
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import java.security.InvalidParameterException;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
|
||||||
|
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||||
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;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
@@ -69,7 +69,7 @@ public class FilePlanTypeUnitTest extends BaseUnitTest
|
|||||||
* When adding a child of type TYPE_FILE_PLAN
|
* When adding a child of type TYPE_FILE_PLAN
|
||||||
* Then an error should be thrown
|
* Then an error should be thrown
|
||||||
*/
|
*/
|
||||||
@Test (expected = InvalidParameterException.class)
|
@Test (expected = IntegrityException.class)
|
||||||
public void testAddFileplanToFileplan()
|
public void testAddFileplanToFileplan()
|
||||||
{
|
{
|
||||||
ChildAssociationRef childAssoc = createFileplanContainerChild(TYPE_FILE_PLAN);
|
ChildAssociationRef childAssoc = createFileplanContainerChild(TYPE_FILE_PLAN);
|
||||||
@@ -112,7 +112,7 @@ public class FilePlanTypeUnitTest extends BaseUnitTest
|
|||||||
* When adding another child of type TYPE_HOLD_CONTAINER
|
* When adding another child of type TYPE_HOLD_CONTAINER
|
||||||
* Then an error should be thrown
|
* Then an error should be thrown
|
||||||
*/
|
*/
|
||||||
@Test (expected = InvalidParameterException.class)
|
@Test (expected = IntegrityException.class)
|
||||||
public void testCreateMultipleHoldContainers()
|
public void testCreateMultipleHoldContainers()
|
||||||
{
|
{
|
||||||
ChildAssociationRef existingHoldAssoc = createFileplanContainerChild(TYPE_HOLD_CONTAINER);
|
ChildAssociationRef existingHoldAssoc = createFileplanContainerChild(TYPE_HOLD_CONTAINER);
|
||||||
@@ -141,7 +141,7 @@ public class FilePlanTypeUnitTest extends BaseUnitTest
|
|||||||
* When adding another child of type TYPE_TRANSFER_CONTAINER
|
* When adding another child of type TYPE_TRANSFER_CONTAINER
|
||||||
* Then an error should be thrown
|
* Then an error should be thrown
|
||||||
*/
|
*/
|
||||||
@Test (expected = InvalidParameterException.class)
|
@Test (expected = IntegrityException.class)
|
||||||
public void testCreateMultipleTransferContainers()
|
public void testCreateMultipleTransferContainers()
|
||||||
{
|
{
|
||||||
ChildAssociationRef existingHoldAssoc = createFileplanContainerChild(TYPE_TRANSFER_CONTAINER);
|
ChildAssociationRef existingHoldAssoc = createFileplanContainerChild(TYPE_TRANSFER_CONTAINER);
|
||||||
@@ -170,7 +170,7 @@ public class FilePlanTypeUnitTest extends BaseUnitTest
|
|||||||
* When adding another child of type TYPE_UNFILED_RECORD_CONTAINER
|
* When adding another child of type TYPE_UNFILED_RECORD_CONTAINER
|
||||||
* Then an error should be thrown
|
* Then an error should be thrown
|
||||||
*/
|
*/
|
||||||
@Test (expected = InvalidParameterException.class)
|
@Test (expected = IntegrityException.class)
|
||||||
public void testCreateMultipleUnfiledRecordsContainers()
|
public void testCreateMultipleUnfiledRecordsContainers()
|
||||||
{
|
{
|
||||||
ChildAssociationRef existingHoldAssoc = createFileplanContainerChild(TYPE_UNFILED_RECORD_CONTAINER);
|
ChildAssociationRef existingHoldAssoc = createFileplanContainerChild(TYPE_UNFILED_RECORD_CONTAINER);
|
||||||
|
@@ -29,10 +29,9 @@ package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
|
|||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import java.security.InvalidParameterException;
|
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
|
||||||
|
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||||
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;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
@@ -52,9 +51,9 @@ public class HoldContainerTypeUnitTest extends BaseUnitTest
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Given that we try to add a non "rma:hold" type to hold container,
|
* Given that we try to add a non "rma:hold" type to hold container,
|
||||||
* Then InvalidParameterException is thrown.
|
* Then IntegrityException is thrown.
|
||||||
*/
|
*/
|
||||||
@Test (expected = InvalidParameterException.class)
|
@Test (expected = IntegrityException.class)
|
||||||
public void testAddNonHoldTypeToHoldContainer()
|
public void testAddNonHoldTypeToHoldContainer()
|
||||||
{
|
{
|
||||||
QName type = AlfMock.generateQName();
|
QName type = AlfMock.generateQName();
|
||||||
|
@@ -30,7 +30,6 @@ package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
|
|||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import java.security.InvalidParameterException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
|
import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model;
|
||||||
@@ -38,6 +37,7 @@ import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock;
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.MockAuthenticationUtilHelper;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.MockAuthenticationUtilHelper;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
|
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
|
||||||
|
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||||
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;
|
||||||
import org.alfresco.service.cmr.site.SiteInfo;
|
import org.alfresco.service.cmr.site.SiteInfo;
|
||||||
@@ -77,9 +77,9 @@ public class RmSiteTypeUnitTest extends BaseUnitTest implements DOD5015Model
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Given that we try to add non allowed type to rm site,
|
* Given that we try to add non allowed type to rm site,
|
||||||
* Then InvalidParameterException is thrown.
|
* Then IntegrityException is thrown.
|
||||||
*/
|
*/
|
||||||
@Test(expected = InvalidParameterException.class)
|
@Test(expected = IntegrityException.class)
|
||||||
public void testAddNonAcceptedTypeToRmSite()
|
public void testAddNonAcceptedTypeToRmSite()
|
||||||
{
|
{
|
||||||
NodeRef rmSiteNodeRef = generateNodeRef(TYPE_RM_SITE, true);
|
NodeRef rmSiteNodeRef = generateNodeRef(TYPE_RM_SITE, true);
|
||||||
@@ -149,9 +149,9 @@ public class RmSiteTypeUnitTest extends BaseUnitTest implements DOD5015Model
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Given that we try to add more than two cm:folder to rm site,
|
* Given that we try to add more than two cm:folder to rm site,
|
||||||
* Then InvalidParameterException is thrown.
|
* Then IntegrityException is thrown.
|
||||||
*/
|
*/
|
||||||
@Test(expected = InvalidParameterException.class)
|
@Test(expected = IntegrityException.class)
|
||||||
public void testAddMoreThanTwhoFolderTypeToRmSite()
|
public void testAddMoreThanTwhoFolderTypeToRmSite()
|
||||||
{
|
{
|
||||||
NodeRef rmSiteNodeRef = generateNodeRef(TYPE_RM_SITE, true);
|
NodeRef rmSiteNodeRef = generateNodeRef(TYPE_RM_SITE, true);
|
||||||
@@ -208,9 +208,9 @@ public class RmSiteTypeUnitTest extends BaseUnitTest implements DOD5015Model
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Given that we try to add one dod:filePlan to standard rm site,
|
* Given that we try to add one dod:filePlan to standard rm site,
|
||||||
* Then InvalidParameterException is thrown.
|
* Then IntegrityException is thrown.
|
||||||
*/
|
*/
|
||||||
@Test(expected = InvalidParameterException.class)
|
@Test(expected = IntegrityException.class)
|
||||||
public void testAddDODFilePlanTypeToStandardRmSite()
|
public void testAddDODFilePlanTypeToStandardRmSite()
|
||||||
{
|
{
|
||||||
NodeRef rmSiteNodeRef = generateNodeRef(TYPE_RM_SITE, true);
|
NodeRef rmSiteNodeRef = generateNodeRef(TYPE_RM_SITE, true);
|
||||||
@@ -225,9 +225,9 @@ public class RmSiteTypeUnitTest extends BaseUnitTest implements DOD5015Model
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Given that we try to add more than one rma:filePlan to rm site,
|
* Given that we try to add more than one rma:filePlan to rm site,
|
||||||
* Then InvalidParameterException is thrown.
|
* Then IntegrityException is thrown.
|
||||||
*/
|
*/
|
||||||
@Test(expected = InvalidParameterException.class)
|
@Test(expected = IntegrityException.class)
|
||||||
public void testAddMoreThanOneFilePlanTypeToRmSite()
|
public void testAddMoreThanOneFilePlanTypeToRmSite()
|
||||||
{
|
{
|
||||||
NodeRef rmSiteNodeRef = generateNodeRef(TYPE_RM_SITE, true);
|
NodeRef rmSiteNodeRef = generateNodeRef(TYPE_RM_SITE, true);
|
||||||
@@ -281,9 +281,9 @@ public class RmSiteTypeUnitTest extends BaseUnitTest implements DOD5015Model
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Given that we try to add more than one dod:filePlan to rm site,
|
* Given that we try to add more than one dod:filePlan to rm site,
|
||||||
* Then InvalidParameterException is thrown.
|
* Then IntegrityException is thrown.
|
||||||
*/
|
*/
|
||||||
@Test(expected = InvalidParameterException.class)
|
@Test(expected = IntegrityException.class)
|
||||||
public void testAddMoreThanOneDODFilePlanTypeToRmSite()
|
public void testAddMoreThanOneDODFilePlanTypeToRmSite()
|
||||||
{
|
{
|
||||||
NodeRef rmSiteNodeRef = generateNodeRef(TYPE_DOD_5015_SITE, true);
|
NodeRef rmSiteNodeRef = generateNodeRef(TYPE_DOD_5015_SITE, true);
|
||||||
@@ -315,9 +315,9 @@ public class RmSiteTypeUnitTest extends BaseUnitTest implements DOD5015Model
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Given that we try to add one rma:filePlan to DOD rm site,
|
* Given that we try to add one rma:filePlan to DOD rm site,
|
||||||
* Then InvalidParameterException is thrown.
|
* Then IntegrityException is thrown.
|
||||||
*/
|
*/
|
||||||
@Test(expected = InvalidParameterException.class)
|
@Test(expected = IntegrityException.class)
|
||||||
public void testAddStandardFilePlanTypeToDODRmSite()
|
public void testAddStandardFilePlanTypeToDODRmSite()
|
||||||
{
|
{
|
||||||
NodeRef rmSiteNodeRef = generateNodeRef(TYPE_DOD_5015_SITE, true);
|
NodeRef rmSiteNodeRef = generateNodeRef(TYPE_DOD_5015_SITE, true);
|
||||||
|
@@ -29,10 +29,9 @@ package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
|
|||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import java.security.InvalidParameterException;
|
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
|
||||||
|
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||||
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;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
@@ -52,9 +51,9 @@ public class TransferContainerTypeUnitTest extends BaseUnitTest
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Given that we try to add to transfer container,
|
* Given that we try to add to transfer container,
|
||||||
* Then InvalidParameterException is thrown.
|
* Then IntegrityException is thrown.
|
||||||
*/
|
*/
|
||||||
@Test(expected = InvalidParameterException.class)
|
@Test(expected = IntegrityException.class)
|
||||||
public void testAddToTransferContainerTest()
|
public void testAddToTransferContainerTest()
|
||||||
{
|
{
|
||||||
NodeRef transferContainer = generateNodeRef(TYPE_TRANSFER_CONTAINER, true);
|
NodeRef transferContainer = generateNodeRef(TYPE_TRANSFER_CONTAINER, true);
|
||||||
|
@@ -30,10 +30,9 @@ package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
|
|||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import java.security.InvalidParameterException;
|
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
|
||||||
|
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||||
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;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
@@ -53,9 +52,9 @@ public class TransferTypeUnitTest extends BaseUnitTest
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Given that we try to add to transfer type folder,
|
* Given that we try to add to transfer type folder,
|
||||||
* Then InvalidParameterException is thrown.
|
* Then IntegrityException is thrown.
|
||||||
*/
|
*/
|
||||||
@Test(expected = InvalidParameterException.class)
|
@Test(expected = IntegrityException.class)
|
||||||
public void testAddToTransferFolderTest()
|
public void testAddToTransferFolderTest()
|
||||||
{
|
{
|
||||||
NodeRef transferFolder = generateNodeRef(TYPE_TRANSFER, true);
|
NodeRef transferFolder = generateNodeRef(TYPE_TRANSFER, true);
|
||||||
|
@@ -30,11 +30,10 @@ package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
|
|||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import java.security.InvalidParameterException;
|
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
|
||||||
|
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||||
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;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
@@ -54,9 +53,9 @@ public class UnfiledRecordContainerTypeUnitTest extends BaseUnitTest
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Given that we try to add a type that is not one of "rma:unfiledRecordFolder", "cm:content" or "rma:nonElectronicDocument" types to unfiled record container,
|
* Given that we try to add a type that is not one of "rma:unfiledRecordFolder", "cm:content" or "rma:nonElectronicDocument" types to unfiled record container,
|
||||||
* Then InvalidParameterException is thrown.
|
* Then IntegrityException is thrown.
|
||||||
*/
|
*/
|
||||||
@Test(expected = InvalidParameterException.class)
|
@Test(expected = IntegrityException.class)
|
||||||
public void testAddNonAcceptedTypeToUnfiledRecordContainer()
|
public void testAddNonAcceptedTypeToUnfiledRecordContainer()
|
||||||
{
|
{
|
||||||
QName type = AlfMock.generateQName();
|
QName type = AlfMock.generateQName();
|
||||||
|
@@ -30,11 +30,10 @@ package org.alfresco.module.org_alfresco_module_rm.model.rma.type;
|
|||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import java.security.InvalidParameterException;
|
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.AlfMock;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
|
||||||
|
import org.alfresco.repo.node.integrity.IntegrityException;
|
||||||
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;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
@@ -54,9 +53,9 @@ public class UnfiledRecordFolderTypeUnitTest extends BaseUnitTest
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Given that we try to add a type that is not one of "rma:unfiledRecordFolder", "cm:content" or "rma:nonElectronicDocument" types to unfiled record folder,
|
* Given that we try to add a type that is not one of "rma:unfiledRecordFolder", "cm:content" or "rma:nonElectronicDocument" types to unfiled record folder,
|
||||||
* Then InvalidParameterException is thrown.
|
* Then IntegrityException is thrown.
|
||||||
*/
|
*/
|
||||||
@Test(expected = InvalidParameterException.class)
|
@Test(expected = IntegrityException.class)
|
||||||
public void testAddNonAcceptedTypeToUnfiledRecordFolder()
|
public void testAddNonAcceptedTypeToUnfiledRecordFolder()
|
||||||
{
|
{
|
||||||
QName type = AlfMock.generateQName();
|
QName type = AlfMock.generateQName();
|
||||||
|
Reference in New Issue
Block a user