metron-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmiklav...@apache.org
Subject [10/24] metron git commit: METRON-1834: Migrate Elasticsearch from TransportClient to new Java REST API (mmiklavc via mmiklavc) closes apache/metron#1242
Date Fri, 16 Nov 2018 00:06:09 GMT
http://git-wip-us.apache.org/repos/asf/metron/blob/8bf3b6ec/metron-interface/metron-config/src/app/service/sensor-enrichment-config.service.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/app/service/sensor-enrichment-config.service.ts b/metron-interface/metron-config/src/app/service/sensor-enrichment-config.service.ts
index 90c314b..bc26581 100644
--- a/metron-interface/metron-config/src/app/service/sensor-enrichment-config.service.ts
+++ b/metron-interface/metron-config/src/app/service/sensor-enrichment-config.service.ts
@@ -15,57 +15,69 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import {Injectable, Inject} from '@angular/core';
-import {Http, Headers, RequestOptions, Response} from '@angular/http';
-import {Observable} from 'rxjs/Observable';
-import {SensorEnrichmentConfig} from '../model/sensor-enrichment-config';
-import {HttpUtil} from '../util/httpUtil';
-import {IAppConfig} from '../app.config.interface';
-import {APP_CONFIG} from '../app.config';
+import { Injectable, Inject } from '@angular/core';
+import { HttpClient, HttpResponse } from '@angular/common/http';
+import { Observable } from 'rxjs';
+import { map, catchError } from 'rxjs/operators';
+import { SensorEnrichmentConfig } from '../model/sensor-enrichment-config';
+import { HttpUtil } from '../util/httpUtil';
+import { IAppConfig } from '../app.config.interface';
+import { APP_CONFIG } from '../app.config';
 
 @Injectable()
 export class SensorEnrichmentConfigService {
   url = this.config.apiEndpoint + '/sensor/enrichment/config';
-  defaultHeaders = {'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest'};
 
-  constructor(private http: Http, @Inject(APP_CONFIG) private config: IAppConfig) {
-  }
+  constructor(
+    private http: HttpClient,
+    @Inject(APP_CONFIG) private config: IAppConfig
+  ) {}
 
-  public post(name: string, sensorEnrichmentConfig: SensorEnrichmentConfig): Observable<SensorEnrichmentConfig> {
-    return this.http.post(this.url + '/' + name, JSON.stringify(sensorEnrichmentConfig),
-                          new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-      .map(HttpUtil.extractData)
-      .catch(HttpUtil.handleError);
+  public post(
+    name: string,
+    sensorEnrichmentConfig: SensorEnrichmentConfig
+  ): Observable<SensorEnrichmentConfig> {
+    return this.http
+      .post(this.url + '/' + name, JSON.stringify(sensorEnrichmentConfig))
+      .pipe(
+        map(HttpUtil.extractData),
+        catchError(HttpUtil.handleError)
+      );
   }
 
   public get(name: string): Observable<SensorEnrichmentConfig> {
-    return this.http.get(this.url + '/' + name, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-      .map(HttpUtil.extractData)
-      .catch(HttpUtil.handleError);
+    return this.http.get(this.url + '/' + name).pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
   public getAll(): Observable<SensorEnrichmentConfig[]> {
-    return this.http.get(this.url, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-      .map(HttpUtil.extractData)
-      .catch(HttpUtil.handleError);
+    return this.http.get(this.url).pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
-  public deleteSensorEnrichments(name: string): Observable<Response> {
-    return this.http.delete(this.url + '/' + name, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-      .catch(HttpUtil.handleError);
+  public deleteSensorEnrichments(name: string) {
+    return this.http
+      .delete<Observable<{}>>(this.url + '/' + name)
+      .pipe<HttpResponse<{}>>(catchError(HttpUtil.handleError));
   }
 
   public getAvailableEnrichments(): Observable<string[]> {
-    return this.http.get(this.url + '/list/available/enrichments', new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-        .map(HttpUtil.extractData)
-        .catch(HttpUtil.handleError);
+    return this.http.get(this.url + '/list/available/enrichments').pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
   public getAvailableThreatTriageAggregators(): Observable<string[]> {
-    return this.http.get(this.url + '/list/available/threat/triage/aggregators',
-        new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-        .map(HttpUtil.extractData)
-        .catch(HttpUtil.handleError);
+    return this.http
+      .get(this.url + '/list/available/threat/triage/aggregators')
+      .pipe(
+        map(HttpUtil.extractData),
+        catchError(HttpUtil.handleError)
+      );
   }
-
 }

http://git-wip-us.apache.org/repos/asf/metron/blob/8bf3b6ec/metron-interface/metron-config/src/app/service/sensor-indexing-config.service.spec.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/app/service/sensor-indexing-config.service.spec.ts b/metron-interface/metron-config/src/app/service/sensor-indexing-config.service.spec.ts
index 3640162..e2c1568 100644
--- a/metron-interface/metron-config/src/app/service/sensor-indexing-config.service.spec.ts
+++ b/metron-interface/metron-config/src/app/service/sensor-indexing-config.service.spec.ts
@@ -15,104 +15,100 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import {async, inject, TestBed} from '@angular/core/testing';
-import {MockBackend, MockConnection} from '@angular/http/testing';
-import {HttpModule, XHRBackend, Response, ResponseOptions, Http} from '@angular/http';
-import '../rxjs-operators';
-import {METRON_REST_CONFIG, APP_CONFIG} from '../app.config';
-import {IAppConfig} from '../app.config.interface';
-import {SensorIndexingConfigService} from './sensor-indexing-config.service';
-import {IndexingConfigurations} from '../model/sensor-indexing-config';
+import { TestBed } from '@angular/core/testing';
+import { HttpResponse } from '@angular/common/http';
+import { METRON_REST_CONFIG, APP_CONFIG } from '../app.config';
+import { SensorIndexingConfigService } from './sensor-indexing-config.service';
+import { IndexingConfigurations } from '../model/sensor-indexing-config';
+import {
+  HttpClientTestingModule,
+  HttpTestingController
+} from '@angular/common/http/testing';
 
 describe('SensorIndexingConfigService', () => {
+  let mockBackend: HttpTestingController;
+  let sensorIndexingConfigService: SensorIndexingConfigService;
 
-  beforeEach(async(() => {
+  beforeEach(() => {
     TestBed.configureTestingModule({
-      imports: [HttpModule],
+      imports: [HttpClientTestingModule],
       providers: [
         SensorIndexingConfigService,
-        {provide: XHRBackend, useClass: MockBackend},
-        {provide: APP_CONFIG, useValue: METRON_REST_CONFIG}
+        { provide: APP_CONFIG, useValue: METRON_REST_CONFIG }
       ]
-    })
-        .compileComponents();
-  }));
-
-  it('can instantiate service when inject service',
-      inject([SensorIndexingConfigService], (service: SensorIndexingConfigService) => {
-        expect(service instanceof SensorIndexingConfigService).toBe(true);
-      }));
-
-  it('can instantiate service with "new"', inject([Http, APP_CONFIG], (http: Http, config: IAppConfig) => {
-    expect(http).not.toBeNull('http should be provided');
-    let service = new SensorIndexingConfigService(http, config);
-    expect(service instanceof SensorIndexingConfigService).toBe(true, 'new service should be ok');
-  }));
-
+    });
+    mockBackend = TestBed.get(HttpTestingController);
+    sensorIndexingConfigService = TestBed.get(SensorIndexingConfigService);
+  });
 
-  it('can provide the mockBackend as XHRBackend',
-      inject([XHRBackend], (backend: MockBackend) => {
-        expect(backend).not.toBeNull('backend should be provided');
-      }));
+  afterEach(() => {
+    mockBackend.verify();
+  });
 
   describe('when service functions', () => {
-    let sensorIndexingConfigService: SensorIndexingConfigService;
-    let mockBackend: MockBackend;
     let sensorIndexingConfig1 = new IndexingConfigurations();
     sensorIndexingConfig1.hdfs.index = 'squid';
     sensorIndexingConfig1.hdfs.batchSize = 1;
     let sensorIndexingConfig2 = new IndexingConfigurations();
     sensorIndexingConfig2.hdfs.index = 'yaf';
     sensorIndexingConfig2.hdfs.batchSize = 2;
-    let sensorIndexingConfigResponse: Response;
-    let sensorIndexingConfigsResponse: Response;
-    let deleteResponse: Response;
+    let deleteResponse: HttpResponse<{}>;
 
-    beforeEach(inject([Http, XHRBackend, APP_CONFIG], (http: Http, be: MockBackend, config: IAppConfig) => {
-      mockBackend = be;
-      sensorIndexingConfigService = new SensorIndexingConfigService(http, config);
-      sensorIndexingConfigResponse = new Response(new ResponseOptions({status: 200, body: sensorIndexingConfig1}));
-      sensorIndexingConfigsResponse = new Response(new ResponseOptions({status: 200, body: [sensorIndexingConfig1,
-        sensorIndexingConfig2]}));
-      deleteResponse = new Response(new ResponseOptions({status: 200}));
-    }));
+    beforeEach(() => {
+      deleteResponse = new HttpResponse({ status: 200 });
+    });
 
-    it('post', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(sensorIndexingConfigResponse));
-
-      sensorIndexingConfigService.post('squid', sensorIndexingConfig1).subscribe(
+    it('post', () => {
+      sensorIndexingConfigService
+        .post('squid', sensorIndexingConfig1)
+        .subscribe(
           result => {
             expect(result).toEqual(sensorIndexingConfig1);
-          }, error => console.log(error));
-    })));
-
-    it('get', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(sensorIndexingConfigResponse));
-
+          },
+          error => console.log(error)
+        );
+      const req = mockBackend.expectOne('/api/v1/sensor/indexing/config/squid');
+      expect(req.request.method).toBe('POST');
+      req.flush(sensorIndexingConfig1);
+    });
+
+    it('get', () => {
       sensorIndexingConfigService.get('squid').subscribe(
-          result => {
-            expect(result).toEqual(sensorIndexingConfig1);
-          }, error => console.log(error));
-    })));
-
-    it('getAll', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(sensorIndexingConfigsResponse));
-
+        result => {
+          expect(result).toEqual(sensorIndexingConfig1);
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne('/api/v1/sensor/indexing/config/squid');
+      expect(req.request.method).toBe('GET');
+      req.flush(sensorIndexingConfig1);
+    });
+
+    it('getAll', () => {
       sensorIndexingConfigService.getAll().subscribe(
-          results => {
-            expect(results).toEqual([sensorIndexingConfig1, sensorIndexingConfig2]);
-          }, error => console.log(error));
-    })));
-
-    it('deleteSensorEnrichments', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(deleteResponse));
-
-      sensorIndexingConfigService.deleteSensorIndexingConfig('squid').subscribe(result => {
-        expect(result.status).toEqual(200);
-      });
-    })));
+        results => {
+          expect(results).toEqual([
+            sensorIndexingConfig1,
+            sensorIndexingConfig2
+          ]);
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne('/api/v1/sensor/indexing/config');
+      expect(req.request.method).toBe('GET');
+      req.flush([sensorIndexingConfig1, sensorIndexingConfig2]);
+    });
+
+    it('deleteSensorEnrichments', () => {
+      sensorIndexingConfigService.deleteSensorIndexingConfig('squid').subscribe(
+        result => {
+          expect(result.status).toEqual(200);
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne('/api/v1/sensor/indexing/config/squid');
+      expect(req.request.method).toBe('DELETE');
+      req.flush(deleteResponse);
+    });
   });
