*/\r
protected Properties prepareAllProperties(File slcRootFile) {\r
try {\r
+ final String fileUrlPrefix ="";\r
+\r
Properties all = new Properties();\r
all.putAll(System.getProperties());\r
all.put(ROOT_FILE_PROPERTY, slcRootFile.getCanonicalPath());\r
final File workDir;\r
// Root dir\r
final File rootDir = slcRootFile.getParentFile();\r
- all.setProperty(ROOT_DIR_PROPERTY, rootDir.getCanonicalPath());\r
+ all.setProperty(ROOT_DIR_PROPERTY, fileUrlPrefix\r
+ + rootDir.getCanonicalPath());\r
\r
// Conf dir\r
if (all.getProperty(CONF_DIR_PROPERTY) == null) {\r
confDir = new File(rootProps.getProperty(CONF_DIR_PROPERTY,\r
rootDir.getAbsolutePath() + "/../conf"))\r
.getCanonicalFile();\r
- all.setProperty(CONF_DIR_PROPERTY, confDir.getAbsolutePath());\r
+ all.setProperty(CONF_DIR_PROPERTY, fileUrlPrefix\r
+ + confDir.getAbsolutePath());\r
} else {\r
confDir = new File(all.getProperty(CONF_DIR_PROPERTY))\r
.getCanonicalFile();\r
workDir = new File(rootProps.getProperty(WORK_DIR_PROPERTY,\r
rootDir.getAbsolutePath() + "/../work"))\r
.getCanonicalFile();\r
- all.setProperty(WORK_DIR_PROPERTY, workDir.getAbsolutePath());\r
+ all.setProperty(WORK_DIR_PROPERTY, fileUrlPrefix\r
+ + workDir.getAbsolutePath());\r
} else {\r
workDir = new File(all.getProperty(WORK_DIR_PROPERTY))\r
.getCanonicalFile();\r
+# Tasks\r
slc.test=org.argeo.slc.ant.test.SlcTestTask\r
slc.deploy=org.argeo.slc.ant.deploy.SlcDeployTask\r
slc.closeResult=org.argeo.slc.ant.test.SlcCloseTestResultTask\r
* Basic implementation of a result part, implementing the standard three status\r
* approach for test results.\r
* </p>\r
- * <p>\r
- * <ul>\r
- * <li>{@link #PASSED}: the test succeeded</li>\r
- * <li>{@link #FAILED}: the test could run, but did not reach the expected\r
- * result</li>\r
- * <li>{@link #ERROR}: an error during the test run prevented to get a\r
- * significant information on the tested system.</li>\r
- * </ul>\r
- * </p>\r
+ * @see TestStatus\r
*/\r
-public class SimpleResultPart implements TestResultPart {\r
+public class SimpleResultPart implements TestResultPart, TestStatus {\r
+\r
/** For ORM */\r
private Long tid;\r
\r
- private TestStatus status;\r
+ private Integer status;\r
private String message;\r
private Throwable exception;\r
\r
- \r
- /** Empty constructor for ORM */\r
- public SimpleResultPart(){\r
- \r
+ public SimpleResultPart() {\r
}\r
- \r
- public SimpleResultPart(TestStatus status, String message,\r
- Throwable exception) {\r
- super();\r
+\r
+ public SimpleResultPart(Integer status, String message) {\r
+ this(status, message, null);\r
+ }\r
+\r
+ public SimpleResultPart(Integer status, String message, Throwable exception) {\r
this.status = status;\r
this.message = message;\r
this.exception = exception;\r
this.message = message;\r
}\r
\r
- public void setStatus(TestStatus status) {\r
+ public void setStatus(Integer status) {\r
this.status = status;\r
}\r
\r
- public TestStatus getStatus() {\r
+ public Integer getStatus() {\r
return status;\r
}\r
\r
@Override\r
public String toString() {\r
StringBuffer buf = new StringBuffer("");\r
- buf.append(status).append(" ");\r
+ if (status == PASSED) {\r
+ buf.append("PASSED ");\r
+ } else if (status == FAILED) {\r
+ buf.append("FAILED ");\r
+ } else if (status == ERROR) {\r
+ buf.append("ERROR ");\r
+ }\r
buf.append(message);\r
if (exception != null) {\r
buf.append("(").append(exception.getMessage()).append(")");\r
* The programmatic definition of a test, which will be associated with\r
* transient objects within a test run.\r
*/\r
-public interface TestDefinition {\r
+public interface TestDefinition extends TestStatus {\r
/** Performs the test. */\r
public void execute(TestRun testRun);\r
}\r
* \r
* @see TestResult\r
*/\r
-public interface TestResultPart {\r
- public TestStatus getStatus();\r
+public interface TestResultPart { \r
+ public Integer getStatus();\r
\r
public String getMessage();\r
}\r
package org.argeo.slc.core.test;\r
\r
-/** Simple statuses. */\r
-public enum TestStatus {\r
- /** Test passed */\r
- PASSED,\r
- /** Test failed: the behavior was not the expected one */\r
- FAILED,\r
+/**\r
+ * Simple statuses. \r
+ * <p>\r
+ * <ul>\r
+ * <li>{@link #PASSED}: the test succeeded</li>\r
+ * <li>{@link #FAILED}: the test could run, but did not reach the expected\r
+ * result</li>\r
+ * <li>{@link #ERROR}: an error during the test run prevented to get a\r
+ * significant information on the tested system.</li>\r
+ * </ul>\r
+ * </p>\r
+ */\r
+public interface TestStatus {\r
+ /** The flag for a passed test: 0 */\r
+ public final static int PASSED = 0;\r
+ /** The flag for a failed test: 1 */\r
+ public final static int FAILED = 1;\r
/**\r
- * Test could not run properly because of an unexpected issue: their can be\r
- * no feedback on the behavior of the tested component\r
+ * The flag for a test which could not properly run because of an error\r
+ * (there is no feedback on the behavior of the tested component): 2\r
*/\r
- ERROR\r
+ public final static int ERROR = 2;\r
}\r
import org.argeo.slc.core.structure.StructureRegistry;\r
import org.argeo.slc.core.structure.tree.TreeSPath;\r
import org.argeo.slc.core.test.SimpleResultPart;\r
+import org.argeo.slc.core.test.SimpleTestResult;\r
import org.argeo.slc.core.test.TestStatus;\r
import org.argeo.slc.core.test.TestReport;\r
import org.argeo.slc.core.test.TestResult;\r
for (TestResultPart part : subList.getParts()) {\r
SimpleResultPart sPart = (SimpleResultPart) part;\r
String color = "yellow";\r
- if (sPart.getStatus() == TestStatus.PASSED) {\r
+ if (sPart.getStatus().equals(SimpleResultPart.PASSED)) {\r
color = "green";\r
} else {\r
color = "red";\r
import org.argeo.slc.core.structure.StructureRegistry;\r
import org.argeo.slc.core.structure.tree.TreeSPath;\r
import org.argeo.slc.core.test.SimpleResultPart;\r
-import org.argeo.slc.core.test.TestStatus;\r
import org.argeo.slc.core.test.TestDefinition;\r
import org.argeo.slc.core.test.TestResult;\r
import org.argeo.slc.core.test.TestRun;\r
private String description;\r
\r
public void execute(TestRun testRun) {\r
- SimpleResultPart part = new SimpleResultPart();\r
- part.setStatus(TestStatus.PASSED);\r
- part.setMessage("Sub task with path " + path + " executed");\r
+ SimpleResultPart part = new SimpleResultPart(PASSED,\r
+ "Sub task with path " + path + " executed", null);\r
\r
TestResult result = testRun.getTestResult();\r
result.addResultPart(part);\r