You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@metron.apache.org by rm...@apache.org on 2019/06/12 15:31:32 UTC
[metron] branch feature/METRON-1856-parser-aggregation updated:
METRON-2117 [UI] Aligning models to grouping feature (tiborm via merrimanr)
closes apache/metron#1412
This is an automated email from the ASF dual-hosted git repository.
rmerriman pushed a commit to branch feature/METRON-1856-parser-aggregation
in repository https://gitbox.apache.org/repos/asf/metron.git
The following commit(s) were added to refs/heads/feature/METRON-1856-parser-aggregation by this push:
new 1ad26a1 METRON-2117 [UI] Aligning models to grouping feature (tiborm via merrimanr) closes apache/metron#1412
1ad26a1 is described below
commit 1ad26a103b62e66d85473f1700142f1bc3b9b1a6
Author: tiborm <ti...@gmail.com>
AuthorDate: Wed Jun 12 10:31:18 2019 -0500
METRON-2117 [UI] Aligning models to grouping feature (tiborm via merrimanr) closes apache/metron#1412
---
metron-interface/metron-config/src/app/index.ts | 2 -
.../src/app/model/parse-message-request.ts | 4 +-
.../src/app/model/sensor-parser-config-history.ts | 29 ++++++--
.../src/app/model/sensor-parser-context.ts | 4 +-
.../src/app/model/sensor-parser-info.ts | 4 +-
.../src/app/model/topology-response.ts | 4 ++
.../metron-config/src/app/model/topology-status.ts | 12 ++++
.../models/parser-config.model.ts} | 83 +++++++++++++++++-----
.../src/app/sensors/models/parser-group.model.ts | 66 +++++++++++++++++
.../models/parser-meta-info.model.ts} | 26 ++++---
.../models/parser.model.ts} | 11 ++-
.../sensor-field-schema.component.spec.ts | 6 +-
.../sensor-field-schema.component.ts | 4 +-
.../sensor-grok/sensor-grok.component.spec.ts | 4 +-
.../sensors/sensor-grok/sensor-grok.component.ts | 4 +-
...sensor-parser-config-readonly.component.spec.ts | 10 +--
.../sensor-parser-config-readonly.component.ts | 6 +-
.../sensor-raw-json.component.spec.ts | 8 +--
.../sensor-raw-json/sensor-raw-json.component.ts | 4 +-
.../sensor-storm-settings.component.spec.ts | 10 +--
.../sensor-storm-settings.component.ts | 8 +--
.../sensor-parser-config-history.service.ts | 10 +--
.../service/sensor-parser-config.service.spec.ts | 21 +++---
.../src/app/service/stellar.service.spec.ts | 4 +-
.../src/app/shared/metron-alerts.spec.ts | 8 +--
.../metron-config/src/app/shared/metron-alerts.ts | 7 +-
26 files changed, 260 insertions(+), 99 deletions(-)
diff --git a/metron-interface/metron-config/src/app/index.ts b/metron-interface/metron-config/src/app/index.ts
index 1639c33..16c868f 100644
--- a/metron-interface/metron-config/src/app/index.ts
+++ b/metron-interface/metron-config/src/app/index.ts
@@ -18,5 +18,3 @@
export * from './environment';
export * from './app.component';
export * from './app.routes';
-export * from './app.config';
-export * from './app.config.interface';
diff --git a/metron-interface/metron-config/src/app/model/parse-message-request.ts b/metron-interface/metron-config/src/app/model/parse-message-request.ts
index 053d7ad..b58db63 100644
--- a/metron-interface/metron-config/src/app/model/parse-message-request.ts
+++ b/metron-interface/metron-config/src/app/model/parse-message-request.ts
@@ -15,9 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import {SensorParserConfig} from './sensor-parser-config';
+import {ParserConfigModel} from '../sensors/models/parser-config.model';
export class ParseMessageRequest {
- sensorParserConfig: SensorParserConfig;
+ sensorParserConfig: ParserConfigModel;
grokStatement: string;
sampleData: string;
}
diff --git a/metron-interface/metron-config/src/app/model/sensor-parser-config-history.ts b/metron-interface/metron-config/src/app/model/sensor-parser-config-history.ts
index 4854001..a4eda68 100644
--- a/metron-interface/metron-config/src/app/model/sensor-parser-config-history.ts
+++ b/metron-interface/metron-config/src/app/model/sensor-parser-config-history.ts
@@ -15,16 +15,37 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import {SensorParserConfig} from './sensor-parser-config';
+import {ParserConfigModel} from '../sensors/models/parser-config.model';
export class SensorParserConfigHistory {
sensorName: string;
createdBy: string;
modifiedBy: string;
createdDate: string;
modifiedByDate: string;
- config: SensorParserConfig;
+ config: ParserConfigModel;
+ status: string;
+ latency: string;
+ throughput: string;
- constructor() {
- this.config = new SensorParserConfig();
+ constructor() {}
+
+ setConfig(config) {
+ this.config = new ParserConfigModel(config);
+ }
+
+ clone(): SensorParserConfigHistory {
+ const clone = new SensorParserConfigHistory();
+
+ clone.sensorName = this.sensorName;
+ clone.createdBy = this.createdBy;
+ clone.modifiedBy = this.modifiedBy;
+ clone.createdDate = this.createdDate;
+ clone.modifiedByDate = this.modifiedByDate;
+ clone.config = this.config.clone();
+ clone.status = this.status;
+ clone.latency = this.latency;
+ clone.throughput = this.throughput;
+
+ return clone;
}
}
diff --git a/metron-interface/metron-config/src/app/model/sensor-parser-context.ts b/metron-interface/metron-config/src/app/model/sensor-parser-context.ts
index 29217fe..b4267cc 100644
--- a/metron-interface/metron-config/src/app/model/sensor-parser-context.ts
+++ b/metron-interface/metron-config/src/app/model/sensor-parser-context.ts
@@ -15,8 +15,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import {SensorParserConfig} from './sensor-parser-config';
+import {ParserConfigModel} from '../sensors/models/parser-config.model';
export class SensorParserContext {
sampleData: any;
- sensorParserConfig: SensorParserConfig;
+ sensorParserConfig: ParserConfigModel;
}
diff --git a/metron-interface/metron-config/src/app/model/sensor-parser-info.ts b/metron-interface/metron-config/src/app/model/sensor-parser-info.ts
index 330b59c..9f66872 100644
--- a/metron-interface/metron-config/src/app/model/sensor-parser-info.ts
+++ b/metron-interface/metron-config/src/app/model/sensor-parser-info.ts
@@ -15,11 +15,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import {SensorParserConfig} from './sensor-parser-config';
+import { ParserConfigModel } from '../sensors/models/parser-config.model';
export class SensorParserInfo {
createdBy: string;
modifiedBy: string;
createdDate: string;
modifiedByDate: string;
- config: SensorParserConfig;
+ config: ParserConfigModel;
}
diff --git a/metron-interface/metron-config/src/app/model/topology-response.ts b/metron-interface/metron-config/src/app/model/topology-response.ts
index 97a5c84..48cd0bf 100644
--- a/metron-interface/metron-config/src/app/model/topology-response.ts
+++ b/metron-interface/metron-config/src/app/model/topology-response.ts
@@ -18,4 +18,8 @@
export class TopologyResponse {
status: string;
message: string;
+ constructor(status?, message?) {
+ this.status = status;
+ this.message = message;
+ }
}
diff --git a/metron-interface/metron-config/src/app/model/topology-status.ts b/metron-interface/metron-config/src/app/model/topology-status.ts
index a8fad1c..a3843b5 100644
--- a/metron-interface/metron-config/src/app/model/topology-status.ts
+++ b/metron-interface/metron-config/src/app/model/topology-status.ts
@@ -23,4 +23,16 @@ export class TopologyStatus {
throughput: number;
emitted: number;
acked: number;
+
+ constructor(props?) {
+ if (props) {
+ this.id = props.id;
+ this.name = props.name;
+ this.status = props.status;
+ this.latency = props.latency;
+ this.throughput = props.throughput;
+ this.emitted = props.emitted;
+ this.acked = props.acked;
+ }
+ }
}
diff --git a/metron-interface/metron-config/src/app/model/sensor-parser-config.ts b/metron-interface/metron-config/src/app/sensors/models/parser-config.model.ts
similarity index 50%
rename from metron-interface/metron-config/src/app/model/sensor-parser-config.ts
rename to metron-interface/metron-config/src/app/sensors/models/parser-config.model.ts
index a2cd4ae..0e791e1 100644
--- a/metron-interface/metron-config/src/app/model/sensor-parser-config.ts
+++ b/metron-interface/metron-config/src/app/sensors/models/parser-config.model.ts
@@ -15,31 +15,76 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import {FieldTransformer} from './field-transformer';
-export class SensorParserConfig {
- parserClassName: string;
- filterClassName: string;
- sensorTopic: string;
- writerClassName: string;
+import {FieldTransformer} from '../../model/field-transformer';
+import { ParserModel } from './parser.model';
+import * as cloneDeep from 'clone-deep';
+
+export class ParserConfigModel implements ParserModel {
+
+ id: string;
+ cacheConfig: Object;
+ errorTopic: any;
errorWriterClassName: string;
- invalidWriterClassName: string;
- parserConfig: {};
+ errorWriterNumTasks: number;
+ errorWriterParallelism: number;
fieldTransformations: FieldTransformer[];
- numWorkers: number;
+ filterClassName: string;
+ mergeMetadata: boolean;
numAckers: number;
- spoutParallelism: number;
- spoutNumTasks: number;
- parserParallelism: number;
+ numWorkers: number;
+ outputTopic: any;
+ parserClassName: string;
+ parserConfig: any;
parserNumTasks: number;
- errorWriterParallelism: number;
- errorWriterNumTasks: number;
+ parserParallelism: number;
+ rawMessageStrategy: string;
+ rawMessageStrategyConfig: {};
+ readMetadata: boolean;
+ securityProtocol: any;
+ sensorTopic: string;
spoutConfig: {};
+ spoutNumTasks: number;
+ spoutParallelism: number;
stormConfig: {};
+ writerClassName: string;
+ invalidWriterClassName: string;
+ startStopInProgress: boolean;
+ group: string;
+ description: string;
+
+ constructor(id: string, config: any = {}) {
+
+ this.id = id;
+
+ Object.keys(config).forEach(key => {
+ this[key] = config[key];
+ });
+
+ this.group = config.group || '';
+ this.parserConfig = config.parserConfig || {};
+ this.fieldTransformations = config.fieldTransformations || [];
+ this.spoutConfig = config.spoutConfig || {};
+ this.stormConfig = config.stormConfig || {};
+ }
+
+ clone(params = {}): ParserConfigModel {
+ const clone = {
+ ...cloneDeep(this),
+ ...params
+ };
+
+ return new ParserConfigModel(clone.id, clone);
+ }
+
+ getName(): string {
+ return this.id;
+ }
+
+ setName(value: string) {
+ this.id = value;
+ }
- constructor() {
- this.parserConfig = {};
- this.fieldTransformations = [];
- this.spoutConfig = {};
- this.stormConfig = {};
+ getDescription(): string {
+ return '';
}
}
diff --git a/metron-interface/metron-config/src/app/sensors/models/parser-group.model.ts b/metron-interface/metron-config/src/app/sensors/models/parser-group.model.ts
new file mode 100644
index 0000000..6b3353b
--- /dev/null
+++ b/metron-interface/metron-config/src/app/sensors/models/parser-group.model.ts
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { ParserModel } from './parser.model';
+import * as cloneDeep from 'clone-deep';
+
+export class ParserGroupModel implements ParserModel {
+ name: string;
+ description: string;
+ sensors: string[];
+
+ constructor(rawJson: object) {
+ if (rawJson['name']) {
+ this.name = rawJson['name'];
+ } else {
+ throw new Error('Json response not contains name');
+ }
+ this.description = rawJson['description'] || '';
+ this.sensors = rawJson['sensors'] || [];
+ }
+
+ clone(rawJson): ParserGroupModel {
+ return new ParserGroupModel({
+ ...cloneDeep(this),
+ ...rawJson,
+ });
+ }
+
+ getName(): string {
+ return this.name;
+ }
+
+ setName(value: string) {
+ this.name = value;
+ }
+
+ getDescription(): string {
+ return this.description;
+ }
+
+ setDescription(value: string) {
+ this.description = value;
+ }
+
+ getSensors(): string[] {
+ return this.sensors;
+ }
+
+ setSensors(sensors: string[]) {
+ this.sensors = sensors;
+ }
+}
diff --git a/metron-interface/metron-config/src/app/model/sensor-parser-config-history.ts b/metron-interface/metron-config/src/app/sensors/models/parser-meta-info.model.ts
similarity index 64%
copy from metron-interface/metron-config/src/app/model/sensor-parser-config-history.ts
copy to metron-interface/metron-config/src/app/sensors/models/parser-meta-info.model.ts
index 4854001..4588789 100644
--- a/metron-interface/metron-config/src/app/model/sensor-parser-config-history.ts
+++ b/metron-interface/metron-config/src/app/sensors/models/parser-meta-info.model.ts
@@ -15,16 +15,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import {SensorParserConfig} from './sensor-parser-config';
-export class SensorParserConfigHistory {
- sensorName: string;
- createdBy: string;
- modifiedBy: string;
- createdDate: string;
- modifiedByDate: string;
- config: SensorParserConfig;
+import { TopologyStatus } from '../../model/topology-status';
+import { ParserModel } from './parser.model';
- constructor() {
- this.config = new SensorParserConfig();
- }
+export interface ParserMetaInfoModel {
+ config: ParserModel;
+ status?: TopologyStatus;
+ isGroup?: boolean;
+ isHighlighted?: boolean;
+ isDraggedOver?: boolean;
+ isPhantom?: boolean;
+ isDirty?: boolean;
+ isDeleted?: boolean;
+ startStopInProgress?: boolean;
+ modifiedByDate?: string;
+ modifiedBy?: string;
+ isRunning?: boolean;
}
diff --git a/metron-interface/metron-config/src/app/model/topology-response.ts b/metron-interface/metron-config/src/app/sensors/models/parser.model.ts
similarity index 86%
copy from metron-interface/metron-config/src/app/model/topology-response.ts
copy to metron-interface/metron-config/src/app/sensors/models/parser.model.ts
index 97a5c84..bc02f0c 100644
--- a/metron-interface/metron-config/src/app/model/topology-response.ts
+++ b/metron-interface/metron-config/src/app/sensors/models/parser.model.ts
@@ -15,7 +15,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-export class TopologyResponse {
- status: string;
- message: string;
+export interface ParserModel {
+ group?: string,
+
+ setName(value: string)
+
+ getName(): string
+
+ getDescription(): string
}
diff --git a/metron-interface/metron-config/src/app/sensors/sensor-field-schema/sensor-field-schema.component.spec.ts b/metron-interface/metron-config/src/app/sensors/sensor-field-schema/sensor-field-schema.component.spec.ts
index 2cb44e2..9878d7c 100644
--- a/metron-interface/metron-config/src/app/sensors/sensor-field-schema/sensor-field-schema.component.spec.ts
+++ b/metron-interface/metron-config/src/app/sensors/sensor-field-schema/sensor-field-schema.component.spec.ts
@@ -32,7 +32,7 @@ import {
import { KafkaService } from '../../service/kafka.service';
import { Observable, throwError } from 'rxjs';
import { StellarFunctionDescription } from '../../model/stellar-function-description';
-import { SensorParserConfig } from '../../model/sensor-parser-config';
+import { ParserConfigModel } from '../../sensors/models/parser-config.model';
import {
SensorEnrichmentConfig,
EnrichmentConfig,
@@ -171,7 +171,7 @@ describe('Component: SensorFieldSchema', () => {
configuration: {}
};
let sensorParserConfig = Object.assign(
- new SensorParserConfig(),
+ new ParserConfigModel('TestConfigId01'),
squidSensorConfigJson
);
let sensorEnrichmentConfig = Object.assign(
@@ -581,7 +581,7 @@ describe('Component: SensorFieldSchema', () => {
codeFieldSchemaRow
];
- component.sensorParserConfig = new SensorParserConfig();
+ component.sensorParserConfig = new ParserConfigModel('TestConfigId01');
component.sensorParserConfig.parserClassName =
'org.apache.metron.parsers.GrokParser';
component.sensorParserConfig.sensorTopic = 'squid';
diff --git a/metron-interface/metron-config/src/app/sensors/sensor-field-schema/sensor-field-schema.component.ts b/metron-interface/metron-config/src/app/sensors/sensor-field-schema/sensor-field-schema.component.ts
index 8d9dd11..214aa7f 100644
--- a/metron-interface/metron-config/src/app/sensors/sensor-field-schema/sensor-field-schema.component.ts
+++ b/metron-interface/metron-config/src/app/sensors/sensor-field-schema/sensor-field-schema.component.ts
@@ -17,7 +17,7 @@
*/
/* tslint:disable:max-line-length */
import { Component, OnInit, Input, OnChanges, ViewChild, SimpleChanges, Output, EventEmitter } from '@angular/core';
-import {SensorParserConfig} from '../../model/sensor-parser-config';
+import {ParserConfigModel} from '../../sensors/models/parser-config.model';
import {ParseMessageRequest} from '../../model/parse-message-request';
import {SensorParserConfigService} from '../../service/sensor-parser-config.service';
import {StellarService} from '../../service/stellar.service';
@@ -62,7 +62,7 @@ export class FieldSchemaRow {
})
export class SensorFieldSchemaComponent implements OnInit, OnChanges {
- @Input() sensorParserConfig: SensorParserConfig;
+ @Input() sensorParserConfig: ParserConfigModel;
@Input() sensorEnrichmentConfig: SensorEnrichmentConfig;
@Input() showFieldSchema: boolean;
@Input() grokStatement: string;
diff --git a/metron-interface/metron-config/src/app/sensors/sensor-grok/sensor-grok.component.spec.ts b/metron-interface/metron-config/src/app/sensors/sensor-grok/sensor-grok.component.spec.ts
index 6151e9d..b83ec3b 100644
--- a/metron-interface/metron-config/src/app/sensors/sensor-grok/sensor-grok.component.spec.ts
+++ b/metron-interface/metron-config/src/app/sensors/sensor-grok/sensor-grok.component.spec.ts
@@ -27,7 +27,7 @@ import { ParseMessageRequest } from '../../model/parse-message-request';
import { SensorGrokComponent } from './sensor-grok.component';
import { GrokValidationService } from '../../service/grok-validation.service';
import { SensorGrokModule } from './sensor-grok.module';
-import { SensorParserConfig } from '../../model/sensor-parser-config';
+import { ParserConfigModel } from '../../sensors/models/parser-config.model';
class MockSensorParserConfigService {
private parsedMessage: string;
@@ -168,7 +168,7 @@ describe('Component: SensorGrok', () => {
'SQUID_DELIMITED %{NUMBER:timestamp} %{INT:elapsed} %{IPV4:ip_src_addr} %{WORD:action}/%{NUMBER:code} ' +
'%{NUMBER:bytes} %{WORD:method} %{NOTSPACE:url} - %{WORD:UNWANTED}/%{IPV4:ip_dst_addr} %{WORD:UNWANTED}/%{WORD:UNWANTED}';
- component.sensorParserConfig = new SensorParserConfig();
+ component.sensorParserConfig = new ParserConfigModel('TestConfigId01');
component.sensorParserConfig.sensorTopic = 'squid';
component.newGrokStatement = grokStatement;
diff --git a/metron-interface/metron-config/src/app/sensors/sensor-grok/sensor-grok.component.ts b/metron-interface/metron-config/src/app/sensors/sensor-grok/sensor-grok.component.ts
index f601f5f..5f9f094 100644
--- a/metron-interface/metron-config/src/app/sensors/sensor-grok/sensor-grok.component.ts
+++ b/metron-interface/metron-config/src/app/sensors/sensor-grok/sensor-grok.component.ts
@@ -17,7 +17,7 @@
*/
import { Component, OnInit, Input, OnChanges, SimpleChanges, ViewChild, EventEmitter, Output} from '@angular/core';
-import {SensorParserConfig} from '../../model/sensor-parser-config';
+import {ParserConfigModel} from '../models/parser-config.model';
import {ParseMessageRequest} from '../../model/parse-message-request';
import {SensorParserConfigService} from '../../service/sensor-parser-config.service';
import {AutocompleteOption} from '../../model/autocomplete-option';
@@ -33,7 +33,7 @@ import {MetronAlerts} from '../../shared/metron-alerts';
export class SensorGrokComponent implements OnInit, OnChanges {
@Input() showGrok; boolean;
- @Input() sensorParserConfig: SensorParserConfig;
+ @Input() sensorParserConfig: ParserConfigModel;
@Input() grokStatement: string;
@Input() patternLabel: string;
diff --git a/metron-interface/metron-config/src/app/sensors/sensor-parser-config-readonly/sensor-parser-config-readonly.component.spec.ts b/metron-interface/metron-config/src/app/sensors/sensor-parser-config-readonly/sensor-parser-config-readonly.component.spec.ts
index 1a027f5..16628d1 100644
--- a/metron-interface/metron-config/src/app/sensors/sensor-parser-config-readonly/sensor-parser-config-readonly.component.spec.ts
+++ b/metron-interface/metron-config/src/app/sensors/sensor-parser-config-readonly/sensor-parser-config-readonly.component.spec.ts
@@ -25,7 +25,7 @@ import { SensorParserConfigReadonlyComponent } from './sensor-parser-config-read
import { SensorParserConfigService } from '../../service/sensor-parser-config.service';
import { KafkaService } from '../../service/kafka.service';
import { TopologyStatus } from '../../model/topology-status';
-import { SensorParserConfig } from '../../model/sensor-parser-config';
+import { ParserConfigModel } from '../../sensors/models/parser-config.model';
import { KafkaTopic } from '../../model/kafka-topic';
import { AuthenticationService } from '../../service/authentication.service';
import { SensorParserConfigHistoryService } from '../../service/sensor-parser-config-history.service';
@@ -281,7 +281,7 @@ describe('Component: SensorParserConfigReadonly', () => {
it('should have sensorsService with parserName and grokPattern defined and kafkaService defined', async(() => {
let sensorParserInfo = new SensorParserConfigHistory();
- let sensorParserConfig = new SensorParserConfig();
+ let sensorParserConfig = new ParserConfigModel('TestConfigId01');
let kafkaTopic = new KafkaTopic();
let topologyStatus = new TopologyStatus();
@@ -378,7 +378,7 @@ describe('Component: SensorParserConfigReadonly', () => {
let grokStatement = 'SQUID_DELIMITED squid grok statement';
hdfsService.setContents(grokStatement);
let sensorParserInfo = new SensorParserConfigHistory();
- let sensorParserConfig = new SensorParserConfig();
+ let sensorParserConfig = new ParserConfigModel('TestConfigId01');
sensorParserConfig.parserConfig = {};
sensorParserConfig.parserConfig['grokPath'] = '/squid/grok/path';
@@ -392,7 +392,7 @@ describe('Component: SensorParserConfigReadonly', () => {
it('setTransformsConfigKeys/getTransformsOutput should return the keys of the transforms config ', async(() => {
let sensorParserInfo = new SensorParserConfigHistory();
- let sensorParserConfig = new SensorParserConfig();
+ let sensorParserConfig = new ParserConfigModel('TestConfigId01');
let fieldTransformer1 = new FieldTransformer();
let fieldTransformer2 = new FieldTransformer();
@@ -507,7 +507,7 @@ describe('Component: SensorParserConfigReadonly', () => {
let setDataForSensorOperation = function() {
let sensorParserInfo = new SensorParserConfigHistory();
- let sensorParserConfig = new SensorParserConfig();
+ let sensorParserConfig = new ParserConfigModel('TestConfigId01');
let kafkaTopic = new KafkaTopic();
let topologyStatus = new TopologyStatus();
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 2904ef5..bbc04f4 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
@@ -31,7 +31,7 @@ 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 { ParserConfigModel } from '../models/parser-config.model';
@Component({
selector: 'metron-config-sensor-parser-readonly',
@@ -40,10 +40,10 @@ import { SensorParserConfig } from '../../model/sensor-parser-config';
})
export class SensorParserConfigReadonlyComponent implements OnInit {
selectedSensorName: string;
- startStopInProgress: boolean = false;
+ startStopInProgress = false;
kafkaTopic: KafkaTopic = new KafkaTopic();
sensorParserConfigHistory: SensorParserConfigHistory = new SensorParserConfigHistory();
- sensorParserConfig: SensorParserConfig = new SensorParserConfig();
+ sensorParserConfig: ParserConfigModel;
topologyStatus: TopologyStatus = new TopologyStatus();
sensorEnrichmentConfig: SensorEnrichmentConfig = new SensorEnrichmentConfig();
grokStatement = {};
diff --git a/metron-interface/metron-config/src/app/sensors/sensor-raw-json/sensor-raw-json.component.spec.ts b/metron-interface/metron-config/src/app/sensors/sensor-raw-json/sensor-raw-json.component.spec.ts
index 427e837..4571973 100644
--- a/metron-interface/metron-config/src/app/sensors/sensor-raw-json/sensor-raw-json.component.spec.ts
+++ b/metron-interface/metron-config/src/app/sensors/sensor-raw-json/sensor-raw-json.component.spec.ts
@@ -20,7 +20,7 @@ import { async, TestBed, ComponentFixture } from '@angular/core/testing';
import { SensorRawJsonComponent } from './sensor-raw-json.component';
import { SharedModule } from '../../shared/shared.module';
import { SimpleChanges, SimpleChange } from '@angular/core';
-import { SensorParserConfig } from '../../model/sensor-parser-config';
+import { ParserConfigModel } from '../../sensors/models/parser-config.model';
import {
SensorEnrichmentConfig,
EnrichmentConfig,
@@ -35,7 +35,7 @@ describe('Component: SensorRawJsonComponent', () => {
let sensorParserConfigString =
'{"parserClassName":"org.apache.metron.parsers.bro.BasicBroParser","sensorTopic":"bro",' +
'"parserConfig": {},"fieldTransformations":[]}';
- let sensorParserConfig: SensorParserConfig = new SensorParserConfig();
+ let sensorParserConfig: ParserConfigModel = new ParserConfigModel('TestConfigId01');
sensorParserConfig.sensorTopic = 'bro';
sensorParserConfig.parserClassName =
'org.apache.metron.parsers.bro.BasicBroParser';
@@ -46,7 +46,7 @@ describe('Component: SensorRawJsonComponent', () => {
"errorWriterClassName": "org.example.errorWriterClassName",
"filterClassName": "org.example.filterClassName", "invalidWriterClassName": "org.example.invalidWriterClassName"}`;
let sensorParserConfigWithClassName = Object.assign(
- new SensorParserConfig(),
+ new ParserConfigModel('TestConfigId01'),
sensorParserConfig
);
sensorParserConfigWithClassName.writerClassName =
@@ -171,7 +171,7 @@ describe('Component: SensorRawJsonComponent', () => {
it('should save the fields', () => {
spyOn(component.hideRawJson, 'emit');
spyOn(component.onRawJsonChanged, 'emit');
- component.sensorParserConfig = new SensorParserConfig();
+ component.sensorParserConfig = new ParserConfigModel('TestConfigId01');
component.sensorEnrichmentConfig = new SensorEnrichmentConfig();
component.indexingConfigurations = new IndexingConfigurations();
diff --git a/metron-interface/metron-config/src/app/sensors/sensor-raw-json/sensor-raw-json.component.ts b/metron-interface/metron-config/src/app/sensors/sensor-raw-json/sensor-raw-json.component.ts
index 4b56b62..f9c7e61 100644
--- a/metron-interface/metron-config/src/app/sensors/sensor-raw-json/sensor-raw-json.component.ts
+++ b/metron-interface/metron-config/src/app/sensors/sensor-raw-json/sensor-raw-json.component.ts
@@ -16,7 +16,7 @@
* limitations under the License.
*/
import {Component, Input, EventEmitter, Output, OnChanges, SimpleChanges} from '@angular/core';
-import {SensorParserConfig} from '../../model/sensor-parser-config';
+import {ParserConfigModel} from '../models/parser-config.model';
import {SensorEnrichmentConfig, EnrichmentConfig, ThreatIntelConfig} from '../../model/sensor-enrichment-config';
import {IndexingConfigurations, SensorIndexingConfig} from '../../model/sensor-indexing-config';
@@ -31,7 +31,7 @@ declare var ace: any;
export class SensorRawJsonComponent implements OnChanges {
@Input() showRawJson: boolean;
- @Input() sensorParserConfig: SensorParserConfig;
+ @Input() sensorParserConfig: ParserConfigModel;
@Input() sensorEnrichmentConfig: SensorEnrichmentConfig;
@Input() indexingConfigurations: IndexingConfigurations;
diff --git a/metron-interface/metron-config/src/app/sensors/sensor-storm-settings/sensor-storm-settings.component.spec.ts b/metron-interface/metron-config/src/app/sensors/sensor-storm-settings/sensor-storm-settings.component.spec.ts
index 6549b4b..f228ec8 100644
--- a/metron-interface/metron-config/src/app/sensors/sensor-storm-settings/sensor-storm-settings.component.spec.ts
+++ b/metron-interface/metron-config/src/app/sensors/sensor-storm-settings/sensor-storm-settings.component.spec.ts
@@ -20,13 +20,13 @@ import { async, TestBed, ComponentFixture } from '@angular/core/testing';
import { SensorStormSettingsComponent } from './sensor-storm-settings.component';
import { SharedModule } from '../../shared/shared.module';
import { SimpleChanges, SimpleChange } from '@angular/core';
-import { SensorParserConfig } from '../../model/sensor-parser-config';
+import { ParserConfigModel } from '../../sensors/models/parser-config.model';
import { SensorStormSettingsModule } from './sensor-storm-settings.module';
describe('Component: SensorStormSettingsComponent', () => {
let fixture: ComponentFixture<SensorStormSettingsComponent>;
let component: SensorStormSettingsComponent;
- let sensorParserConfig: SensorParserConfig = new SensorParserConfig();
+ let sensorParserConfig: ParserConfigModel = new ParserConfigModel('TestConfigId01');
sensorParserConfig.sensorTopic = 'bro';
sensorParserConfig.parserClassName =
'org.apache.metron.parsers.bro.BasicBroParser';
@@ -73,7 +73,7 @@ describe('Component: SensorStormSettingsComponent', () => {
it('should initialise the fields', () => {
component.init();
- expect(component.newSensorParserConfig).toEqual(new SensorParserConfig());
+ expect(component.newSensorParserConfig).toEqual(new ParserConfigModel('TestConfigId01'));
component.sensorParserConfig = sensorParserConfig;
component.init();
@@ -123,7 +123,7 @@ describe('Component: SensorStormSettingsComponent', () => {
});
it('hasSpoutConfigChanged should properly detect changes', () => {
- let sensorParserConfigWithSpoutConfig = new SensorParserConfig();
+ let sensorParserConfigWithSpoutConfig = new ParserConfigModel('TestConfigId01');
sensorParserConfigWithSpoutConfig.spoutConfig = {};
component.sensorParserConfig = sensorParserConfigWithSpoutConfig;
component.newSpoutConfig = '{}';
@@ -144,7 +144,7 @@ describe('Component: SensorStormSettingsComponent', () => {
});
it('hasStormConfigChanged should properly detect changes', () => {
- let sensorParserConfigWithStormConfig = new SensorParserConfig();
+ let sensorParserConfigWithStormConfig = new ParserConfigModel('TestConfigId01');
sensorParserConfigWithStormConfig.stormConfig = {};
component.sensorParserConfig = sensorParserConfigWithStormConfig;
component.newStormConfig = '{}';
diff --git a/metron-interface/metron-config/src/app/sensors/sensor-storm-settings/sensor-storm-settings.component.ts b/metron-interface/metron-config/src/app/sensors/sensor-storm-settings/sensor-storm-settings.component.ts
index a393da8..1863554 100644
--- a/metron-interface/metron-config/src/app/sensors/sensor-storm-settings/sensor-storm-settings.component.ts
+++ b/metron-interface/metron-config/src/app/sensors/sensor-storm-settings/sensor-storm-settings.component.ts
@@ -16,7 +16,7 @@
* limitations under the License.
*/
import {Component, Input, EventEmitter, Output, OnChanges, SimpleChanges} from '@angular/core';
-import {SensorParserConfig} from '../../model/sensor-parser-config';
+import {ParserConfigModel} from '../models/parser-config.model';
declare var ace: any;
@@ -29,12 +29,12 @@ declare var ace: any;
export class SensorStormSettingsComponent implements OnChanges {
@Input() showStormSettings: boolean;
- @Input() sensorParserConfig: SensorParserConfig;
+ @Input() sensorParserConfig: ParserConfigModel;
@Output() hideStormSettings: EventEmitter<boolean> = new EventEmitter<boolean>();
@Output() onStormSettingsChanged: EventEmitter<boolean> = new EventEmitter<boolean>();
- newSensorParserConfig: SensorParserConfig = new SensorParserConfig();
+ newSensorParserConfig: ParserConfigModel = new ParserConfigModel('TestConfigId01');
newSpoutConfig: string = '{}';
newStormConfig: string = '{}';
@@ -46,7 +46,7 @@ export class SensorStormSettingsComponent implements OnChanges {
init(): void {
if (this.sensorParserConfig) {
- this.newSensorParserConfig = Object.assign(new SensorParserConfig(), this.sensorParserConfig);
+ this.newSensorParserConfig = Object.assign(new ParserConfigModel('TestConfigId01'), this.sensorParserConfig);
this.newSpoutConfig = JSON.stringify(this.sensorParserConfig.spoutConfig, null, '\t');
this.newStormConfig = JSON.stringify(this.sensorParserConfig.stormConfig, null, '\t');
}
diff --git a/metron-interface/metron-config/src/app/service/sensor-parser-config-history.service.ts b/metron-interface/metron-config/src/app/service/sensor-parser-config-history.service.ts
index c5d0c67..ae408ec 100644
--- a/metron-interface/metron-config/src/app/service/sensor-parser-config-history.service.ts
+++ b/metron-interface/metron-config/src/app/service/sensor-parser-config-history.service.ts
@@ -21,9 +21,9 @@ import { Observable } from 'rxjs';
import { map, catchError } from 'rxjs/operators';
import { HttpUtil } from '../util/httpUtil';
import { SensorParserConfigHistory } from '../model/sensor-parser-config-history';
-import { SensorParserConfig } from '../model/sensor-parser-config';
+import { ParserConfigModel } from '../sensors/models/parser-config.model';
import { RestError } from '../model/rest-error';
-import {AppConfigService} from './app-config.service';
+import { AppConfigService } from './app-config.service';
@Injectable()
export class SensorParserConfigHistoryService {
@@ -36,7 +36,7 @@ export class SensorParserConfigHistoryService {
public get(name: string): Observable<RestError | SensorParserConfigHistory> {
return this.http.get(this.url + '/' + name).pipe(
- map((response: SensorParserConfig) => {
+ map((response: ParserConfigModel) => {
let sensorParserConfigHistory = new SensorParserConfigHistory();
sensorParserConfigHistory.config = response;
return sensorParserConfigHistory;
@@ -47,9 +47,9 @@ export class SensorParserConfigHistoryService {
public getAll(): Observable<SensorParserConfigHistory[] | RestError> {
return this.http.get(this.url).pipe(
- map((response: SensorParserConfig[]) => {
+ map((response: ParserConfigModel[]) => {
let sensorParserConfigHistoryArray = [];
- let sensorParserConfigs: SensorParserConfig[] = response;
+ let sensorParserConfigs: ParserConfigModel[] = response;
for (let sensorParserConfig of sensorParserConfigs) {
let sensorParserConfigHistory = new SensorParserConfigHistory();
sensorParserConfigHistory.config = sensorParserConfig;
diff --git a/metron-interface/metron-config/src/app/service/sensor-parser-config.service.spec.ts b/metron-interface/metron-config/src/app/service/sensor-parser-config.service.spec.ts
index 9baf883..6e63113 100644
--- a/metron-interface/metron-config/src/app/service/sensor-parser-config.service.spec.ts
+++ b/metron-interface/metron-config/src/app/service/sensor-parser-config.service.spec.ts
@@ -17,15 +17,18 @@
*/
import { TestBed } from '@angular/core/testing';
import { SensorParserConfigService } from './sensor-parser-config.service';
-import { SensorParserConfig } from '../model/sensor-parser-config';
+import { ParserConfigModel } from '../sensors/models/parser-config.model';
import { ParseMessageRequest } from '../model/parse-message-request';
-import { APP_CONFIG, METRON_REST_CONFIG } from '../app.config';
import {
HttpClientTestingModule,
- HttpTestingController
+ HttpTestingController,
+ TestRequest
} from '@angular/common/http/testing';
-import {AppConfigService} from './app-config.service';
-import {MockAppConfigService} from './mock.app-config.service';
+import { ParserGroupModel } from '../sensors/models/parser-group.model';
+import { ParserMetaInfoModel } from '../sensors/models/parser-meta-info.model';
+import { noop } from 'rxjs';
+import { AppConfigService } from './app-config.service';
+import { MockAppConfigService } from './mock.app-config.service';
describe('SensorParserConfigService', () => {
let mockBackend: HttpTestingController;
@@ -47,19 +50,19 @@ describe('SensorParserConfigService', () => {
mockBackend.verify();
});
- let sensorParserConfig = new SensorParserConfig();
+ let sensorParserConfig = new ParserConfigModel('TestConfigId01');
sensorParserConfig.sensorTopic = 'bro';
sensorParserConfig.parserClassName = 'parserClass';
sensorParserConfig.parserConfig = { field: 'value' };
let availableParsers = [{ Grok: 'org.apache.metron.parsers.GrokParser' }];
let parseMessageRequest = new ParseMessageRequest();
- parseMessageRequest.sensorParserConfig = new SensorParserConfig();
+ parseMessageRequest.sensorParserConfig = new ParserConfigModel('TestConfigId02');
parseMessageRequest.sensorParserConfig.sensorTopic = 'bro';
parseMessageRequest.sampleData = 'sampleData';
let parsedMessage = { field: 'value' };
- let sensorParserConfig1 = new SensorParserConfig();
+ let sensorParserConfig1 = new ParserConfigModel('TestConfigId03');
sensorParserConfig1.sensorTopic = 'bro1';
- let sensorParserConfig2 = new SensorParserConfig();
+ let sensorParserConfig2 = new ParserConfigModel('TestConfigId04');
sensorParserConfig2.sensorTopic = 'bro2';
it('post', () => {
diff --git a/metron-interface/metron-config/src/app/service/stellar.service.spec.ts b/metron-interface/metron-config/src/app/service/stellar.service.spec.ts
index ce9f34f..97fe7e4 100644
--- a/metron-interface/metron-config/src/app/service/stellar.service.spec.ts
+++ b/metron-interface/metron-config/src/app/service/stellar.service.spec.ts
@@ -18,7 +18,7 @@
import { TestBed } from '@angular/core/testing';
import { StellarService } from './stellar.service';
import { SensorParserContext } from '../model/sensor-parser-context';
-import { SensorParserConfig } from '../model/sensor-parser-config';
+import { ParserConfigModel } from '../sensors/models/parser-config.model';
import {
HttpClientTestingModule,
HttpTestingController
@@ -48,7 +48,7 @@ describe('StellarService', () => {
let transformationRulesValidation = { rule1: true, rule2: false };
let transformationValidation = new SensorParserContext();
transformationValidation.sampleData = { data: 'data' };
- transformationValidation.sensorParserConfig = new SensorParserConfig();
+ transformationValidation.sensorParserConfig = new ParserConfigModel('TestConfigId01');
transformationValidation.sensorParserConfig.sensorTopic = 'test';
let transformations = ['STELLAR', 'REMOVE'];
let transformFunctions: StellarFunctionDescription[] = [
diff --git a/metron-interface/metron-config/src/app/shared/metron-alerts.spec.ts b/metron-interface/metron-config/src/app/shared/metron-alerts.spec.ts
index 5efe063..4713931 100644
--- a/metron-interface/metron-config/src/app/shared/metron-alerts.spec.ts
+++ b/metron-interface/metron-config/src/app/shared/metron-alerts.spec.ts
@@ -22,11 +22,11 @@ import {MetronAlerts} from './metron-alerts';
describe('MetronAlerts', () => {
beforeEach(function() {
- MetronAlerts.SUCESS_MESSAGE_DISPALY_TIME = 500;
+ MetronAlerts.SUCCESS_MESSAGE_DISPLAY_TIME = 500;
});
afterEach(function() {
- MetronAlerts.SUCESS_MESSAGE_DISPALY_TIME = 5000;
+ MetronAlerts.SUCCESS_MESSAGE_DISPLAY_TIME = 5000;
});
it('should create an instance', () => {
@@ -41,7 +41,7 @@ describe('MetronAlerts', () => {
setTimeout(() => {
expect($(document).find('.alert .alert-success').length).toEqual(0);
done();
- }, MetronAlerts.SUCESS_MESSAGE_DISPALY_TIME);
+ }, MetronAlerts.SUCCESS_MESSAGE_DISPLAY_TIME);
});
it('should close success message on click of close', (done) => {
@@ -56,7 +56,7 @@ describe('MetronAlerts', () => {
setTimeout(() => {
expect($(document).find('.alert .alert-success').length).toEqual(0);
done();
- }, MetronAlerts.SUCESS_MESSAGE_DISPALY_TIME);
+ }, MetronAlerts.SUCCESS_MESSAGE_DISPLAY_TIME);
});
diff --git a/metron-interface/metron-config/src/app/shared/metron-alerts.ts b/metron-interface/metron-config/src/app/shared/metron-alerts.ts
index 5b307e4..6294c02 100644
--- a/metron-interface/metron-config/src/app/shared/metron-alerts.ts
+++ b/metron-interface/metron-config/src/app/shared/metron-alerts.ts
@@ -1,3 +1,5 @@
+import { Injectable } from "@angular/core";
+
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -15,9 +17,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+@Injectable()
export class MetronAlerts {
- public static SUCESS_MESSAGE_DISPALY_TIME = 5000;
+ public static SUCCESS_MESSAGE_DISPLAY_TIME = 5000;
private createMessage(message: string, type: string): Node {
let element = document.createElement('div');
@@ -47,6 +50,6 @@ export class MetronAlerts {
document.body.removeChild(element);
- }, MetronAlerts.SUCESS_MESSAGE_DISPALY_TIME);
+ }, MetronAlerts.SUCCESS_MESSAGE_DISPLAY_TIME);
}
}