|
| 1 | +/* |
| 2 | + * Copyright 2019 Philipp Salvisberg <philipp.salvisberg@trivadis.com> |
| 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.utplsql.sqldev.model.runner |
| 17 | + |
| 18 | +import java.util.LinkedHashMap |
| 19 | +import java.util.List |
| 20 | +import org.eclipse.xtend.lib.annotations.Accessors |
| 21 | +import org.utplsql.sqldev.model.AbstractModel |
| 22 | + |
| 23 | +@Accessors |
| 24 | +class Run extends AbstractModel { |
| 25 | + String reporterId |
| 26 | + String connectionName |
| 27 | + Integer totalNumberOfTests |
| 28 | + String startTime |
| 29 | + String endTime |
| 30 | + Double executionTime |
| 31 | + Counter counter |
| 32 | + String errorStack |
| 33 | + String serverOutput |
| 34 | + LinkedHashMap<String, Test> tests |
| 35 | + |
| 36 | + new(String reporterId, String connectionName) { |
| 37 | + this.reporterId = reporterId |
| 38 | + this.connectionName = connectionName |
| 39 | + this.counter = new Counter |
| 40 | + this.tests = new LinkedHashMap<String, Test> |
| 41 | + } |
| 42 | + |
| 43 | + def getName() { |
| 44 | + return '''«startTime» («connectionName»)''' |
| 45 | + } |
| 46 | + |
| 47 | + def void put(List<Item> items) { |
| 48 | + for (item : items) { |
| 49 | + if (item instanceof Test) { |
| 50 | + this.tests.put(item.id, item) |
| 51 | + } |
| 52 | + if (item instanceof Suite) { |
| 53 | + item.items.put |
| 54 | + } |
| 55 | + } |
| 56 | + } |
| 57 | + |
| 58 | + def getTest(String id) { |
| 59 | + return tests.get(id) |
| 60 | + } |
| 61 | + |
| 62 | + def getTotalNumberOfCompletedTests() { |
| 63 | + return counter.disabled + counter.success + counter.failure + counter.error |
| 64 | + } |
| 65 | + |
| 66 | +} |
0 commit comments