]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc.runtime/src/org/argeo/slc/runtime/test/SimpleTestRun.java
Continue to remove dependencies with Spring.
[gpl/argeo-slc.git] / org.argeo.slc.runtime / src / org / argeo / slc / runtime / test / SimpleTestRun.java
diff --git a/org.argeo.slc.runtime/src/org/argeo/slc/runtime/test/SimpleTestRun.java b/org.argeo.slc.runtime/src/org/argeo/slc/runtime/test/SimpleTestRun.java
new file mode 100644 (file)
index 0000000..a00c48d
--- /dev/null
@@ -0,0 +1,110 @@
+/*\r
+ * Copyright (C) 2007-2012 Argeo GmbH\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *         http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package org.argeo.slc.runtime.test;\r
+\r
+import java.util.UUID;\r
+\r
+import org.argeo.slc.deploy.DeployedSystem;\r
+import org.argeo.slc.test.ExecutableTestRun;\r
+import org.argeo.slc.test.TestData;\r
+import org.argeo.slc.test.TestDefinition;\r
+import org.argeo.slc.test.TestResult;\r
+import org.argeo.slc.test.WritableTestRun;\r
+\r
+/**\r
+ * A basic bean implementation of a <code>WritableTestRun</code>, holding\r
+ * references to the various parts of a test run.\r
+ */\r
+public class SimpleTestRun implements WritableTestRun, ExecutableTestRun {\r
+       private String uuid;\r
+\r
+       // private String slcExecutionUuid;\r
+       // private String slcExecutionStepUuid;\r
+\r
+       private DeployedSystem deployedSystem;\r
+       private TestData testData;\r
+       private TestDefinition testDefinition;\r
+       private TestResult testResult;\r
+\r
+       /** Executes the underlying test definition. */\r
+       public void run() {\r
+               uuid = UUID.randomUUID().toString();\r
+               if (testResult != null)\r
+                       testResult.notifyTestRun(this);\r
+\r
+               testDefinition.execute(this);\r
+       }\r
+\r
+       @SuppressWarnings("unchecked")\r
+       public <T extends DeployedSystem> T getDeployedSystem() {\r
+               return (T) deployedSystem;\r
+       }\r
+\r
+       public void setDeployedSystem(DeployedSystem deployedSystem) {\r
+               this.deployedSystem = deployedSystem;\r
+       }\r
+\r
+       @SuppressWarnings("unchecked")\r
+       public <T extends TestData> T getTestData() {\r
+               return (T) testData;\r
+       }\r
+\r
+       public void setTestData(TestData testData) {\r
+               this.testData = testData;\r
+       }\r
+\r
+       @SuppressWarnings("unchecked")\r
+       public <T extends TestDefinition> T getTestDefinition() {\r
+               return (T) testDefinition;\r
+       }\r
+\r
+       public void setTestDefinition(TestDefinition testDefinition) {\r
+               this.testDefinition = testDefinition;\r
+       }\r
+\r
+       @SuppressWarnings("unchecked")\r
+       public <T extends TestResult> T getTestResult() {\r
+               return (T) testResult;\r
+       }\r
+\r
+       public void setTestResult(TestResult testResult) {\r
+               this.testResult = testResult;\r
+       }\r
+\r
+       public String getUuid() {\r
+               return uuid;\r
+       }\r
+\r
+       public void setUuid(String uuid) {\r
+               this.uuid = uuid;\r
+       }\r
+\r
+       // public String getSlcExecutionUuid() {\r
+       // return slcExecutionUuid;\r
+       // }\r
+       //\r
+       // public void setSlcExecutionUuid(String slcExecutionUuid) {\r
+       // this.slcExecutionUuid = slcExecutionUuid;\r
+       // }\r
+       //\r
+       // public String getSlcExecutionStepUuid() {\r
+       // return slcExecutionStepUuid;\r
+       // }\r
+       //\r
+       // public void setSlcExecutionStepUuid(String slcExecutionStepUuid) {\r
+       // this.slcExecutionStepUuid = slcExecutionStepUuid;\r
+       // }\r
+}\r