@nsshunt/ststestrunner 1.1.59 → 1.1.61

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.
@@ -33,7 +33,6 @@ var TestCaseFhirBase = class {
33
33
  #authAgentManager;
34
34
  accessTokenTime = performance.now();
35
35
  newTokenLimitTime = 30;
36
- fhirClient = null;
37
36
  restFhirClient = null;
38
37
  defaultAgentOptions = {
39
38
  keepAlive: true,
@@ -132,7 +131,8 @@ var TestCaseFhirBase = class {
132
131
  GetFhirSocketClient = async () => {
133
132
  try {
134
133
  this.#clientSocketFetchCount++;
135
- if (this.fhirClient) return this.fhirClient;
134
+ let fhirClient = this.runnerExecutionWorker.GetFhirClient();
135
+ if (fhirClient) return fhirClient;
136
136
  const fhirOptions = this.#options.fhirOptions;
137
137
  const options = {
138
138
  fhirServerEndpoint: fhirOptions.stsfhirserverendpoint,
@@ -149,10 +149,11 @@ var TestCaseFhirBase = class {
149
149
  GetConnectionAccessToken: this.GetAccessTokenForSocketClientAccess,
150
150
  GetAccessToken: this.GetAccessToken
151
151
  };
152
- if (this.runner.options.fhirOptions.stsfhirsocketclientmode === "socket-client-all-in-one") this.fhirClient = new FhirSocketClientAllInOne("FhirSocketClient", options);
153
- else this.fhirClient = new FhirSocketClientIndividual("FhirSocketClient", options);
154
- await this.fhirClient.WaitForSocketConnected();
155
- return this.fhirClient;
152
+ if (this.runner.options.fhirOptions.stsfhirsocketclientmode === "socket-client-all-in-one") fhirClient = new FhirSocketClientAllInOne("FhirSocketClient", options);
153
+ else fhirClient = new FhirSocketClientIndividual("FhirSocketClient", options);
154
+ await fhirClient.WaitForSocketConnected();
155
+ this.runnerExecutionWorker.SetFhirClient(fhirClient);
156
+ return fhirClient;
156
157
  } catch (error) {
157
158
  this.LogErrorMessage(error);
158
159
  throw error;
@@ -424,23 +425,11 @@ var TestCaseFhirBase = class {
424
425
  StopRunner = async () => {
425
426
  await this.#OutputLogMessage(`StopRunner [${this.#runner.id}]`);
426
427
  await this.#ForcePublishTelemetryData();
427
- if (this.fhirClient) {
428
- this.Debug(chalk.magenta(`TestCaseFhirBase:StopRunner(): Calling: [fhirClient.ResetSocket()]`));
429
- this.fhirClient.ResetSocket();
430
- await Sleep(100);
431
- this.fhirClient = null;
432
- }
433
428
  return true;
434
429
  };
435
430
  TerminateRunner = async () => {
436
431
  await this.#OutputLogMessage(`TerminateRunner [${this.#runner.id}]`);
437
432
  await this.#ForcePublishTelemetryData();
438
- if (this.fhirClient) {
439
- this.Debug(chalk.magenta(`TestCaseFhirBase:TerminateRunner(): Calling: [fhirClient.ResetSocket()]`));
440
- this.fhirClient.ResetSocket();
441
- await Sleep(100);
442
- this.fhirClient = null;
443
- }
444
433
  return true;
445
434
  };
446
435
  Completed = async () => {
@@ -448,12 +437,6 @@ var TestCaseFhirBase = class {
448
437
  this.runner.instrumentData.timer = performance.now() - start;
449
438
  await this.#OutputLogMessage(`Completed [${this.#runner.id}] [${JSON.stringify(this.#runner.instrumentData)}]`);
450
439
  await this.#ForcePublishTelemetryData();
451
- if (this.fhirClient) {
452
- this.Debug(chalk.magenta(`TestCaseFhirBase:Completed(): Calling: [fhirClient.ResetSocket()]`));
453
- this.fhirClient.ResetSocket();
454
- await Sleep(100);
455
- this.fhirClient = null;
456
- }
457
440
  return true;
458
441
  };
459
442
  PauseRunner = async () => {
@@ -469,12 +452,6 @@ var TestCaseFhirBase = class {
469
452
  ResetRunner = async () => {
470
453
  await this.#OutputLogMessage(`ResetRunner [${this.#runner.id}]`);
471
454
  await this.#ForcePublishTelemetryData();
472
- if (this.fhirClient) {
473
- this.Debug(chalk.magenta(`TestCaseFhirBase:ResetRunner(): Calling: [fhirClient.ResetSocket()]`));
474
- this.fhirClient.ResetSocket();
475
- await Sleep(100);
476
- this.fhirClient = null;
477
- }
478
455
  return true;
479
456
  };
480
457
  UpdateRunner = async () => {
@@ -35804,11 +35781,21 @@ var ResourceDataGenerator = class {
35804
35781
  var WorkerFhirTestCases = class extends AbstractRunnerExecutionWorker {
35805
35782
  _options;
35806
35783
  _resourceDataGenerator;
35784
+ fhirClient = void 0;
35807
35785
  constructor(options) {
35808
35786
  super();
35809
35787
  this._options = options;
35810
35788
  this._resourceDataGenerator = new ResourceDataGenerator();
35811
35789
  }
35790
+ GetFhirClient = () => {
35791
+ if (this.fhirClient) console.log(chalk.yellow(`GetFhirClient: SET`));
35792
+ else console.log(chalk.yellow(`GetFhirClient: NO SET`));
35793
+ return this.fhirClient;
35794
+ };
35795
+ SetFhirClient = (fhirClient) => {
35796
+ console.log(chalk.yellow(`SetFhirClient: *****************************************************************************`));
35797
+ this.fhirClient = fhirClient;
35798
+ };
35812
35799
  get resourceDataGenerator() {
35813
35800
  return this._resourceDataGenerator;
35814
35801
  }