-
 });
-
-

http://git-wip-us.apache.org/repos/asf/metron/blob/8bf3b6ec/metron-interface/metron-config/src/app/service/sensor-indexing-config.service.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/app/service/sensor-indexing-config.service.ts b/metron-interface/metron-config/src/app/service/sensor-indexing-config.service.ts
index 958b27d..41e2c00 100644
--- a/metron-interface/metron-config/src/app/service/sensor-indexing-config.service.ts
+++ b/metron-interface/metron-config/src/app/service/sensor-indexing-config.service.ts
@@ -15,44 +15,56 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import {Injectable, Inject} from '@angular/core';
-import {Http, Headers, RequestOptions, Response} from '@angular/http';
-import {Observable} from 'rxjs/Observable';
-import {IndexingConfigurations} from '../model/sensor-indexing-config';
-import {HttpUtil} from '../util/httpUtil';
-import {IAppConfig} from '../app.config.interface';
-import {APP_CONFIG} from '../app.config';
+import { Injectable, Inject } from '@angular/core';
+import { HttpClient, HttpResponse } from '@angular/common/http';
+import { Observable } from 'rxjs';
+import { map, catchError } from 'rxjs/operators';
+
+import { IndexingConfigurations } from '../model/sensor-indexing-config';
+import { HttpUtil } from '../util/httpUtil';
+import { IAppConfig } from '../app.config.interface';
+import { APP_CONFIG } from '../app.config';
 
 @Injectable()
 export class SensorIndexingConfigService {
   url = this.config.apiEndpoint + '/sensor/indexing/config';
-  defaultHeaders = {'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest'};
 
-  constructor(private http: Http, @Inject(APP_CONFIG) private config: IAppConfig) {
-  }
+  constructor(
+    private http: HttpClient,
+    @Inject(APP_CONFIG) private config: IAppConfig
+  ) {}
 
-  public post(name: string, sensorIndexingConfig: IndexingConfigurations): Observable<IndexingConfigurations> {
-    return this.http.post(this.url + '/' + name, JSON.stringify(sensorIndexingConfig),
-                          new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-      .map(HttpUtil.extractData)
-      .catch(HttpUtil.handleError);
+  public post(
+    name: string,
+    sensorIndexingConfig: IndexingConfigurations
+  ): Observable<IndexingConfigurations> {
+    return this.http
+      .post(this.url + '/' + name, JSON.stringify(sensorIndexingConfig))
+      .pipe(
+        map(HttpUtil.extractData),
+        catchError(HttpUtil.handleError)
+      );
   }
 
   public get(name: string): Observable<IndexingConfigurations> {
-    return this.http.get(this.url + '/' + name, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-      .map(HttpUtil.extractData)
-      .catch(HttpUtil.handleError);
+    return this.http.get(this.url + '/' + name).pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
   public getAll(): Observable<IndexingConfigurations[]> {
-    return this.http.get(this.url, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-      .map(HttpUtil.extractData)
-      .catch(HttpUtil.handleError);
+    return this.http.get(this.url).pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
-  public deleteSensorIndexingConfig(name: string): Observable<Response> {
-    return this.http.delete(this.url + '/' + name, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-      .catch(HttpUtil.handleError);
+  public deleteSensorIndexingConfig(
+    name: string
+  ) {
+    return this.http
+      .delete<{}>(this.url + '/' + name)
+      .pipe<HttpResponse<{}>>(catchError(HttpUtil.handleError));
   }
-
 }

http://git-wip-us.apache.org/repos/asf/metron/blob/8bf3b6ec/metron-interface/metron-config/src/app/service/sensor-parser-config-history.service.spec.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/app/service/sensor-parser-config-history.service.spec.ts b/metron-interface/metron-config/src/app/service/sensor-parser-config-history.service.spec.ts
index 3da4065..2170a59 100644
--- a/metron-interface/metron-config/src/app/service/sensor-parser-config-history.service.spec.ts
+++ b/metron-interface/metron-config/src/app/service/sensor-parser-config-history.service.spec.ts
@@ -15,83 +15,64 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import {async, inject, TestBed} from '@angular/core/testing';
-import {MockBackend, MockConnection} from '@angular/http/testing';
-import {SensorParserConfig} from '../model/sensor-parser-config';
-import {HttpModule, XHRBackend, Response, ResponseOptions, Http} from '@angular/http';
-import '../rxjs-operators';
-import {METRON_REST_CONFIG, APP_CONFIG} from '../app.config';
-import {SensorParserConfigHistoryService} from './sensor-parser-config-history.service';
-import {IAppConfig} from '../app.config.interface';
-import {SensorParserConfigHistory} from '../model/sensor-parser-config-history';
+import { TestBed } from '@angular/core/testing';
+import { SensorParserConfig } from '../model/sensor-parser-config';
+import { METRON_REST_CONFIG, APP_CONFIG } from '../app.config';
+import { SensorParserConfigHistoryService } from './sensor-parser-config-history.service';
+import { SensorParserConfigHistory } from '../model/sensor-parser-config-history';
+import {
+  HttpTestingController,
+  HttpClientTestingModule
+} from '@angular/common/http/testing';
 
 describe('SensorParserConfigHistoryService', () => {
+  let mockBackend: HttpTestingController;
+  let sensorParserConfigHistoryService: SensorParserConfigHistoryService;
 
-  beforeEach(async(() => {
+  beforeEach(() => {
     TestBed.configureTestingModule({
-      imports: [HttpModule],
+      imports: [HttpClientTestingModule],
       providers: [
         SensorParserConfigHistoryService,
-        {provide: XHRBackend, useClass: MockBackend},
-        {provide: APP_CONFIG, useValue: METRON_REST_CONFIG}
+        { provide: APP_CONFIG, useValue: METRON_REST_CONFIG }
       ]
-    })
-        .compileComponents();
-  }));
-
-  it('can instantiate service when inject service',
-      inject([SensorParserConfigHistoryService], (service: SensorParserConfigHistoryService) => {
-        expect(service instanceof SensorParserConfigHistoryService).toBe(true);
-      }));
-
-  it('can instantiate service with "new"', inject([Http, APP_CONFIG], (http: Http, config: IAppConfig) => {
-    expect(http).not.toBeNull('http should be provided');
-    let service = new SensorParserConfigHistoryService(http, config);
-    expect(service instanceof SensorParserConfigHistoryService).toBe(true, 'new service should be ok');
-  }));
-
+    });
+    mockBackend = TestBed.get(HttpTestingController);
+    sensorParserConfigHistoryService = TestBed.get(
+      SensorParserConfigHistoryService
+    );
+  });
 
-  it('can provide the mockBackend as XHRBackend',
-      inject([XHRBackend], (backend: MockBackend) => {
-        expect(backend).not.toBeNull('backend should be provided');
-      }));
+  afterAll(() => {
+    mockBackend.verify();
+  });
 
   describe('when service functions', () => {
-    let sensorParserConfigHistoryService: SensorParserConfigHistoryService;
-    let mockBackend: MockBackend;
     let sensorParserConfigHistory = new SensorParserConfigHistory();
-    let sensorParserConfig = new SensorParserConfig();
-    sensorParserConfig.sensorTopic = 'bro';
-    sensorParserConfigHistory.config = sensorParserConfig;
-    let sensorParserConfigHistoryResponse: Response;
-    let allSensorParserConfigHistoryResponse: Response;
-
-    beforeEach(inject([Http, XHRBackend, APP_CONFIG], (http: Http, be: MockBackend, config: IAppConfig) => {
-      mockBackend = be;
-      sensorParserConfigHistoryService = new SensorParserConfigHistoryService(http, config);
-      sensorParserConfigHistoryResponse = new Response(new ResponseOptions({status: 200, body: sensorParserConfig}));
-      allSensorParserConfigHistoryResponse = new Response(new ResponseOptions({status: 200, body: [sensorParserConfig]}));
-    }));
-
-    it('get', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(sensorParserConfigHistoryResponse));
+    sensorParserConfigHistory.config = new SensorParserConfig();
 
+    it('get', () => {
       sensorParserConfigHistoryService.get('bro').subscribe(
-          result => {
-            expect(result).toEqual(sensorParserConfigHistory);
-          }, error => console.log(error));
-    })));
-
-    it('getAll', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(allSensorParserConfigHistoryResponse));
+        result => {
+          expect(result).toEqual(sensorParserConfigHistory);
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne('/api/v1/sensor/parser/config/bro');
+      expect(req.request.method).toBe('GET');
+      req.flush(sensorParserConfigHistory.config);
+    });
 
+    it('getAll', () => {
       sensorParserConfigHistoryService.getAll().subscribe(
-          result => {
-            expect(result).toEqual([sensorParserConfigHistory]);
-          }, error => console.log(error));
-    })));
+        result => {
+          expect(result).toEqual([sensorParserConfigHistory]);
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne('/api/v1/sensor/parser/config');
+      expect(req.request.method).toBe('GET');
+      req.flush([sensorParserConfigHistory.config]);
+    });
   });
-
 });
