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