RM-4312: fixed some integration tests

This commit is contained in:
Silviu Dinuta
2016-11-07 16:05:19 +02:00
parent a63da9551e
commit e06b50f1f9
2 changed files with 12 additions and 17 deletions

View File

@@ -27,14 +27,13 @@
*/ */
package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; package org.alfresco.module.org_alfresco_module_rm.test.integration.issue;
import org.alfresco.error.AlfrescoRuntimeException; 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.service.cmr.model.FileInfo;
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;
import org.springframework.extensions.surf.util.I18NUtil;
/** /**
* Unit test for RM-3341 .. can copy to hold and transfer folder * Unit test for RM-3341 .. can copy to hold and transfer folder
@@ -43,9 +42,6 @@ import org.springframework.extensions.surf.util.I18NUtil;
*/ */
public class RM3341Test extends BaseRMTestCase public class RM3341Test extends BaseRMTestCase
{ {
private final static String MSG_ERROR_ADD_CONTENT_CONTAINER = "rm.service.error-add-content-container";
public void testCopyingContentsInHoldandTransfer() throws Exception public void testCopyingContentsInHoldandTransfer() throws Exception
{ {
doTestInTransaction(new Test<Void>() doTestInTransaction(new Test<Void>()
@@ -79,13 +75,12 @@ public class RM3341Test extends BaseRMTestCase
try try
{ {
FileInfo copyInfo = 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 (AlfrescoRuntimeException e) catch (InvalidParameterException e)
{ {
// ("Content can't be added to a record container. Use record folders to file content.") // ("Content can't be added to a hold container. Use record folders to file content.")
assertEquals(I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER), e.getMsgId());
} }
return null; return null;
} }
@@ -109,10 +104,9 @@ public class RM3341Test extends BaseRMTestCase
fail("This should have thrown an exception"); fail("This should have thrown an exception");
} }
catch (AlfrescoRuntimeException e) catch (InvalidParameterException e)
{ {
// ("Content can't be added to a record container. Use record folders to file content.") // ("Content can't be added to a transfer container. Use record folders to file content.")
assertEquals(I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER), e.getMsgId());
} }
return null; return null;
} }

View File

@@ -26,7 +26,8 @@
*/ */
package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; package org.alfresco.module.org_alfresco_module_rm.test.integration.issue;
import org.alfresco.error.AlfrescoRuntimeException; 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.transaction.RetryingTransactionHelper.RetryingTransactionCallback; import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
@@ -48,8 +49,8 @@ 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),
AlfrescoRuntimeException.class InvalidParameterException.class
) )
{ {
@Override @Override
@@ -64,7 +65,7 @@ public class RM3450Test extends BaseRMTestCase
} }
}, false, true); }, false, true);
} }
}, ADMIN_USER); }, ADMIN_USER);
} }
} }