added svcapi ui and camunda code
[it/otf.git] / otf-camunda / src / main / java / org / oran / otf / common / model / TestExecution.java
1 /*  Copyright (c) 2019 AT&T Intellectual Property.                             #\r
2 #                                                                              #\r
3 #   Licensed under the Apache License, Version 2.0 (the "License");            #\r
4 #   you may not use this file except in compliance with the License.           #\r
5 #   You may obtain a copy of the License at                                    #\r
6 #                                                                              #\r
7 #       http://www.apache.org/licenses/LICENSE-2.0                             #\r
8 #                                                                              #\r
9 #   Unless required by applicable law or agreed to in writing, software        #\r
10 #   distributed under the License is distributed on an "AS IS" BASIS,          #\r
11 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #\r
12 #   See the License for the specific language governing permissions and        #\r
13 #   limitations under the License.                                             #\r
14 ##############################################################################*/\r
15 \r
16 \r
17 package org.oran.otf.common.model;\r
18 \r
19 import org.oran.otf.common.model.historic.TestDefinitionHistoric;\r
20 import org.oran.otf.common.model.historic.TestInstanceHistoric;\r
21 import org.oran.otf.common.model.local.TestHeadResult;\r
22 import org.oran.otf.common.utility.gson.Convert;\r
23 import java.io.Serializable;\r
24 import java.util.Date;\r
25 import java.util.List;\r
26 import java.util.Map;\r
27 import org.bson.types.ObjectId;\r
28 import org.springframework.data.annotation.Id;\r
29 import org.springframework.data.mongodb.core.mapping.Document;\r
30 \r
31 @Document(collection = "testExecutions")\r
32 public class TestExecution implements Serializable {\r
33 \r
34   private static final long serialVersionUID = 1L;\r
35 \r
36   @Id\r
37   private ObjectId _id;\r
38   private ObjectId groupId;\r
39   private ObjectId executorId;\r
40 \r
41   private boolean async;\r
42   private Date startTime;\r
43   private Date endTime;\r
44   private String businessKey;\r
45   private String processInstanceId;\r
46   private String testResult;\r
47   private String testResultMessage;\r
48   private Map<String, Object> testDetails;\r
49   private List<TestHeadResult> testHeadResults;\r
50   private List<TestExecution> testInstanceResults;\r
51   // Stores historic information of associated\r
52   private String historicEmail;\r
53   private TestInstanceHistoric historicTestInstance;\r
54   private TestDefinitionHistoric historicTestDefinition;\r
55 \r
56   public TestExecution() {\r
57   }\r
58 \r
59   public TestExecution(\r
60       ObjectId _id,\r
61       ObjectId groupId,\r
62       ObjectId executorId,\r
63       boolean async,\r
64       Date startTime,\r
65       Date endTime,\r
66       String businessKey,\r
67       String processInstanceId,\r
68       String testResult,\r
69       String testResultMessage,\r
70       Map<String, Object> testDetails,\r
71       List<TestHeadResult> testHeadResults,\r
72       List<TestExecution> testInstanceResults,\r
73       String historicEmail,\r
74       TestInstanceHistoric historicTestInstance,\r
75       TestDefinitionHistoric historicTestDefinition) {\r
76     this._id = _id;\r
77     this.groupId = groupId;\r
78     this.executorId = executorId;\r
79     this.async = async;\r
80     this.startTime = startTime;\r
81     this.endTime = endTime;\r
82     this.businessKey = businessKey;\r
83     this.processInstanceId = processInstanceId;\r
84     this.testResult = testResult;\r
85     this.testResultMessage = testResultMessage;\r
86     this.testDetails = testDetails;\r
87     this.testHeadResults = testHeadResults;\r
88     this.testInstanceResults = testInstanceResults;\r
89     this.historicEmail = historicEmail;\r
90     this.historicTestInstance = historicTestInstance;\r
91     this.historicTestDefinition = historicTestDefinition;\r
92   }\r
93 \r
94   public ObjectId get_id() {\r
95     return _id;\r
96   }\r
97 \r
98   public void set_id(ObjectId _id) {\r
99     this._id = _id;\r
100   }\r
101 \r
102   public ObjectId getGroupId() {\r
103     return groupId;\r
104   }\r
105 \r
106   public void setGroupId(ObjectId groupId) {\r
107     this.groupId = groupId;\r
108   }\r
109 \r
110   public ObjectId getExecutorId() {\r
111     return executorId;\r
112   }\r
113 \r
114   public void setExecutorId(ObjectId executorId) {\r
115     this.executorId = executorId;\r
116   }\r
117 \r
118   public boolean isAsync() {\r
119     return async;\r
120   }\r
121 \r
122   public void setAsync(boolean async) {\r
123     this.async = async;\r
124   }\r
125 \r
126   public Date getStartTime() {\r
127     return startTime;\r
128   }\r
129 \r
130   public void setStartTime(Date startTime) {\r
131     this.startTime = startTime;\r
132   }\r
133 \r
134   public Date getEndTime() {\r
135     return endTime;\r
136   }\r
137 \r
138   public void setEndTime(Date endTime) {\r
139     this.endTime = endTime;\r
140   }\r
141 \r
142   public String getBusinessKey() {\r
143     return businessKey;\r
144   }\r
145 \r
146   public void setBusinessKey(String businessKey) {\r
147     this.businessKey = businessKey;\r
148   }\r
149 \r
150   public String getProcessInstanceId() {\r
151     return processInstanceId;\r
152   }\r
153 \r
154   public void setProcessInstanceId(String processInstanceId) {\r
155     this.processInstanceId = processInstanceId;\r
156   }\r
157 \r
158   public String getTestResult() {\r
159     return testResult;\r
160   }\r
161 \r
162   public void setTestResult(String testResult) {\r
163     this.testResult = testResult;\r
164   }\r
165 \r
166   public String getTestResultMessage() {\r
167     return testResultMessage;\r
168   }\r
169 \r
170   public void setTestResultMessage(String testResultMessage) {\r
171     this.testResultMessage = testResultMessage;\r
172   }\r
173 \r
174   public Map<String, Object> getTestDetails() {\r
175     return testDetails;\r
176   }\r
177 \r
178   public void setTestDetails(Map<String, Object> testDetails) {\r
179     this.testDetails = testDetails;\r
180   }\r
181 \r
182   public List<TestHeadResult> getTestHeadResults() {\r
183     synchronized (testHeadResults) {\r
184       return testHeadResults;\r
185     }\r
186   }\r
187 \r
188   public void setTestHeadResults(List<TestHeadResult> testHeadResults) {\r
189     synchronized (testHeadResults) {\r
190       this.testHeadResults = testHeadResults;\r
191     }\r
192   }\r
193 \r
194   public List<TestExecution> getTestInstanceResults() {\r
195     synchronized (testInstanceResults) {\r
196       return testInstanceResults;\r
197     }\r
198   }\r
199 \r
200   public void setTestInstanceResults(List<TestExecution> testInstanceResults) {\r
201     synchronized (testInstanceResults) {\r
202       this.testInstanceResults = testInstanceResults;\r
203     }\r
204   }\r
205 \r
206   public String getHistoricEmail() {\r
207     return historicEmail;\r
208   }\r
209 \r
210   public void setHistoricEmail(String historicEmail) {\r
211     this.historicEmail = historicEmail;\r
212   }\r
213 \r
214   public TestInstanceHistoric getHistoricTestInstance() {\r
215     return historicTestInstance;\r
216   }\r
217 \r
218   public void setHistoricTestInstance(TestInstanceHistoric historicTestInstance) {\r
219     this.historicTestInstance = historicTestInstance;\r
220   }\r
221 \r
222   public TestDefinitionHistoric getHistoricTestDefinition() {\r
223     return historicTestDefinition;\r
224   }\r
225 \r
226   public void setHistoricTestDefinition(\r
227       TestDefinitionHistoric historicTestDefinition) {\r
228     this.historicTestDefinition = historicTestDefinition;\r
229   }\r
230 \r
231   @Override\r
232   public String toString() {\r
233     return Convert.objectToJson(this);\r
234   }\r
235 }\r