@nsshunt/ststestrunner 1.1.60 → 1.1.62

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,10 +154,8 @@ var TestCaseFhirBase = class {
155
154
  GetFhirSocketClient = async () => {
156
155
  try {
157
156
  this.#clientSocketFetchCount++;
158
- if (this.runnerExecutionWorker.fhirClient) {
159
- this.fhirClient = this.runnerExecutionWorker.fhirClient;
160
- return this.fhirClient;
161
- }
157
+ let fhirClient = this.runnerExecutionWorker.GetFhirClient();
158
+ if (fhirClient) return fhirClient;
162
159
  const fhirOptions = this.#options.fhirOptions;
163
160
  const options = {
164
161
  fhirServerEndpoint: fhirOptions.stsfhirserverendpoint,
@@ -175,11 +172,11 @@ var TestCaseFhirBase = class {
175
172
  GetConnectionAccessToken: this.GetAccessTokenForSocketClientAccess,
176
173
  GetAccessToken: this.GetAccessToken
177
174
  };
178
- if (this.runner.options.fhirOptions.stsfhirsocketclientmode === "socket-client-all-in-one") this.fhirClient = new _nsshunt_stsfhirclient.FhirSocketClientAllInOne("FhirSocketClient", options);
179
- else this.fhirClient = new _nsshunt_stsfhirclient.FhirSocketClientIndividual("FhirSocketClient", options);
180
- await this.fhirClient.WaitForSocketConnected();
181
- this.runnerExecutionWorker.fhirClient = this.fhirClient;
182
- 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;
183
180
  } catch (error) {
184
181
  this.LogErrorMessage(error);
185
182
  throw error;
@@ -451,23 +448,11 @@ var TestCaseFhirBase = class {
451
448
  StopRunner = async () => {
452
449
  await this.#OutputLogMessage(`StopRunner [${this.#runner.id}]`);
453
450
  await this.#ForcePublishTelemetryData();
454
- if (this.fhirClient) {
455
- this.Debug(chalk.default.magenta(`TestCaseFhirBase:StopRunner(): Calling: [fhirClient.ResetSocket()]`));
456
- this.fhirClient.ResetSocket();
457
- await (0, _nsshunt_stsutils.Sleep)(100);
458
- this.fhirClient = null;
459
- }
460
451
  return true;
461
452
  };
462
453
  TerminateRunner = async () => {
463
454
  await this.#OutputLogMessage(`TerminateRunner [${this.#runner.id}]`);
464
455
  await this.#ForcePublishTelemetryData();
465
- if (this.fhirClient) {
466
- this.Debug(chalk.default.magenta(`TestCaseFhirBase:TerminateRunner(): Calling: [fhirClient.ResetSocket()]`));
467
- this.fhirClient.ResetSocket();
468
- await (0, _nsshunt_stsutils.Sleep)(100);
469
- this.fhirClient = null;
470
- }
471
456
  return true;
472
457
  };
473
458
  Completed = async () => {
@@ -475,12 +460,6 @@ var TestCaseFhirBase = class {
475
460
  this.runner.instrumentData.timer = performance.now() - start;
476
461
  await this.#OutputLogMessage(`Completed [${this.#runner.id}] [${JSON.stringify(this.#runner.instrumentData)}]`);
477
462
  await this.#ForcePublishTelemetryData();
478
- if (this.fhirClient) {
479
- this.Debug(chalk.default.magenta(`TestCaseFhirBase:Completed(): Calling: [fhirClient.ResetSocket()]`));
480
- this.fhirClient.ResetSocket();
481
- await (0, _nsshunt_stsutils.Sleep)(100);
482
- this.fhirClient = null;
483
- }
484
463
  return true;
485
464
  };
486
465
  PauseRunner = async () => {
@@ -496,12 +475,6 @@ var TestCaseFhirBase = class {
496
475
  ResetRunner = async () => {
497
476
  await this.#OutputLogMessage(`ResetRunner [${this.#runner.id}]`);
498
477
  await this.#ForcePublishTelemetryData();
499
- if (this.fhirClient) {
500
- this.Debug(chalk.default.magenta(`TestCaseFhirBase:ResetRunner(): Calling: [fhirClient.ResetSocket()]`));
501
- this.fhirClient.ResetSocket();
502
- await (0, _nsshunt_stsutils.Sleep)(100);
503
- this.fhirClient = null;
504
- }
505
478
  return true;
506
479
  };
507
480
  UpdateRunner = async () => {
@@ -35831,12 +35804,18 @@ var ResourceDataGenerator = class {
35831
35804
  var WorkerFhirTestCases = class extends _nsshunt_stsrunnerframework.AbstractRunnerExecutionWorker {
35832
35805
  _options;
35833
35806
  _resourceDataGenerator;
35807
+ fhirClient = void 0;
35834
35808
  constructor(options) {
35835
35809
  super();
35836
35810
  this._options = options;
35837
35811
  this._resourceDataGenerator = new ResourceDataGenerator();
35838
35812
  }
35839
- fhirClient = void 0;
35813
+ GetFhirClient = () => {
35814
+ return this.fhirClient;
35815
+ };
35816
+ SetFhirClient = (fhirClient) => {
35817
+ this.fhirClient = fhirClient;
35818
+ };
35840
35819
  get resourceDataGenerator() {
35841
35820
  return this._resourceDataGenerator;
35842
35821
  }