@nsshunt/ststestrunner 1.1.67 → 1.1.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/dist/ststestrunner.cjs +44 -1
- package/dist/ststestrunner.cjs.map +1 -1
- package/dist/ststestrunner.mjs +44 -1
- package/dist/ststestrunner.mjs.map +1 -1
- package/package.json +1 -1
- package/types/libmodule/testCaseFhirBase.d.ts.map +1 -1
- package/types/libmodule/workerFhirTestCases.d.ts +5 -0
- package/types/libmodule/workerFhirTestCases.d.ts.map +1 -1
package/dist/ststestrunner.mjs
CHANGED
|
@@ -145,7 +145,28 @@ var TestCaseFhirBase = class {
|
|
|
145
145
|
console.log(`-----------------------------------------------------------------------------------------------------------------`);
|
|
146
146
|
}
|
|
147
147
|
let fhirClient = this.runnerExecutionWorker.GetFhirClient();
|
|
148
|
-
if (fhirClient)
|
|
148
|
+
if (fhirClient) {
|
|
149
|
+
console.log(chalk.green(`[${this.runnerExecutionWorker.id}] Getting existing fhir client`));
|
|
150
|
+
return fhirClient;
|
|
151
|
+
}
|
|
152
|
+
if (this.runnerExecutionWorker.GetOnHold("fhirclient") === true) {
|
|
153
|
+
console.log(chalk.magenta(`[${this.runnerExecutionWorker.id}] fhir client does not exist - some other client setting up the new client - waiting ...`));
|
|
154
|
+
try {
|
|
155
|
+
await this.runnerExecutionWorker.WaitOnHold("fhirclient", 6e4);
|
|
156
|
+
const fhirClient = this.runnerExecutionWorker.GetFhirClient();
|
|
157
|
+
if (fhirClient) {
|
|
158
|
+
console.log(chalk.green(`[${this.runnerExecutionWorker.id}] Getting existing fhir client (post hold release)`));
|
|
159
|
+
return fhirClient;
|
|
160
|
+
} else {
|
|
161
|
+
console.log(chalk.red(`[${this.runnerExecutionWorker.id}] Could not get existing fhir client (post hold release)`));
|
|
162
|
+
console.log(chalk.red(`continue anyway ...`));
|
|
163
|
+
}
|
|
164
|
+
} catch (error) {
|
|
165
|
+
console.error(chalk.red(`GetFhirSocketClient(): Error: [${error}]`));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
console.log(chalk.red(`[${this.runnerExecutionWorker.id}] fhir client does not exist - setting up new client`));
|
|
169
|
+
this.runnerExecutionWorker.SetOnHold("fhirclient");
|
|
149
170
|
const fhirOptions = this.#options.fhirOptions;
|
|
150
171
|
const options = {
|
|
151
172
|
fhirServerEndpoint: fhirOptions.stsfhirserverendpoint,
|
|
@@ -165,7 +186,9 @@ var TestCaseFhirBase = class {
|
|
|
165
186
|
if (this.runner.options.fhirOptions.stsfhirsocketclientmode === "socket-client-all-in-one") fhirClient = new FhirSocketClientAllInOne("FhirSocketClient", options);
|
|
166
187
|
else fhirClient = new FhirSocketClientIndividual("FhirSocketClient", options);
|
|
167
188
|
await fhirClient.WaitForSocketConnected();
|
|
189
|
+
console.log(chalk.red(`[${this.runnerExecutionWorker.id}] setting fhir client into object`));
|
|
168
190
|
this.runnerExecutionWorker.SetFhirClient(fhirClient);
|
|
191
|
+
this.runnerExecutionWorker.ReleaseOnHold("fhirclient");
|
|
169
192
|
return fhirClient;
|
|
170
193
|
} catch (error) {
|
|
171
194
|
this.LogErrorMessage(error);
|
|
@@ -35796,6 +35819,7 @@ var WorkerFhirTestCases = class extends AbstractRunnerExecutionWorker {
|
|
|
35796
35819
|
_resourceDataGenerator;
|
|
35797
35820
|
fhirClient = void 0;
|
|
35798
35821
|
_id = crypto.randomUUID();
|
|
35822
|
+
_onHoldKeys = {};
|
|
35799
35823
|
constructor(options) {
|
|
35800
35824
|
super();
|
|
35801
35825
|
this._options = options;
|
|
@@ -35832,6 +35856,25 @@ var WorkerFhirTestCases = class extends AbstractRunnerExecutionWorker {
|
|
|
35832
35856
|
myresponsepreterminate: `I got: [${JSON.stringify(messagePayload.payload.data)}]`
|
|
35833
35857
|
};
|
|
35834
35858
|
}
|
|
35859
|
+
GetOnHold = (holdKey) => {
|
|
35860
|
+
if (this._onHoldKeys[holdKey]) return true;
|
|
35861
|
+
return false;
|
|
35862
|
+
};
|
|
35863
|
+
WaitOnHold = async (holdKey, timeout) => {
|
|
35864
|
+
const start = performance.now();
|
|
35865
|
+
for (;;) {
|
|
35866
|
+
if (this._onHoldKeys[holdKey]) await Sleep(100);
|
|
35867
|
+
else break;
|
|
35868
|
+
if (performance.now() - start > timeout) throw new Error(`WaitOnHold timeout: [${timeout}] reached.`);
|
|
35869
|
+
}
|
|
35870
|
+
return true;
|
|
35871
|
+
};
|
|
35872
|
+
SetOnHold = (holdKey) => {
|
|
35873
|
+
this._onHoldKeys[holdKey] = true;
|
|
35874
|
+
};
|
|
35875
|
+
ReleaseOnHold = (holdKey) => {
|
|
35876
|
+
delete this._onHoldKeys[holdKey];
|
|
35877
|
+
};
|
|
35835
35878
|
};
|
|
35836
35879
|
//#endregion
|
|
35837
35880
|
export { WorkerFhirTestCases };
|