1 package org
.argeo
.slc
.core
.test
;
5 import org
.argeo
.slc
.core
.structure
.tree
.TreeSPath
;
6 import org
.argeo
.slc
.deploy
.DeployedSystem
;
7 import org
.argeo
.slc
.process
.SlcExecution
;
8 import org
.argeo
.slc
.process
.SlcExecutionRelated
;
9 import org
.argeo
.slc
.process
.SlcExecutionStep
;
10 import org
.argeo
.slc
.structure
.StructureAware
;
11 import org
.argeo
.slc
.structure
.StructureRegistry
;
12 import org
.argeo
.slc
.test
.ExecutableTestRun
;
13 import org
.argeo
.slc
.test
.TestData
;
14 import org
.argeo
.slc
.test
.TestDefinition
;
15 import org
.argeo
.slc
.test
.TestResult
;
16 import org
.argeo
.slc
.test
.WritableTestRun
;
19 * A basic bean implementation of a <code>WritableTestRun</code>, holding
20 * references to the various parts of a test run.
22 public class SimpleTestRun
implements WritableTestRun
, ExecutableTestRun
,
23 SlcExecutionRelated
, StructureAware
<TreeSPath
> {
26 private String slcExecutionUuid
;
27 private String slcExecutionStepUuid
;
29 private TreeSPath path
;
30 private StructureRegistry
<TreeSPath
> registry
;
32 private DeployedSystem deployedSystem
;
33 private TestData testData
;
34 private TestDefinition testDefinition
;
35 private TestResult testResult
;
37 /** Executes the underlying test definition. */
38 @SuppressWarnings("unchecked")
40 uuid
= UUID
.randomUUID().toString();
41 if (testResult
!= null)
42 testResult
.notifyTestRun(this);
45 if (testResult
!= null && path
!= null
46 && testResult
instanceof StructureAware
)
47 ((StructureAware
<TreeSPath
>) testResult
).notifyCurrentPath(
50 if (path
!= null && testDefinition
instanceof StructureAware
)
51 ((StructureAware
<TreeSPath
>) testDefinition
).notifyCurrentPath(
54 testDefinition
.execute(this);
57 @SuppressWarnings("unchecked")
58 public <T
extends DeployedSystem
> T
getDeployedSystem() {
59 return (T
) deployedSystem
;
62 public void setDeployedSystem(DeployedSystem deployedSystem
) {
63 this.deployedSystem
= deployedSystem
;
66 @SuppressWarnings("unchecked")
67 public <T
extends TestData
> T
getTestData() {
71 public void setTestData(TestData testData
) {
72 this.testData
= testData
;
75 @SuppressWarnings("unchecked")
76 public <T
extends TestDefinition
> T
getTestDefinition() {
77 return (T
) testDefinition
;
80 public void setTestDefinition(TestDefinition testDefinition
) {
81 this.testDefinition
= testDefinition
;
84 @SuppressWarnings("unchecked")
85 public <T
extends TestResult
> T
getTestResult() {
86 return (T
) testResult
;
89 public void setTestResult(TestResult testResult
) {
90 this.testResult
= testResult
;
93 public String
getUuid() {
97 public void setUuid(String uuid
) {
101 public String
getSlcExecutionUuid() {
102 return slcExecutionUuid
;
105 public void setSlcExecutionUuid(String slcExecutionUuid
) {
106 this.slcExecutionUuid
= slcExecutionUuid
;
109 public String
getSlcExecutionStepUuid() {
110 return slcExecutionStepUuid
;
113 public void setSlcExecutionStepUuid(String slcExecutionStepUuid
) {
114 this.slcExecutionStepUuid
= slcExecutionStepUuid
;
117 public void notifySlcExecution(SlcExecution slcExecution
) {
118 if (slcExecution
!= null) {
119 slcExecutionUuid
= slcExecution
.getUuid();
120 SlcExecutionStep step
= slcExecution
.currentStep();
122 slcExecutionStepUuid
= step
.getUuid();
127 public void notifyCurrentPath(StructureRegistry
<TreeSPath
> registry
,
129 this.registry
= registry
;