-
-

http://git-wip-us.apache.org/repos/asf/metron/blob/8bf3b6ec/metron-interface/metron-config/src/app/service/sensor-parser-config-history.service.ts
----------------------------------------------------------------------
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 bd5cbc5..a7a73b2 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
@@ -15,47 +15,50 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import {Injectable, Inject} from '@angular/core';
-import {Http, Headers, RequestOptions, Response} from '@angular/http';
-import {Observable} from 'rxjs/Observable';
-import {HttpUtil} from '../util/httpUtil';
-import {IAppConfig} from '../app.config.interface';
-import {SensorParserConfigHistory} from '../model/sensor-parser-config-history';
-import {APP_CONFIG} from '../app.config';
-import {SensorParserConfig} from '../model/sensor-parser-config';
+import { Injectable, Inject } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import { Observable } from 'rxjs';
+import { map, catchError } from 'rxjs/operators';
+import { HttpUtil } from '../util/httpUtil';
+import { IAppConfig } from '../app.config.interface';
+import { SensorParserConfigHistory } from '../model/sensor-parser-config-history';
+import { APP_CONFIG } from '../app.config';
+import { SensorParserConfig } from '../model/sensor-parser-config';
+import { RestError } from '../model/rest-error';
 
 @Injectable()
 export class SensorParserConfigHistoryService {
-  url =  this.config.apiEndpoint + '/sensor/parser/config';
-  defaultHeaders = {'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest'};
+  url = this.config.apiEndpoint + '/sensor/parser/config';
 
-  constructor(private http: Http, @Inject(APP_CONFIG) private config: IAppConfig) {
+  constructor(
+    private http: HttpClient,
+    @Inject(APP_CONFIG) private config: IAppConfig
+  ) {}
 
-  }
-
-  public get(name: string): Observable<SensorParserConfigHistory> {
-    return this.http.get(this.url + '/' + name, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-      .map((response: Response) => {
+  public get(name: string): Observable<RestError | SensorParserConfigHistory> {
+    return this.http.get(this.url + '/' + name).pipe(
+      map((response: SensorParserConfig) => {
         let sensorParserConfigHistory = new SensorParserConfigHistory();
-        sensorParserConfigHistory.config = response.json();
+        sensorParserConfigHistory.config = response;
         return sensorParserConfigHistory;
-      })
-      .catch(HttpUtil.handleError);
+      }),
+      catchError(HttpUtil.handleError)
+    );
   }
 
-  public getAll(): Observable<SensorParserConfigHistory[]> {
-    return this.http.get(this.url, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-      .map((response: Response) => {
+  public getAll(): Observable<SensorParserConfigHistory[] | RestError> {
+    return this.http.get(this.url).pipe(
+      map((response: SensorParserConfig[]) => {
         let sensorParserConfigHistoryArray = [];
-        let sensorParserConfigs: SensorParserConfig[] = response.json();
+        let sensorParserConfigs: SensorParserConfig[] = response;
         for (let sensorParserConfig of sensorParserConfigs) {
           let sensorParserConfigHistory = new SensorParserConfigHistory();
           sensorParserConfigHistory.config = sensorParserConfig;
           sensorParserConfigHistoryArray.push(sensorParserConfigHistory);
         }
         return sensorParserConfigHistoryArray;
-      })
-      .catch(HttpUtil.handleError);
+      }),
+      catchError(HttpUtil.handleError)
+    );
   }
-
 }

http://git-wip-us.apache.org/repos/asf/metron/blob/8bf3b6ec/metron-interface/metron-config/src/app/service/sensor-parser-config.service.spec.ts
----------------------------------------------------------------------
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 c42f127..4f2750e 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
@@ -15,135 +15,117 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import {async, inject, TestBed} from '@angular/core/testing';
-import {MockBackend, MockConnection} from '@angular/http/testing';
-import {SensorParserConfigService} from './sensor-parser-config.service';
-import {SensorParserConfig} from '../model/sensor-parser-config';
-import {ParseMessageRequest} from '../model/parse-message-request';
-import {HttpModule, XHRBackend, Response, ResponseOptions, Http} from '@angular/http';
-import '../rxjs-operators';
-import {APP_CONFIG, METRON_REST_CONFIG} from '../app.config';
-import {IAppConfig} from '../app.config.interface';
+import { TestBed } from '@angular/core/testing';
+import { SensorParserConfigService } from './sensor-parser-config.service';
+import { SensorParserConfig } from '../model/sensor-parser-config';
+import { ParseMessageRequest } from '../model/parse-message-request';
+import { APP_CONFIG, METRON_REST_CONFIG } from '../app.config';
+import {
+  HttpClientTestingModule,
+  HttpTestingController
+} from '@angular/common/http/testing';
 
 describe('SensorParserConfigService', () => {
+  let mockBackend: HttpTestingController;
+  let sensorParserConfigService: SensorParserConfigService;
 
-  beforeEach(async(() => {
+  beforeEach(() => {
     TestBed.configureTestingModule({
-      imports: [HttpModule],
+      imports: [HttpClientTestingModule],
       providers: [
         SensorParserConfigService,
-        {provide: XHRBackend, useClass: MockBackend},
-        {provide: APP_CONFIG, useValue: METRON_REST_CONFIG}
+        { provide: APP_CONFIG, useValue: METRON_REST_CONFIG }
       ]
-    })
-      .compileComponents();
-  }));
-
-  it('can instantiate service when inject service',
-    inject([SensorParserConfigService], (service: SensorParserConfigService) => {
-      expect(service instanceof SensorParserConfigService).toBe(true);
-    }));
-
-  it('can instantiate service with "new"', inject([Http, APP_CONFIG], (http: Http, config: IAppConfig) => {
-    expect(http).not.toBeNull('http should be provided');
-    let service = new SensorParserConfigService(http, config);
-    expect(service instanceof SensorParserConfigService).toBe(true, 'new service should be ok');
-  }));
-
-
-  it('can provide the mockBackend as XHRBackend',
-    inject([XHRBackend], (backend: MockBackend) => {
-      expect(backend).not.toBeNull('backend should be provided');
-    }));
-
-  describe('when service functions', () => {
-    let sensorParserConfigService: SensorParserConfigService;
-    let mockBackend: MockBackend;
-    let sensorParserConfig = new SensorParserConfig();
-    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.sensorTopic = 'bro';
-    parseMessageRequest.sampleData = 'sampleData';
-    let parsedMessage = { 'field': 'value'};
-    let sensorParserConfig1 = new SensorParserConfig();
-    sensorParserConfig1.sensorTopic = 'bro1';
-    let sensorParserConfig2 = new SensorParserConfig();
-    sensorParserConfig2.sensorTopic = 'bro2';
-    let deleteResult = {success: ['bro1', 'bro2']};
-    let sensorParserConfigResponse: Response;
-    let sensorParserConfigsResponse: Response;
-    let availableParserResponse: Response;
-    let parseMessageResponse: Response;
-    let deleteResponse: Response;
-
-    beforeEach(inject([Http, XHRBackend, APP_CONFIG], (http: Http, be: MockBackend, config: IAppConfig) => {
-      mockBackend = be;
-      sensorParserConfigService = new SensorParserConfigService(http, config);
-      sensorParserConfigResponse = new Response(new ResponseOptions({status: 200, body: sensorParserConfig}));
-      sensorParserConfigsResponse = new Response(new ResponseOptions({status: 200, body: [sensorParserConfig]}));
-      availableParserResponse = new Response(new ResponseOptions({status: 200, body: availableParsers}));
-      parseMessageResponse = new Response(new ResponseOptions({status: 200, body: parsedMessage}));
-      deleteResponse = new Response(new ResponseOptions({status: 200, body: deleteResult}));
-    }));
+    });
+    mockBackend = TestBed.get(HttpTestingController);
+    sensorParserConfigService = TestBed.get(SensorParserConfigService);
+  });
 
-    it('post', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(sensorParserConfigResponse));
+  afterEach(() => {
+    mockBackend.verify();
+  });
 
-      sensorParserConfigService.post('bro', sensorParserConfig).subscribe(
-      result => {
+  let sensorParserConfig = new SensorParserConfig();
+  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.sensorTopic = 'bro';
+  parseMessageRequest.sampleData = 'sampleData';
+  let parsedMessage = { field: 'value' };
+  let sensorParserConfig1 = new SensorParserConfig();
+  sensorParserConfig1.sensorTopic = 'bro1';
+  let sensorParserConfig2 = new SensorParserConfig();
+  sensorParserConfig2.sensorTopic = 'bro2';
+
+  it('post', () => {
+    sensorParserConfigService
+      .post('bro', sensorParserConfig)
+      .subscribe(result => {
         expect(result).toEqual(sensorParserConfig);
-      }, error => console.log(error));
-    })));
-
-    it('get', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(sensorParserConfigResponse));
-
-      sensorParserConfigService.get('bro').subscribe(
-        result => {
-          expect(result).toEqual(sensorParserConfig);
-        }, error => console.log(error));
-    })));
-
-    it('getAll', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(sensorParserConfigsResponse));
-
-      sensorParserConfigService.getAll().subscribe(
-        results => {
-          expect(results).toEqual([sensorParserConfig]);
-        }, error => console.log(error));
-    })));
+      });
 
