Kaynağa Gözat

test file set up

Enzo 1 yıl önce
ebeveyn
işleme
369c6316fd

Dosya farkı çok büyük olduğundan ihmal edildi
+ 2487 - 44
package-lock.json


+ 2 - 1
package.json

@@ -4,7 +4,7 @@
   "description": "",
   "main": "index.js",
   "scripts": {
-    "build": "tsc -p tsconfig.json",
+    "build": "tsc -p ",
     "start": "node test/test.js",
     "test": "echo \"Error: no test specified\" && exit 1"
   },
@@ -18,6 +18,7 @@
     "@types/node": "^18.11.18",
     "dotenv": "^16.0.3",
     "jsonschema": "^1.4.1",
+    "mongoose": "^6.9.0",
     "rfdc": "^1.3.0",
     "rxjs": "^7.8.0",
     "typescript": "^4.9.4",

+ 5 - 0
services/acknowledgemeent.service.ts

@@ -0,0 +1,5 @@
+export class AcknowledgementService {
+    public acknowledge(){
+        console.log('Hi. My sole existence is to acknowledge You!!!!')
+    }
+}

+ 5 - 0
services/synchronization.service.ts

@@ -0,0 +1,5 @@
+export class SyncrhonizationService {
+    public synchronize(){
+        console.log('Hi. My sole existence is to SYNCHRONIZE')
+    }
+}

+ 22 - 0
test/stream.ts

@@ -0,0 +1,22 @@
+import { from, map, Observable, of } from "rxjs";
+import * as fs from "fs"
+
+export class StreamingService {
+    private messagesJSON: any = fs.readFileSync("dependencies/fisloggingservice/messages.json")
+    private messages = JSON.parse(this.messagesJSON)
+
+    public stream(): Observable<any> {
+        return new Observable(observer => {
+            let messages = this.messages
+            let count = 0
+            const intervalId = setInterval(() => {
+                observer.next(messages[count]);
+                count++;
+                if (count >= 7) {
+                    clearInterval(intervalId);
+                    observer.complete();
+                }
+            }, 1000)
+        })
+    }
+}

+ 41 - 2
test/test.ts

@@ -1,5 +1,44 @@
-import { Observable } from "rxjs";
+import { Observable, of, take } from "rxjs";
 import * as fs from "fs"
+import { LoggingService } from "../dependencies/fisloggingservice/services/logging-service";
+import { AcknowledgementService } from "../services/acknowledgemeent.service";
+import { StreamingService } from "./stream";
+import { SyncrhonizationService } from "../services/synchronization.service";
+import { LogSetting } from "../dependencies/fisloggingservice/type/datatype";
+const acknowledge = new AcknowledgementService()
+const syncrhonize = new SyncrhonizationService()
+const log = new LoggingService()
+const stream = new StreamingService()
 
+// Configure Log Setting
+const storage: LogSetting = {
+    storage: "File",
+    setting: {
+        appName: 'Default from client',
+        appLocName: 'To be generated in client',
+        logLocName: 'To be generated in client',
+    }
+}
 
-console.log('Hellow World')
+console.log(`I am Client 1`)
+acknowledge.acknowledge()
+syncrhonize.synchronize()
+
+stream.stream().subscribe(data => {
+    // console.log(data)
+    let chainStream = of(data)
+    chainStream.subscribe(
+        // value => console.log(value),
+        error => console.error(error),
+        // () => console.log('Streaming completed')
+    );
+    log.init(storage).then(() => {
+        log.subscribe(data).then(() => {
+             log.filter({ msgId: "44f701a9-8ba7-4e07-bd66-f84db12ae481" }).catch(() => console.log(`Failed to resolve filter`))
+         }).catch(() => console.log(`Failed to resolve stream data`))
+         
+     }).catch(() => console.log(`Failed to resolve init`))
+},
+    error => console.error(error),
+    () => console.log('Streaming completed')
+)

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor