@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.
@@ -56,7 +56,6 @@ var TestCaseFhirBase = class {
56
56
  #authAgentManager;
57
57
  accessTokenTime = performance.now();
58
58
  newTokenLimitTime = 30;
59
- fhirClient = null;
60
59
  restFhirClient = null;
61
60
  defaultAgentOptions = {
62
61
  keepAlive: true,
@@ -155,7 +154,8 @@ var TestCaseFhirBase = class {
155
154
  GetFhirSocketClient = async () => {
156
155
  try {
157
156
  this.#clientSocketFetchCount++;
158
- if (this.fhirClient) return this.fhirClient;
157
+ let fhirClient = this.runnerExecutionWorker.GetFhirClient();
158
+ if (fhirClient) return fhirClient;
159
159
  const fhirOptions = this.#options.fhirOptions;
160
160
  const options = {
161
161
  fhirServerEndpoint: fhirOptions.stsfhirserverendpoint,
@@ -172,10 +172,11 @@ var TestCaseFhirBase = class {
172
172
  GetConnectionAccessToken: this.GetAccessTokenForSocketClientAccess,
173
173
  GetAccessToken: this.GetAccessToken
174
174
  };
175
- if (this.runner.options.fhirOptions.stsfhirsocketclientmode === "socket-client-all-in-one") this.fhirClient = new _nsshunt_stsfhirclient.FhirSocketClientAllInOne("FhirSocketClient", options);
176
- else this.fhirClient = new _nsshunt_stsfhirclient.FhirSocketClientIndividual("FhirSocketClient", options);
177
- await this.fhirClient.WaitForSocketConnected();
178
- return this.fhirClient;
175
+ if (this.runner.options.fhirOptions.stsfhirsocketclientmode === "socket-client-all-in-one") fhirClient = new _nsshunt_stsfhirclient.FhirSocketClientAllInOne("FhirSocketClient", options);
176
+ else fhirClient = new _nsshunt_stsfhirclient.FhirSocketClientIndividual("FhirSocketClient", options);
177
+ await fhirClient.WaitForSocketConnected();
178
+ this.runnerExecutionWorker.SetFhirClient(fhirClient);
179
+ return fhirClient;
179
180
  } catch (error) {
180
181
  this.LogErrorMessage(error);
181
182
  throw error;
@@ -447,23 +448,11 @@ var TestCaseFhirBase = class {
447
448
  StopRunner = async () => {
448
449
  await this.#OutputLogMessage(`StopRunner [${this.#runner.id}]`);
449
450
  await this.#ForcePublishTelemetryData();
450
- if (this.fhirClient) {
451
- this.Debug(chalk.default.magenta(`TestCaseFhirBase:StopRunner(): Calling: [fhirClient.ResetSocket()]`));
452
- this.fhirClient.ResetSocket();
453
- await (0, _nsshunt_stsutils.Sleep)(100);
454
- this.fhirClient = null;
455
- }
456
451
  return true;
457
452
  };
458
453
  TerminateRunner = async () => {
459
454
  await this.#OutputLogMessage(`TerminateRunner [${this.#runner.id}]`);
460
455
  await this.#ForcePublishTelemetryData();
461
- if (this.fhirClient) {
462
- this.Debug(chalk.default.magenta(`TestCaseFhirBase:TerminateRunner(): Calling: [fhirClient.ResetSocket()]`));
463
- this.fhirClient.ResetSocket();
464
- await (0, _nsshunt_stsutils.Sleep)(100);
465
- this.fhirClient = null;
466
- }
467
456
  return true;
468
457
  };
469
458
  Completed = async () => {
@@ -471,12 +460,6 @@ var TestCaseFhirBase = class {
471
460
  this.runner.instrumentData.timer = performance.now() - start;
472
461
  await this.#OutputLogMessage(`Completed [${this.#runner.id}] [${JSON.stringify(this.#runner.instrumentData)}]`);
473
462
  await this.#ForcePublishTelemetryData();
474
- if (this.fhirClient) {
475
- this.Debug(chalk.default.magenta(`TestCaseFhirBase:Completed(): Calling: [fhirClient.ResetSocket()]`));
476
- this.fhirClient.ResetSocket();
477
- await (0, _nsshunt_stsutils.Sleep)(100);
478
- this.fhirClient = null;
479
- }
480
463
  return true;
481
464
  };
482
465
  PauseRunner = async () => {
@@ -492,12 +475,6 @@ var TestCaseFhirBase = class {
492
475
  ResetRunner = async () => {
493
476
  await this.#OutputLogMessage(`ResetRunner [${this.#runner.id}]`);
494
477
  await this.#ForcePublishTelemetryData();
495
- if (this.fhirClient) {
496
- this.Debug(chalk.default.magenta(`TestCaseFhirBase:ResetRunner(): Calling: [fhirClient.ResetSocket()]`));
497
- this.fhirClient.ResetSocket();
498
- await (0, _nsshunt_stsutils.Sleep)(100);
499
- this.fhirClient = null;
500
- }
501
478
  return true;
502
479
  };
503
480
  UpdateRunner = async () => {
@@ -35827,11 +35804,21 @@ var ResourceDataGenerator = class {
35827
35804
  var WorkerFhirTestCases = class extends _nsshunt_stsrunnerframework.AbstractRunnerExecutionWorker {
35828
35805
  _options;
35829
35806
  _resourceDataGenerator;
35807
+ fhirClient = void 0;
35830
35808
  constructor(options) {
35831
35809
  super();
35832
35810
  this._options = options;
35833
35811
  this._resourceDataGenerator = new ResourceDataGenerator();
35834
35812
  }
35813
+ GetFhirClient = () => {
35814
+ if (this.fhirClient) console.log(chalk.default.yellow(`GetFhirClient: SET`));
35815
+ else console.log(chalk.default.yellow(`GetFhirClient: NO SET`));
35816
+ return this.fhirClient;
35817
+ };
35818
+ SetFhirClient = (fhirClient) => {
35819
+ console.log(chalk.default.yellow(`SetFhirClient: *****************************************************************************`));
35820
+ this.fhirClient = fhirClient;
35821
+ };
35835
35822
  get resourceDataGenerator() {
35836
35823
  return this._resourceDataGenerator;
35837
35824
  }