-    it('getAvailableParsers', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(availableParserResponse));
+    const req = mockBackend.expectOne('/api/v1/sensor/parser/config/bro');
+    expect(req.request.method).toBe('POST');
+    req.flush(sensorParserConfig);
+  });
 
-      sensorParserConfigService.getAvailableParsers().subscribe(
-        results => {
-          expect(results).toEqual(availableParsers);
-        }, error => console.log(error));
-    })));
+  it('get', () => {
+    sensorParserConfigService.get('bro').subscribe(result => {
+      expect(result).toEqual(sensorParserConfig);
+    });
+    const req = mockBackend.expectOne('/api/v1/sensor/parser/config/bro');
+    expect(req.request.method).toBe('GET');
+    req.flush(sensorParserConfig);
+  });
 
-    it('parseMessage', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(parseMessageResponse));
+  it('getAll', () => {
+    sensorParserConfigService.getAll().subscribe(results => {
+      expect(results).toEqual([sensorParserConfig]);
+    });
+    const req = mockBackend.expectOne('/api/v1/sensor/parser/config');
+    expect(req.request.method).toBe('GET');
+    req.flush([sensorParserConfig]);
+  });
 
-      sensorParserConfigService.parseMessage(parseMessageRequest).subscribe(
-        results => {
-          expect(results).toEqual(parsedMessage);
-        }, error => console.log(error));
-    })));
+  it('getAvailableParsers', () => {
+    sensorParserConfigService.getAvailableParsers().subscribe(results => {
+      expect(results).toEqual(availableParsers);
+    });
+    const req = mockBackend.expectOne(
+      '/api/v1/sensor/parser/config/list/available'
+    );
+    expect(req.request.method).toBe('GET');
+    req.flush(availableParsers);
+  });
 
-    it('deleteSensorParserConfigs', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(deleteResponse));
+  it('parseMessage', () => {
+    sensorParserConfigService
+      .parseMessage(parseMessageRequest)
+      .subscribe(results => {
+        expect(results).toEqual(parsedMessage);
+      });
+    const req = mockBackend.expectOne(
+      '/api/v1/sensor/parser/config/parseMessage'
+    );
+    expect(req.request.method).toBe('POST');
+    req.flush(parsedMessage);
+  });
 
-      sensorParserConfigService.deleteSensorParserConfigs(['bro1', 'bro2']).subscribe(result => {
+  it('deleteSensorParserConfigs', () => {
+    let req = [];
+    sensorParserConfigService
+      .deleteSensorParserConfigs(['bro1', 'bro2'])
+      .subscribe(result => {
         expect(result.success.length).toEqual(2);
       });
-    })));
+    req[0] = mockBackend.expectOne('/api/v1/sensor/parser/config/bro1');
+    req[1] = mockBackend.expectOne('/api/v1/sensor/parser/config/bro2');
+    req.map(r => {
+      expect(r.request.method).toBe('DELETE');
+      r.flush(parsedMessage);
+    });
   });
-
 });
-
-

