mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM: Modify build scripts to make it possible to run unit tests locally from gradle
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@49381 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -75,32 +75,40 @@ task resetDatabase << {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
|
|
||||||
|
if (localBuild == false) {
|
||||||
dependsOn resetDatabase
|
dependsOn resetDatabase
|
||||||
|
}
|
||||||
|
|
||||||
include '**/*CreateRecordActionTest.class'
|
include '**/*CreateRecordActionTest.class'
|
||||||
|
|
||||||
//include '**/*Test.class'
|
|
||||||
//exclude '**/*SystemTest.class'
|
|
||||||
|
|
||||||
// temporarily exclude out of date tests
|
|
||||||
//exclude '**/RMCaveatConfigServiceImplTest.class'
|
|
||||||
//exclude '**/RMCaveatConfigScriptTest.class'
|
|
||||||
//exclude '**/RmRestApiTest.class'
|
|
||||||
//exclude '**/RmRestApiTest.class'
|
|
||||||
//exclude '**/RoleRestApiTest.class'
|
|
||||||
//exclude '**/CustomEMailMappingServiceImplTest.class'
|
|
||||||
|
|
||||||
testLogging.showStandardStreams = true
|
testLogging.showStandardStreams = true
|
||||||
|
|
||||||
jvmArgs '-Xms256M', '-Xmx1024M', '-XX:MaxPermSize=256M'
|
jvmArgs '-Xms256M', '-Xmx1024M', '-XX:MaxPermSize=256M'
|
||||||
|
|
||||||
|
if (localBuild == false) {
|
||||||
// Put systemProperty definition in a doFirst closure, otherwise it's executed before resetDatabase task
|
// Put systemProperty definition in a doFirst closure, otherwise it's executed before resetDatabase task
|
||||||
doFirst {
|
doFirst {
|
||||||
ant.property(name: "dir.root", value: System.getProperty("user.dir") + "/build/test_alf_data")
|
ant.property(name: "dir.root", value: System.getProperty("user.dir") + "/build/test_alf_data")
|
||||||
systemProperties = ant.getProperties()
|
systemProperties = ant.getProperties()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
beforeTest { descriptor ->
|
beforeTest { descriptor ->
|
||||||
logger.lifecycle("Running test: " + descriptor)
|
logger.lifecycle("Running test: " + descriptor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task localTest << {
|
||||||
|
test
|
||||||
|
{
|
||||||
|
include '**/*CreateRecordActionTest.class'
|
||||||
|
|
||||||
|
testLogging.showStandardStreams = true
|
||||||
|
|
||||||
|
jvmArgs '-Xms256M', '-Xmx1024M', '-XX:MaxPermSize=256M'
|
||||||
|
|
||||||
|
beforeTest { descriptor ->
|
||||||
|
logger.lifecycle("Running test: " + descriptor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -60,16 +60,23 @@ public class CreateRecordActionTest extends BaseRMTestCase
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setupTestDataImpl()
|
||||||
|
{
|
||||||
|
// Testing
|
||||||
|
AuthorityDAO authDao = (AuthorityDAO)applicationContext.getBean("authorityDAO");
|
||||||
|
assertTrue(authDao.authorityExists(AuthenticationUtil.getSystemUserName()));
|
||||||
|
assertFalse(true);
|
||||||
|
|
||||||
|
super.setupTestDataImpl();
|
||||||
|
}
|
||||||
|
|
||||||
public void testCreateRecordAction()
|
public void testCreateRecordAction()
|
||||||
{
|
{
|
||||||
doTestInTransaction(new Test<Void>()
|
doTestInTransaction(new Test<Void>()
|
||||||
{
|
{
|
||||||
public Void run()
|
public Void run()
|
||||||
{
|
{
|
||||||
// Testing
|
|
||||||
AuthorityDAO authDao = (AuthorityDAO)applicationContext.getBean("authorityDAO");
|
|
||||||
assertTrue(authDao.authorityExists(AuthenticationUtil.getSystemUserName()));
|
|
||||||
|
|
||||||
assertEquals(AccessStatus.DENIED, dmPermissionService.hasPermission(dmDocument, RMPermissionModel.READ_RECORDS));
|
assertEquals(AccessStatus.DENIED, dmPermissionService.hasPermission(dmDocument, RMPermissionModel.READ_RECORDS));
|
||||||
assertEquals(AccessStatus.DENIED, dmPermissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS));
|
assertEquals(AccessStatus.DENIED, dmPermissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user