Bläddra i källkod

another test case 3a

Enzo 1 år sedan
förälder
incheckning
10f2c25754
1 ändrade filer med 79 tillägg och 6 borttagningar
  1. 79 6
      test/test3a.ts

+ 79 - 6
test/test3a.ts

@@ -1,3 +1,4 @@
+import { resolve } from "path";
 import { Observable, map, Subject, takeUntil, take } from "rxjs";
 import { BaseMessage } from "../dependencies/fisappmessagejsutilty/dependencies/dependencies";
 import { LogSetting } from "../dependencies/fisloggingservice/type/datatype";
@@ -21,9 +22,9 @@ const source_payload_string = source_payload.pipe(
     })
 )
 
-// Declare target Services && Observables (Using MongoDB Storage) Simlluating Partial Logs
+// Declare target Services && Observables (Using MongoDB Storage) Simulating Partial Logs
 const target_payload: Observable<BaseMessage> = stream.stream().pipe(take(2))
-const target_payload_subject: Subject<BaseMessage> = new Subject();
+const target_payload_subject: Subject<BaseMessage> = new Subject()
 target_payload.subscribe(
     {
         next: (data) => {
@@ -93,12 +94,84 @@ let settings: MessageSynchronisationServiceSetting = {
     }  //LogSetting & {tags:string[] }  
 }
 
+setTimeout(()=>{
+    target_payload_subject.next(
+        <BaseMessage>{
+            "header": {
+                "messageType": "Command",
+                "messageID": "ab05f310-f3c5-4fd0-9af1-15cda97b4444",
+                "messageName": "Command",
+                "dateCreated": "2023-02-13T03:33:58.746Z",
+                "isAggregate": false,
+                "dataSourceTiming": "",
+                "serviceId": "",
+                "userId": "",
+                "requesterId": "Generatede203a86a-c99e-460e-95ff-f2dc7f484a7d",
+                "messageProducerInformation": {
+                    "origin": {
+                        "userApplication": {
+                            "userAppId": "FisAppID/Name",
+                            "userAppName": "Client"
+                        }
+                    },
+                    "components": "Presentation"
+                },
+                "security": {
+                    "ucpId": "GeneratedFromMessageSync"
+                },
+                "messageDataLocation": {
+                    "isEmbaded": true
+                },
+                "messageDataFormat": {
+                    "dataFormat": "Json"
+                },
+                "requestExecutionMode": 0,
+                "resquestTimeOut": 0,
+                "command": "New"
+            },
+            "data": {
+                "header": "fa29074d-9718-4aba-9999-0001",
+                "data": {
+                    "appLogLocId": "fa29074d-9718-4aba-9999-0001",
+                    "appData": {
+                        "msgId": "6c162cd3-d42d-4ab4-8882-0001",
+                        "msgLogDateTime": "2022-12-06T15:01:46.987Z",
+                        "msgDateTime": "2022-12-06T08:50:33.809Z",
+                        "msgTag": [
+                            "oval",
+                            "likable"
+                        ],
+                        "msgPayload": "Molestias facilis iusto similique iste voluptas facere. Alias est sequi. Quos consequatur temporibus blanditiis numquam vel. Eos repellat eaque. Voluptatibus optio optio magni eveniet. Quidem architecto esse aut sint neque error magnam perspiciatis."
+                    }
+                }
+            }
+        }
+    )
+},2000)
+
 /* -------- SYNCHRONIZATION --------- */
-function initializeData() {
+async function initializeData(): Promise<void> {
     source_incoming.init(source_dataSet)
     target_incoming.init(target_dataSet)
+    return 
 }
 
+/*  Run this code to pluck some data into the database. 4 in File storage and 2 in Mongo */
+// initializeData()
+
+
+/* Testing to wrap everything into a promise */
+// initializeData().then(() => {
+//     source_synchronize.init(settings).then(() => {
+//         source_synchronize.subscribe(source_payload_string).subscribe({
+//             next: msgToBeSynchronized => {
+//                 target_payload_subject.next(msgToBeSynchronized)
+//                 console.log(msgToBeSynchronized) // It does log missing items
+//             }
+//         })
+//     })
+// })
+
 /*  Type 1 synchronization */
 /* Please note that this operation assumes that there's already existing data in the designated storage place. It still cannot perform real-time live streaming dynamically
 when there is a streaming occuring.  */
@@ -106,9 +179,9 @@ source_synchronize.init(settings).then(() => {
     source_synchronize.subscribe(source_payload_string).subscribe({
         next: msgToBeSynchronized => {
             target_payload_subject.next(msgToBeSynchronized)
+            // console.log(msgToBeSynchronized) // It does log missing items
         }
     })
 })
-
-/*  Run this code to pluck some data into the database. 4 in File storage and 2 in Mongo */
-// initializeData()
+ 
+// Doesnt seem like they do anything