http://git-wip-us.apache.org/repos/asf/metron/blob/8bf3b6ec/metron-interface/metron-config/src/app/service/sensor-parser-config.service.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/app/service/sensor-parser-config.service.ts b/metron-interface/metron-config/src/app/service/sensor-parser-config.service.ts
index 7f1afa2..b7107d3 100644
--- a/metron-interface/metron-config/src/app/service/sensor-parser-config.service.ts
+++ b/metron-interface/metron-config/src/app/service/sensor-parser-config.service.ts
@@ -15,69 +15,88 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import {Injectable, Inject}     from '@angular/core';
-import {Http, Headers, RequestOptions, Response} from '@angular/http';
-import {Observable}     from 'rxjs/Observable';
-import {SensorParserConfig} from '../model/sensor-parser-config';
-import {HttpUtil} from '../util/httpUtil';
-import {Subject}    from 'rxjs/Subject';
-import {ParseMessageRequest} from '../model/parse-message-request';
-import {IAppConfig} from '../app.config.interface';
-import {APP_CONFIG} from '../app.config';
+import { Injectable, Inject } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import { Observable, Subject } from 'rxjs';
+import { catchError, map } from 'rxjs/operators';
+import { SensorParserConfig } from '../model/sensor-parser-config';
+import { HttpUtil } from '../util/httpUtil';
+import { ParseMessageRequest } from '../model/parse-message-request';
+import { RestError } from '../model/rest-error';
+import { IAppConfig } from '../app.config.interface';
+import { APP_CONFIG } from '../app.config';
 
 @Injectable()
 export class SensorParserConfigService {
   url = this.config.apiEndpoint + '/sensor/parser/config';
-  defaultHeaders = {'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest'};
   selectedSensorParserConfig: SensorParserConfig;
 
   dataChangedSource = new Subject<string[]>();
   dataChanged$ = this.dataChangedSource.asObservable();
 
-  constructor(private http: Http, @Inject(APP_CONFIG) private config: IAppConfig) {
-
-  }
-
-  public post(name: string, sensorParserConfig: SensorParserConfig): Observable<SensorParserConfig> {
-    return this.http.post(this.url + '/' + name, JSON.stringify(sensorParserConfig),
-        new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-      .map(HttpUtil.extractData)
-      .catch(HttpUtil.handleError);
+  constructor(
+    private http: HttpClient,
+    @Inject(APP_CONFIG) private config: IAppConfig
+  ) {}
+
+  public post(
+    name: string,
+    sensorParserConfig: SensorParserConfig
+  ): Observable<SensorParserConfig> {
+    return this.http
+      .post(this.url + '/' + name, JSON.stringify(sensorParserConfig))
+      .pipe(
+        map(HttpUtil.extractData),
+        catchError(HttpUtil.handleError)
+      );
   }
 
   public get(name: string): Observable<SensorParserConfig> {
-    return this.http.get(this.url + '/' + name, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-      .map(HttpUtil.extractData)
-      .catch(HttpUtil.handleError);
+    return this.http.get(this.url + '/' + name).pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
   public getAll(): Observable<{}> {
-    return this.http.get(this.url, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-      .map(HttpUtil.extractData)
-      .catch(HttpUtil.handleError);
+    return this.http.get(this.url).pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
-  public deleteSensorParserConfig(name: string): Observable<Response> {
-    return this.http.delete(this.url + '/' + name, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-      .catch(HttpUtil.handleError);
+  public deleteSensorParserConfig(
+    name: string
+  ): Observable<Object | RestError> {
+    return this.http
+      .delete(this.url + '/' + name)
+      .pipe(catchError(HttpUtil.handleError));
   }
 
   public getAvailableParsers(): Observable<{}> {
-    return this.http.get(this.url + '/list/available', new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-      .map(HttpUtil.extractData)
-      .catch(HttpUtil.handleError);
+    return this.http.get(this.url + '/list/available').pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
-  public parseMessage(parseMessageRequest: ParseMessageRequest): Observable<{}> {
-    return this.http.post(this.url + '/parseMessage', parseMessageRequest, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-      .map(HttpUtil.extractData)
-      .catch(HttpUtil.handleError);
+  public parseMessage(
+    parseMessageRequest: ParseMessageRequest
+  ): Observable<{}> {
+    return this.http.post(this.url + '/parseMessage', parseMessageRequest).pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
-  public deleteSensorParserConfigs(sensorNames: string[]): Observable<{success: Array<string>, failure: Array<string>}> {
-    let result: {success: Array<string>, failure: Array<string>} = {success: [], failure: []};
-    let observable = Observable.create((observer => {
-
+  public deleteSensorParserConfigs(
+    sensorNames: string[]
+  ): Observable<{ success: Array<string>; failure: Array<string> }> {
+    let result: { success: Array<string>; failure: Array<string> } = {
+      success: [],
+      failure: []
+    };
+    let observable = Observable.create(observer => {
       let completed = () => {
         if (observer) {
           observer.next(result);
@@ -87,22 +106,29 @@ export class SensorParserConfigService {
         this.dataChangedSource.next(sensorNames);
       };
       for (let i = 0; i < sensorNames.length; i++) {
-        this.deleteSensorParserConfig(sensorNames[i]).subscribe(results => {
-          result.success.push(sensorNames[i]);
-          if (result.success.length + result.failure.length === sensorNames.length) {
-            completed();
+        this.deleteSensorParserConfig(sensorNames[i]).subscribe(
+          results => {
+            result.success.push(sensorNames[i]);
+            if (
+              result.success.length + result.failure.length ===
+              sensorNames.length
+            ) {
+              completed();
+            }
+          },
+          error => {
+            result.failure.push(sensorNames[i]);
+            if (
+              result.success.length + result.failure.length ===
+              sensorNames.length
+            ) {
+              completed();
+            }
           }
-        }, error => {
-          result.failure.push(sensorNames[i]);
-          if (result.success.length + result.failure.length === sensorNames.length) {
-            completed();
-          }
-        });
+        );
       }
-
-    }));
+    });
 
     return observable;
   }
-
 }

http://git-wip-us.apache.org/repos/asf/metron/blob/8bf3b6ec/metron-interface/metron-config/src/app/service/stellar.service.spec.ts
----------------------------------------------------------------------
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 163eefb..da329dc 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
@@ -15,128 +15,111 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import {async, inject, TestBed} from '@angular/core/testing';
-import {MockBackend, MockConnection} from '@angular/http/testing';
-import {StellarService} from './stellar.service';
-import {SensorParserContext} from '../model/sensor-parser-context';
-import {SensorParserConfig} from '../model/sensor-parser-config';
-import {HttpModule, XHRBackend, Response, ResponseOptions, Http} from '@angular/http';
-import '../rxjs-operators';
-import {APP_CONFIG, METRON_REST_CONFIG} from '../app.config';
-import {IAppConfig} from '../app.config.interface';
+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 { APP_CONFIG, METRON_REST_CONFIG } from '../app.config';
+import {
+  HttpClientTestingModule,
+  HttpTestingController
+} from '@angular/common/http/testing';
+import { StellarFunctionDescription } from '../model/stellar-function-description';
 
 describe('StellarService', () => {
+  let mockBackend: HttpTestingController;
+  let transformationValidationService: StellarService;
 
-  beforeEach(async(() => {
+  beforeEach(() => {
     TestBed.configureTestingModule({
-      imports: [HttpModule],
+      imports: [HttpClientTestingModule],
       providers: [
         StellarService,
-        {provide: XHRBackend, useClass: MockBackend},
-        {provide: APP_CONFIG, useValue: METRON_REST_CONFIG}
+        { provide: APP_CONFIG, useValue: METRON_REST_CONFIG }
       ]
-    })
-      .compileComponents();
-  }));
-
-  it('can instantiate service when inject service',
-    inject([StellarService], (service: StellarService) => {
-      expect(service instanceof StellarService).toBe(true);
-    }));
-
-  it('can instantiate service with "new"', inject([Http, APP_CONFIG], (http: Http, config: IAppConfig) => {
-    expect(http).not.toBeNull('http should be provided');
-    let service = new StellarService(http, config);
-    expect(service instanceof StellarService).toBe(true, 'new service should be ok');
-  }));
-
-
-  it('can provide the mockBackend as XHRBackend',
-    inject([XHRBackend], (backend: MockBackend) => {
-      expect(backend).not.toBeNull('backend should be provided');
-    }));
+    });
+    mockBackend = TestBed.get(HttpTestingController);
+    transformationValidationService = TestBed.get(StellarService);
+  });
 
   describe('when service functions', () => {
-    let transformationValidationService: StellarService;
-    let mockBackend: MockBackend;
     let transformationRules = ['rule1', 'rule2'];
-    let transformationRulesValidation = {rule1: true, rule2: false};
+    let transformationRulesValidation = { rule1: true, rule2: false };
     let transformationValidation = new SensorParserContext();
-    transformationValidation.sampleData = {'data': 'data'};
+    transformationValidation.sampleData = { data: 'data' };
     transformationValidation.sensorParserConfig = new SensorParserConfig();
     transformationValidation.sensorParserConfig.sensorTopic = 'test';
     let transformations = ['STELLAR', 'REMOVE'];
-    let transformFunctions = [{'function1': 'desc1'}, {'function2': 'desc2'}];
-    let simpleTransformFunctions = [{'simplefunction1': 'simpledesc1'}, {'simplefunction2': 'simpledesc2'}];
-    let transformationRulesValidationResponse: Response;
-    let transformationValidationResponse: Response;
-    let transformationListResponse: Response;
-    let transformationListFunctionsResponse: Response;
-    let transformationListSimpleFunctionsResponse: Response;
-
-    beforeEach(inject([Http, XHRBackend, APP_CONFIG], (http: Http, be: MockBackend, config: IAppConfig) => {
-      mockBackend = be;
-      transformationValidationService = new StellarService(http, config);
-      transformationRulesValidationResponse = new Response(new ResponseOptions({
-        status: 200,
-        body: transformationRulesValidation
-      }));
-      transformationValidationResponse = new Response(new ResponseOptions({
-        status: 200,
-        body: transformationValidation
-      }));
-      transformationListResponse = new Response(new ResponseOptions({status: 200, body: transformations}));
-      transformationListFunctionsResponse = new Response(new ResponseOptions({status: 200, body: transformFunctions}));
-      transformationListSimpleFunctionsResponse = new Response(new ResponseOptions({status: 200, body: simpleTransformFunctions}));
-    }));
-
-    it('validateRules', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(transformationRulesValidationResponse));
-
-      transformationValidationService.validateRules(transformationRules).subscribe(
-        result => {
-          expect(result).toEqual(transformationRulesValidation);
-        }, error => console.log(error));
-    })));
-
-    it('validate', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(transformationValidationResponse));
-
-      transformationValidationService.validate(transformationValidation).subscribe(
-        result => {
-          expect(result).toEqual(transformationValidation);
-        }, error => console.log(error));
-    })));
-
-    it('list', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(transformationListResponse));
-
+    let transformFunctions: StellarFunctionDescription[] = [
+      { name: 'function1', description: 'desc1', params: [], returns: '' },
+      { name: 'function2', description: 'desc2', params: [], returns: '' }
+    ];
+    let simpleTransformFunctions = Object.assign([], transformFunctions);
+
+    it('validateRules', () => {
+      transformationValidationService
+        .validateRules(transformationRules)
+        .subscribe(
+          result => {
+            expect(result).toEqual(transformationRulesValidation);
+          },
+          error => console.log(error)
+        );
+      const req = mockBackend.expectOne('/api/v1/stellar/validate/rules');
+      expect(req.request.method).toBe('POST');
+      req.flush(transformationRulesValidation);
+    });
+
+    it('validate', () => {
+      transformationValidationService
+        .validate(transformationValidation)
+        .subscribe(
+          result => {
+            expect(result).toEqual(transformationValidation);
+          },
+          error => console.log(error)
+        );
+      const req = mockBackend.expectOne('/api/v1/stellar/validate');
+      expect(req.request.method).toBe('POST');
+      req.flush(transformationValidation);
+    });
+
+    it('list', () => {
       transformationValidationService.list().subscribe(
         result => {
           expect(result).toEqual(transformations);
-        }, error => console.log(error));
-    })));
-
-    it('listFunctions', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(transformationListFunctionsResponse));
-
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne('/api/v1/stellar/list');
+      expect(req.request.method).toBe('GET');
+      req.flush(transformations);
+    });
+
+    it('listFunctions', () => {
       transformationValidationService.listFunctions().subscribe(
         result => {
           expect(result).toEqual(transformFunctions);
-        }, error => console.log(error));
-    })));
-
-    it('listSimpleFunctions', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(transformationListSimpleFunctionsResponse));
-
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne('/api/v1/stellar/list/functions');
+      expect(req.request.method).toBe('GET');
+      req.flush(transformFunctions);
+    });
+
+    it('listSimpleFunctions', () => {
       transformationValidationService.listSimpleFunctions().subscribe(
-          result => {
-            expect(result).toEqual(simpleTransformFunctions);
-          }, error => console.log(error));
-    })));
+        result => {
+          expect(result).toEqual(simpleTransformFunctions);
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne(
+        '/api/v1/stellar/list/simple/functions'
+      );
+      expect(req.request.method).toBe('GET');
+      req.flush(simpleTransformFunctions);
+    });
   });
