added svcapi ui and camunda code
[it/otf.git] / otf-service-api / 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 asyncTopic;\r
45   private String businessKey;\r
46   private String processInstanceId;\r
47   private String testResult;\r
48   private String testResultMessage;\r
49   private Map<String, Object> testDetails;\r
50   private List<TestHeadResult> testHeadResults;\r
51   private List<TestExecution> testInstanceResults;\r
52   // Stores historic information of associated\r
53   private String historicEmail;\r
54   private TestInstanceHistoric historicTestInstance;\r
55   private TestDefinitionHistoric historicTestDefinition;\r
56 \r
57   public TestExecution() {\r
58   }\r
59 \r
60   public TestExecution(\r
61           ObjectId _id,\r
62           ObjectId groupId,\r
63           ObjectId executorId,\r
64           boolean async,\r
65           Date startTime,\r
66           Date endTime,\r
67           String asyncTopic,\r
68           String businessKey,\r
69           String processInstanceId,\r
70           String testResult,\r
71           String testResultMessage,\r
72           Map<String, Object> testDetails,\r
73           List<TestHeadResult> testHeadResults,\r
74           List<TestExecution> testInstanceResults,\r
75           String historicEmail,\r
76           TestInstanceHistoric historicTestInstance,\r
77           TestDefinitionHistoric historicTestDefinition) {\r
78     this._id = _id;\r
79     this.groupId = groupId;\r
80     this.executorId = executorId;\r
81     this.async = async;\r
82     this.startTime = startTime;\r
83     this.endTime = endTime;\r
84     this.asyncTopic = asyncTopic;\r
85     this.businessKey = businessKey;\r
86     this.processInstanceId = processInstanceId;\r
87     this.testResult = testResult;\r
88     this.testDetails = testDetails;\r
89     this.testHeadResults = testHeadResults;\r
90     this.testInstanceResults = testInstanceResults;\r
91     this.historicEmail = historicEmail;\r
92     this.historicTestInstance = historicTestInstance;\r
93     this.historicTestDefinition = historicTestDefinition;\r
94   }\r
95 \r
96   public ObjectId get_id() {\r
97     return _id;\r
98   }\r
99 \r
100   public void set_id(ObjectId _id) {\r
101     this._id = _id;\r
102   }\r
103 \r
104   public ObjectId getGroupId() {\r
105     return groupId;\r
106   }\r
107 \r
108   public void setGroupId(ObjectId groupId) {\r
109     this.groupId = groupId;\r
110   }\r
111 \r
112   public ObjectId getExecutorId() {\r
113     return executorId;\r
114   }\r
115 \r
116   public void setExecutorId(ObjectId executorId) {\r
117     this.executorId = executorId;\r
118   }\r
119 \r
120   public boolean isAsync() {\r
121     return async;\r
122   }\r
123 \r
124   public void setAsync(boolean async) {\r
125     this.async = async;\r
126   }\r
127 \r
128   public Date getStartTime() {\r
129     return startTime;\r
130   }\r
131 \r
132   public void setStartTime(Date startTime) {\r
133     this.startTime = startTime;\r
134   }\r
135 \r
136   public Date getEndTime() {\r
137     return endTime;\r
138   }\r
139 \r
140   public void setEndTime(Date endTime) {\r
141     this.endTime = endTime;\r
142   }\r
143 \r
144   public String getAsyncTopic() {\r
145     return asyncTopic;\r
146   }\r
147 \r
148   public void setAsyncTopic(String asyncTopic) {\r
149     this.asyncTopic = asyncTopic;\r
150   }\r
151 \r
152   public String getBusinessKey() {\r
153     return businessKey;\r
154   }\r
155 \r
156   public void setBusinessKey(String businessKey) {\r
157     this.businessKey = businessKey;\r
158   }\r
159 \r
160   public String getProcessInstanceId() {\r
161     return processInstanceId;\r
162   }\r
163 \r
164   public void setProcessInstanceId(String processInstanceId) {\r
165     this.processInstanceId = processInstanceId;\r
166   }\r
167 \r
168   public String getTestResult() {\r
169     return testResult;\r
170   }\r
171 \r
172   public void setTestResult(String testResult) {\r
173     this.testResult = testResult;\r
174   }\r
175 \r
176   public String getTestResultMessage() {\r
177     return testResultMessage;\r
178   }\r
179 \r
180   public void setTestResultMessage(String testResultMessage) {\r
181     this.testResultMessage = testResultMessage;\r
182   }\r
183 \r
184   public Map<String, Object> getTestDetails() {\r
185     return testDetails;\r
186   }\r
187 \r
188   public void setTestDetails(Map<String, Object> testDetails) {\r
189     this.testDetails = testDetails;\r
190   }\r
191 \r
192   public List<TestHeadResult> getTestHeadResults() {\r
193     synchronized (testHeadResults) {\r
194       return testHeadResults;\r
195     }\r
196   }\r
197 \r
198   public void setTestHeadResults(List<TestHeadResult> testHeadResults) {\r
199     synchronized (testHeadResults) {\r
200       this.testHeadResults = testHeadResults;\r
201     }\r
202   }\r
203 \r
204   public List<TestExecution> getTestInstanceResults() {\r
205     synchronized (testInstanceResults) {\r
206       return testInstanceResults;\r
207     }\r
208   }\r
209 \r
210   public void setTestInstanceResults(List<TestExecution> testInstanceResults) {\r
211     synchronized (testInstanceResults) {\r
212       this.testInstanceResults = testInstanceResults;\r
213     }\r
214   }\r
215 \r
216   public String getHistoricEmail() {\r
217     return historicEmail;\r
218   }\r
219 \r
220   public void setHistoricEmail(String historicEmail) {\r
221     this.historicEmail = historicEmail;\r
222   }\r
223 \r
224   public TestInstanceHistoric getHistoricTestInstance() {\r
225     return historicTestInstance;\r
226   }\r
227 \r
228   public void setHistoricTestInstance(TestInstanceHistoric historicTestInstance) {\r
229     this.historicTestInstance = historicTestInstance;\r
230   }\r
231 \r
232   public TestDefinitionHistoric getHistoricTestDefinition() {\r
233     return historicTestDefinition;\r
234   }\r
235 \r
236   public void setHistoricTestDefinition(\r
237           TestDefinitionHistoric historicTestDefinition) {\r
238     this.historicTestDefinition = historicTestDefinition;\r
239   }\r
240 \r
241   @Override\r
242   public String toString() {\r
243     return Convert.objectToJson(this);\r
244   }\r
245 }\r