Explorar o código

update test5 configurations

Enzo hai 1 ano
pai
achega
221e35f801
Modificáronse 2 ficheiros con 8 adicións e 8 borrados
  1. 1 1
      services/message-auditor.service.ts
  2. 7 7
      test/test5.ts

+ 1 - 1
services/message-auditor.service.ts

@@ -56,7 +56,7 @@ export class MessageAuditorService implements MessageAuditorServiceInterface {
         // Making a separate function to cater to different multi filters conditions are coded below
         function checkValues(filters): boolean { //FYI, all parameters are string
             let key = Object.keys(filters)
-            console.log(Object.values(filters))
+            // console.log(Object.values(filters))
             let value = Object.values(filters)[0]
             let res = _.get(payload, key[0])
             // Check first if the payload has the filtering properties/path

+ 7 - 7
test/test5.ts

@@ -40,7 +40,7 @@ let source: LogSetting = {
         logLocName: 'To be generated in source',
     },
     customSetting: {
-        url: 'mongodb+srv://testDB:h1nt1OyXw6QeUnzS@cluster0.29sklte.mongodb.net/test'
+        url: 'mongodb+srv://testDB:h1nt1OyXw6QeUnzS@cluster0.29sklte.mongodb.net/test1'
     }
 }
 let target: LogSetting = {
@@ -67,6 +67,11 @@ let settings: MessageSynchronisationServiceSetting = {
         ...target,
         tags: ['default'],
     },
+    //  Set Filters here, since it's part of the settings
+    filters: {
+        'data.data.appData.msgTag[0]': 'likable',
+        'header.messageProducerInformation.origin.userApplication.userAppName': 'Client'
+    }
 }
 
 /* -------  Calling the functions to be tested ----------- */
@@ -79,12 +84,7 @@ setTimeout(() => {
 
 // Basically start up all the functions and relevant subscription service in Audit Service.
 async function initializeAuditService(configuration: MessageSynchronisationServiceSetting) {
-    let filter: any = {
-        'data.data.appData.msgTag[0]': 'likable',
-        'header.messageProducerInformation.origin.userApplication.userAppName': 'Client'
-    }
-    auditService.init(configuration, filter) // Configure two points of audit and also adding filter
-    // auditService.setFilter({ 'data.data.appData.msgTag[0]': 'oval' }) // set fitler if there's any. Please not that 
+    auditService.init(configuration) // Configure two points of audit and also adding filter
     auditService.subscribe(triggerSyncSubject).subscribe((missingElements: MessageLog) => {
         let message = JSON.parse(missingElements.appData.msgPayload as any)
         subscriber.next(message)