mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM: Add extended rule service which allows RM rules to be executed as RMAdmin
* unit test fix ups * fix test fall out from previous changes git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@46815 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -108,13 +108,15 @@ public class CapabilityServiceImplTest extends BaseRMTestCase
|
||||
@Override
|
||||
public Void run() throws Exception
|
||||
{
|
||||
int initialSize = capabilityService.getGroups().size();
|
||||
|
||||
GroupImpl testGroup = new GroupImpl();
|
||||
testGroup.setId("testGroup");
|
||||
testGroup.setIndex(140);
|
||||
testGroup.setTitle("Test group");
|
||||
capabilityService.addGroup(testGroup);
|
||||
|
||||
assertTrue(capabilityService.getGroups().size() == 14);
|
||||
assertEquals(initialSize+1, capabilityService.getGroups().size());
|
||||
|
||||
Group group = capabilityService.getGroup("testGroup");
|
||||
assertNotNull(group);
|
||||
@@ -133,36 +135,10 @@ public class CapabilityServiceImplTest extends BaseRMTestCase
|
||||
{
|
||||
Group testGroup = capabilityService.getGroup("testGroup");
|
||||
assertNotNull(testGroup);
|
||||
int initialSize = capabilityService.getGroups().size();
|
||||
|
||||
capabilityService.removeGroup(testGroup);
|
||||
assertTrue(capabilityService.getGroups().size() == 13);
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void run() throws Exception
|
||||
{
|
||||
List<Group> groups = capabilityService.getGroups();
|
||||
assertNotNull(groups);
|
||||
|
||||
int size = groups.size();
|
||||
assertTrue(size == 13);
|
||||
|
||||
Group auditGroup = groups.get(0);
|
||||
assertNotNull(auditGroup);
|
||||
assertTrue(auditGroup.getIndex() == 10);
|
||||
assertTrue(auditGroup.getId().equalsIgnoreCase("audit"));
|
||||
assertTrue(auditGroup.getTitle().equalsIgnoreCase("Audit"));
|
||||
|
||||
Group vitalRecords = groups.get(size - 1);
|
||||
assertNotNull(vitalRecords);
|
||||
assertTrue(vitalRecords.getIndex() == 130);
|
||||
assertTrue(vitalRecords.getId().equalsIgnoreCase("vitalRecords"));
|
||||
assertTrue(vitalRecords.getTitle().equalsIgnoreCase("Vital Records"));
|
||||
assertEquals(initialSize-1, capabilityService.getGroups().size());
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -186,7 +162,7 @@ public class CapabilityServiceImplTest extends BaseRMTestCase
|
||||
assertNotNull(auditCapabilities);
|
||||
|
||||
int vitalRecordCapabilitiesSize = auditCapabilities.size();
|
||||
assertTrue(vitalRecordCapabilitiesSize == 6);
|
||||
assertEquals(4, vitalRecordCapabilitiesSize);
|
||||
|
||||
for (int i = 1; i == vitalRecordCapabilitiesSize; i++)
|
||||
{
|
||||
@@ -202,7 +178,7 @@ public class CapabilityServiceImplTest extends BaseRMTestCase
|
||||
assertNotNull(vitalRecordCapabilities);
|
||||
|
||||
vitalRecordCapabilitiesSize = vitalRecordCapabilities.size();
|
||||
assertEquals(3, vitalRecordCapabilitiesSize);
|
||||
assertEquals(1, vitalRecordCapabilitiesSize);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@@ -524,7 +524,7 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}, AuthenticationUtil.getSystemUserName());
|
||||
}
|
||||
|
||||
|
||||
|
@@ -23,6 +23,7 @@ import java.util.List;
|
||||
import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchParameters;
|
||||
import org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetails;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.security.MutableAuthenticationService;
|
||||
import org.alfresco.util.TestWithUserUtils;
|
||||
@@ -89,7 +90,7 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}, AuthenticationUtil.getSystemUserName());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,14 +118,12 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}, AuthenticationUtil.getSystemUserName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception
|
||||
{
|
||||
super.tearDown();
|
||||
|
||||
doTestInTransaction(new Test<Void>()
|
||||
{
|
||||
@Override
|
||||
@@ -136,7 +135,9 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}, AuthenticationUtil.getSystemUserName());
|
||||
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public void testSearch()
|
||||
@@ -156,7 +157,7 @@ public class RecordsManagementSearchServiceImplTest extends BaseRMTestCase
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}, AuthenticationUtil.getSystemUserName());
|
||||
|
||||
// Property search
|
||||
|
||||
|
@@ -101,6 +101,9 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
||||
/** Common test utils */
|
||||
protected CommonRMTestUtils utils;
|
||||
|
||||
/** RM Admin user name */
|
||||
protected String rmAdminUserName;
|
||||
|
||||
/** Services */
|
||||
protected NodeService nodeService;
|
||||
protected ContentService contentService;
|
||||
@@ -293,6 +296,20 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
||||
// Initialise the service beans
|
||||
initServices();
|
||||
|
||||
// grab the rmadmin user name
|
||||
retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback<Object>()
|
||||
{
|
||||
@Override
|
||||
public Object execute() throws Throwable
|
||||
{
|
||||
// As system user
|
||||
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
|
||||
rmAdminUserName = filePlanAuthenticationService.getRmAdminUserName();
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
// Setup test data
|
||||
setupTestData();
|
||||
|
||||
@@ -671,13 +688,13 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
|
||||
@Override
|
||||
protected <A> A doTestInTransaction(Test<A> test)
|
||||
{
|
||||
return super.doTestInTransaction(test, filePlanAuthenticationService.getRmAdminUserName());
|
||||
return super.doTestInTransaction(test, rmAdminUserName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doTestInTransaction(FailureTest test)
|
||||
{
|
||||
super.doTestInTransaction(test, filePlanAuthenticationService.getRmAdminUserName());
|
||||
super.doTestInTransaction(test, rmAdminUserName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user