RM Build Scripts and Tests:

* moved RM tests into separate folder structure
 * updated Gradle scripts with test source locations and dependancies .. 'gradlew test' will now attempt to execute the unit tests (even if they fail!)
 * eclipse project dependancies updated so unit tests execute within the RM eclipse project
 * TODO get the unit tests working reliabily! (still lots of refactoring of old tests to do)



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@35093 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2012-04-05 03:01:22 +00:00
parent b0180e599a
commit f70eb812bc
51 changed files with 51 additions and 6 deletions

View File

@@ -15,6 +15,16 @@ task wrapper(type: Wrapper) {
gradleVersion = '1.0-milestone-8' gradleVersion = '1.0-milestone-8'
} }
task downloadAlfresco << {
def address = "https://bamboo.alfresco.com/bamboo/artifact/ALF-ENTERPRISEV40/JOB1/build-891/ALL/alfresco-enterprise-4.0.1.zip?os_authType=basic&os_username=rwetherall&os_password=31vegaleg"
def file = new FileOutputStream(file('alfresco.zip'))
def out = new BufferedOutputStream(file)
out << new URL(address).openStream()
out.close()
}
/** Subproject configuration */ /** Subproject configuration */
subprojects { subprojects {
@@ -25,10 +35,13 @@ subprojects {
explodedDepsDir = 'explodedDeps' explodedDepsDir = 'explodedDeps'
explodedLibsDir = "${explodedDepsDir}/lib" explodedLibsDir = "${explodedDepsDir}/lib"
explodedConfigDir = "${explodedDepsDir}/config"
buildDistDir = 'build/dist' buildDistDir = 'build/dist'
buildLibDir = 'build/libs' buildLibDir = 'build/libs'
sourceJavaDir = 'source/java' sourceJavaDir = 'source/java'
sourceWebDir = 'source/web' sourceWebDir = 'source/web'
testJavaDir = 'test/java'
testResourceDir = 'test/resource'
configDir = 'config' configDir = 'config'
configModuleDir = "config/alfresco/module/${moduleid}" configModuleDir = "config/alfresco/module/${moduleid}"
moduleProperties = 'module.properties' moduleProperties = 'module.properties'
@@ -44,6 +57,14 @@ subprojects {
srcDir sourceJavaDir srcDir sourceJavaDir
} }
} }
test {
java {
srcDir testJavaDir
}
resources {
srcDir testResourceDir
}
}
} }
repositories { repositories {

View File

@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="source/java"/> <classpathentry kind="src" path="source/java"/>
<classpathentry kind="src" path="test/java"/>
<classpathentry kind="src" path="test/resources"/>
<classpathentry kind="src" path="explodedDeps/config"/> <classpathentry kind="src" path="explodedDeps/config"/>
<classpathentry kind="src" path="config"/> <classpathentry kind="src" path="config"/>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
@@ -277,5 +279,6 @@
<classpathentry exported="true" kind="lib" path="C:/mywork/projects/rmhead/code/rm-server/explodedDeps/lib/xpp3-1.1.3_8.jar"/> <classpathentry exported="true" kind="lib" path="C:/mywork/projects/rmhead/code/rm-server/explodedDeps/lib/xpp3-1.1.3_8.jar"/>
<classpathentry exported="true" kind="lib" path="C:/mywork/projects/rmhead/code/rm-server/explodedDeps/lib/xstream-1.2.2.jar"/> <classpathentry exported="true" kind="lib" path="C:/mywork/projects/rmhead/code/rm-server/explodedDeps/lib/xstream-1.2.2.jar"/>
<classpathentry kind="lib" path="libs/spring-webscripts-1.0.0-tests.jar"/> <classpathentry kind="lib" path="libs/spring-webscripts-1.0.0-tests.jar"/>
<classpathentry kind="lib" path="libs/postgresql-9.0-801.jdbc4.jar"/>
<classpathentry kind="output" path="build/classes"/> <classpathentry kind="output" path="build/classes"/>
</classpath> </classpath>

View File

@@ -1,5 +1,26 @@
dependencies { dependencies {
compile fileTree(dir: 'libs', include: '*.jar') compile fileTree(dir: 'libs', include: '*.jar')
compile 'javax.servlet:servlet-api:2.5' compile 'javax.servlet:servlet-api:2.5'
compile 'org.springframework:spring-test:2.5'
testCompile 'org.springframework:spring-test:2.5'
testRuntime files(explodedConfigDir)
testRuntime files(configDir)
}
test {
//makes the standard streams (err and out) visible at console when running tests
testLogging.showStandardStreams = true
//tweaking memory settings for the forked vm that runs tests
jvmArgs '-Xms256M', '-Xmx1024M', '-XX:MaxPermSize=256M'
//listening to test execution events
beforeTest { descriptor ->
logger.lifecycle("Running test: " + descriptor)
}
onOutput { descriptor, event ->
logger.lifecycle(event.message)
}
} }

Binary file not shown.

View File

@@ -63,7 +63,7 @@ public class RecordsManagementActionServiceImplTest extends TestCase
{ {
private static final String[] CONFIG_LOCATIONS = new String[] { private static final String[] CONFIG_LOCATIONS = new String[] {
"classpath:alfresco/application-context.xml", "classpath:alfresco/application-context.xml",
"classpath:org/alfresco/module/org_alfresco_module_rm/test/util/test-context.xml"}; "classpath:test-context.xml"};
private ApplicationContext ctx; private ApplicationContext ctx;

View File

@@ -77,7 +77,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase
protected static final String[] CONFIG_LOCATIONS = new String[] protected static final String[] CONFIG_LOCATIONS = new String[]
{ {
"classpath:alfresco/application-context.xml", "classpath:alfresco/application-context.xml",
"classpath:org/alfresco/module/org_alfresco_module_rm/test/util/test-context.xml" "classpath:test-context.xml"
}; };
protected ApplicationContext applicationContext; protected ApplicationContext applicationContext;

View File

@@ -102,7 +102,7 @@ public class TestUtilities implements RecordsManagementModel
// Do the data load into the the provided filePlan node reference // Do the data load into the the provided filePlan node reference
// TODO ... // TODO ...
InputStream is = TestUtilities.class.getClassLoader().getResourceAsStream( InputStream is = TestUtilities.class.getClassLoader().getResourceAsStream(
"alfresco/module/org_alfresco_module_rm/bootstrap/DODExampleFilePlan.xml"); "alfresco/module/org_alfresco_module_rm/dod5015/DODExampleFilePlan.xml");
//"alfresco/module/org_alfresco_module_rm/bootstrap/temp.xml"); //"alfresco/module/org_alfresco_module_rm/bootstrap/temp.xml");
Assert.assertNotNull("The DODExampleFilePlan.xml import file could not be found", is); Assert.assertNotNull("The DODExampleFilePlan.xml import file could not be found", is);
Reader viewReader = new InputStreamReader(is); Reader viewReader = new InputStreamReader(is);

View File

@@ -117,7 +117,7 @@ public class RmRestApiTest extends BaseWebScriptTest implements RecordsManagemen
@Override @Override
protected void setUp() throws Exception protected void setUp() throws Exception
{ {
setCustomContext("classpath:org/alfresco/module/org_alfresco_module_rm/test/util/test-context.xml"); setCustomContext("classpath:test-context.xml");
super.setUp(); super.setUp();
this.namespaceService = (NamespaceService) getServer().getApplicationContext().getBean("NamespaceService"); this.namespaceService = (NamespaceService) getServer().getApplicationContext().getBean("NamespaceService");

View File

@@ -7,7 +7,7 @@
<bean id="org_alfresco_module_dod5015_rmTestdictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap"> <bean id="org_alfresco_module_dod5015_rmTestdictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
<property name="models"> <property name="models">
<list> <list>
<value>org/alfresco/module/org_alfresco_module_rm/test/util/test-model.xml</value> <value>test-model.xml</value>
</list> </list>
</property> </property>
</bean> </bean>