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
.StructureRegistry
;
13 import org
.argeo
.slc
.test
.ExecutableTestRun
;
14 import org
.argeo
.slc
.test
.TestData
;
15 import org
.argeo
.slc
.test
.TestDefinition
;
16 import org
.argeo
.slc
.test
.TestResult
;
17 import org
.argeo
.slc
.test
.WritableTestRun
;
20 * A basic bean implementation of a <code>WritableTestRun</code>, holding
21 * references to the various parts of a test run.
23 public class SimpleTestRun
implements WritableTestRun
, ExecutableTestRun
,
27 private String slcExecutionUuid
;
28 private String slcExecutionStepUuid
;
32 private DeployedSystem deployedSystem
;
33 private TestData testData
;
34 private TestDefinition testDefinition
;
35 private TestResult testResult
;
37 /** Executes the underlying test definition. */
38 public void execute() {
39 TreeSPath basePath
= null;
40 StructureRegistry
<TreeSPath
> registry
= null;
43 basePath
= new TreeSPath(path
);
44 registry
= new TreeSRegistry();
47 uuid
= UUID
.randomUUID().toString();
48 if (testResult
!= null)
49 testResult
.notifyTestRun(this);
52 if (testResult
!= null && basePath
!= null
53 && testResult
instanceof StructureAware
)
54 ((StructureAware
<TreeSPath
>) testResult
).notifyCurrentPath(
57 if (basePath
!= null && testDefinition
instanceof StructureAware
)
58 ((StructureAware
<TreeSPath
>) testDefinition
).notifyCurrentPath(
61 testDefinition
.execute(this);
64 public <T
extends DeployedSystem
> T
getDeployedSystem() {
65 return (T
) deployedSystem
;
68 public void setDeployedSystem(DeployedSystem deployedSystem
) {
69 this.deployedSystem
= deployedSystem
;
72 public <T
extends TestData
> T
getTestData() {
76 public void setTestData(TestData testData
) {
77 this.testData
= testData
;
80 public <T
extends TestDefinition
> T
getTestDefinition() {
81 return (T
) testDefinition
;
84 public void setTestDefinition(TestDefinition testDefinition
) {
85 this.testDefinition
= testDefinition
;
88 public <T
extends TestResult
> T
getTestResult() {
89 return (T
) testResult
;
92 public void setTestResult(TestResult testResult
) {
93 this.testResult
= testResult
;
96 public String
getUuid() {
100 public void setUuid(String uuid
) {
104 public String
getSlcExecutionUuid() {
105 return slcExecutionUuid
;
108 public void setSlcExecutionUuid(String slcExecutionUuid
) {
109 this.slcExecutionUuid
= slcExecutionUuid
;
112 public String
getSlcExecutionStepUuid() {
113 return slcExecutionStepUuid
;
116 public void setSlcExecutionStepUuid(String slcExecutionStepUuid
) {
117 this.slcExecutionStepUuid
= slcExecutionStepUuid
;
120 public void notifySlcExecution(SlcExecution slcExecution
) {
121 if (slcExecution
!= null) {
122 slcExecutionUuid
= slcExecution
.getUuid();
123 SlcExecutionStep step
= slcExecution
.currentStep();
125 slcExecutionStepUuid
= step
.getUuid();
130 public void setPath(String path
) {