@intuitionrobotics/testelot 0.41.67 → 0.41.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/Action.js +125 -196
- package/core/Action.js.map +1 -1
- package/core/Action_Container.js +59 -123
- package/core/Action_Container.js.map +1 -1
- package/core/Action_Custom.js +10 -58
- package/core/Action_Custom.js.map +1 -1
- package/core/Action_Http.js +114 -194
- package/core/Action_Http.js.map +1 -1
- package/core/Action_Log.js +12 -58
- package/core/Action_Log.js.map +1 -1
- package/core/Action_Sleep.js +12 -57
- package/core/Action_Sleep.js.map +1 -1
- package/core/Action_ThrowException.js +11 -56
- package/core/Action_ThrowException.js.map +1 -1
- package/core/ContainerContext.js +14 -16
- package/core/ContainerContext.js.map +1 -1
- package/core/Reporter.js +56 -77
- package/core/Reporter.js.map +1 -1
- package/core/Scenario.js +9 -61
- package/core/Scenario.js.map +1 -1
- package/core/TestException.js +5 -20
- package/core/TestException.js.map +1 -1
- package/core/_base_apis.js +14 -46
- package/core/_base_apis.js.map +1 -1
- package/package.json +1 -1
- package/test-app/AppTester.js +32 -85
- package/test-app/AppTester.js.map +1 -1
package/core/Action.js
CHANGED
|
@@ -16,19 +16,6 @@
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
-
var __extends = (this && this.__extends) || (function () {
|
|
20
|
-
var extendStatics = function (d, b) {
|
|
21
|
-
extendStatics = Object.setPrototypeOf ||
|
|
22
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
23
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
24
|
-
return extendStatics(d, b);
|
|
25
|
-
};
|
|
26
|
-
return function (d, b) {
|
|
27
|
-
extendStatics(d, b);
|
|
28
|
-
function __() { this.constructor = d; }
|
|
29
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
30
|
-
};
|
|
31
|
-
})();
|
|
32
19
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
33
20
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
34
21
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -38,40 +25,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
38
25
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
39
26
|
});
|
|
40
27
|
};
|
|
41
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
42
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
43
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
44
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
45
|
-
function step(op) {
|
|
46
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
47
|
-
while (_) try {
|
|
48
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
49
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
50
|
-
switch (op[0]) {
|
|
51
|
-
case 0: case 1: t = op; break;
|
|
52
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
53
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
54
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
55
|
-
default:
|
|
56
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
57
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
58
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
59
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
60
|
-
if (t[2]) _.ops.pop();
|
|
61
|
-
_.trys.pop(); continue;
|
|
62
|
-
}
|
|
63
|
-
op = body.call(thisArg, _);
|
|
64
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
65
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69
29
|
exports.Action = exports.Status = void 0;
|
|
70
30
|
/**
|
|
71
31
|
* Created by IR on 3/18/17.
|
|
72
32
|
*/
|
|
73
|
-
|
|
74
|
-
|
|
33
|
+
const ts_common_1 = require("@intuitionrobotics/ts-common");
|
|
34
|
+
const TestException_1 = require("./TestException");
|
|
75
35
|
var Status;
|
|
76
36
|
(function (Status) {
|
|
77
37
|
Status["Ready"] = "Ready";
|
|
@@ -80,202 +40,171 @@ var Status;
|
|
|
80
40
|
Status["Success"] = "Success";
|
|
81
41
|
Status["Error"] = "Error";
|
|
82
42
|
})(Status = exports.Status || (exports.Status = {}));
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
_this.actionType = actionType.name;
|
|
93
|
-
return _this;
|
|
43
|
+
class Action extends ts_common_1.Logger {
|
|
44
|
+
constructor(actionType, tag) {
|
|
45
|
+
super(tag || "Testelot");
|
|
46
|
+
this.uuid = ts_common_1.generateUUID();
|
|
47
|
+
this.label = "Unnamed Action";
|
|
48
|
+
this.policy = 1 /* SkipOnError */;
|
|
49
|
+
this.postExecutionDelay = 0;
|
|
50
|
+
this.status = Status.Ready;
|
|
51
|
+
this.actionType = actionType.name;
|
|
94
52
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
console.log(
|
|
98
|
-
this.testsToRun = strings.map(
|
|
99
|
-
console.log(
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
this.shouldFailCondition =
|
|
103
|
-
|
|
53
|
+
static resolveTestsToRun() {
|
|
54
|
+
const strings = process.argv.filter((arg) => arg.includes("--test="));
|
|
55
|
+
console.log(`raw: ${ts_common_1.__stringify(strings)}`);
|
|
56
|
+
this.testsToRun = strings.map(arg => arg.replace("--test=", ""));
|
|
57
|
+
console.log(`Tests to run: ${ts_common_1.__stringify(this.testsToRun)}`);
|
|
58
|
+
}
|
|
59
|
+
expectToFail(_exceptionType, assertFailCondition) {
|
|
60
|
+
this.shouldFailCondition = (e) => {
|
|
61
|
+
const err = ts_common_1.isErrorOfType(e, _exceptionType);
|
|
104
62
|
if (!err)
|
|
105
|
-
throw new TestException_1.TestException(
|
|
63
|
+
throw new TestException_1.TestException(`Test should have failed with an: ${_exceptionType.name}`);
|
|
106
64
|
return !assertFailCondition ? true : assertFailCondition(err);
|
|
107
65
|
};
|
|
108
66
|
return this;
|
|
109
|
-
}
|
|
110
|
-
|
|
67
|
+
}
|
|
68
|
+
processReturnValue(returnValueProcessor) {
|
|
111
69
|
this.assertFailCondition = returnValueProcessor;
|
|
112
70
|
return this;
|
|
113
|
-
}
|
|
114
|
-
|
|
71
|
+
}
|
|
72
|
+
isContainer() {
|
|
115
73
|
return false;
|
|
116
|
-
}
|
|
117
|
-
|
|
74
|
+
}
|
|
75
|
+
hasParent() {
|
|
118
76
|
return !!this.parent;
|
|
119
|
-
}
|
|
120
|
-
|
|
77
|
+
}
|
|
78
|
+
setErrorPolicy(policy) {
|
|
121
79
|
this.policy = policy;
|
|
122
80
|
return this;
|
|
123
|
-
}
|
|
124
|
-
|
|
81
|
+
}
|
|
82
|
+
setParent(parent) {
|
|
125
83
|
this.parent = parent;
|
|
126
|
-
}
|
|
127
|
-
|
|
84
|
+
}
|
|
85
|
+
setReporter(reporter) {
|
|
128
86
|
this.reporter = reporter;
|
|
129
|
-
}
|
|
130
|
-
|
|
87
|
+
}
|
|
88
|
+
setWriteKey(writeKey) {
|
|
131
89
|
this.writeKey = writeKey;
|
|
132
90
|
return this;
|
|
133
|
-
}
|
|
134
|
-
|
|
91
|
+
}
|
|
92
|
+
setReadKey(readKey) {
|
|
135
93
|
this.readKey = readKey;
|
|
136
94
|
return this;
|
|
137
|
-
}
|
|
138
|
-
|
|
95
|
+
}
|
|
96
|
+
setPostExecutionDelay(postExecutionDelay) {
|
|
139
97
|
this.postExecutionDelay = postExecutionDelay;
|
|
140
98
|
return this;
|
|
141
|
-
}
|
|
142
|
-
|
|
99
|
+
}
|
|
100
|
+
setLabel(label) {
|
|
143
101
|
this.label = label;
|
|
144
102
|
return this;
|
|
145
|
-
}
|
|
146
|
-
|
|
103
|
+
}
|
|
104
|
+
getStarted() {
|
|
147
105
|
return this._started;
|
|
148
|
-
}
|
|
149
|
-
|
|
106
|
+
}
|
|
107
|
+
getEnded() {
|
|
150
108
|
return this._ended;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
action.setParent(this);
|
|
158
|
-
action.setReporter(this.reporter);
|
|
159
|
-
return [4 /*yield*/, action._execute()];
|
|
160
|
-
case 1:
|
|
161
|
-
_a.sent();
|
|
162
|
-
return [2 /*return*/];
|
|
163
|
-
}
|
|
164
|
-
});
|
|
109
|
+
}
|
|
110
|
+
_executeSubAction(action) {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
action.setParent(this);
|
|
113
|
+
action.setReporter(this.reporter);
|
|
114
|
+
yield action._execute();
|
|
165
115
|
});
|
|
166
|
-
}
|
|
167
|
-
|
|
116
|
+
}
|
|
117
|
+
resolveLabel(param) {
|
|
168
118
|
if (!this.label)
|
|
169
119
|
return;
|
|
170
120
|
return typeof this.label === "string" ? this.label : this.label(param);
|
|
171
|
-
}
|
|
172
|
-
|
|
121
|
+
}
|
|
122
|
+
_execute() {
|
|
173
123
|
var _a, _b;
|
|
174
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
else
|
|
191
|
-
this.setStatus(Status.Ready);
|
|
192
|
-
if (!(this.status === Status.Skipped)) return [3 /*break*/, 4];
|
|
193
|
-
if (!this.isContainer()) return [3 /*break*/, 3];
|
|
194
|
-
// @ts-ignore
|
|
195
|
-
return [4 /*yield*/, this.execute()];
|
|
196
|
-
case 2:
|
|
124
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
this._started = ts_common_1.currentTimeMillies();
|
|
126
|
+
let label;
|
|
127
|
+
let err;
|
|
128
|
+
let retValue = undefined;
|
|
129
|
+
try {
|
|
130
|
+
let param;
|
|
131
|
+
if (this.readKey)
|
|
132
|
+
param = this.get(this.readKey);
|
|
133
|
+
label = this.resolveLabel(param);
|
|
134
|
+
if (Action.testsToRun.length > 0 && !Action.testsToRun.find(testToRun => (label || "").includes(testToRun)))
|
|
135
|
+
this.setStatus(Status.Skipped);
|
|
136
|
+
else
|
|
137
|
+
this.setStatus(Status.Ready);
|
|
138
|
+
if (this.status === Status.Skipped) {
|
|
139
|
+
if (this.isContainer())
|
|
197
140
|
// @ts-ignore
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
else {
|
|
232
|
-
// only set the ret value if we expect a success...
|
|
233
|
-
if (this.writeKey && !this.shouldFailCondition) {
|
|
234
|
-
this.set(this.writeKey, retValue);
|
|
235
|
-
}
|
|
236
|
-
(_b = this.assertFailCondition) === null || _b === void 0 ? void 0 : _b.call(this, retValue);
|
|
237
|
-
// label && this.reporter.logVerbose(`ended: ${label}`);
|
|
238
|
-
if (this.isContainer())
|
|
239
|
-
label && this.reporter.logVerbose("- " + label);
|
|
240
|
-
}
|
|
141
|
+
yield this.execute();
|
|
142
|
+
label && this.reporter.logVerbose(`skipped: ${label}`);
|
|
143
|
+
this.reporter.onActionEnded(this);
|
|
144
|
+
this._ended = ts_common_1.currentTimeMillies();
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (this.isContainer())
|
|
148
|
+
label && this.reporter.logVerbose(`+ ${label}`);
|
|
149
|
+
else {
|
|
150
|
+
label && this.reporter.logVerbose(`Running: ${label}`);
|
|
151
|
+
if (this.readKey)
|
|
152
|
+
this.reporter.logDebug(`Using context: ${this.readKey.key}`);
|
|
153
|
+
}
|
|
154
|
+
this.reporter.onActionStarted(this);
|
|
155
|
+
this.setStatus(Status.Running);
|
|
156
|
+
retValue = yield this.execute((param || ts_common_1.Void));
|
|
157
|
+
}
|
|
158
|
+
catch (e) {
|
|
159
|
+
err = ((_a = this.shouldFailCondition) === null || _a === void 0 ? void 0 : _a.call(this, e)) ? undefined : e;
|
|
160
|
+
}
|
|
161
|
+
finally {
|
|
162
|
+
if (this.status !== Status.Skipped) {
|
|
163
|
+
this.setStatus(err ? Status.Error : Status.Success);
|
|
164
|
+
this.reporter.onActionEnded(this);
|
|
165
|
+
if (err) {
|
|
166
|
+
label && this.reporter.logError(`Error in Action: ${label}`);
|
|
167
|
+
this.reporter.logError(err);
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
// only set the ret value if we expect a success...
|
|
171
|
+
if (this.writeKey && !this.shouldFailCondition) {
|
|
172
|
+
this.set(this.writeKey, retValue);
|
|
241
173
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
if (
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
_c.sent();
|
|
248
|
-
_c.label = 10;
|
|
249
|
-
case 10:
|
|
250
|
-
this._ended = ts_common_1.currentTimeMillies();
|
|
251
|
-
return [2 /*return*/];
|
|
174
|
+
(_b = this.assertFailCondition) === null || _b === void 0 ? void 0 : _b.call(this, retValue);
|
|
175
|
+
// label && this.reporter.logVerbose(`ended: ${label}`);
|
|
176
|
+
if (this.isContainer())
|
|
177
|
+
label && this.reporter.logVerbose(`- ${label}`);
|
|
178
|
+
}
|
|
252
179
|
}
|
|
253
|
-
}
|
|
180
|
+
}
|
|
181
|
+
if (this.postExecutionDelay > 0)
|
|
182
|
+
yield ts_common_1.timeout(this.postExecutionDelay);
|
|
183
|
+
this._ended = ts_common_1.currentTimeMillies();
|
|
254
184
|
});
|
|
255
|
-
}
|
|
256
|
-
|
|
185
|
+
}
|
|
186
|
+
setStatus(status) {
|
|
257
187
|
this.status = status;
|
|
258
|
-
}
|
|
259
|
-
|
|
188
|
+
}
|
|
189
|
+
get(key) {
|
|
260
190
|
if (!this.parent)
|
|
261
191
|
return key.defaultValue;
|
|
262
192
|
return this.parent.get(key);
|
|
263
|
-
}
|
|
264
|
-
|
|
193
|
+
}
|
|
194
|
+
remove(key) {
|
|
265
195
|
if (!this.parent)
|
|
266
196
|
return false;
|
|
267
197
|
return this.parent.remove(key);
|
|
268
|
-
}
|
|
269
|
-
|
|
198
|
+
}
|
|
199
|
+
set(key, value) {
|
|
270
200
|
if (!this.parent)
|
|
271
201
|
return;
|
|
272
202
|
return this.parent.set(key, value);
|
|
273
|
-
}
|
|
274
|
-
|
|
203
|
+
}
|
|
204
|
+
reset() {
|
|
275
205
|
//
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
return Action;
|
|
279
|
-
}(ts_common_1.Logger));
|
|
206
|
+
}
|
|
207
|
+
}
|
|
280
208
|
exports.Action = Action;
|
|
209
|
+
Action.testsToRun = [];
|
|
281
210
|
//# sourceMappingURL=Action.js.map
|
package/core/Action.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Action.js","sourceRoot":"","sources":["../../src/main/core/Action.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG
|
|
1
|
+
{"version":3,"file":"Action.js","sourceRoot":"","sources":["../../src/main/core/Action.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;;;;;;;;AAEH;;GAEG;AACH,4DASsC;AAGtC,mDAA8C;AAE9C,IAAY,MAMX;AAND,WAAY,MAAM;IACjB,yBAAiB,CAAA;IACjB,6BAAmB,CAAA;IACnB,6BAAmB,CAAA;IACnB,6BAAmB,CAAA;IACnB,yBAAiB,CAAA;AAClB,CAAC,EANW,MAAM,GAAN,cAAM,KAAN,cAAM,QAMjB;AAYD,MAAsB,MACrB,SAAQ,kBAAM;IAsBd,YAAsB,UAAoB,EAAE,GAAY;QACvD,KAAK,CAAC,GAAG,IAAI,UAAU,CAAC,CAAC;QAlBjB,SAAI,GAAW,wBAAY,EAAE,CAAC;QAM/B,UAAK,GAA+C,gBAAgB,CAAC;QACtE,WAAM,uBAAwC;QAG7C,uBAAkB,GAAW,CAAC,CAAC;QAEhC,WAAM,GAAW,MAAM,CAAC,KAAK,CAAC;QAQpC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,iBAAiB;QACvB,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CA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AAkB,CAAC,CAAC;YAExC,IAAI,CAAC,MAAM,GAAG,8BAAkB,EAAE,CAAC;;KACnC;IAED,SAAS,CAAC,MAAc;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;IAIM,GAAG,CAAY,GAA0B;QAC/C,IAAI,CAAC,IAAI,CAAC,MAAM;YACf,OAAO,GAAG,CAAC,YAAY,CAAC;QAEzB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAES,MAAM,CAAY,GAA0B;QACrD,IAAI,CAAC,IAAI,CAAC,MAAM;YACf,OAAO,KAAK,CAAC;QAEd,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IAEM,GAAG,CAAY,GAA0B,EAAE,KAAgB;QACjE,IAAI,CAAC,IAAI,CAAC,MAAM;YACf,OAAO;QAER,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,KAAK;QACJ,EAAE;IACH,CAAC;;AAvNF,wBAwNC;AAtNe,iBAAU,GAAa,EAAE,CAAC"}
|
package/core/Action_Container.js
CHANGED
|
@@ -16,19 +16,6 @@
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
-
var __extends = (this && this.__extends) || (function () {
|
|
20
|
-
var extendStatics = function (d, b) {
|
|
21
|
-
extendStatics = Object.setPrototypeOf ||
|
|
22
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
23
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
24
|
-
return extendStatics(d, b);
|
|
25
|
-
};
|
|
26
|
-
return function (d, b) {
|
|
27
|
-
extendStatics(d, b);
|
|
28
|
-
function __() { this.constructor = d; }
|
|
29
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
30
|
-
};
|
|
31
|
-
})();
|
|
32
19
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
33
20
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
34
21
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -38,139 +25,88 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
38
25
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
39
26
|
});
|
|
40
27
|
};
|
|
41
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
42
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
43
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
44
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
45
|
-
function step(op) {
|
|
46
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
47
|
-
while (_) try {
|
|
48
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
49
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
50
|
-
switch (op[0]) {
|
|
51
|
-
case 0: case 1: t = op; break;
|
|
52
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
53
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
54
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
55
|
-
default:
|
|
56
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
57
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
58
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
59
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
60
|
-
if (t[2]) _.ops.pop();
|
|
61
|
-
_.trys.pop(); continue;
|
|
62
|
-
}
|
|
63
|
-
op = body.call(thisArg, _);
|
|
64
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
65
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69
29
|
exports.Action_Container = void 0;
|
|
70
30
|
/**
|
|
71
31
|
* Created by IR on 3/18/17.
|
|
72
32
|
*/
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
_this.isProxy = false;
|
|
82
|
-
return _this;
|
|
33
|
+
const Action_1 = require("./Action");
|
|
34
|
+
const ContainerContext_1 = require("./ContainerContext");
|
|
35
|
+
class Action_Container extends Action_1.Action {
|
|
36
|
+
constructor(type, tag) {
|
|
37
|
+
super(type, tag);
|
|
38
|
+
this.context = new ContainerContext_1.TypedHashMap();
|
|
39
|
+
this.actions = [];
|
|
40
|
+
this.isProxy = false;
|
|
83
41
|
}
|
|
84
|
-
|
|
42
|
+
isContainer() {
|
|
85
43
|
return true;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
var steps = [];
|
|
90
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
91
|
-
steps[_i] = arguments[_i];
|
|
92
|
-
}
|
|
93
|
-
(_a = this.actions).push.apply(_a, steps);
|
|
44
|
+
}
|
|
45
|
+
add(...steps) {
|
|
46
|
+
this.actions.push(...steps);
|
|
94
47
|
return this;
|
|
95
|
-
}
|
|
96
|
-
|
|
48
|
+
}
|
|
49
|
+
setProxy(isProxy) {
|
|
97
50
|
this.isProxy = isProxy;
|
|
98
51
|
return this;
|
|
99
|
-
}
|
|
100
|
-
|
|
52
|
+
}
|
|
53
|
+
get(key) {
|
|
101
54
|
if (this.isProxy)
|
|
102
|
-
return
|
|
103
|
-
|
|
55
|
+
return super.get(key);
|
|
56
|
+
const value = this.context.get(key);
|
|
104
57
|
if (value)
|
|
105
58
|
return value;
|
|
106
|
-
return
|
|
107
|
-
}
|
|
108
|
-
|
|
59
|
+
return super.get(key);
|
|
60
|
+
}
|
|
61
|
+
remove(key) {
|
|
109
62
|
if (this.isProxy)
|
|
110
|
-
return
|
|
111
|
-
|
|
63
|
+
return super.remove(key);
|
|
64
|
+
const value = this.context.delete(key);
|
|
112
65
|
if (value)
|
|
113
66
|
return value;
|
|
114
|
-
return
|
|
115
|
-
}
|
|
116
|
-
|
|
67
|
+
return super.remove(key);
|
|
68
|
+
}
|
|
69
|
+
set(key, value) {
|
|
117
70
|
if (this.isProxy)
|
|
118
|
-
return
|
|
119
|
-
this.logDebug(
|
|
120
|
-
|
|
71
|
+
return super.set(key, value);
|
|
72
|
+
this.logDebug(` Storing: ${key.key} => ${JSON.stringify(value)}`);
|
|
73
|
+
const prevValue = this.context.get(key);
|
|
121
74
|
this.context.set(key, value);
|
|
122
75
|
return prevValue;
|
|
123
|
-
}
|
|
124
|
-
|
|
76
|
+
}
|
|
77
|
+
getSteps() {
|
|
125
78
|
return this.actions;
|
|
126
|
-
}
|
|
127
|
-
|
|
79
|
+
}
|
|
80
|
+
reset() {
|
|
128
81
|
this.context.clear();
|
|
129
|
-
|
|
130
|
-
this.actions.forEach(
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
// noinspection FallThroughInSwitchStatementJS
|
|
151
|
-
switch (action.policy) {
|
|
152
|
-
case 0 /* ContinueOnError */:
|
|
153
|
-
return [3 /*break*/, 3];
|
|
154
|
-
case 2 /* HaltOnError */:
|
|
155
|
-
this.setErrorPolicy(1 /* SkipOnError */);
|
|
156
|
-
this.setStatus(Action_1.Status.Error);
|
|
157
|
-
case 1 /* SkipOnError */:
|
|
158
|
-
this.setStatus(Action_1.Status.Skipped);
|
|
159
|
-
break;
|
|
160
|
-
}
|
|
161
|
-
_b.label = 3;
|
|
162
|
-
case 3:
|
|
163
|
-
_i++;
|
|
164
|
-
return [3 /*break*/, 1];
|
|
165
|
-
case 4: return [2 /*return*/];
|
|
82
|
+
super.reset();
|
|
83
|
+
this.actions.forEach(action => action.reset());
|
|
84
|
+
}
|
|
85
|
+
execute() {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
for (const action of this.actions) {
|
|
88
|
+
if (this.status !== Action_1.Status.Running)
|
|
89
|
+
action.setStatus(Action_1.Status.Skipped);
|
|
90
|
+
yield this._executeSubAction(action);
|
|
91
|
+
if (action.status !== Action_1.Status.Error)
|
|
92
|
+
continue;
|
|
93
|
+
// noinspection FallThroughInSwitchStatementJS
|
|
94
|
+
switch (action.policy) {
|
|
95
|
+
case 0 /* ContinueOnError */:
|
|
96
|
+
continue;
|
|
97
|
+
case 2 /* HaltOnError */:
|
|
98
|
+
this.setErrorPolicy(1 /* SkipOnError */);
|
|
99
|
+
this.setStatus(Action_1.Status.Error);
|
|
100
|
+
case 1 /* SkipOnError */:
|
|
101
|
+
this.setStatus(Action_1.Status.Skipped);
|
|
102
|
+
break;
|
|
166
103
|
}
|
|
167
|
-
}
|
|
104
|
+
}
|
|
168
105
|
});
|
|
169
|
-
}
|
|
170
|
-
|
|
106
|
+
}
|
|
107
|
+
isEmpty() {
|
|
171
108
|
return this.actions && this.actions.length === 0;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
}(Action_1.Action));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
175
111
|
exports.Action_Container = Action_Container;
|
|
176
112
|
//# sourceMappingURL=Action_Container.js.map
|