metron-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o...@apache.org
Subject [39/52] [abbrv] metron git commit: METRON-1834: Migrate Elasticsearch from TransportClient to new Java REST API (mmiklavc via mmiklavc) closes apache/metron#1242
Date Sun, 18 Nov 2018 18:15:52 GMT
http://git-wip-us.apache.org/repos/asf/metron/blob/8bf3b6ec/metron-interface/metron-config/src/app/sensors/sensor-parser-config-readonly/sensor-parser-config-readonly.component.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/app/sensors/sensor-parser-config-readonly/sensor-parser-config-readonly.component.ts b/metron-interface/metron-config/src/app/sensors/sensor-parser-config-readonly/sensor-parser-config-readonly.component.ts
index 5db6d45..2904ef5 100644
--- a/metron-interface/metron-config/src/app/sensors/sensor-parser-config-readonly/sensor-parser-config-readonly.component.ts
+++ b/metron-interface/metron-config/src/app/sensors/sensor-parser-config-readonly/sensor-parser-config-readonly.component.ts
@@ -15,23 +15,23 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import {Component, OnInit} from '@angular/core';
-import {KafkaService} from '../../service/kafka.service';
-import {Router, ActivatedRoute} from '@angular/router';
-import {KafkaTopic} from '../../model/kafka-topic';
-import {MetronAlerts} from '../../shared/metron-alerts';
-import {SensorParserConfigService} from '../../service/sensor-parser-config.service';
-import {StormService} from '../../service/storm.service';
-import {TopologyStatus} from '../../model/topology-status';
-import {SensorParserConfigHistoryService} from '../../service/sensor-parser-config-history.service';
-import {SensorParserConfigHistory} from '../../model/sensor-parser-config-history';
-import {SensorEnrichmentConfigService} from '../../service/sensor-enrichment-config.service';
-import {SensorEnrichmentConfig} from '../../model/sensor-enrichment-config';
-import {RiskLevelRule} from '../../model/risk-level-rule';
-import {HdfsService} from '../../service/hdfs.service';
-import {RestError} from '../../model/rest-error';
-import {GrokValidationService} from '../../service/grok-validation.service';
-import {SensorParserConfig} from '../../model/sensor-parser-config';
+import { Component, OnInit } from '@angular/core';
+import { KafkaService } from '../../service/kafka.service';
+import { Router, ActivatedRoute } from '@angular/router';
+import { KafkaTopic } from '../../model/kafka-topic';
+import { MetronAlerts } from '../../shared/metron-alerts';
+import { SensorParserConfigService } from '../../service/sensor-parser-config.service';
+import { StormService } from '../../service/storm.service';
+import { TopologyStatus } from '../../model/topology-status';
+import { SensorParserConfigHistoryService } from '../../service/sensor-parser-config-history.service';
+import { SensorParserConfigHistory } from '../../model/sensor-parser-config-history';
+import { SensorEnrichmentConfigService } from '../../service/sensor-enrichment-config.service';
+import { SensorEnrichmentConfig } from '../../model/sensor-enrichment-config';
+import { RiskLevelRule } from '../../model/risk-level-rule';
+import { HdfsService } from '../../service/hdfs.service';
+import { RestError } from '../../model/rest-error';
+import { GrokValidationService } from '../../service/grok-validation.service';
+import { SensorParserConfig } from '../../model/sensor-parser-config';
 
 @Component({
   selector: 'metron-config-sensor-parser-readonly',
@@ -39,7 +39,6 @@ import {SensorParserConfig} from '../../model/sensor-parser-config';
   styleUrls: ['sensor-parser-config-readonly.component.scss']
 })
 export class SensorParserConfigReadonlyComponent implements OnInit {
-
   selectedSensorName: string;
   startStopInProgress: boolean = false;
   kafkaTopic: KafkaTopic = new KafkaTopic();
@@ -47,78 +46,149 @@ export class SensorParserConfigReadonlyComponent implements OnInit {
   sensorParserConfig: SensorParserConfig = new SensorParserConfig();
   topologyStatus: TopologyStatus = new TopologyStatus();
   sensorEnrichmentConfig: SensorEnrichmentConfig = new SensorEnrichmentConfig();
-  grokStatement: string = '';
+  grokStatement = {};
   transformsConfigKeys: string[] = [];
   transformsConfigMap: {} = {};
   rules: RiskLevelRule[] = [];
   transformLinkText = 'show more';
   threatTriageLinkText = 'show more';
 
-  editViewMetaData: {label?: string, value?: string, type?: string, model?: string, boldTitle?: boolean}[] = [
-    {type: 'SEPARATOR', model: '', value: ''},
-    {label: 'PARSER', model: 'sensorParserConfigHistory', value: 'parserClassName'},
-    {label: 'LAST UPDATED', model: 'sensorParserConfigHistory', value: 'modifiedByDate'},
-    {label: 'LAST EDITOR', model: 'sensorParserConfigHistory', value: 'modifiedBy'},
-    {label: 'STATE', model: 'topologyStatus', value: 'sensorStatus'},
-    {label: 'ORIGINATOR', model: 'sensorParserConfigHistory', value: 'createdBy'},
-    {label: 'CREATION DATE', model: 'sensorParserConfigHistory', value: 'createdDate'},
-
-    {type: 'SPACER', model: '', value: ''},
-
-    {label: 'STORM', model: 'topologyStatus', value: 'status', boldTitle: true},
-    {label: 'LATENCY', model: 'topologyStatus', value: 'latency'},
-    {label: 'THROUGHPUT', model: 'topologyStatus', value: 'throughput'},
-    {label: 'EMITTED(10 MIN)', model: 'topologyStatus', value: 'emitted'},
-    {label: 'ACKED(10 MIN)', model: 'topologyStatus', value: 'acked'},
-    {label: 'NUM WORKERS', model: 'sensorParserConfig', value: 'numWorkers'},
-    {label: 'NUM ACKERS', model: 'sensorParserConfig', value: 'numAckers'},
-    {label: 'SPOUT PARALLELISM', model: 'sensorParserConfig', value: 'spoutParallelism'},
-    {label: 'SPOUT NUM TASKS', model: 'sensorParserConfig', value: 'spoutNumTasks'},
-    {label: 'PARSER PARALLELISM', model: 'sensorParserConfig', value: 'parserParallelism'},
-    {label: 'PARSER NUM TASKS', model: 'sensorParserConfig', value: 'parserNumTasks'},
-    {label: 'ERROR WRITER PARALLELISM', model: 'sensorParserConfig', value: 'errorWriterParallelism'},
-    {label: 'ERROR NUM TASKS', model: 'sensorParserConfig', value: 'errorWriterNumTasks'},
-
-    {type: 'SPACER', model: '', value: ''},
-
-    {label: 'KAFKA', model: 'kafkaTopic', value: 'currentKafkaStatus', boldTitle: true},
-    {label: 'PARTITONS', model: 'kafkaTopic', value: 'numPartitions'},
-    {label: 'REPLICATION FACTOR', model: 'kafkaTopic', value: 'replicationFactor'},
-    {type: 'SEPARATOR', model: '', value: ''},
-
-    {label: '', model: 'grokStatement', value: 'grokPattern'},
-
-    {type: 'TITLE', model: '', value: 'Schema'},
-    {label: '', model: 'transforms', value: ''},
-    {type: 'SEPARATOR', model: '', value: ''},
-
-    {type: 'TITLE', model: '', value: 'Threat Triage Rules'},
-    {label: '', model: 'threatTriageRules', value: ''}
-
+  editViewMetaData: {
+    label?: string;
+    value?: string;
+    type?: string;
+    model?: string;
+    boldTitle?: boolean;
+  }[] = [
+    { type: 'SEPARATOR', model: '', value: '' },
+    {
+      label: 'PARSER',
+      model: 'sensorParserConfigHistory',
+      value: 'parserClassName'
+    },
+    {
+      label: 'LAST UPDATED',
+      model: 'sensorParserConfigHistory',
+      value: 'modifiedByDate'
+    },
+    {
+      label: 'LAST EDITOR',
+      model: 'sensorParserConfigHistory',
+      value: 'modifiedBy'
+    },
+    { label: 'STATE', model: 'topologyStatus', value: 'sensorStatus' },
+    {
+      label: 'ORIGINATOR',
+      model: 'sensorParserConfigHistory',
+      value: 'createdBy'
+    },
+    {
+      label: 'CREATION DATE',
+      model: 'sensorParserConfigHistory',
+      value: 'createdDate'
+    },
+
+    { type: 'SPACER', model: '', value: '' },
+
+    {
+      label: 'STORM',
+      model: 'topologyStatus',
+      value: 'status',
+      boldTitle: true
+    },
+    { label: 'LATENCY', model: 'topologyStatus', value: 'latency' },
+    { label: 'THROUGHPUT', model: 'topologyStatus', value: 'throughput' },
+    { label: 'EMITTED(10 MIN)', model: 'topologyStatus', value: 'emitted' },
+    { label: 'ACKED(10 MIN)', model: 'topologyStatus', value: 'acked' },
+    { label: 'NUM WORKERS', model: 'sensorParserConfig', value: 'numWorkers' },
+    { label: 'NUM ACKERS', model: 'sensorParserConfig', value: 'numAckers' },
+    {
+      label: 'SPOUT PARALLELISM',
+      model: 'sensorParserConfig',
+      value: 'spoutParallelism'
+    },
+    {
+      label: 'SPOUT NUM TASKS',
+      model: 'sensorParserConfig',
+      value: 'spoutNumTasks'
+    },
+    {
+      label: 'PARSER PARALLELISM',
+      model: 'sensorParserConfig',
+      value: 'parserParallelism'
+    },
+    {
+      label: 'PARSER NUM TASKS',
+      model: 'sensorParserConfig',
+      value: 'parserNumTasks'
+    },
+    {
+      label: 'ERROR WRITER PARALLELISM',
+      model: 'sensorParserConfig',
+      value: 'errorWriterParallelism'
+    },
+    {
+      label: 'ERROR NUM TASKS',
+      model: 'sensorParserConfig',
+      value: 'errorWriterNumTasks'
+    },
+
+    { type: 'SPACER', model: '', value: '' },
+
+    {
+      label: 'KAFKA',
+      model: 'kafkaTopic',
+      value: 'currentKafkaStatus',
+      boldTitle: true
+    },
+    { label: 'PARTITONS', model: 'kafkaTopic', value: 'numPartitions' },
+    {
+      label: 'REPLICATION FACTOR',
+      model: 'kafkaTopic',
+      value: 'replicationFactor'
+    },
+    { type: 'SEPARATOR', model: '', value: '' },
+
+    { label: '', model: 'grokStatement', value: 'grokPattern' },
+
+    { type: 'TITLE', model: '', value: 'Schema' },
+    { label: '', model: 'transforms', value: '' },
+    { type: 'SEPARATOR', model: '', value: '' },
+
+    { type: 'TITLE', model: '', value: 'Threat Triage Rules' },
+    { label: '', model: 'threatTriageRules', value: '' }
   ];
 
-  constructor(private sensorParserConfigHistoryService: SensorParserConfigHistoryService,
-              private sensorParserConfigService: SensorParserConfigService,
-              private sensorEnrichmentService: SensorEnrichmentConfigService,
-              private stormService: StormService,
-              private kafkaService: KafkaService,
-              private hdfsService: HdfsService,
-              private grokValidationService: GrokValidationService,
-              private activatedRoute: ActivatedRoute, private router: Router,
-              private metronAlerts: MetronAlerts) {
-  }
+  constructor(
+    private sensorParserConfigHistoryService: SensorParserConfigHistoryService,
+    private sensorParserConfigService: SensorParserConfigService,
+    private sensorEnrichmentService: SensorEnrichmentConfigService,
+    private stormService: StormService,
+    private kafkaService: KafkaService,
+    private hdfsService: HdfsService,
+    private grokValidationService: GrokValidationService,
+    private activatedRoute: ActivatedRoute,
+    private router: Router,
+    private metronAlerts: MetronAlerts
+  ) {}
 
   getSensorInfo(): void {
-    this.sensorParserConfigHistoryService.get(this.selectedSensorName).subscribe(
-      (results: SensorParserConfigHistory) => {
+    this.sensorParserConfigHistoryService
+      .get(this.selectedSensorName)
+      .subscribe((results: SensorParserConfigHistory) => {
         this.sensorParserConfigHistory = results;
         this.sensorParserConfig = this.sensorParserConfigHistory.config;
         this.setGrokStatement();
         this.setTransformsConfigKeys();
 
-        let items = this.sensorParserConfigHistory.config.parserClassName.split('.');
-        this.sensorParserConfigHistory['parserClassName'] = items[items.length - 1].replace('Basic', '').replace('Parser', '');
-
+        let items = this.sensorParserConfigHistory.config.parserClassName.split(
+          '.'
+        );
+        this.sensorParserConfigHistory['parserClassName'] = items[
+          items.length - 1
+        ]
+          .replace('Basic', '')
+          .replace('Parser', '');
       });
   }
 
@@ -129,40 +199,57 @@ export class SensorParserConfigReadonlyComponent implements OnInit {
       },
       error => {
         this.topologyStatus.status = 'Stopped';
-      });
+      }
+    );
   }
 
   getKafkaData(): void {
     this.kafkaService.get(this.selectedSensorName).subscribe(
       (results: KafkaTopic) => {
         this.kafkaTopic = results;
-        this.kafkaService.sample(this.selectedSensorName).subscribe((sampleData: string) => {
-              this.kafkaTopic['currentKafkaStatus'] = (sampleData && sampleData.length > 0) ? 'Emitting' : 'Not Emitting';
-            },
-            error => {
-              this.kafkaTopic['currentKafkaStatus'] = 'Not Emitting';
-            });
-      }, error => {
-          this.kafkaTopic['currentKafkaStatus'] = 'No Kafka Topic';
-      });
+        this.kafkaService.sample(this.selectedSensorName).subscribe(
+          (sampleData: string) => {
+            this.kafkaTopic['currentKafkaStatus'] =
+              sampleData && sampleData.length > 0 ? 'Emitting' : 'Not Emitting';
+          },
+          error => {
+            this.kafkaTopic['currentKafkaStatus'] = 'Not Emitting';
+          }
+        );
+      },
+      error => {
+        this.kafkaTopic['currentKafkaStatus'] = 'No Kafka Topic';
+      }
+    );
   }
 
   getEnrichmentData() {
-    this.sensorEnrichmentService.get(this.selectedSensorName).subscribe((sensorEnrichmentConfig) => {
-      this.sensorEnrichmentConfig = sensorEnrichmentConfig;
-      this.rules = sensorEnrichmentConfig.threatIntel.triageConfig.riskLevelRules;
-    });
+    this.sensorEnrichmentService
+      .get(this.selectedSensorName)
+      .subscribe(sensorEnrichmentConfig => {
+        this.sensorEnrichmentConfig = sensorEnrichmentConfig;
+        this.rules =
+          sensorEnrichmentConfig.threatIntel.triageConfig.riskLevelRules;
+      });
   }
 
   getTopologyStatus(key: string): string {
     if (key === 'latency') {
-      return this.topologyStatus.latency >= 0 ? (this.topologyStatus.latency + 's') : '-';
+      return this.topologyStatus.latency >= 0
+        ? this.topologyStatus.latency + 'ms'
+        : '-';
     } else if (key === 'throughput') {
-      return this.topologyStatus.throughput >= 0 ? ((Math.round(this.topologyStatus.throughput * 100) / 100) + 'kb/s') : '-';
+      return this.topologyStatus.throughput >= 0
+        ? Math.round(this.topologyStatus.throughput * 100) / 100 + 'kb/s'
+        : '-';
     } else if (key === 'emitted') {
-      return this.topologyStatus.emitted >= 0 ? (this.topologyStatus.emitted + '') : '-';
+      return this.topologyStatus.emitted >= 0
+        ? this.topologyStatus.emitted + ''
+        : '-';
     } else if (key === 'acked') {
-      return this.topologyStatus.acked >= 0 ? (this.topologyStatus.acked + '') : '-';
+      return this.topologyStatus.acked >= 0
+        ? this.topologyStatus.acked + ''
+        : '-';
     } else if (key === 'sensorStatus') {
       if (this.topologyStatus.status === 'ACTIVE') {
         return 'Enabled';
@@ -173,7 +260,7 @@ export class SensorParserConfigReadonlyComponent implements OnInit {
       }
     } else if (key === 'status') {
       if (this.topologyStatus.status === 'ACTIVE') {
-       return 'Running';
+        return 'Running';
       } else if (this.topologyStatus.status === 'INACTIVE') {
         return 'Disabled';
       } else {
@@ -201,27 +288,43 @@ export class SensorParserConfigReadonlyComponent implements OnInit {
   }
 
   setGrokStatement() {
-    if (this.sensorParserConfigHistory.config && this.sensorParserConfigHistory.config.parserConfig) {
+    if (
+      this.sensorParserConfigHistory.config &&
+      this.sensorParserConfigHistory.config.parserConfig
+    ) {
       let path = this.sensorParserConfigHistory.config.parserConfig['grokPath'];
       if (path) {
-        this.hdfsService.read(path).subscribe(contents => {
-          this.grokStatement = contents;
-        }, (hdfsError: RestError) => {
-          this.grokValidationService.getStatement(path).subscribe(contents => {
+        this.hdfsService.read(path).subscribe(
+          contents => {
             this.grokStatement = contents;
-          }, (grokError: RestError) => {
-            this.metronAlerts.showErrorMessage('Could not find grok statement in HDFS or classpath at ' + path);
-          });
-        });
+          },
+          (hdfsError: RestError) => {
+            this.grokValidationService.getStatement(path).subscribe(
+              contents => {
+                this.grokStatement = contents;
+              },
+              (grokError: RestError) => {
+                this.metronAlerts.showErrorMessage(
+                  'Could not find grok statement in HDFS or classpath at ' +
+                    path
+                );
+              }
+            );
+          }
+        );
       }
     }
   }
 
   setTransformsConfigKeys() {
-    if (this.sensorParserConfigHistory.config && this.sensorParserConfigHistory.config.fieldTransformations &&
-        this.sensorParserConfigHistory.config.fieldTransformations.length > 0) {
+    if (
+      this.sensorParserConfigHistory.config &&
+      this.sensorParserConfigHistory.config.fieldTransformations &&
+      this.sensorParserConfigHistory.config.fieldTransformations.length > 0
+    ) {
       this.transformsConfigKeys = [];
-      for (let transforms of this.sensorParserConfigHistory.config.fieldTransformations) {
+      for (let transforms of this.sensorParserConfigHistory.config
+        .fieldTransformations) {
         if (transforms.config) {
           for (let key of Object.keys(transforms.config)) {
             if (this.transformsConfigKeys.indexOf(key) === -1) {
@@ -237,10 +340,14 @@ export class SensorParserConfigReadonlyComponent implements OnInit {
   }
 
   getTransformsOutput(): string {
-    if (this.sensorParserConfigHistory.config && this.sensorParserConfigHistory.config.fieldTransformations &&
-        this.sensorParserConfigHistory.config.fieldTransformations.length > 0) {
+    if (
+      this.sensorParserConfigHistory.config &&
+      this.sensorParserConfigHistory.config.fieldTransformations &&
+      this.sensorParserConfigHistory.config.fieldTransformations.length > 0
+    ) {
       let output = [];
-      for (let transforms of this.sensorParserConfigHistory.config.fieldTransformations) {
+      for (let transforms of this.sensorParserConfigHistory.config
+        .fieldTransformations) {
         if (transforms.output) {
           output = output.concat(transforms.output);
         }
@@ -260,14 +367,17 @@ export class SensorParserConfigReadonlyComponent implements OnInit {
   }
 
   onEditSensor() {
-    this.router.navigateByUrl('/sensors(dialog:sensors-config/' + this.selectedSensorName + ')');
+    this.router.navigateByUrl(
+      '/sensors(dialog:sensors-config/' + this.selectedSensorName + ')'
+    );
   }
 
   onStartSensor() {
     this.toggleStartStopInProgress();
     let name = this.selectedSensorName;
 
-    this.stormService.startParser(name).subscribe(result => {
+    this.stormService.startParser(name).subscribe(
+      result => {
         this.metronAlerts.showSuccessMessage('Started sensor ' + name);
         this.toggleStartStopInProgress();
         this.getData();
@@ -275,14 +385,16 @@ export class SensorParserConfigReadonlyComponent implements OnInit {
       error => {
         this.metronAlerts.showErrorMessage('Unable to start sensor ' + name);
         this.toggleStartStopInProgress();
-      });
+      }
+    );
   }
 
   onStopSensor() {
     this.toggleStartStopInProgress();
 
     let name = this.selectedSensorName;
-    this.stormService.stopParser(name).subscribe(result => {
+    this.stormService.stopParser(name).subscribe(
+      result => {
         this.metronAlerts.showSuccessMessage('Stopped sensor ' + name);
         this.toggleStartStopInProgress();
         this.getData();
@@ -290,14 +402,16 @@ export class SensorParserConfigReadonlyComponent implements OnInit {
       error => {
         this.metronAlerts.showErrorMessage('Unable to stop sensor ' + name);
         this.toggleStartStopInProgress();
-      });
+      }
+    );
   }
 
   onEnableSensor() {
     this.toggleStartStopInProgress();
 
     let name = this.selectedSensorName;
-    this.stormService.activateParser(name).subscribe(result => {
+    this.stormService.activateParser(name).subscribe(
+      result => {
         this.metronAlerts.showSuccessMessage('Enabled sensor ' + name);
         this.toggleStartStopInProgress();
         this.getData();
@@ -305,14 +419,16 @@ export class SensorParserConfigReadonlyComponent implements OnInit {
       error => {
         this.metronAlerts.showErrorMessage('Unable to enabled sensor ' + name);
         this.toggleStartStopInProgress();
-      });
+      }
+    );
   }
 
   onDisableSensor() {
     this.toggleStartStopInProgress();
 
     let name = this.selectedSensorName;
-    this.stormService.deactivateParser(name).subscribe(result => {
+    this.stormService.deactivateParser(name).subscribe(
+      result => {
         this.metronAlerts.showSuccessMessage('Disabled sensor ' + name);
         this.toggleStartStopInProgress();
         this.getData();
@@ -320,14 +436,16 @@ export class SensorParserConfigReadonlyComponent implements OnInit {
       error => {
         this.metronAlerts.showErrorMessage('Unable to disable sensor ' + name);
         this.toggleStartStopInProgress();
-      });
+      }
+    );
   }
 
   onDeleteSensor() {
     this.toggleStartStopInProgress();
 
     let name = this.selectedSensorName;
-    this.sensorParserConfigService.deleteSensorParserConfig(name).subscribe(result => {
+    this.sensorParserConfigService.deleteSensorParserConfig(name).subscribe(
+      result => {
         this.metronAlerts.showSuccessMessage('Deleted sensor ' + name);
         this.toggleStartStopInProgress();
         this.sensorParserConfigService.dataChangedSource.next([name]);
@@ -336,7 +454,8 @@ export class SensorParserConfigReadonlyComponent implements OnInit {
       error => {
         this.metronAlerts.showErrorMessage('Unable to delete sensor ' + name);
         this.toggleStartStopInProgress();
-      });
+      }
+    );
   }
 
   toggleStartStopInProgress() {
@@ -356,28 +475,42 @@ export class SensorParserConfigReadonlyComponent implements OnInit {
   }
 
   toggleTransformLink() {
-    return this.transformLinkText = (this.transformLinkText === 'show more') ? 'show less' : 'show more';
+    return (this.transformLinkText =
+      this.transformLinkText === 'show more' ? 'show less' : 'show more');
   }
 
   toggleThreatTriageLink() {
-    return this.threatTriageLinkText = (this.threatTriageLinkText === 'show more') ? 'show less' : 'show more';
+    return (this.threatTriageLinkText =
+      this.threatTriageLinkText === 'show more' ? 'show less' : 'show more');
   }
 
   isStartHidden() {
-    return (this.topologyStatus.status === 'ACTIVE' || this.topologyStatus.status === 'INACTIVE');
+    return (
+      this.topologyStatus.status === 'ACTIVE' ||
+      this.topologyStatus.status === 'INACTIVE'
+    );
   }
 
   isStopHidden() {
-    return ((this.topologyStatus.status === 'KILLED' || this.topologyStatus.status === 'Stopped'));
+    return (
+      this.topologyStatus.status === 'KILLED' ||
+      this.topologyStatus.status === 'Stopped'
+    );
   }
 
   isEnableHidden() {
-    return (this.topologyStatus.status === 'ACTIVE' || this.topologyStatus.status === 'KILLED'
-            || this.topologyStatus.status === 'Stopped');
+    return (
+      this.topologyStatus.status === 'ACTIVE' ||
+      this.topologyStatus.status === 'KILLED' ||
+      this.topologyStatus.status === 'Stopped'
+    );
   }
 
   isDisableHidden() {
-    return (this.topologyStatus.status === 'INACTIVE' || this.topologyStatus.status === 'KILLED'
-            || this.topologyStatus.status === 'Stopped');
+    return (
+      this.topologyStatus.status === 'INACTIVE' ||
+      this.topologyStatus.status === 'KILLED' ||
+      this.topologyStatus.status === 'Stopped'
+    );
   }
 }

http://git-wip-us.apache.org/repos/asf/metron/blob/8bf3b6ec/metron-interface/metron-config/src/app/sensors/sensor-parser-config/sensor-parser-config.component.spec.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/app/sensors/sensor-parser-config/sensor-parser-config.component.spec.ts b/metron-interface/metron-config/src/app/sensors/sensor-parser-config/sensor-parser-config.component.spec.ts
index d5f3d67..06927f4 100644
--- a/metron-interface/metron-config/src/app/sensors/sensor-parser-config/sensor-parser-config.component.spec.ts
+++ b/metron-interface/metron-config/src/app/sensors/sensor-parser-config/sensor-parser-config.component.spec.ts
@@ -15,36 +15,38 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {Inject} from '@angular/core';
-import {Observable} from 'rxjs/Observable';
-import {Router, ActivatedRoute, Params} from '@angular/router';
-import {Http, RequestOptions, Response, ResponseOptions} from '@angular/http';
-import {SensorParserConfigComponent, Pane, KafkaStatus} from './sensor-parser-config.component';
-import {StellarService} from '../../service/stellar.service';
-import {SensorParserConfigService} from '../../service/sensor-parser-config.service';
-import {KafkaService} from '../../service/kafka.service';
-import {KafkaTopic} from '../../model/kafka-topic';
-import {GrokValidationService} from '../../service/grok-validation.service';
-import {MetronAlerts} from '../../shared/metron-alerts';
-import {SensorParserConfig} from '../../model/sensor-parser-config';
-import {ParseMessageRequest} from '../../model/parse-message-request';
-import {SensorParserContext} from '../../model/sensor-parser-context';
-import {AuthenticationService} from '../../service/authentication.service';
-import {FieldTransformer} from '../../model/field-transformer';
-import {SensorParserConfigModule} from './sensor-parser-config.module';
-import {SensorEnrichmentConfigService} from '../../service/sensor-enrichment-config.service';
-import {SensorEnrichmentConfig} from '../../model/sensor-enrichment-config';
-import {APP_CONFIG, METRON_REST_CONFIG} from '../../app.config';
-import {IAppConfig} from '../../app.config.interface';
-import {SensorIndexingConfigService} from '../../service/sensor-indexing-config.service';
-import {IndexingConfigurations} from '../../model/sensor-indexing-config';
-import '../../rxjs-operators';
-import 'rxjs/add/observable/of';
-import {HdfsService} from '../../service/hdfs.service';
-import {RestError} from '../../model/rest-error';
-import {RiskLevelRule} from '../../model/risk-level-rule';
-
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { Inject } from '@angular/core';
+import { Observable, throwError } from 'rxjs';
+import { Router, ActivatedRoute, Params } from '@angular/router';
+import { HttpClient, HttpResponse } from '@angular/common/http';
+import {
+  SensorParserConfigComponent,
+  Pane,
+  KafkaStatus
+} from './sensor-parser-config.component';
+import { StellarService } from '../../service/stellar.service';
+import { SensorParserConfigService } from '../../service/sensor-parser-config.service';
+import { KafkaService } from '../../service/kafka.service';
+import { KafkaTopic } from '../../model/kafka-topic';
+import { GrokValidationService } from '../../service/grok-validation.service';
+import { MetronAlerts } from '../../shared/metron-alerts';
+import { SensorParserConfig } from '../../model/sensor-parser-config';
+import { ParseMessageRequest } from '../../model/parse-message-request';
+import { SensorParserContext } from '../../model/sensor-parser-context';
+import { AuthenticationService } from '../../service/authentication.service';
+import { FieldTransformer } from '../../model/field-transformer';
+import { SensorParserConfigModule } from './sensor-parser-config.module';
+import { SensorEnrichmentConfigService } from '../../service/sensor-enrichment-config.service';
+import { SensorEnrichmentConfig } from '../../model/sensor-enrichment-config';
+import { APP_CONFIG, METRON_REST_CONFIG } from '../../app.config';
+import { IAppConfig } from '../../app.config.interface';
+import { SensorIndexingConfigService } from '../../service/sensor-indexing-config.service';
+import { IndexingConfigurations } from '../../model/sensor-indexing-config';
+import { of } from 'rxjs';
+import { HdfsService } from '../../service/hdfs.service';
+import { RestError } from '../../model/rest-error';
+import { RiskLevelRule } from '../../model/risk-level-rule';
 
 class MockRouter {
   navigateByUrl(url: string) {}
@@ -57,7 +59,7 @@ class MockActivatedRoute {
   setNameForTest(name: string) {
     this.name = name;
     this.params = Observable.create(observer => {
-      observer.next({id: this.name});
+      observer.next({ id: this.name });
       observer.complete();
     });
   }
@@ -70,15 +72,21 @@ class MockSensorParserConfigService extends SensorParserConfigService {
   private postedSensorParserConfig: SensorParserConfig;
   private throwError: boolean;
 
-  constructor(private http2: Http, @Inject(APP_CONFIG) private config2: IAppConfig) {
+  constructor(
+    private http2: HttpClient,
+    @Inject(APP_CONFIG) private config2: IAppConfig
+  ) {
     super(http2, config2);
   }
 
-  public post(name: string, sensorParserConfig: SensorParserConfig): Observable<SensorParserConfig> {
+  public post(
+    name: string,
+    sensorParserConfig: SensorParserConfig
+  ): Observable<SensorParserConfig> {
     if (this.throwError) {
       let error = new RestError();
       error.message = 'SensorParserConfig post error';
-      return Observable.throw(error);
+      return throwError(error);
     }
     this.postedSensorParserConfig = sensorParserConfig;
     return Observable.create(observer => {
@@ -106,21 +114,26 @@ class MockSensorParserConfigService extends SensorParserConfigService {
   public getAvailableParsers(): Observable<{}> {
     return Observable.create(observer => {
       observer.next({
-        'Bro': 'org.apache.metron.parsers.bro.BasicBroParser',
-        'Grok': 'org.apache.metron.parsers.GrokParser'
+        Bro: 'org.apache.metron.parsers.bro.BasicBroParser',
+        Grok: 'org.apache.metron.parsers.GrokParser'
       });
       observer.complete();
     });
   }
 
-  public parseMessage(parseMessageRequest: ParseMessageRequest): Observable<{}> {
+  public parseMessage(
+    parseMessageRequest: ParseMessageRequest
+  ): Observable<{}> {
     return Observable.create(observer => {
       observer.next(this.parsedMessage);
       observer.complete();
     });
   }
 
-  public setSensorParserConfig(name: string, sensorParserConfig: SensorParserConfig) {
+  public setSensorParserConfig(
+    name: string,
+    sensorParserConfig: SensorParserConfig
+  ) {
     this.name = name;
     this.sensorParserConfig = sensorParserConfig;
   }
@@ -144,15 +157,21 @@ class MockSensorIndexingConfigService extends SensorIndexingConfigService {
   private sensorIndexingConfig: IndexingConfigurations;
   private throwError: boolean;
 
-  constructor(private http2: Http, @Inject(APP_CONFIG) private config2: IAppConfig) {
+  constructor(
+    private http2: HttpClient,
+    @Inject(APP_CONFIG) private config2: IAppConfig
+  ) {
     super(http2, config2);
   }
 
-  public post(name: string, sensorIndexingConfig: IndexingConfigurations): Observable<IndexingConfigurations> {
+  public post(
+    name: string,
+    sensorIndexingConfig: IndexingConfigurations
+  ): Observable<IndexingConfigurations> {
     if (this.throwError) {
       let error = new RestError();
       error.message = 'IndexingConfigurations post error';
-      return Observable.throw(error);
+      return throwError(error);
     }
     this.postedIndexingConfigurations = sensorIndexingConfig;
     return Observable.create(observer => {
@@ -165,7 +184,7 @@ class MockSensorIndexingConfigService extends SensorIndexingConfigService {
     if (this.sensorIndexingConfig === null) {
       let error = new RestError();
       error.message = 'IndexingConfigurations get error';
-      return Observable.throw(error);
+      return throwError(error);
     }
     return Observable.create(observer => {
       if (name === this.name) {
@@ -193,9 +212,12 @@ class MockKafkaService extends KafkaService {
   private name: string;
   private kafkaTopic: KafkaTopic;
   private kafkaTopicForPost: KafkaTopic;
-  private sampleData = {'key1': 'value1', 'key2': 'value2'};
+  private sampleData = { key1: 'value1', key2: 'value2' };
 
-  constructor(private http2: Http, @Inject(APP_CONFIG) private config2: IAppConfig) {
+  constructor(
+    private http2: HttpClient,
+    @Inject(APP_CONFIG) private config2: IAppConfig
+  ) {
     super(http2, config2);
   }
 
@@ -211,7 +233,7 @@ class MockKafkaService extends KafkaService {
 
   public sample(name: string): Observable<string> {
     if (this.sampleData === null) {
-      return Observable.throw(new RestError());
+      return throwError(new RestError());
     }
     return Observable.create(observer => {
       if (name === this.name) {
@@ -223,7 +245,7 @@ class MockKafkaService extends KafkaService {
 
   public get(name: string): Observable<KafkaTopic> {
     if (this.kafkaTopic === null) {
-      return Observable.throw(new RestError());
+      return throwError(new RestError());
     }
     return Observable.create(observer => {
       if (name === this.name) {
@@ -249,11 +271,13 @@ class MockKafkaService extends KafkaService {
 }
 
 class MockGrokValidationService extends GrokValidationService {
-
   private path: string;
   private contents: string;
 
-  constructor(private http2: Http, @Inject(APP_CONFIG) private config2: IAppConfig) {
+  constructor(
+    private http2: HttpClient,
+    @Inject(APP_CONFIG) private config2: IAppConfig
+  ) {
     super(http2, config2);
   }
 
@@ -265,21 +289,22 @@ class MockGrokValidationService extends GrokValidationService {
   public list(): Observable<string[]> {
     return Observable.create(observer => {
       observer.next({
-        'BASE10NUM': '(?<![0-9.+-])(?>[+-]?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+)))',
-        'BASE16FLOAT': '\\b(?<![0-9A-Fa-f.])(?:[+-]?(?:0x)?(?:(?:[0-9A-Fa-f]+(?:\\.[0-9A-Fa-f]*)?)|(?:\\.[0-9A-Fa-f]+)))\\b',
-        'BASE16NUM': '(?<![0-9A-Fa-f])(?:[+-]?(?:0x)?(?:[0-9A-Fa-f]+))',
-        'CISCOMAC': '(?:(?:[A-Fa-f0-9]{4}\\.){2}[A-Fa-f0-9]{4})',
-        'COMMONMAC': '(?:(?:[A-Fa-f0-9]{2}:){5}[A-Fa-f0-9]{2})',
-        'DATA': '.*?'
+        BASE10NUM:
+          '(?<![0-9.+-])(?>[+-]?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+)))',
+        BASE16FLOAT:
+          '\\b(?<![0-9A-Fa-f.])(?:[+-]?(?:0x)?(?:(?:[0-9A-Fa-f]+(?:\\.[0-9A-Fa-f]*)?)|(?:\\.[0-9A-Fa-f]+)))\\b',
+        BASE16NUM: '(?<![0-9A-Fa-f])(?:[+-]?(?:0x)?(?:[0-9A-Fa-f]+))',
+        CISCOMAC: '(?:(?:[A-Fa-f0-9]{4}\\.){2}[A-Fa-f0-9]{4})',
+        COMMONMAC: '(?:(?:[A-Fa-f0-9]{2}:){5}[A-Fa-f0-9]{2})',
+        DATA: '.*?'
       });
       observer.complete();
     });
   }
 
-
   public getStatement(path: string): Observable<string> {
     if (this.contents === null) {
-      return Observable.throw('Error');
+      return throwError('Error');
     }
     return Observable.create(observer => {
       if (path === this.path) {
@@ -296,7 +321,10 @@ class MockHdfsService extends HdfsService {
   private contents: string;
   private postedContents: string;
 
-  constructor(private http2: Http, @Inject(APP_CONFIG) private config2: IAppConfig) {
+  constructor(
+    private http2: HttpClient,
+    @Inject(APP_CONFIG) private config2: IAppConfig
+  ) {
     super(http2, config2);
   }
 
@@ -312,7 +340,7 @@ class MockHdfsService extends HdfsService {
 
   public list(path: string): Observable<string[]> {
     if (this.fileList === null) {
-      return Observable.throw('Error');
+      return throwError('Error');
     }
     return Observable.create(observer => {
       if (path === this.path) {
@@ -324,7 +352,7 @@ class MockHdfsService extends HdfsService {
 
   public read(path: string): Observable<string> {
     if (this.contents === null) {
-      return Observable.throw('Error');
+      return throwError('Error');
     }
     return Observable.create(observer => {
       if (path === this.path) {
@@ -338,7 +366,7 @@ class MockHdfsService extends HdfsService {
     if (this.contents === null) {
       let error = new RestError();
       error.message = 'HDFS post Error';
-      return Observable.throw(error);
+      return throwError(error);
     }
     this.postedContents = contents;
     return Observable.create(observer => {
@@ -347,7 +375,7 @@ class MockHdfsService extends HdfsService {
     });
   }
 
-  public deleteFile(path: string): Observable<Response> {
+  public deleteFile(path: string): Observable<HttpResponse<{}>> {
     return Observable.create(observer => {
       observer.next({});
       observer.complete();
@@ -360,29 +388,35 @@ class MockHdfsService extends HdfsService {
 }
 
 class MockAuthenticationService extends AuthenticationService {
-
-  constructor(private http2: Http, private router2: Router, @Inject(APP_CONFIG) private config2: IAppConfig) {
+  constructor(
+    private http2: HttpClient,
+    private router2: Router,
+    @Inject(APP_CONFIG) private config2: IAppConfig
+  ) {
     super(http2, router2, config2);
   }
 
-  public getCurrentUser(options: RequestOptions): Observable<Response> {
-    let responseOptions: ResponseOptions = new ResponseOptions();
-    responseOptions.body = 'user';
-    let response: Response = new Response(responseOptions);
-    return Observable.of(response);
-  };
+  public getCurrentUser(options: {}): Observable<HttpResponse<{}>> {
+    let responseOptions: {} = { body: 'user' };
+    let response: HttpResponse<{}> = new HttpResponse(responseOptions);
+    return of(response);
+  }
 }
 
 class MockTransformationValidationService extends StellarService {
-
   private transformationValidationResult: any;
   private transformationValidationForValidate: SensorParserContext;
 
-  constructor(private http2: Http, @Inject(APP_CONFIG) private config2: IAppConfig) {
+  constructor(
+    private http2: HttpClient,
+    @Inject(APP_CONFIG) private config2: IAppConfig
+  ) {
     super(http2, config2);
   }
 
-  public setTransformationValidationResultForTest(transformationValidationResult: any): void {
+  public setTransformationValidationResultForTest(
+    transformationValidationResult: any
+  ): void {
     this.transformationValidationResult = transformationValidationResult;
   }
 
@@ -405,7 +439,10 @@ export class MockSensorEnrichmentConfigService {
   private postedSensorEnrichmentConfig: SensorEnrichmentConfig;
   private throwError: boolean;
 
-  public setSensorEnrichmentConfig(name: string, sensorEnrichmentConfig: SensorEnrichmentConfig) {
+  public setSensorEnrichmentConfig(
+    name: string,
+    sensorEnrichmentConfig: SensorEnrichmentConfig
+  ) {
     this.name = name;
     this.sensorEnrichmentConfig = sensorEnrichmentConfig;
   }
@@ -414,7 +451,7 @@ export class MockSensorEnrichmentConfigService {
     if (this.sensorEnrichmentConfig === null) {
       let error = new RestError();
       error.message = 'SensorEnrichmentConfig get error';
-      return Observable.throw(error);
+      return throwError(error);
     }
     return Observable.create(observer => {
       if (name === this.name) {
@@ -424,14 +461,17 @@ export class MockSensorEnrichmentConfigService {
     });
   }
 
-  public post(name: string, sensorEnrichmentConfig: SensorEnrichmentConfig): Observable<SensorEnrichmentConfig> {
+  public post(
+    name: string,
+    sensorEnrichmentConfig: SensorEnrichmentConfig
+  ): Observable<SensorEnrichmentConfig> {
     if (this.throwError) {
       let error = new RestError();
       error.message = 'SensorEnrichmentConfig post error';
-      return Observable.throw(error);
+      return throwError(error);
     }
     this.postedSensorEnrichmentConfig = sensorEnrichmentConfig;
-    return  Observable.create(observer => {
+    return Observable.create(observer => {
       observer.next(sensorEnrichmentConfig);
       observer.complete();
     });
@@ -447,7 +487,6 @@ export class MockSensorEnrichmentConfigService {
 }
 
 describe('Component: SensorParserConfig', () => {
-
   let component: SensorParserConfigComponent;
   let fixture: ComponentFixture<SensorParserConfigComponent>;
   let sensorParserConfigService: MockSensorParserConfigService;
@@ -462,97 +501,106 @@ describe('Component: SensorParserConfig', () => {
   let router: MockRouter;
 
   let squidSensorParserConfig: any = {
-    'parserClassName': 'org.apache.metron.parsers.GrokParser',
-    'sensorTopic': 'squid',
-    'parserConfig': {
-      'grokPath': '/apps/metron/patterns/squid',
-      'patternLabel': 'SQUID_DELIMITED',
-      'timestampField': 'timestamp'
+    parserClassName: 'org.apache.metron.parsers.GrokParser',
+    sensorTopic: 'squid',
+    parserConfig: {
+      grokPath: '/apps/metron/patterns/squid',
+      patternLabel: 'SQUID_DELIMITED',
+      timestampField: 'timestamp'
     },
-    'fieldTransformations': [
+    fieldTransformations: [
       {
-        'input': [],
-        'output': ['full_hostname', 'domain_without_subdomains', 'hostname'],
-        'transformation': 'STELLAR',
-        'config': {
-          'full_hostname': 'URL_TO_HOST(url)',
-          'domain_without_subdomains': 'DOMAIN_REMOVE_SUBDOMAINS(full_hostname)'
+        input: [],
+        output: ['full_hostname', 'domain_without_subdomains', 'hostname'],
+        transformation: 'STELLAR',
+        config: {
+          full_hostname: 'URL_TO_HOST(url)',
+          domain_without_subdomains: 'DOMAIN_REMOVE_SUBDOMAINS(full_hostname)'
         }
       }
-    ],
+    ]
   };
 
   let squidSensorEnrichmentConfig = {
-    'enrichment': {
-      'fieldMap': {
-        'geo': ['ip_dst_addr'],
-        'host': ['ip_dst_addr'],
-        'whois': [],
-        'stellar': { 'config': { 'group1': {} }}
+    enrichment: {
+      fieldMap: {
+        geo: ['ip_dst_addr'],
+        host: ['ip_dst_addr'],
+        whois: [],
+        stellar: { config: { group1: {} } }
       },
-      'fieldToTypeMap': {}, 'config': {}
+      fieldToTypeMap: {},
+      config: {}
     },
-    'threatIntel': {
-      'threatIntel': {
-        'fieldMap': { 'hbaseThreatIntel': ['ip_dst_addr'] },
-        'fieldToTypeMap': { 'ip_dst_addr': ['malicious_ip'] }
+    threatIntel: {
+      threatIntel: {
+        fieldMap: { hbaseThreatIntel: ['ip_dst_addr'] },
+        fieldToTypeMap: { ip_dst_addr: ['malicious_ip'] }
       }
     }
   };
 
   let squidIndexingConfigurations = {
-    'hdfs': {
-      'index': 'squid',
-      'batchSize': 5,
-      'enabled': true
+    hdfs: {
+      index: 'squid',
+      batchSize: 5,
+      enabled: true
     },
-    'elasticsearch': {
-      'index': 'squid',
-      'batchSize': 10,
-      'enabled': true
-    },
-    'solr': {
-      'index': 'squid',
-      'batchSize': 1,
-      'enabled': false
+    elasticsearch: {
+      index: 'squid',
+      batchSize: 10,
+      enabled: true
     },
+    solr: {
+      index: 'squid',
+      batchSize: 1,
+      enabled: false
+    }
   };
 
   beforeEach(async(() => {
-
     TestBed.configureTestingModule({
       imports: [SensorParserConfigModule],
       providers: [
         MetronAlerts,
-        {provide: Http},
-        {provide: SensorParserConfigService, useClass: MockSensorParserConfigService},
-        {provide: SensorIndexingConfigService, useClass: MockSensorIndexingConfigService},
-        {provide: KafkaService, useClass: MockKafkaService},
-        {provide: HdfsService, useClass: MockHdfsService},
-        {provide: GrokValidationService, useClass: MockGrokValidationService},
-        {provide: StellarService, useClass: MockTransformationValidationService},
-        {provide: ActivatedRoute, useClass: MockActivatedRoute},
-        {provide: Router, useClass: MockRouter},
-        {provide: AuthenticationService, useClass: MockAuthenticationService},
-        {provide: SensorEnrichmentConfigService, useClass: MockSensorEnrichmentConfigService},
-        {provide: APP_CONFIG, useValue: METRON_REST_CONFIG}
+        { provide: HttpClient },
+        {
+          provide: SensorParserConfigService,
+          useClass: MockSensorParserConfigService
+        },
+        {
+          provide: SensorIndexingConfigService,
+          useClass: MockSensorIndexingConfigService
+        },
+        { provide: KafkaService, useClass: MockKafkaService },
+        { provide: HdfsService, useClass: MockHdfsService },
+        { provide: GrokValidationService, useClass: MockGrokValidationService },
+        {
+          provide: StellarService,
+          useClass: MockTransformationValidationService
+        },
+        { provide: ActivatedRoute, useClass: MockActivatedRoute },
+        { provide: Router, useClass: MockRouter },
+        { provide: AuthenticationService, useClass: MockAuthenticationService },
+        {
+          provide: SensorEnrichmentConfigService,
+          useClass: MockSensorEnrichmentConfigService
+        },
+        { provide: APP_CONFIG, useValue: METRON_REST_CONFIG }
       ]
-    }).compileComponents()
-      .then(() => {
-        fixture = TestBed.createComponent(SensorParserConfigComponent);
-        component = fixture.componentInstance;
-        sensorParserConfigService = fixture.debugElement.injector.get(SensorParserConfigService);
-        sensorIndexingConfigService = fixture.debugElement.injector.get(SensorIndexingConfigService);
-        transformationValidationService = fixture.debugElement.injector.get(StellarService);
-        kafkaService = fixture.debugElement.injector.get(KafkaService);
-        hdfsService = fixture.debugElement.injector.get(HdfsService);
-        grokValidationService = fixture.debugElement.injector.get(GrokValidationService);
-        sensorEnrichmentConfigService = fixture.debugElement.injector.get(SensorEnrichmentConfigService);
-        activatedRoute = fixture.debugElement.injector.get(ActivatedRoute);
-        metronAlerts = fixture.debugElement.injector.get(MetronAlerts);
-        router = fixture.debugElement.injector.get(Router);
-      });
-
+    });
+    fixture = TestBed.createComponent(SensorParserConfigComponent);
+    component = fixture.componentInstance;
+    sensorParserConfigService = TestBed.get(SensorParserConfigService);
+    sensorIndexingConfigService = TestBed.get(SensorIndexingConfigService);
+    transformationValidationService = TestBed.get(StellarService);
+    kafkaService = TestBed.get(KafkaService);
+    hdfsService = TestBed.get(HdfsService);
+    grokValidationService = TestBed.get(GrokValidationService);
+    sensorEnrichmentConfigService = TestBed.get(SensorEnrichmentConfigService);
+    activatedRoute = TestBed.get(ActivatedRoute);
+    metronAlerts = TestBed.get(MetronAlerts);
+    router = TestBed.get(Router);
   }));
 
   it('should create an instance of SensorParserConfigComponent', async(() => {
@@ -578,11 +626,16 @@ describe('Component: SensorParserConfig', () => {
   }));
 
   it('should createForms', async(() => {
-    component.sensorParserConfig = Object.assign(new SensorParserConfig(), squidSensorParserConfig);
+    component.sensorParserConfig = Object.assign(
+      new SensorParserConfig(),
+      squidSensorParserConfig
+    );
     component.createForms();
 
     expect(Object.keys(component.sensorConfigForm.controls).length).toEqual(16);
-    expect(Object.keys(component.transformsValidationForm.controls).length).toEqual(2);
+    expect(
+      Object.keys(component.transformsValidationForm.controls).length
+    ).toEqual(2);
     expect(component.showAdvancedParserConfiguration).toEqual(true);
 
     component.sensorParserConfig.parserConfig = {};
@@ -596,8 +649,8 @@ describe('Component: SensorParserConfig', () => {
   it('should getAvailableParsers', async(() => {
     component.getAvailableParsers();
     expect(component.availableParsers).toEqual({
-      'Bro': 'org.apache.metron.parsers.bro.BasicBroParser',
-      'Grok': 'org.apache.metron.parsers.GrokParser'
+      Bro: 'org.apache.metron.parsers.bro.BasicBroParser',
+      Grok: 'org.apache.metron.parsers.GrokParser'
     });
     expect(component.availableParserNames).toEqual(['Bro', 'Grok']);
 
@@ -605,57 +658,95 @@ describe('Component: SensorParserConfig', () => {
   }));
 
   it('should init', async(() => {
-    sensorParserConfigService.setSensorParserConfig('squid', squidSensorParserConfig);
+    sensorParserConfigService.setSensorParserConfig(
+      'squid',
+      squidSensorParserConfig
+    );
     component.init('new');
 
     let expectedSensorParserConfig = new SensorParserConfig();
-    expectedSensorParserConfig.parserClassName = 'org.apache.metron.parsers.GrokParser';
+    expectedSensorParserConfig.parserClassName =
+      'org.apache.metron.parsers.GrokParser';
     expect(component.sensorParserConfig).toEqual(expectedSensorParserConfig);
-    expect(component.sensorEnrichmentConfig).toEqual(new SensorEnrichmentConfig());
-    expect(component.indexingConfigurations).toEqual(new IndexingConfigurations());
+    expect(component.sensorEnrichmentConfig).toEqual(
+      new SensorEnrichmentConfig()
+    );
+    expect(component.indexingConfigurations).toEqual(
+      new IndexingConfigurations()
+    );
     expect(component.editMode).toEqual(false);
     expect(component.currentSensors).toEqual(['squid']);
 
     spyOn(component, 'getKafkaStatus');
-    let sensorParserConfig = Object.assign(new SensorParserConfig(), squidSensorParserConfig);
-    sensorParserConfigService.setSensorParserConfig('squid', sensorParserConfig);
-    sensorEnrichmentConfigService.setSensorEnrichmentConfig('squid',
-        Object.assign(new SensorEnrichmentConfig(), squidSensorEnrichmentConfig));
-    sensorIndexingConfigService.setSensorIndexingConfig('squid',
-        Object.assign(new IndexingConfigurations(), squidIndexingConfigurations));
-    hdfsService.setContents('/apps/metron/patterns/squid', 'SQUID_DELIMITED grok statement');
+    let sensorParserConfig = Object.assign(
+      new SensorParserConfig(),
+      squidSensorParserConfig
+    );
+    sensorParserConfigService.setSensorParserConfig(
+      'squid',
+      sensorParserConfig
+    );
+    sensorEnrichmentConfigService.setSensorEnrichmentConfig(
+      'squid',
+      Object.assign(new SensorEnrichmentConfig(), squidSensorEnrichmentConfig)
+    );
+    sensorIndexingConfigService.setSensorIndexingConfig(
+      'squid',
+      Object.assign(new IndexingConfigurations(), squidIndexingConfigurations)
+    );
+    hdfsService.setContents(
+      '/apps/metron/patterns/squid',
+      'SQUID_DELIMITED grok statement'
+    );
 
     component.init('squid');
-    expect(component.sensorParserConfig).toEqual(Object.assign(new SensorParserConfig(), squidSensorParserConfig));
+    expect(component.sensorParserConfig).toEqual(
+      Object.assign(new SensorParserConfig(), squidSensorParserConfig)
+    );
     expect(component.sensorNameValid).toEqual(true);
     expect(component.getKafkaStatus).toHaveBeenCalled();
     expect(component.showAdvancedParserConfiguration).toEqual(true);
     expect(component.grokStatement).toEqual('SQUID_DELIMITED grok statement');
     expect(component.patternLabel).toEqual('SQUID_DELIMITED');
-    expect(component.sensorEnrichmentConfig).toEqual(Object.assign(new SensorEnrichmentConfig(), squidSensorEnrichmentConfig));
-    expect(component.indexingConfigurations).toEqual(Object.assign(new IndexingConfigurations(), squidIndexingConfigurations));
+    expect(component.sensorEnrichmentConfig).toEqual(
+      Object.assign(new SensorEnrichmentConfig(), squidSensorEnrichmentConfig)
+    );
+    expect(component.indexingConfigurations).toEqual(
+      Object.assign(new IndexingConfigurations(), squidIndexingConfigurations)
+    );
 
     component.sensorParserConfig.parserConfig['grokPath'] = '/patterns/squid';
     hdfsService.setContents('/patterns/squid', null);
-    grokValidationService.setContents('/patterns/squid', 'SQUID grok statement from classpath');
+    grokValidationService.setContents(
+      '/patterns/squid',
+      'SQUID grok statement from classpath'
+    );
 
     component.init('squid');
-    expect(component.grokStatement).toEqual('SQUID grok statement from classpath');
+    expect(component.grokStatement).toEqual(
+      'SQUID grok statement from classpath'
+    );
 
     spyOn(metronAlerts, 'showErrorMessage');
 
     sensorEnrichmentConfigService.setSensorEnrichmentConfig('squid', null);
     component.init('squid');
-    expect(metronAlerts.showErrorMessage).toHaveBeenCalledWith('SensorEnrichmentConfig get error');
+    expect(metronAlerts.showErrorMessage).toHaveBeenCalledWith(
+      'SensorEnrichmentConfig get error'
+    );
 
     sensorIndexingConfigService.setSensorIndexingConfig('squid', null);
     component.init('squid');
-    expect(metronAlerts.showErrorMessage).toHaveBeenCalledWith('IndexingConfigurations get error');
+    expect(metronAlerts.showErrorMessage).toHaveBeenCalledWith(
+      'IndexingConfigurations get error'
+    );
 
     grokValidationService.setContents('/patterns/squid', null);
 
     component.init('squid');
-    expect(metronAlerts.showErrorMessage).toHaveBeenCalledWith('Could not find grok statement in HDFS or classpath at /patterns/squid');
+    expect(metronAlerts.showErrorMessage).toHaveBeenCalledWith(
+      'Could not find grok statement in HDFS or classpath at /patterns/squid'
+    );
 
     sensorParserConfig = new SensorParserConfig();
     sensorParserConfig.sensorTopic = 'bro';
@@ -722,12 +813,14 @@ describe('Component: SensorParserConfig', () => {
     expect(component.hidePane).not.toHaveBeenCalled();
     expect(component.isConfigValid).toHaveBeenCalled();
 
-    component.sensorParserConfig.parserClassName = 'org.apache.metron.parsers.GrokParser';
+    component.sensorParserConfig.parserClassName =
+      'org.apache.metron.parsers.GrokParser';
     component.onParserTypeChange();
     expect(component.parserClassValid).toEqual(true);
     expect(component.hidePane).not.toHaveBeenCalled();
 
-    component.sensorParserConfig.parserClassName = 'org.apache.metron.parsers.bro.BasicBroParser';
+    component.sensorParserConfig.parserClassName =
+      'org.apache.metron.parsers.bro.BasicBroParser';
     component.onParserTypeChange();
     expect(component.hidePane).toHaveBeenCalledWith(Pane.GROK);
 
@@ -759,7 +852,8 @@ describe('Component: SensorParserConfig', () => {
     component.isConfigValid();
     expect(component.configValid).toEqual(true);
 
-    component.sensorParserConfig.parserClassName = 'org.apache.metron.parsers.GrokParser';
+    component.sensorParserConfig.parserClassName =
+      'org.apache.metron.parsers.GrokParser';
     component.isConfigValid();
     expect(component.configValid).toEqual(false);
 
@@ -796,8 +890,12 @@ describe('Component: SensorParserConfig', () => {
   it('should getTransforms', async(() => {
     expect(component.getTransforms()).toEqual('0 Transformations Applied');
 
-    component.sensorParserConfig.fieldTransformations.push(Object.assign(new FieldTransformer(), {'output': ['field1', 'field2']}));
-    component.sensorParserConfig.fieldTransformations.push(Object.assign(new FieldTransformer(), {'output': ['field3']}));
+    component.sensorParserConfig.fieldTransformations.push(
+      Object.assign(new FieldTransformer(), { output: ['field1', 'field2'] })
+    );
+    component.sensorParserConfig.fieldTransformations.push(
+      Object.assign(new FieldTransformer(), { output: ['field3'] })
+    );
 
     expect(component.getTransforms()).toEqual('3 Transformations Applied');
 
@@ -809,15 +907,21 @@ describe('Component: SensorParserConfig', () => {
 
     component.onSaveGrokStatement('grok statement');
     expect(component.grokStatement).toEqual('grok statement');
-    expect(component.sensorParserConfig.parserConfig['grokPath']).toEqual('/apps/metron/patterns/squid');
+    expect(component.sensorParserConfig.parserConfig['grokPath']).toEqual(
+      '/apps/metron/patterns/squid'
+    );
 
     component.sensorParserConfig.parserConfig['grokPath'] = '/patterns/squid';
     component.onSaveGrokStatement('grok statement');
-    expect(component.sensorParserConfig.parserConfig['grokPath']).toEqual('/apps/metron/patterns/squid');
+    expect(component.sensorParserConfig.parserConfig['grokPath']).toEqual(
+      '/apps/metron/patterns/squid'
+    );
 
     component.sensorParserConfig.parserConfig['grokPath'] = '/custom/grok/path';
     component.onSaveGrokStatement('grok statement');
-    expect(component.sensorParserConfig.parserConfig['grokPath']).toEqual('/custom/grok/path');
+    expect(component.sensorParserConfig.parserConfig['grokPath']).toEqual(
+      '/custom/grok/path'
+    );
 
     fixture.destroy();
   }));
@@ -825,7 +929,9 @@ describe('Component: SensorParserConfig', () => {
   it('should onSavePatternLabel', async(() => {
     component.onSavePatternLabel('PATTERN_LABEL');
     expect(component.patternLabel).toEqual('PATTERN_LABEL');
-    expect(component.sensorParserConfig.parserConfig['patternLabel']).toEqual('PATTERN_LABEL');
+    expect(component.sensorParserConfig.parserConfig['patternLabel']).toEqual(
+      'PATTERN_LABEL'
+    );
 
     fixture.destroy();
   }));
@@ -842,15 +948,17 @@ describe('Component: SensorParserConfig', () => {
 
   it('should save sensor configuration', async(() => {
     let fieldTransformer = Object.assign(new FieldTransformer(), {
-      'input': [],
-      'output': ['url_host'],
-      'transformation': 'MTL',
-      'config': {'url_host': 'TO_LOWER(URL_TO_HOST(url))'}
+      input: [],
+      output: ['url_host'],
+      transformation: 'MTL',
+      config: { url_host: 'TO_LOWER(URL_TO_HOST(url))' }
     });
     let sensorParserConfigSave: SensorParserConfig = new SensorParserConfig();
     sensorParserConfigSave.sensorTopic = 'squid';
-    sensorParserConfigSave.parserClassName = 'org.apache.metron.parsers.GrokParser';
-    sensorParserConfigSave.parserConfig['grokPath'] = '/apps/metron/patterns/squid';
+    sensorParserConfigSave.parserClassName =
+      'org.apache.metron.parsers.GrokParser';
+    sensorParserConfigSave.parserConfig['grokPath'] =
+      '/apps/metron/patterns/squid';
     sensorParserConfigSave.fieldTransformations = [fieldTransformer];
     activatedRoute.setNameForTest('new');
     sensorParserConfigService.setThrowError(true);
@@ -859,93 +967,114 @@ describe('Component: SensorParserConfig', () => {
     spyOn(metronAlerts, 'showErrorMessage');
 
     component.sensorParserConfig.sensorTopic = 'squid';
-    component.sensorParserConfig.parserClassName = 'org.apache.metron.parsers.GrokParser';
-    component.sensorParserConfig.parserConfig['grokPath'] = '/apps/metron/patterns/squid';
+    component.sensorParserConfig.parserClassName =
+      'org.apache.metron.parsers.GrokParser';
+    component.sensorParserConfig.parserConfig['grokPath'] =
+      '/apps/metron/patterns/squid';
     component.sensorParserConfig.fieldTransformations = [fieldTransformer];
 
     component.onSave();
-    expect(metronAlerts.showErrorMessage['calls'].mostRecent().args[0])
-        .toEqual('Unable to save sensor config: SensorParserConfig post error');
-
-    component.sensorEnrichmentConfig = Object.assign(new SensorEnrichmentConfig(), squidSensorEnrichmentConfig);
-    component.indexingConfigurations = Object.assign(new IndexingConfigurations(), squidIndexingConfigurations);
+    expect(metronAlerts.showErrorMessage['calls'].mostRecent().args[0]).toEqual(
+      'Unable to save sensor config: SensorParserConfig post error'
+    );
+
+    component.sensorEnrichmentConfig = Object.assign(
+      new SensorEnrichmentConfig(),
+      squidSensorEnrichmentConfig
+    );
+    component.indexingConfigurations = Object.assign(
+      new IndexingConfigurations(),
+      squidIndexingConfigurations
+    );
     sensorParserConfigService.setThrowError(false);
-    hdfsService.setContents('/apps/metron/patterns/squid', 'SQUID grok statement');
+    hdfsService.setContents(
+      '/apps/metron/patterns/squid',
+      'SQUID grok statement'
+    );
     component.grokStatement = 'SQUID grok statement';
 
     component.onSave();
-    expect(sensorParserConfigService.getPostedSensorParserConfig()).toEqual(sensorParserConfigSave);
-    expect(sensorEnrichmentConfigService.getPostedSensorEnrichmentConfig())
-        .toEqual(Object.assign(new SensorEnrichmentConfig(), squidSensorEnrichmentConfig));
-    expect(sensorIndexingConfigService.getPostedIndexingConfigurations())
-        .toEqual(Object.assign(new IndexingConfigurations(), squidIndexingConfigurations));
+    expect(sensorParserConfigService.getPostedSensorParserConfig()).toEqual(
+      sensorParserConfigSave
+    );
+    expect(
+      sensorEnrichmentConfigService.getPostedSensorEnrichmentConfig()
+    ).toEqual(
+      Object.assign(new SensorEnrichmentConfig(), squidSensorEnrichmentConfig)
+    );
+    expect(
+      sensorIndexingConfigService.getPostedIndexingConfigurations()
+    ).toEqual(
+      Object.assign(new IndexingConfigurations(), squidIndexingConfigurations)
+    );
     expect(hdfsService.getPostedContents()).toEqual('SQUID grok statement');
 
     hdfsService.setContents('/apps/metron/patterns/squid', null);
 
     component.onSave();
-    expect(metronAlerts.showErrorMessage['calls'].mostRecent().args[0]).toEqual('HDFS post Error');
+    expect(metronAlerts.showErrorMessage['calls'].mostRecent().args[0]).toEqual(
+      'HDFS post Error'
+    );
 
     sensorEnrichmentConfigService.setThrowError(true);
 
     component.onSave();
-    expect(metronAlerts.showErrorMessage['calls'].mostRecent().args[0])
-        .toEqual('Created Sensor parser config but unable to save enrichment configuration: SensorEnrichmentConfig post error');
+    expect(metronAlerts.showErrorMessage['calls'].mostRecent().args[0]).toEqual(
+      'Created Sensor parser config but unable to save enrichment configuration: SensorEnrichmentConfig post error'
+    );
 
     sensorIndexingConfigService.setThrowError(true);
 
     component.onSave();
-    expect(metronAlerts.showErrorMessage['calls'].mostRecent().args[0])
-        .toEqual('Created Sensor parser config but unable to save indexing configuration: IndexingConfigurations post error');
+    expect(metronAlerts.showErrorMessage['calls'].mostRecent().args[0]).toEqual(
+      'Created Sensor parser config but unable to save indexing configuration: IndexingConfigurations post error'
+    );
 
     fixture.destroy();
   }));
 
   it('should getTransformationCount', async(() => {
-    let transforms =
-    [
+    let transforms = [
       Object.assign(new FieldTransformer(), {
-        'input': [
-          'method'
-        ],
-        'output': null,
-        'transformation': 'REMOVE',
-        'config': {
-          'condition': 'exists(method) and method == "foo"'
+        input: ['method'],
+        output: null,
+        transformation: 'REMOVE',
+        config: {
+          condition: 'exists(method) and method == "foo"'
         }
       }),
       Object.assign(new FieldTransformer(), {
-        'input': [],
-        'output': [
-          'method',
-          'status_code',
-          'url'
-        ],
-        'transformation': 'STELLAR',
-        'config': {
-          'method': 'TO_UPPER(method)',
-          'status_code': 'TO_LOWER(code)',
-          'url': 'TO_STRING(TRIM(url))'
+        input: [],
+        output: ['method', 'status_code', 'url'],
+        transformation: 'STELLAR',
+        config: {
+          method: 'TO_UPPER(method)',
+          status_code: 'TO_LOWER(code)',
+          url: 'TO_STRING(TRIM(url))'
         }
       })
     ];
 
-
-
     expect(component.getTransformationCount()).toEqual(0);
 
     fixture.componentInstance.sensorParserConfig.fieldTransformations = transforms;
     expect(component.getTransformationCount()).toEqual(3);
 
-    fixture.componentInstance.sensorParserConfig.fieldTransformations = [transforms[0]];
+    fixture.componentInstance.sensorParserConfig.fieldTransformations = [
+      transforms[0]
+    ];
     expect(component.getTransformationCount()).toEqual(0);
     fixture.destroy();
   }));
 
   it('should getEnrichmentCount', async(() => {
-
-    component.sensorEnrichmentConfig.enrichment.fieldMap['geo'] = ['ip_src_addr', 'ip_dst_addr'];
-    component.sensorEnrichmentConfig.enrichment.fieldToTypeMap['hbaseenrichment'] = ['ip_src_addr', 'ip_dst_addr'];
+    component.sensorEnrichmentConfig.enrichment.fieldMap['geo'] = [
+      'ip_src_addr',
+      'ip_dst_addr'
+    ];
+    component.sensorEnrichmentConfig.enrichment.fieldToTypeMap[
+      'hbaseenrichment'
+    ] = ['ip_src_addr', 'ip_dst_addr'];
 
     expect(component.getEnrichmentCount()).toEqual(4);
 
@@ -953,8 +1082,9 @@ describe('Component: SensorParserConfig', () => {
   }));
 
   it('should getThreatIntelCount', async(() => {
-
-    component.sensorEnrichmentConfig.threatIntel.fieldToTypeMap['hbaseenrichment'] = ['ip_src_addr', 'ip_dst_addr'];
+    component.sensorEnrichmentConfig.threatIntel.fieldToTypeMap[
+      'hbaseenrichment'
+    ] = ['ip_src_addr', 'ip_dst_addr'];
 
     expect(component.getThreatIntelCount()).toEqual(2);
 
@@ -962,10 +1092,22 @@ describe('Component: SensorParserConfig', () => {
   }));
 
   it('should getRuleCount', async(() => {
-    let rule1 = Object.assign(new RiskLevelRule(), {'name': 'rule1', 'rule': 'some rule', 'score': 50});
-    let rule2 = Object.assign(new RiskLevelRule(), {'name': 'rule2', 'rule': 'some other rule', 'score': 80});
-    component.sensorEnrichmentConfig.threatIntel.triageConfig.riskLevelRules.push(rule1);
-    component.sensorEnrichmentConfig.threatIntel.triageConfig.riskLevelRules.push(rule2);
+    let rule1 = Object.assign(new RiskLevelRule(), {
+      name: 'rule1',
+      rule: 'some rule',
+      score: 50
+    });
+    let rule2 = Object.assign(new RiskLevelRule(), {
+      name: 'rule2',
+      rule: 'some other rule',
+      score: 80
+    });
+    component.sensorEnrichmentConfig.threatIntel.triageConfig.riskLevelRules.push(
+      rule1
+    );
+    component.sensorEnrichmentConfig.threatIntel.triageConfig.riskLevelRules.push(
+      rule2
+    );
 
     expect(component.getRuleCount()).toEqual(2);
 
@@ -973,7 +1115,6 @@ describe('Component: SensorParserConfig', () => {
   }));
 
   it('should showPane', async(() => {
-
     component.showPane(Pane.GROK);
     expect(component.showGrokValidator).toEqual(true);
     expect(component.showFieldSchema).toEqual(false);
@@ -993,7 +1134,6 @@ describe('Component: SensorParserConfig', () => {
   }));
 
   it('should hidePane', async(() => {
-
     component.hidePane(Pane.GROK);
     expect(component.showGrokValidator).toEqual(false);
     expect(component.showFieldSchema).toEqual(false);
@@ -1033,7 +1173,9 @@ describe('Component: SensorParserConfig', () => {
 
     component.onRawJsonChanged();
 
-    expect(component.sensorFieldSchema.createFieldSchemaRows).toHaveBeenCalled();
+    expect(
+      component.sensorFieldSchema.createFieldSchemaRows
+    ).toHaveBeenCalled();
 
     fixture.destroy();
   }));
@@ -1045,5 +1187,4 @@ describe('Component: SensorParserConfig', () => {
 
     fixture.destroy();
   }));
-
 });


Mime
View raw message