1 package org
.argeo
.slc
.core
.test
;
5 import org
.argeo
.slc
.core
.structure
.tree
.TreeSPath
;
6 import org
.argeo
.slc
.core
.structure
.tree
.TreeSRegistry
;
7 import org
.argeo
.slc
.deploy
.DeployedSystem
;
8 import org
.argeo
.slc
.process
.SlcExecution
;
9 import org
.argeo
.slc
.process
.SlcExecutionRelated
;
10 import org
.argeo
.slc
.process
.SlcExecutionStep
;
11 import org
.argeo
.slc
.structure
.StructureAware
;
12 import org
.argeo
.slc
.structure
.StructureElement
;
13 import org
.argeo
.slc
.structure
.StructureRegistry
;
14 import org
.argeo
.slc
.test
.ExecutableTestRun
;
15 import org
.argeo
.slc
.test
.TestData
;
16 import org
.argeo
.slc
.test
.TestDefinition
;
17 import org
.argeo
.slc
.test
.TestResult
;
18 import org
.argeo
.slc
.test
.WritableTestRun
;
21 * A basic bean implementation of a <code>WritableTestRun</code>, holding
22 * references to the various parts of a test run.
24 public class SimpleTestRun
implements WritableTestRun
, ExecutableTestRun
,
25 SlcExecutionRelated
, StructureAware
<TreeSPath
> {
28 private String slcExecutionUuid
;
29 private String slcExecutionStepUuid
;
31 private TreeSPath path
;
32 private StructureRegistry
<TreeSPath
> registry
;
34 private DeployedSystem deployedSystem
;
35 private TestData testData
;
36 private TestDefinition testDefinition
;
37 private TestResult testResult
;
39 /** Executes the underlying test definition. */
40 public void execute() {
41 uuid
= UUID
.randomUUID().toString();
42 if (testResult
!= null)
43 testResult
.notifyTestRun(this);
46 if (testResult
!= null && path
!= null
47 && testResult
instanceof StructureAware
)
48 ((StructureAware
<TreeSPath
>) testResult
).notifyCurrentPath(
51 if (path
!= null && testDefinition
instanceof StructureAware
)
52 ((StructureAware
<TreeSPath
>) testDefinition
).notifyCurrentPath(
55 testDefinition
.execute(this);
58 public <T
extends DeployedSystem
> T
getDeployedSystem() {
59 return (T
) deployedSystem
;
62 public void setDeployedSystem(DeployedSystem deployedSystem
) {
63 this.deployedSystem
= deployedSystem
;
66 public <T
extends TestData
> T
getTestData() {
70 public void setTestData(TestData testData
) {
71 this.testData
= testData
;
74 public <T
extends TestDefinition
> T
getTestDefinition() {
75 return (T
) testDefinition
;
78 public void setTestDefinition(TestDefinition testDefinition
) {
79 this.testDefinition
= testDefinition
;
82 public <T
extends TestResult
> T
getTestResult() {
83 return (T
) testResult
;
86 public void setTestResult(TestResult testResult
) {
87 this.testResult
= testResult
;
90 public String
getUuid() {
94 public void setUuid(String uuid
) {
98 public String
getSlcExecutionUuid() {
99 return slcExecutionUuid
;
102 public void setSlcExecutionUuid(String slcExecutionUuid
) {
103 this.slcExecutionUuid
= slcExecutionUuid
;
106 public String
getSlcExecutionStepUuid() {
107 return slcExecutionStepUuid
;
110 public void setSlcExecutionStepUuid(String slcExecutionStepUuid
) {
111 this.slcExecutionStepUuid
= slcExecutionStepUuid
;
114 public void notifySlcExecution(SlcExecution slcExecution
) {
115 if (slcExecution
!= null) {
116 slcExecutionUuid
= slcExecution
.getUuid();
117 SlcExecutionStep step
= slcExecution
.currentStep();
119 slcExecutionStepUuid
= step
.getUuid();
124 public void notifyCurrentPath(StructureRegistry
<TreeSPath
> registry
,
126 this.registry
= registry
;