--- /dev/null
+/* Copyright (c) 2019 AT&T Intellectual Property. #\r
+# #\r
+# Licensed under the Apache License, Version 2.0 (the "License"); #\r
+# you may not use this file except in compliance with the License. #\r
+# You may obtain a copy of the License at #\r
+# #\r
+# http://www.apache.org/licenses/LICENSE-2.0 #\r
+# #\r
+# Unless required by applicable law or agreed to in writing, software #\r
+# distributed under the License is distributed on an "AS IS" BASIS, #\r
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #\r
+# See the License for the specific language governing permissions and #\r
+# limitations under the License. #\r
+##############################################################################*/\r
+\r
+\r
+\r
+module.exports = function (app) {\r
+ const mongooseClient = app.get('mongooseClient');\r
+\r
+ const { Schema } = mongooseClient;\r
+ const testExecutions = new Schema({\r
+ processInstanceId: { type: String, required: true },\r
+ businessKey: { type: String },\r
+ testResult: { type: String },\r
+ testDetails: { type: Object },\r
+ startTime: { type: Date },\r
+ endTime: { type: Date },\r
+ async: { type: Boolean },\r
+ asyncTopic: { type: String },\r
+ groupId: { type: Schema.Types.ObjectId, ref: 'groups', required: true },\r
+ executorId: { type: Schema.Types.ObjectId, ref: 'users', required: true },\r
+ testResultMessage: { type: String },\r
+ testHeadResults: [\r
+ new Schema({\r
+ testHeadName: { type: String },\r
+ testHeadId: { type: Schema.Types.ObjectId, ref: 'testHeads' },\r
+ testHeadGroupId: { type: Schema.Types.ObjectId, ref: 'groups' }\r
+ }, {_id: false})\r
+ ],\r
+ testInstanceResults: [{}],\r
+ historicEmail: { type: String },\r
+ historicTestInstance: { type: Object },\r
+ historicTestDefinition: { type: Object }\r
+\r
+ }, {\r
+ timestamps: false\r
+ });\r
+ \r
+ testExecutions.index({startTime: 1, endTime: 1});\r
+\r
+ return mongooseClient.model('testExecutions', testExecutions, 'testExecutions');\r
+};\r