-
 });
-
-
-

http://git-wip-us.apache.org/repos/asf/metron/blob/8bf3b6ec/metron-interface/metron-config/src/app/service/stellar.service.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/app/service/stellar.service.ts b/metron-interface/metron-config/src/app/service/stellar.service.ts
index be04906..97cb019 100644
--- a/metron-interface/metron-config/src/app/service/stellar.service.ts
+++ b/metron-interface/metron-config/src/app/service/stellar.service.ts
@@ -15,54 +15,64 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import {Injectable, Inject} from '@angular/core';
-import {Http, Headers, RequestOptions} from '@angular/http';
-import {Observable} from 'rxjs/Observable';
-import {SensorParserContext} from '../model/sensor-parser-context';
-import {HttpUtil} from '../util/httpUtil';
-import {StellarFunctionDescription} from '../model/stellar-function-description';
-import {IAppConfig} from '../app.config.interface';
-import {APP_CONFIG} from '../app.config';
+import { Injectable, Inject } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import { Observable } from 'rxjs';
+import { map, catchError } from 'rxjs/operators';
+
+import { SensorParserContext } from '../model/sensor-parser-context';
+import { HttpUtil } from '../util/httpUtil';
+import { StellarFunctionDescription } from '../model/stellar-function-description';
+import { IAppConfig } from '../app.config.interface';
+import { APP_CONFIG } from '../app.config';
 
 @Injectable()
 export class StellarService {
   url = this.config.apiEndpoint + '/stellar';
-  defaultHeaders = {'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest'};
-
-  constructor(private http: Http, @Inject(APP_CONFIG) private config: IAppConfig) {
 
-  }
+  constructor(
+    private http: HttpClient,
+    @Inject(APP_CONFIG) private config: IAppConfig
+  ) {}
 
   public validateRules(rules: string[]): Observable<{}> {
-    return this.http.post(this.url + '/validate/rules', JSON.stringify(rules),
-      new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-      .map(HttpUtil.extractData)
-      .catch(HttpUtil.handleError);
+    return this.http
+      .post(this.url + '/validate/rules', JSON.stringify(rules))
+      .pipe(
+        map(HttpUtil.extractData),
+        catchError(HttpUtil.handleError)
+      );
   }
 
-  public validate(transformationValidation: SensorParserContext): Observable<{}> {
-    return this.http.post(this.url + '/validate', JSON.stringify(transformationValidation),
-      new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-      .map(HttpUtil.extractData)
-      .catch(HttpUtil.handleError);
+  public validate(
+    transformationValidation: SensorParserContext
+  ): Observable<{}> {
+    return this.http
+      .post(this.url + '/validate', JSON.stringify(transformationValidation))
+      .pipe(
+        map(HttpUtil.extractData),
+        catchError(HttpUtil.handleError)
+      );
   }
 
   public list(): Observable<string[]> {
-    return this.http.get(this.url + '/list', new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-      .map(HttpUtil.extractData)
-      .catch(HttpUtil.handleError);
+    return this.http.get(this.url + '/list').pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
   public listFunctions(): Observable<StellarFunctionDescription[]> {
-    return this.http.get(this.url + '/list/functions', new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-      .map(HttpUtil.extractData)
-      .catch(HttpUtil.handleError);
+    return this.http.get(this.url + '/list/functions').pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
   public listSimpleFunctions(): Observable<StellarFunctionDescription[]> {
-    return this.http.get(this.url + '/list/simple/functions', new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-      .map(HttpUtil.extractData)
-      .catch(HttpUtil.handleError);
+    return this.http.get(this.url + '/list/simple/functions').pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
-
 }

http://git-wip-us.apache.org/repos/asf/metron/blob/8bf3b6ec/metron-interface/metron-config/src/app/service/storm.service.spec.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/app/service/storm.service.spec.ts b/metron-interface/metron-config/src/app/service/storm.service.spec.ts
index 528c1c3..840aff8 100644
--- a/metron-interface/metron-config/src/app/service/storm.service.spec.ts
+++ b/metron-interface/metron-config/src/app/service/storm.service.spec.ts
@@ -15,50 +15,33 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import {async, inject, TestBed} from '@angular/core/testing';
-import {MockBackend, MockConnection} from '@angular/http/testing';
-import {TopologyStatus} from '../model/topology-status';
-import {TopologyResponse} from '../model/topology-response';
-import {HttpModule, XHRBackend, Response, ResponseOptions, Http} from '@angular/http';
-import '../rxjs-operators';
-import {APP_CONFIG, METRON_REST_CONFIG} from '../app.config';
-import {IAppConfig} from '../app.config.interface';
-import {StormService} from './storm.service';
+import { TestBed } from '@angular/core/testing';
+import { TopologyStatus } from '../model/topology-status';
+import { TopologyResponse } from '../model/topology-response';
+import { APP_CONFIG, METRON_REST_CONFIG } from '../app.config';
+import { StormService } from './storm.service';
+import {
+  HttpTestingController,
+  HttpClientTestingModule
+} from '@angular/common/http/testing';
 
 describe('StormService', () => {
+  let mockBackend: HttpTestingController;
+  let stormService: StormService;
 
-  beforeEach(async(() => {
+  beforeEach(() => {
     TestBed.configureTestingModule({
-      imports: [HttpModule],
+      imports: [HttpClientTestingModule],
       providers: [
         StormService,
-        {provide: XHRBackend, useClass: MockBackend},
-        {provide: APP_CONFIG, useValue: METRON_REST_CONFIG}
+        { provide: APP_CONFIG, useValue: METRON_REST_CONFIG }
       ]
-    })
-        .compileComponents();
-  }));
-
-  it('can instantiate service when inject service',
-      inject([StormService], (service: StormService) => {
-        expect(service instanceof StormService).toBe(true);
-      }));
-
-  it('can instantiate service with "new"', inject([Http, APP_CONFIG], (http: Http, config: IAppConfig) => {
-    expect(http).not.toBeNull('http should be provided');
-    let service = new StormService(http, config);
-    expect(service instanceof StormService).toBe(true, 'new service should be ok');
-  }));
-
-
-  it('can provide the mockBackend as XHRBackend',
-      inject([XHRBackend], (backend: MockBackend) => {
-        expect(backend).not.toBeNull('backend should be provided');
-      }));
+    });
+    mockBackend = TestBed.get(HttpTestingController);
+    stormService = TestBed.get(StormService);
+  });
 
   describe('when service functions', () => {
-    let stormService: StormService;
-    let mockBackend: MockBackend;
     let allStatuses: TopologyStatus[] = [];
     let broStatus = new TopologyStatus();
     broStatus.name = 'bro';
@@ -75,178 +58,213 @@ describe('StormService', () => {
     indexingStatus.id = 'indexingid';
     indexingStatus.status = 'ACTIVE';
     allStatuses.push(indexingStatus);
-    let startMessage: TopologyResponse = {status: 'success', message: 'STARTED'};
-    let stopMessage: TopologyResponse = {status: 'success', message: 'STOPPED'};
-    let activateMessage: TopologyResponse = {status: 'success', message: 'ACTIVE'};
-    let deactivateMessage: TopologyResponse = {status: 'success', message: 'INACTIVE'};
-    let allStatusesResponse: Response;
-    let enrichmentStatusResponse: Response;
-    let indexingStatusResponse: Response;
-    let broStatusResponse: Response;
-    let startResponse: Response;
-    let stopResponse: Response;
-    let activateResponse: Response;
-    let deactivateResponse: Response;
-
-    beforeEach(inject([Http, XHRBackend, APP_CONFIG], (http: Http, be: MockBackend, config: IAppConfig) => {
-      mockBackend = be;
-      stormService = new StormService(http, config);
-      allStatusesResponse = new Response(new ResponseOptions({status: 200, body: allStatuses}));
-      enrichmentStatusResponse = new Response(new ResponseOptions({status: 200, body: enrichmentStatus}));
-      indexingStatusResponse = new Response(new ResponseOptions({status: 200, body: indexingStatus}));
-      broStatusResponse = new Response(new ResponseOptions({status: 200, body: broStatus}));
-      startResponse = new Response(new ResponseOptions({status: 200, body: startMessage}));
-      stopResponse = new Response(new ResponseOptions({status: 200, body: stopMessage}));
-      activateResponse = new Response(new ResponseOptions({status: 200, body: activateMessage}));
-      deactivateResponse = new Response(new ResponseOptions({status: 200, body: deactivateMessage}));
-    }));
-
-    it('getAll', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(allStatusesResponse));
-
+    let startMessage: TopologyResponse = {
+      status: 'success',
+      message: 'STARTED'
+    };
+    let stopMessage: TopologyResponse = {
+      status: 'success',
+      message: 'STOPPED'
+    };
+    let activateMessage: TopologyResponse = {
+      status: 'success',
+      message: 'ACTIVE'
+    };
+    let deactivateMessage: TopologyResponse = {
+      status: 'success',
+      message: 'INACTIVE'
+    };
+
+    it('getAll', () => {
       stormService.getAll().subscribe(
-          result => {
-            expect(result).toEqual(allStatuses);
-          }, error => console.log(error));
-    })));
-
-    it('getEnrichmentStatus', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(enrichmentStatusResponse));
-
+        result => {
+          expect(result).toEqual(allStatuses);
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne('/api/v1/storm');
+      expect(req.request.method).toBe('GET');
+      req.flush(allStatuses);
+    });
+
+    it('getEnrichmentStatus', () => {
       stormService.getEnrichmentStatus().subscribe(
-          result => {
-            expect(result).toEqual(enrichmentStatus);
-          }, error => console.log(error));
-    })));
-
-    it('activateEnrichment', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(activateResponse));
-
+        result => {
+          expect(result).toEqual(enrichmentStatus);
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne('/api/v1/storm/enrichment');
+      expect(req.request.method).toBe('GET');
+      req.flush(enrichmentStatus);
+    });
+
+    it('activateEnrichment', () => {
       stormService.activateEnrichment().subscribe(
-          result => {
-            expect(result).toEqual(activateMessage);
-          }, error => console.log(error));
-    })));
-
-    it('deactivateEnrichment', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(deactivateResponse));
-
+        result => {
+          expect(result).toEqual(activateMessage);
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne('/api/v1/storm/enrichment/activate');
+      expect(req.request.method).toBe('GET');
+      req.flush(activateMessage);
+    });
+
+    it('deactivateEnrichment', () => {
       stormService.deactivateEnrichment().subscribe(
-          result => {
-            expect(result).toEqual(deactivateMessage);
-          }, error => console.log(error));
-    })));
-
-    it('startEnrichment', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(startResponse));
-
+        result => {
+          expect(result).toEqual(deactivateMessage);
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne('/api/v1/storm/enrichment/deactivate');
+      expect(req.request.method).toBe('GET');
+      req.flush(deactivateMessage);
+    });
+
+    it('startEnrichment', () => {
       stormService.startEnrichment().subscribe(
-          result => {
-            expect(result).toEqual(startMessage);
-          }, error => console.log(error));
-    })));
-
-    it('stopEnrichment', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(stopResponse));
-
+        result => {
+          expect(result).toEqual(startMessage);
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne('/api/v1/storm/enrichment/start');
+      expect(req.request.method).toBe('GET');
+      req.flush(startMessage);
+    });
+
+    it('stopEnrichment', () => {
       stormService.stopEnrichment().subscribe(
-          result => {
-            expect(result).toEqual(stopMessage);
-          }, error => console.log(error));
-    })));
-
-    it('getIndexingStatus', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(indexingStatusResponse));
-
+        result => {
+          expect(result).toEqual(stopMessage);
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne('/api/v1/storm/enrichment/stop');
+      expect(req.request.method).toBe('GET');
+      req.flush(stopMessage);
+    });
+
+    it('getIndexingStatus', () => {
       stormService.getIndexingStatus().subscribe(
-          result => {
-            expect(result).toEqual(indexingStatus);
-          }, error => console.log(error));
-    })));
-
-    it('activateIndexing', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(activateResponse));
-
+        result => {
+          expect(result).toEqual(indexingStatus);
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne('/api/v1/storm/indexing');
+      expect(req.request.method).toBe('GET');
+      req.flush(indexingStatus);
+    });
+
+    it('activateIndexing', () => {
       stormService.activateIndexing().subscribe(
-          result => {
-            expect(result).toEqual(activateMessage);
-          }, error => console.log(error));
-    })));
-
-    it('deactivateIndexing', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(deactivateResponse));
-
+        result => {
+          expect(result).toEqual(activateMessage);
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne('/api/v1/storm/indexing/activate');
+      expect(req.request.method).toBe('GET');
+      req.flush(activateMessage);
+    });
+
+    it('deactivateIndexing', () => {
       stormService.deactivateIndexing().subscribe(
-          result => {
-            expect(result).toEqual(deactivateMessage);
-          }, error => console.log(error));
-    })));
-
-    it('startIndexing', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(startResponse));
-
+        result => {
+          expect(result).toEqual(deactivateMessage);
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne('/api/v1/storm/indexing/deactivate');
+      expect(req.request.method).toBe('GET');
+      req.flush(deactivateMessage);
+    });
+
+    it('startIndexing', () => {
       stormService.startIndexing().subscribe(
-          result => {
-            expect(result).toEqual(startMessage);
-          }, error => console.log(error));
-    })));
-
-    it('stopIndexing', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(stopResponse));
-
+        result => {
+          expect(result).toEqual(startMessage);
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne('/api/v1/storm/indexing/start');
+      expect(req.request.method).toBe('GET');
+      req.flush(startMessage);
+    });
+
+    it('stopIndexing', () => {
       stormService.stopIndexing().subscribe(
-          result => {
-            expect(result).toEqual(stopMessage);
-          }, error => console.log(error));
-    })));
-
-    it('getStatus', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(broStatusResponse));
-
+        result => {
+          expect(result).toEqual(stopMessage);
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne('/api/v1/storm/indexing/stop');
+      expect(req.request.method).toBe('GET');
+      req.flush(stopMessage);
+    });
+
+    it('getStatus', () => {
       stormService.getStatus('bro').subscribe(
-          result => {
-            expect(result).toEqual(broStatus);
-          }, error => console.log(error));
-    })));
-
-    it('activateParser', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(activateResponse));
-
+        result => {
+          expect(result).toEqual(broStatus);
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne('/api/v1/storm/bro');
+      expect(req.request.method).toBe('GET');
+      req.flush(broStatus);
+    });
+
+    it('activateParser', () => {
       stormService.activateParser('bro').subscribe(
-          result => {
-            expect(result).toEqual(activateMessage);
-          }, error => console.log(error));
-    })));
-
-    it('deactivateParser', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(deactivateResponse));
-
+        result => {
+          expect(result).toEqual(activateMessage);
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne('/api/v1/storm/parser/activate/bro');
+      expect(req.request.method).toBe('GET');
+      req.flush(activateMessage);
+    });
+
+    it('deactivateParser', () => {
       stormService.deactivateParser('bro').subscribe(
-          result => {
-            expect(result).toEqual(deactivateMessage);
-          }, error => console.log(error));
-    })));
-
-    it('startParser', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(startResponse));
-
+        result => {
+          expect(result).toEqual(deactivateMessage);
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne('/api/v1/storm/parser/deactivate/bro');
+      expect(req.request.method).toBe('GET');
+      req.flush(deactivateMessage);
+    });
+
+    it('startParser', () => {
       stormService.startParser('bro').subscribe(
-          result => {
-            expect(result).toEqual(startMessage);
-          }, error => console.log(error));
-    })));
-
-    it('stopParser', async(inject([], () => {
-      mockBackend.connections.subscribe((c: MockConnection) => c.mockRespond(stopResponse));
-
+        result => {
+          expect(result).toEqual(startMessage);
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne('/api/v1/storm/parser/start/bro');
+      expect(req.request.method).toBe('GET');
+      req.flush(startMessage);
+    });
+
+    it('stopParser', () => {
       stormService.stopParser('bro').subscribe(
-          result => {
-            expect(result).toEqual(stopMessage);
-          }, error => console.log(error));
-    })));
-
-
-
+        result => {
+          expect(result).toEqual(stopMessage);
+        },
+        error => console.log(error)
+      );
+      const req = mockBackend.expectOne('/api/v1/storm/parser/stop/bro');
+      expect(req.request.method).toBe('GET');
+      req.flush(stopMessage);
+    });
   });
