]> git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc/src/main/java/org/argeo/slc/ant/test/SlcTestTask.java
Fix typo
[gpl/argeo-slc.git] / org.argeo.slc / src / main / java / org / argeo / slc / ant / test / SlcTestTask.java
1 package org.argeo.slc.ant.test;
2
3 import org.apache.tools.ant.BuildException;
4
5 import org.argeo.slc.ant.structure.SAwareArg;
6 import org.argeo.slc.ant.structure.SAwareTask;
7 import org.argeo.slc.core.deploy.DeployedSystem;
8 import org.argeo.slc.core.test.TestData;
9 import org.argeo.slc.core.test.TestDefinition;
10 import org.argeo.slc.core.test.TestResult;
11 import org.argeo.slc.core.test.TestRun;
12
13 /** Ant task wrapping a test run. */
14 public class SlcTestTask extends SAwareTask implements TestRun {
15
16 private TestDefinitionArg testDefinitionArg;
17 private TestDataArg testDataArg;
18
19 @Override
20 public void executeActions(String mode) throws BuildException {
21 TestDefinition testDefinition = testDefinitionArg.getTestDefinition();
22 testDefinition.execute(this);
23 }
24
25 public TestDefinitionArg createTestDefinition() {
26 testDefinitionArg = new TestDefinitionArg();
27 sAwareArgs.add(testDefinitionArg);
28 return testDefinitionArg;
29 }
30
31 public TestDataArg createTestData() {
32 testDataArg = new TestDataArg();
33 sAwareArgs.add(testDataArg);
34 return testDataArg;
35 }
36
37 public DeployedSystem getDeployedSystem() {
38 throw new RuntimeException("Not yet implemented.");
39 }
40
41 public TestDefinition getTestDefinition() {
42 return testDefinitionArg.getTestDefinition();
43 }
44
45 public TestData getTestData() {
46 return testDataArg.getTestData();
47 }
48
49 public TestResult getTestResult() {
50 throw new RuntimeException("Not yet implemented.");
51 }
52
53 }
54
55 class TestDefinitionArg extends SAwareArg {
56 private TestDefinition testDefinition;
57
58 public TestDefinition getTestDefinition() {
59 if (testDefinition == null) {
60 // don't call Spring each time in order not to multi-instantiate
61 // prototype
62 testDefinition = (TestDefinition) getBeanInstance();
63 }
64 return testDefinition;
65 }
66 }
67
68 class TestDataArg extends SAwareArg {
69 private TestData testData;
70
71 public TestData getTestData() {
72 if (testData == null) {
73 // don't call Spring each time in order not to multi-instantiate
74 // prototype
75 testData = (TestData) getBeanInstance();
76 }
77 return testData;
78 }
79
80 }