]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.support.simple/src/main/java/org/argeo/slc/core/test/SimpleTestRun.java
Restructure execution packages
[gpl/argeo-slc.git] / runtime / org.argeo.slc.support.simple / src / main / java / org / argeo / slc / core / test / SimpleTestRun.java
1 package org.argeo.slc.core.test;
2
3 import java.util.UUID;
4
5 import org.argeo.slc.deploy.DeployedSystem;
6 import org.argeo.slc.process.SlcExecution;
7 import org.argeo.slc.process.SlcExecutionRelated;
8 import org.argeo.slc.process.SlcExecutionStep;
9 import org.argeo.slc.test.ExecutableTestRun;
10 import org.argeo.slc.test.TestData;
11 import org.argeo.slc.test.TestDefinition;
12 import org.argeo.slc.test.TestResult;
13 import org.argeo.slc.test.WritableTestRun;
14
15 /**
16 * A basic bean implementation of a <code>WritableTestRun</code>, holding
17 * references to the various parts of a test run.
18 */
19 public class SimpleTestRun implements WritableTestRun, ExecutableTestRun, SlcExecutionRelated {
20 private String uuid;
21
22 private String slcExecutionUuid;
23 private String slcExecutionStepUuid;
24
25 private DeployedSystem deployedSystem;
26 private TestData testData;
27 private TestDefinition testDefinition;
28 private TestResult testResult;
29
30 /** Executes the underlying test definition. */
31 public void execute() {
32 uuid = UUID.randomUUID().toString();
33 if (testResult != null)
34 testResult.notifyTestRun(this);
35 testDefinition.execute(this);
36 }
37
38 public <T extends DeployedSystem> T getDeployedSystem() {
39 return (T) deployedSystem;
40 }
41
42 public void setDeployedSystem(DeployedSystem deployedSystem) {
43 this.deployedSystem = deployedSystem;
44 }
45
46 public <T extends TestData> T getTestData() {
47 return (T) testData;
48 }
49
50 public void setTestData(TestData testData) {
51 this.testData = testData;
52 }
53
54 public <T extends TestDefinition> T getTestDefinition() {
55 return (T) testDefinition;
56 }
57
58 public void setTestDefinition(TestDefinition testDefinition) {
59 this.testDefinition = testDefinition;
60 }
61
62 public <T extends TestResult> T getTestResult() {
63 return (T) testResult;
64 }
65
66 public void setTestResult(TestResult testResult) {
67 this.testResult = testResult;
68 }
69
70 public String getUuid() {
71 return uuid;
72 }
73
74 public void setUuid(String uuid) {
75 this.uuid = uuid;
76 }
77
78 public String getSlcExecutionUuid() {
79 return slcExecutionUuid;
80 }
81
82 public void setSlcExecutionUuid(String slcExecutionUuid) {
83 this.slcExecutionUuid = slcExecutionUuid;
84 }
85
86 public String getSlcExecutionStepUuid() {
87 return slcExecutionStepUuid;
88 }
89
90 public void setSlcExecutionStepUuid(String slcExecutionStepUuid) {
91 this.slcExecutionStepUuid = slcExecutionStepUuid;
92 }
93
94 public void notifySlcExecution(SlcExecution slcExecution) {
95 if (slcExecution != null) {
96 slcExecutionUuid = slcExecution.getUuid();
97 SlcExecutionStep step = slcExecution.currentStep();
98 if (step != null) {
99 slcExecutionStepUuid = step.getUuid();
100 }
101 }
102 }
103
104 }