]> git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.core/src/org/argeo/slc/core/test/SimpleTestRun.java
Adapt to changes in Commons
[gpl/argeo-slc.git] / org.argeo.slc.core / src / org / argeo / slc / core / test / SimpleTestRun.java
1 /*
2 * Copyright (C) 2007-2012 Argeo GmbH
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.argeo.slc.core.test;
17
18 import java.util.UUID;
19
20 import org.argeo.slc.deploy.DeployedSystem;
21 import org.argeo.slc.test.ExecutableTestRun;
22 import org.argeo.slc.test.TestData;
23 import org.argeo.slc.test.TestDefinition;
24 import org.argeo.slc.test.TestResult;
25 import org.argeo.slc.test.WritableTestRun;
26
27 /**
28 * A basic bean implementation of a <code>WritableTestRun</code>, holding
29 * references to the various parts of a test run.
30 */
31 public class SimpleTestRun implements WritableTestRun, ExecutableTestRun {
32 private String uuid;
33
34 // private String slcExecutionUuid;
35 // private String slcExecutionStepUuid;
36
37 private DeployedSystem deployedSystem;
38 private TestData testData;
39 private TestDefinition testDefinition;
40 private TestResult testResult;
41
42 /** Executes the underlying test definition. */
43 public void run() {
44 uuid = UUID.randomUUID().toString();
45 if (testResult != null)
46 testResult.notifyTestRun(this);
47
48 testDefinition.execute(this);
49 }
50
51 @SuppressWarnings("unchecked")
52 public <T extends DeployedSystem> T getDeployedSystem() {
53 return (T) deployedSystem;
54 }
55
56 public void setDeployedSystem(DeployedSystem deployedSystem) {
57 this.deployedSystem = deployedSystem;
58 }
59
60 @SuppressWarnings("unchecked")
61 public <T extends TestData> T getTestData() {
62 return (T) testData;
63 }
64
65 public void setTestData(TestData testData) {
66 this.testData = testData;
67 }
68
69 @SuppressWarnings("unchecked")
70 public <T extends TestDefinition> T getTestDefinition() {
71 return (T) testDefinition;
72 }
73
74 public void setTestDefinition(TestDefinition testDefinition) {
75 this.testDefinition = testDefinition;
76 }
77
78 @SuppressWarnings("unchecked")
79 public <T extends TestResult> T getTestResult() {
80 return (T) testResult;
81 }
82
83 public void setTestResult(TestResult testResult) {
84 this.testResult = testResult;
85 }
86
87 public String getUuid() {
88 return uuid;
89 }
90
91 public void setUuid(String uuid) {
92 this.uuid = uuid;
93 }
94
95 // public String getSlcExecutionUuid() {
96 // return slcExecutionUuid;
97 // }
98 //
99 // public void setSlcExecutionUuid(String slcExecutionUuid) {
100 // this.slcExecutionUuid = slcExecutionUuid;
101 // }
102 //
103 // public String getSlcExecutionStepUuid() {
104 // return slcExecutionStepUuid;
105 // }
106 //
107 // public void setSlcExecutionStepUuid(String slcExecutionStepUuid) {
108 // this.slcExecutionStepUuid = slcExecutionStepUuid;
109 // }
110 }