-
 });

http://git-wip-us.apache.org/repos/asf/metron/blob/8bf3b6ec/metron-interface/metron-config/src/app/service/storm.service.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/app/service/storm.service.ts b/metron-interface/metron-config/src/app/service/storm.service.ts
index 7a79e1f..b38525c 100644
--- a/metron-interface/metron-config/src/app/service/storm.service.ts
+++ b/metron-interface/metron-config/src/app/service/storm.service.ts
@@ -15,130 +15,146 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import {Injectable, Inject} from '@angular/core';
-import {Http, Headers, RequestOptions} from '@angular/http';
-import {HttpUtil} from '../util/httpUtil';
-import {TopologyStatus} from '../model/topology-status';
-import {TopologyResponse} from '../model/topology-response';
-import {APP_CONFIG} from '../app.config';
-import {IAppConfig} from '../app.config.interface';
-import {Observable} from 'rxjs/Observable';
-import 'rxjs/add/observable/interval';
-import 'rxjs/add/operator/switchMap';
-import 'rxjs/add/operator/onErrorResumeNext';
+import { Injectable, Inject } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import { HttpUtil } from '../util/httpUtil';
+import { TopologyStatus } from '../model/topology-status';
+import { TopologyResponse } from '../model/topology-response';
+import { APP_CONFIG } from '../app.config';
+import { IAppConfig } from '../app.config.interface';
+import { Observable, interval } from 'rxjs';
+import { map, catchError, switchMap, onErrorResumeNext } from 'rxjs/operators';
 
 @Injectable()
 export class StormService {
   url = this.config.apiEndpoint + '/storm';
-  defaultHeaders = {'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest'};
 
-  constructor(private http: Http, @Inject(APP_CONFIG) private config: IAppConfig) {
-
-  }
+  constructor(
+    private http: HttpClient,
+    @Inject(APP_CONFIG) private config: IAppConfig
+  ) {}
 
   public pollGetAll(): Observable<TopologyStatus[]> {
-    return Observable.interval(8000).switchMap(() => {
-      return this.http.get(this.url, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-          .map(HttpUtil.extractData)
-          .catch(HttpUtil.handleError)
-          .onErrorResumeNext();
-    });
+    return interval(8000).pipe(
+      switchMap(() => {
+        return this.http.get(this.url).pipe(
+          map(HttpUtil.extractData),
+          catchError(HttpUtil.handleError),
+          onErrorResumeNext()
+        );
+      })
+    );
   }
 
   public getAll(): Observable<TopologyStatus[]> {
-    return this.http.get(this.url, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-        .map(HttpUtil.extractData)
-        .catch(HttpUtil.handleError);
+    return this.http.get(this.url).pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
   public getEnrichmentStatus(): Observable<TopologyStatus> {
-    return this.http.get(this.url + '/enrichment', new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-        .map(HttpUtil.extractData)
-        .catch(HttpUtil.handleError);
+    return this.http.get(this.url + '/enrichment').pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
   public activateEnrichment(): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/enrichment/activate', new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-        .map(HttpUtil.extractData)
-        .catch(HttpUtil.handleError);
+    return this.http.get(this.url + '/enrichment/activate').pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
   public deactivateEnrichment(): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/enrichment/deactivate', new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-        .map(HttpUtil.extractData)
-        .catch(HttpUtil.handleError);
+    return this.http.get(this.url + '/enrichment/deactivate').pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
   public startEnrichment(): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/enrichment/start', new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-        .map(HttpUtil.extractData)
-        .catch(HttpUtil.handleError);
+    return this.http.get(this.url + '/enrichment/start').pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
   public stopEnrichment(): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/enrichment/stop', new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-        .map(HttpUtil.extractData)
-        .catch(HttpUtil.handleError);
+    return this.http.get(this.url + '/enrichment/stop').pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
   public getIndexingStatus(): Observable<TopologyStatus> {
-    return this.http.get(this.url + '/indexing', new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-        .map(HttpUtil.extractData)
-        .catch(HttpUtil.handleError);
+    return this.http.get(this.url + '/indexing').pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
   public activateIndexing(): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/indexing/activate', new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-        .map(HttpUtil.extractData)
-        .catch(HttpUtil.handleError);
+    return this.http.get(this.url + '/indexing/activate').pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
   public deactivateIndexing(): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/indexing/deactivate', new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-        .map(HttpUtil.extractData)
-        .catch(HttpUtil.handleError);
+    return this.http.get(this.url + '/indexing/deactivate').pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
   public startIndexing(): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/indexing/start', new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-        .map(HttpUtil.extractData)
-        .catch(HttpUtil.handleError);
+    return this.http.get(this.url + '/indexing/start').pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
   public stopIndexing(): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/indexing/stop', new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-        .map(HttpUtil.extractData)
-        .catch(HttpUtil.handleError);
+    return this.http.get(this.url + '/indexing/stop').pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
   public getStatus(name: string): Observable<TopologyStatus> {
-    return this.http.get(this.url + '/' + name, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-        .map(HttpUtil.extractData)
-        .catch(HttpUtil.handleError);
+    return this.http.get(this.url + '/' + name).pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
   public activateParser(name: string): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/parser/activate/' + name, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-        .map(HttpUtil.extractData)
-        .catch(HttpUtil.handleError);
+    return this.http.get(this.url + '/parser/activate/' + name).pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
   public deactivateParser(name: string): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/parser/deactivate/' + name, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-        .map(HttpUtil.extractData)
-        .catch(HttpUtil.handleError);
+    return this.http.get(this.url + '/parser/deactivate/' + name).pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
   public startParser(name: string): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/parser/start/' + name, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-        .map(HttpUtil.extractData)
-        .catch(HttpUtil.handleError);
+    return this.http.get(this.url + '/parser/start/' + name).pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
 
   public stopParser(name: string): Observable<TopologyResponse> {
-    return this.http.get(this.url + '/parser/stop/' + name, new RequestOptions({headers: new Headers(this.defaultHeaders)}))
-        .map(HttpUtil.extractData)
-        .catch(HttpUtil.handleError);
+    return this.http.get(this.url + '/parser/stop/' + name).pipe(
+      map(HttpUtil.extractData),
+      catchError(HttpUtil.handleError)
+    );
   }
-
 }

http://git-wip-us.apache.org/repos/asf/metron/blob/8bf3b6ec/metron-interface/metron-config/src/app/shared/ace-editor/ace-editor.component.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/app/shared/ace-editor/ace-editor.component.ts b/metron-interface/metron-config/src/app/shared/ace-editor/ace-editor.component.ts
index 45684a0..cf1c495 100644
--- a/metron-interface/metron-config/src/app/shared/ace-editor/ace-editor.component.ts
+++ b/metron-interface/metron-config/src/app/shared/ace-editor/ace-editor.component.ts
@@ -15,10 +15,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
+/// <reference path="../../../../node_modules/@types/ace/index.d.ts" />
 import { Component, AfterViewInit, ViewChild, ElementRef, forwardRef, Input} from '@angular/core';
 import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
-import Editor = AceAjax.Editor;
 import {AutocompleteOption} from '../../model/autocomplete-option';
 
 declare var ace: any;
@@ -38,9 +37,9 @@ declare var ace: any;
 export class AceEditorComponent implements AfterViewInit, ControlValueAccessor {
 
   inputJson: any = '';
-  aceConfigEditor: Editor;
-  @Input() type: string = 'JSON';
-  @Input() placeHolder: string = 'Enter text here';
+  aceConfigEditor: AceAjax.Editor;
+  @Input() type = 'JSON';
+  @Input() placeHolder = 'Enter text here';
   @Input() options: AutocompleteOption[] = [];
   @ViewChild('aceEditor') aceEditorEle: ElementRef;
 

http://git-wip-us.apache.org/repos/asf/metron/blob/8bf3b6ec/metron-interface/metron-config/src/app/shared/auth-guard.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/app/shared/auth-guard.ts b/metron-interface/metron-config/src/app/shared/auth-guard.ts
index 66c27cf..3271853 100644
--- a/metron-interface/metron-config/src/app/shared/auth-guard.ts
+++ b/metron-interface/metron-config/src/app/shared/auth-guard.ts
@@ -22,7 +22,7 @@ import {
   ActivatedRouteSnapshot,
   RouterStateSnapshot
 } from '@angular/router';
-import { Observable } from 'rxjs/Observable';
+import { Observable } from 'rxjs';
 import { AuthenticationService } from '../service/authentication.service';
 
 @Injectable()

http://git-wip-us.apache.org/repos/asf/metron/blob/8bf3b6ec/metron-interface/metron-config/src/app/shared/metron-dialog-box.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/app/shared/metron-dialog-box.ts b/metron-interface/metron-config/src/app/shared/metron-dialog-box.ts
index 5e0e32b..d2910fc 100644
--- a/metron-interface/metron-config/src/app/shared/metron-dialog-box.ts
+++ b/metron-interface/metron-config/src/app/shared/metron-dialog-box.ts
@@ -15,7 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import {EventEmitter}     from '@angular/core';
+import { EventEmitter }     from '@angular/core';
 
 export class MetronDialogBox {
 
@@ -25,8 +25,8 @@ export class MetronDialogBox {
                   <div class="modal-dialog modal-sm" role="document">
                     <div class="modal-content">
                       <div class="modal-header">
-                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"> 
-                            <span aria-hidden="true">&times;</span> 
+                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                            <span aria-hidden="true">&times;</span>
                         </button>
                         <span class="modal-title"><b>` + title + `</b></span>
                       </div>

http://git-wip-us.apache.org/repos/asf/metron/blob/8bf3b6ec/metron-interface/metron-config/src/app/shared/sample-data/sample-data.component.html
----------------------------------------------------------------------
diff --git a/metron-interface/metron-config/src/app/shared/sample-data/sample-data.component.html b/metron-interface/metron-config/src/app/shared/sample-data/sample-data.component.html
index 887211c..475f745 100644
--- a/metron-interface/metron-config/src/app/shared/sample-data/sample-data.component.html
+++ b/metron-interface/metron-config/src/app/shared/sample-data/sample-data.component.html
@@ -16,7 +16,7 @@
 <label attr.for="sampleData">SAMPLE&nbsp;( {{sampleDataIndex + 1}} of {{sampleData.length}} )</label>
 <div>
   <i class="fa fa-caret-left sample-iterator sample-unavailable" aria-hidden="true" [class.sample-available]="sampleDataIndex > 0" [class.sample-unavailable]="sampleDataIndex < 1" (click)="getPreviousSample()"></i>
-  <textarea #sampleDataElement type="text" class="form-control sample-input" name="sampleData"  [ngModel]="sampleData[sampleDataIndex]" (blur)="onBlur(sample)"
+  <textarea #sampleDataElement type="text" class="form-control sample-input" name="sampleData"  [ngModel]="sampleData[sampleDataIndex]" (blur)="onBlur()"
             [attr.placeholder]="placeHolderText" (focus)="sampleDataElement.placeholder=''"> </textarea>
   <i class="fa fa-caret-right sample-iterator sample-available" aria-hidden="true" (click)="getNextSample()"></i>
 </div>


Mime
View raw message