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