]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/test/SlcTestTask.java
Improve spring arguments
[gpl/argeo-slc.git] / org.argeo.slc.agent / src / main / java / org / argeo / slc / ant / test / SlcTestTask.java
index 6f2411c0093ea9454a43caf95538dc8683e6fa8d..263242fb79dde7305c9a827421a99c135f089e49 100644 (file)
@@ -3,14 +3,11 @@ package org.argeo.slc.ant.test;
 import org.apache.commons.logging.Log;\r
 import org.apache.commons.logging.LogFactory;\r
 import org.apache.tools.ant.BuildException;\r
-\r
 import org.argeo.slc.ant.SlcAntConfig;\r
-import org.argeo.slc.ant.spring.AbstractSpringArg;\r
+import org.argeo.slc.ant.spring.SpringArg;\r
 import org.argeo.slc.ant.structure.SAwareTask;\r
-import org.argeo.slc.core.SlcException;\r
 import org.argeo.slc.core.deploy.DeployedSystem;\r
 import org.argeo.slc.core.process.SlcExecution;\r
-import org.argeo.slc.core.process.SlcExecutionAware;\r
 import org.argeo.slc.core.structure.StructureAware;\r
 import org.argeo.slc.core.structure.tree.TreeSPath;\r
 import org.argeo.slc.core.test.ExecutableTestRun;\r
@@ -28,10 +25,10 @@ public class SlcTestTask extends SAwareTask {
 \r
        private String testRunBean = null;\r
 \r
-       private TestDefinitionArg testDefinitionArg;\r
-       private TestDataArg testDataArg;\r
-       private DeployedSystemArg deployedSystemArg;\r
-       private TestResultArg testResultArg;\r
+       private SpringArg<TestDefinition> testDefinitionArg;\r
+       private SpringArg<TestData> testDataArg;\r
+       private SpringArg<DeployedSystem> deployedSystemArg;\r
+       private SpringArg<TestResult> testResultArg;\r
 \r
        @Override\r
        public void executeActions(String mode) throws BuildException {\r
@@ -64,22 +61,22 @@ public class SlcTestTask extends SAwareTask {
 \r
                // set overridden references\r
                if (testDataArg != null) {\r
-                       testRun.setTestData(testDataArg.getTestData());\r
+                       testRun.setTestData(testDataArg.getBeanInstance());\r
                        log.trace("Overrides test data");\r
                }\r
 \r
                if (testDefinitionArg != null) {\r
-                       testRun.setTestDefinition(testDefinitionArg.getTestDefinition());\r
+                       testRun.setTestDefinition(testDefinitionArg.getBeanInstance());\r
                        log.trace("Overrides test definition");\r
                }\r
 \r
                if (deployedSystemArg != null) {\r
-                       testRun.setDeployedSystem(deployedSystemArg.getDeployedSystem());\r
+                       testRun.setDeployedSystem(deployedSystemArg.getBeanInstance());\r
                        log.trace("Overrides deployed system");\r
                }\r
 \r
                if (testResultArg != null) {\r
-                       testRun.setTestResult(testResultArg.getTestResult());\r
+                       testRun.setTestResult(testResultArg.getBeanInstance());\r
                        log.trace("Overrides test result");\r
                }\r
 \r
@@ -118,28 +115,28 @@ public class SlcTestTask extends SAwareTask {
        }\r
 \r
        /** Creates sub tag. */\r
-       public TestDefinitionArg createTestDefinition() {\r
-               testDefinitionArg = new TestDefinitionArg();\r
+       public SpringArg<TestDefinition> createTestDefinition() {\r
+               testDefinitionArg = new SpringArg<TestDefinition>();\r
                // only test definitions can add to path\r
                addSAwareArg(testDefinitionArg);\r
                return testDefinitionArg;\r
        }\r
 \r
        /** Creates sub tag. */\r
-       public TestDataArg createTestData() {\r
-               testDataArg = new TestDataArg();\r
+       public SpringArg<TestData> createTestData() {\r
+               testDataArg = new SpringArg<TestData>();\r
                return testDataArg;\r
        }\r
 \r
        /** Creates sub tag. */\r
-       public DeployedSystemArg createDeployedSystem() {\r
-               deployedSystemArg = new DeployedSystemArg();\r
+       public SpringArg<DeployedSystem> createDeployedSystem() {\r
+               deployedSystemArg = new SpringArg<DeployedSystem>();\r
                return deployedSystemArg;\r
        }\r
 \r
        /** Creates sub tag. */\r
-       public TestResultArg createTestResult() {\r
-               testResultArg = new TestResultArg();\r
+       public SpringArg<TestResult> createTestResult() {\r
+               testResultArg = new SpringArg<TestResult>();\r
                return testResultArg;\r
        }\r
 \r
@@ -147,30 +144,3 @@ public class SlcTestTask extends SAwareTask {
                return SpringUtils.loadSingleFromContext(getContext(), clss);\r
        }\r
 }\r
-\r
-class TestDefinitionArg extends AbstractSpringArg {\r
-       TestDefinition getTestDefinition() {\r
-               return (TestDefinition) getBeanInstance();\r
-       }\r
-}\r
-\r
-class TestDataArg extends AbstractSpringArg {\r
-       TestData getTestData() {\r
-               return (TestData) getBeanInstance();\r
-       }\r
-\r
-}\r
-\r
-class DeployedSystemArg extends AbstractSpringArg {\r
-       DeployedSystem getDeployedSystem() {\r
-               return (DeployedSystem) getBeanInstance();\r
-       }\r
-\r
-}\r
-\r
-class TestResultArg extends AbstractSpringArg {\r
-       TestResult getTestResult() {\r
-               return (TestResult) getBeanInstance();\r
-       }\r
-\r
-}\r