test.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { AcknowledgementService } from "../services/acknowledgement.service";
  2. import { StreamingService } from "./test-streamOBS";
  3. import { MessageSyncrhonizationService } from "../services/synchronization.service";
  4. import { IncomingMessageService } from "../services/incomingMessage.service";
  5. import { map, Observable } from "rxjs";
  6. import { LogSetting, MessageLog } from "../dependencies/fisloggingservice/type/datatype";
  7. import { BaseMessage } from "../dependencies/fisappmessagejsutilty/dependencies/dependencies";
  8. const acknowledge = new AcknowledgementService()
  9. const incoming = new IncomingMessageService()
  10. const syncrhonize = new MessageSyncrhonizationService()
  11. const streamService = new StreamingService()
  12. /* -------------- TEST -------------------- */
  13. // change payload into Observable<BaseMessage>
  14. const payload: Observable<BaseMessage> = streamService.stream().pipe(
  15. map(dataSet => ({
  16. header: dataSet.appLogLocId,
  17. data: dataSet
  18. }))
  19. );
  20. // Configure Log Setting
  21. let storage: LogSetting = {
  22. storage: "File",
  23. setting: {
  24. appName: 'Default from client',
  25. appLocName: 'To be generated in client',
  26. logLocName: 'To be generated in client',
  27. }
  28. }
  29. let dataSet: LogSetting & { incomingObservable: Observable<BaseMessage> } = {
  30. storage: storage.storage,
  31. setting: storage.setting,
  32. customSetting: storage.customSetting,
  33. incomingObservable: payload
  34. }
  35. incoming.init(dataSet)
  36. // acknowledge.init(storage).then(() => {
  37. // acknowledge.subscribe(payload)
  38. // }).catch((e) => console.error(e))