]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.support.ant/src/main/java/org/argeo/slc/ant/unit/AntSlcApplicationTestCase.java
Properly pass properties
[gpl/argeo-slc.git] / runtime / org.argeo.slc.support.ant / src / main / java / org / argeo / slc / ant / unit / AntSlcApplicationTestCase.java
1 package org.argeo.slc.ant.unit;
2
3 import java.io.File;
4
5 import junit.framework.TestCase;
6
7 import org.argeo.slc.ant.AntExecutionContext;
8 import org.argeo.slc.ant.AntSlcRuntime;
9 import org.argeo.slc.runtime.SlcExecutionOutput;
10
11 public abstract class AntSlcApplicationTestCase extends TestCase implements
12 SlcExecutionOutput<AntExecutionContext> {
13
14 /** To be overriden */
15 public void postExecution(AntExecutionContext executionContext) {
16
17 }
18
19 protected String getRootDir() {
20 String rootDirPath = System.getProperty("slc.rootDir", "src/slc/root");
21 if(!new File(rootDirPath).exists())
22 rootDirPath = "src/main/slc/root";// try older convention
23 return rootDirPath;
24 }
25
26 protected String getAbsoluteScript(String relative) {
27 return getRootDir() + '/' + relative;
28 }
29
30 protected void execute(String relativeScript) {
31 execute(relativeScript, null);
32 }
33
34 protected void execute(String relativeScript, String targets) {
35 new AntSlcRuntime().executeScript(
36 getAbsoluteScript(relativeScript), targets, this);
37 }
38
39 }