Merge "Update logging version to 1.5.1"
authorByung-Woo Jun <byung-woo.jun@est.tech>
Fri, 4 Oct 2019 21:48:50 +0000 (21:48 +0000)
committerGerrit Code Review <gerrit@onap.org>
Fri, 4 Oct 2019 21:48:50 +0000 (21:48 +0000)
23 files changed:
adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java
so-monitoring/readme.md [deleted file]
so-monitoring/so-monitoring-service/pom.xml
so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/UserController.java [deleted file]
so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebApplicationConfig.java
so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebSecurityConfigImpl.java [deleted file]
so-monitoring/so-monitoring-service/src/main/resources/application.yaml
so-monitoring/so-monitoring-ui/src/main/frontend/README.md
so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app-routing.module.ts
so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts
so-monitoring/so-monitoring-ui/src/main/frontend/src/app/auth.guard.ts [deleted file]
so-monitoring/so-monitoring-ui/src/main/frontend/src/app/authentication.service.ts [deleted file]
so-monitoring/so-monitoring-ui/src/main/frontend/src/app/basic-auth.interceptor.ts [deleted file]
so-monitoring/so-monitoring-ui/src/main/frontend/src/app/data.service.ts
so-monitoring/so-monitoring-ui/src/main/frontend/src/app/error.interceptor.ts [deleted file]
so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.html [deleted file]
so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.spec.ts [deleted file]
so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.ts [deleted file]
so-monitoring/so-monitoring-ui/src/main/frontend/src/app/sidebar/sidebar.component.html
so-monitoring/so-monitoring-ui/src/main/frontend/src/environments/environment.ts

index ad25430..d7bc22a 100644 (file)
@@ -755,16 +755,19 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
         GetBlueprint getRequest = cloudify.blueprints().getMetadataById(blueprintId);
         try {
             Blueprint bp = getRequest.execute();
-            logger.debug("Blueprint exists: {}", bp.getId());
-            return true;
+            if (bp != null) {
+                logger.debug("Blueprint exists: {}", bp.getId());
+                return true;
+            } else {
+                logger.debug("Null blueprint!");
+                return false;
+            }
         } catch (CloudifyResponseException ce) {
             if (ce.getStatus() == 404) {
                 return false;
             } else {
                 throw ce;
             }
-        } catch (Exception e) {
-            throw e;
         }
     }
 
@@ -803,8 +806,12 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
         GetBlueprint getRequest = cloudify.blueprints().getMetadataById(blueprintId);
         try {
             Blueprint bp = getRequest.execute();
-            logger.debug("Blueprint {} already exists.", bp.getId());
-            return false;
+            if (bp != null) {
+                logger.debug("Blueprint {} already exists.", bp.getId());
+                return false;
+            } else {
+                logger.debug("Null blueprint!");
+            }
         } catch (CloudifyResponseException ce) {
             if (ce.getStatus() == 404) {
                 // This is the expected result.
@@ -812,8 +819,6 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
             } else {
                 throw ce;
             }
-        } catch (Exception e) {
-            throw e;
         }
 
         // Create a blueprint ZIP file in memory
index a94713e..7a50e5f 100644 (file)
@@ -155,24 +155,11 @@ public class BPMNUtil {
         }
     }
 
-    private static String getProcessInstanceId(HistoryService historyService, String processDefinitionID) {
-        List<HistoricProcessInstance> historyList = historyService.createHistoricProcessInstanceQuery().list();
-        String pID = null;
-        for (HistoricProcessInstance hInstance : historyList) {
-            if (hInstance.getProcessDefinitionKey().equals(processDefinitionID)) {
-                pID = hInstance.getId();
-                break;
-            }
-        }
-        return pID;
-    }
-
     public static boolean isProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) {
         return processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid)
                 .finished().count() == 1 ? true : false;
     }
 
-
     private static void buildVariable(String key, String value, Map<String, Object> variableValueType) {
         Map<String, Object> host = new HashMap<>();
         host.put("value", value);
index 9413e8e..e73a504 100644 (file)
@@ -124,12 +124,14 @@ public class ConfigAssignVnf {
     private Service getServiceFromRequestUserParams(List<Map<String, Object>> userParams) throws Exception {
         Map<String, Object> serviceMap = userParams.stream().filter(key -> key.containsKey("service")).findFirst()
                 .orElseThrow(() -> new Exception("Can not find service in userParams section in generalBuildingBlock"));
-        return convertServiceFromJsonToServiceObject((String) serviceMap.get("service"));
+        return getServiceObjectFromServiceMap(serviceMap);
     }
 
-    private Service convertServiceFromJsonToServiceObject(String serviceFromJson) throws Exception {
+    private Service getServiceObjectFromServiceMap(Map<String, Object> serviceMap) throws Exception {
+        ObjectMapper objectMapper = new ObjectMapper();
+        String serviceFromJson = objectMapper.writeValueAsString(serviceMap.get("service"));
         try {
-            return new ObjectMapper().readValue(serviceFromJson, Service.class);
+            return objectMapper.readValue(serviceFromJson, Service.class);
         } catch (Exception e) {
             logger.error(String.format(
                     "An exception occurred while converting json object to Service object. The json is: %s",
@@ -150,5 +152,4 @@ public class ConfigAssignVnf {
                     genericVnfModelCustomizationUuid));
         }
     }
-
 }
index 468bc7d..bbc2070 100644 (file)
@@ -47,23 +47,32 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
 import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
 import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
 import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.Resources;
+import org.onap.so.serviceinstancebeans.Service;
+import org.onap.so.serviceinstancebeans.Vnfs;
 
 public class ConfigAssignVnfTest {
 
     private static final String GENERIC_VNF_ID = "vnfId_configVnfTest";
     private static final String GENERIC_VNF_NAME = "vnfName_configVnfTest";
-    private static final String VNF_MODEL_CUSTOMIZATION_UUID = "0c1ac643-377e-475b-be50-6be65f91a7ad";
+    private static final String VNF_MODEL_CUSTOMIZATION_ID = "0c1ac643-377e-475b-be50-6be65f91a7ad";
     private static final String SERVICE_INSTANCE_ID = "serviceInst_configTest";
     private static final String SERVICE_MODEL_UUID = "5af91c26-8418-4d3f-944c-965842deda94";
     private static final String TARGET_VNF_MODEL_CUSTOMIZATION_UUID = "0c1ac643-377e-475b-be50-6be65f91a7ad";
     private static final String GENERAL_BLOCK_EXECUTION_MAP_KEY = "gBBInput";
     private static final int THE_NUMBER_OF_EXPECTED_CONFIG_PROPERTIES = 8;
 
-    private static final String USER_PARAMS_FROM_REQUEST = "{\"resources\":{\"vnfs\":["
-            + "{\"modelInfo\":{\"modelCustomizationId\":\"" + VNF_MODEL_CUSTOMIZATION_UUID + "\"},"
-            + "\"instanceParams\":[{\"paramName1\":\"paramValue1\",\"paramName2\":\"paramValue2\"},{\"paramName3\":\"paramValue3\"}]},"
-            + "{\"modelInfo\":{\"modelCustomizationId\":\"2d1ac656-377e-467b-be50-6ce65f66a7ca\"},"
-            + "\"instanceParams\":[{\"parName4\":\"parValue4\",\"parName5\":\"parValue5\"}]}]}}\n";
+    private static final String INSTANCE_PARAM1_NAME = "paramName1";
+    private static final String INSTANCE_PARAM1_VALUE = "paramValue1";
+    private static final String INSTANCE_PARAM2_NAME = "paramName2";
+    private static final String INSTANCE_PARAM2_VALUE = "paramValue2";
+    private static final String INSTANCE_PARAM3_NAME = "paramName3";
+    private static final String INSTANCE_PARAM3_VALUE = "paramValue3";
+    private static final String INSTANCE_PARAM4_NAME = "paramName4";
+    private static final String INSTANCE_PARAM4_VALUE = "paramValue4";
+    private static final String INSTANCE_PARAM5_NAME = "paramName5";
+    private static final String INSTANCE_PARAM5_VALUE = "paramValue5";
 
 
     private ConfigAssignVnf testedObject;
@@ -103,13 +112,13 @@ public class ConfigAssignVnfTest {
         assertThat(configAssignPropertiesNode.get("vnf-name").asText()).isEqualTo(GENERIC_VNF_NAME);
         assertThat(configAssignPropertiesNode.get("service-model-uuid").asText()).isEqualTo(SERVICE_MODEL_UUID);
         assertThat(configAssignPropertiesNode.get("vnf-customization-uuid").asText())
-                .isEqualTo(VNF_MODEL_CUSTOMIZATION_UUID);
-        assertThat(configAssignPropertiesNode.has("paramName1")).isTrue();
-        assertThat(configAssignPropertiesNode.get("paramName1").asText()).isEqualTo("paramValue1");
-        assertThat(configAssignPropertiesNode.has("paramName2")).isTrue();
-        assertThat(configAssignPropertiesNode.get("paramName2").asText()).isEqualTo("paramValue2");
-        assertThat(configAssignPropertiesNode.has("paramName3")).isTrue();
-        assertThat(configAssignPropertiesNode.get("paramName3").asText()).isEqualTo("paramValue3");
+                .isEqualTo(VNF_MODEL_CUSTOMIZATION_ID);
+        assertThat(configAssignPropertiesNode.has(INSTANCE_PARAM1_NAME)).isTrue();
+        assertThat(configAssignPropertiesNode.get(INSTANCE_PARAM1_NAME).asText()).isEqualTo(INSTANCE_PARAM1_VALUE);
+        assertThat(configAssignPropertiesNode.has(INSTANCE_PARAM2_NAME)).isTrue();
+        assertThat(configAssignPropertiesNode.get(INSTANCE_PARAM2_NAME).asText()).isEqualTo(INSTANCE_PARAM2_VALUE);
+        assertThat(configAssignPropertiesNode.has(INSTANCE_PARAM3_NAME)).isTrue();
+        assertThat(configAssignPropertiesNode.get(INSTANCE_PARAM3_NAME).asText()).isEqualTo(INSTANCE_PARAM3_VALUE);
     }
 
     private BuildingBlockExecution createBuildingBlockExecution() {
@@ -152,8 +161,49 @@ public class ConfigAssignVnfTest {
     private List<Map<String, Object>> createRequestUserParams() {
         List<Map<String, Object>> userParams = new ArrayList<>();
         Map<String, Object> userParamMap = new HashMap<>();
-        userParamMap.put("service", USER_PARAMS_FROM_REQUEST);
+        userParamMap.put("service", createService());
         userParams.add(userParamMap);
         return userParams;
     }
+
+    private Service createService() {
+        Service service = new Service();
+        Resources resources = new Resources();
+        resources.setVnfs(createVnfList());
+        service.setResources(resources);
+        return service;
+    }
+
+    private List<Vnfs> createVnfList() {
+        List<Map<String, String>> instanceParamsListSearchedVnf = new ArrayList<>();
+        Map<String, String> instanceParam = new HashMap<>();
+        instanceParam.put(INSTANCE_PARAM1_NAME, INSTANCE_PARAM1_VALUE);
+        instanceParam.put(INSTANCE_PARAM2_NAME, INSTANCE_PARAM2_VALUE);
+        Map<String, String> instanceParam2 = new HashMap<>();
+        instanceParam2.put(INSTANCE_PARAM3_NAME, INSTANCE_PARAM3_VALUE);
+        instanceParamsListSearchedVnf.add(instanceParam);
+        instanceParamsListSearchedVnf.add(instanceParam2);
+        Vnfs searchedVnf = createVnf(VNF_MODEL_CUSTOMIZATION_ID, instanceParamsListSearchedVnf);
+
+        List<Map<String, String>> instanceParamsListForAnotherVnf = new ArrayList<>();
+        Map<String, String> instanceParam3 = new HashMap<>();
+        instanceParam3.put(INSTANCE_PARAM4_NAME, INSTANCE_PARAM4_VALUE);
+        instanceParam3.put(INSTANCE_PARAM5_NAME, INSTANCE_PARAM5_VALUE);
+        instanceParamsListForAnotherVnf.add(instanceParam3);
+        Vnfs anotherVnf = createVnf("2d1ac656-377e-467b-be50-6ce65f66a7ca", instanceParamsListForAnotherVnf);
+
+        List<Vnfs> vnfList = new ArrayList<>();
+        vnfList.add(searchedVnf);
+        vnfList.add(anotherVnf);
+        return vnfList;
+    }
+
+    private Vnfs createVnf(String vnfModelCustomizationId, List<Map<String, String>> instanceParamsList) {
+        Vnfs vnf = new Vnfs();
+        ModelInfo modelInfo = new ModelInfo();
+        modelInfo.setModelCustomizationId(vnfModelCustomizationId);
+        vnf.setModelInfo(modelInfo);
+        vnf.setInstanceParams(instanceParamsList);
+        return vnf;
+    }
 }
diff --git a/so-monitoring/readme.md b/so-monitoring/readme.md
deleted file mode 100644 (file)
index d4b876c..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-# SO Monitoring
-
-----
-
-## Introduction
-
-SO Monitoring provides multiple useful features:
-* Search/Filtering Menu
-* A graphical user interface
-* Workflow pathing
-* Subflow navigation
-* Access to the workflow variables
-
-## Compiling / Running
-
-Compiling is simple: `mvn clean install`
-Compilation may fail if your code is not formatted properly. 
-
-## Components
-
-### so-monitoring-handler
-
-
-### so-monitoring-service
-
-Backend API for so-monitoring. Requires basic auth to access it.
-
-Default credentials:
-- with role GUI-Client: gui/password1$
-
-Note that these default users should be changed for production.
-
-### so-monitoring-ui
-
-UI for so-monitoring has a separate README.md - so-monitoring/so-monitoring-ui/src/main/frontend/README.md
index f5448aa..ff70a77 100644 (file)
       <artifactId>spring-boot-configuration-processor</artifactId>
       <scope>compile</scope>
     </dependency>
-    <dependency>
-      <groupId>org.springframework.boot</groupId>
-      <artifactId>spring-boot-starter-security</artifactId>
-    </dependency>
   </dependencies>
 
   <build>
diff --git a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/UserController.java b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/UserController.java
deleted file mode 100644 (file)
index 3959631..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2019 Samsung
- * ================================================================================
- * Licensed 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.monitoring.rest.api;
-
-import java.security.Principal;
-import org.springframework.web.bind.annotation.CrossOrigin;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-public class UserController {
-
-    @RequestMapping("/user")
-    public Principal user(Principal user) {
-        return user;
-    }
-}
index 2b53ed8..cadd60b 100644 (file)
@@ -2,9 +2,7 @@
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2018 Ericsson. All rights reserved.
  * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
-  * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed 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
  * 
@@ -23,15 +21,16 @@ package org.onap.so.monitoring.rest.api;
 
 import org.springframework.context.annotation.Configuration;
 import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
 
 /**
  * @author waqas.ikram@ericsson.com
  */
 @Configuration
-public class WebApplicationConfig implements WebMvcConfigurer {
+public class WebApplicationConfig extends WebMvcConfigurerAdapter {
     @Override
     public void addViewControllers(final ViewControllerRegistry registry) {
+        super.addViewControllers(registry);
         registry.addViewController("/details/**").setViewName("forward:/");
     }
 }
diff --git a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebSecurityConfigImpl.java b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebSecurityConfigImpl.java
deleted file mode 100644 (file)
index 298f52b..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- *  Copyright (C) 2019 Samsung
- * ================================================================================
- * Licensed 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.monitoring.rest.api;
-
-import org.onap.so.security.WebSecurityConfig;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.annotation.Order;
-import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
-
-@EnableWebSecurity
-@Configuration("att-security-config")
-@Order(2)
-public class WebSecurityConfigImpl extends WebSecurityConfig {
-
-    @Override
-    protected void configure(HttpSecurity http) throws Exception {
-        http.authorizeRequests().antMatchers("/actuator", "/actuator/*", "/login", "/", "/index.html", "/*.js",
-                "/*.js.map", "/favicon.png").permitAll().anyRequest().authenticated().and().httpBasic();
-    }
-}
index 417febe..dbccb76 100644 (file)
@@ -19,9 +19,3 @@ mso:
 spring:
   main:
     allow-bean-definition-overriding: true
-  security:
-    usercredentials:
-    -
-      username: gui
-      password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
-      role: GUI-Client
index 65731cd..329de0f 100644 (file)
@@ -6,15 +6,6 @@ This project was generated with [Angular CLI](https://github.com/angular/angular
 \r
 Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.\r
 \r
-FYI: You may need to change environments.ts to hit to your backend: not so-monitoring:30224 but localhost:8088  \r
-\r
-### Logging in\r
-\r
-Backend API for so-monitoring. Requires basic auth to access it.\r
-\r
-Default credentials:\r
-- with role GUI-Client: gui/password1$\r
-\r
 ## Code scaffolding\r
 \r
 Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.\r
index 03e77fc..428998d 100644 (file)
@@ -1,8 +1,6 @@
 /**
 ============LICENSE_START=======================================================
  Copyright (C) 2018 Ericsson. All rights reserved.
-================================================================================
- Modifications Copyright (c) 2019 Samsung
 ================================================================================
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
@@ -26,25 +24,17 @@ import { NgModule } from '@angular/core';
 import { Routes, RouterModule } from '@angular/router';
 import { HomeComponent } from './home/home.component';
 import { DetailsComponent } from './details/details.component';
-import {AuthGuard} from "./auth.guard";
-import {LoginComponent} from "./login/login.component";
 
 const routes: Routes = [
   {
     // Route to home page
     path: '',
-    component: HomeComponent,
-    canActivate: [AuthGuard]
+    component: HomeComponent
   },
   {
     // Route to page to show individual process based on ID
     path: 'details/:id',
     component: DetailsComponent
-  },
-  {
-    // Route to login page
-    path: 'login',
-    component: LoginComponent
   }
 ];
 
index 5adfc04..75be395 100644 (file)
@@ -1,8 +1,6 @@
 /**
 ============LICENSE_START=======================================================
  Copyright (C) 2018 Ericsson. All rights reserved.
-================================================================================
- Modifications Copyright (c) 2019 Samsung
 ================================================================================
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
@@ -30,7 +28,7 @@ import { AppComponent } from './app.component';
 import { SidebarComponent } from './sidebar/sidebar.component';
 import { TopbarComponent } from './topbar/topbar.component';
 import { HomeComponent } from './home/home.component';
-import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
+import { HttpClientModule } from '@angular/common/http';
 import { FormsModule, ReactiveFormsModule } from '@angular/forms';
 import { DetailsComponent } from './details/details.component';
 import { ToastrNotificationService } from './toastr-notification-service.service';
@@ -39,9 +37,6 @@ import { MatFormFieldModule, MatInputModule, MatTableModule, MatTabsModule, MatS
 import { NgxSpinnerModule } from 'ngx-spinner';
 import { RouterModule, Routes } from '@angular/router';
 import { APP_BASE_HREF } from '@angular/common';
-import { LoginComponent } from './login/login.component';
-import { BasicAuthInterceptor } from "./basic-auth.interceptor";
-import { ErrorInterceptor } from "./error.interceptor";
 
 @NgModule({
   declarations: [
@@ -49,8 +44,7 @@ import { ErrorInterceptor } from "./error.interceptor";
     SidebarComponent,
     TopbarComponent,
     HomeComponent,
-    DetailsComponent,
-    LoginComponent
+    DetailsComponent
   ],
   imports: [
     BrowserModule,
@@ -77,10 +71,7 @@ import { ErrorInterceptor } from "./error.interceptor";
   schemas: [
     CUSTOM_ELEMENTS_SCHEMA
   ],
-  providers: [
-    { provide: HTTP_INTERCEPTORS, useClass: BasicAuthInterceptor, multi: true },
-    { provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true },
-    ToastrNotificationService],
+  providers: [ToastrNotificationService],
   bootstrap: [AppComponent]
 })
 export class AppModule { }
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/auth.guard.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/auth.guard.ts
deleted file mode 100644 (file)
index f437a21..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- ============LICENSE_START=======================================================
- Copyright (C) 2019 Samsung. All rights reserved.
- ================================================================================
- Licensed 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.
-
- SPDX-License-Identifier: Apache-2.0
- ============LICENSE_END=========================================================
-
- @authors: k.kazak@samsung.com
- **/
-
-import { Injectable } from '@angular/core';
-import {CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router} from '@angular/router';
-import { Observable } from 'rxjs';
-
-@Injectable({
-  providedIn: 'root'
-})
-export class AuthGuard implements CanActivate {
-
-  constructor(private router:Router) { }
-
-  canActivate(
-    next: ActivatedRouteSnapshot,
-    state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean {
-      if (localStorage.getItem('authdata')) {
-        // logged in
-        return true;
-      }
-
-      // not logged in
-      this.router.navigate(['/login'], { queryParams: {returnUrl: state.url}});
-      return false;
-  }
-}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/authentication.service.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/authentication.service.ts
deleted file mode 100644 (file)
index d7610ee..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- ============LICENSE_START=======================================================
- Copyright (C) 2019 Samsung. All rights reserved.
- ================================================================================
- Licensed 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.
-
- SPDX-License-Identifier: Apache-2.0
- ============LICENSE_END=========================================================
-
- @authors: k.kazak@samsung.com
- **/
-
-import {Injectable} from '@angular/core';
-import {HttpClient} from "@angular/common/http";
-import {environment} from "../environments/environment";
-
-@Injectable({
-  providedIn: 'root'
-})
-export class AuthenticationService {
-
-  constructor(private http: HttpClient) {
-  }
-
-  login(username: string, password: string) {
-    // remove old data from storage
-    localStorage.removeItem('authdata');
-    // add to local storage
-    var authdata = window.btoa(username + ':' + password);
-    localStorage.setItem('authdata', authdata);
-
-    // make request
-    return this.http.get(environment.authBackendURL);
-  }
-
-  logout() {
-    // remove from local storage
-    localStorage.removeItem('authdata');
-  }
-}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/basic-auth.interceptor.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/basic-auth.interceptor.ts
deleted file mode 100644 (file)
index 4990d05..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- ============LICENSE_START=======================================================
- Copyright (C) 2019 Samsung. All rights reserved.
- ================================================================================
- Licensed 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.
-
- SPDX-License-Identifier: Apache-2.0
- ============LICENSE_END=========================================================
-
- @authors: k.kazak@samsung.com
- **/
-
-import { Injectable } from '@angular/core';
-import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from '@angular/common/http';
-import { Observable } from 'rxjs';
-
-@Injectable()
-export class BasicAuthInterceptor implements HttpInterceptor {
-  intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
-    //add authorization header with basic auth credentials if available
-    let auth = localStorage.getItem('authdata');
-    if (auth) {
-        const authReq = request.clone({
-          headers: request.headers.set('Authorization', 'Basic Z3VpOnBhc3N3b3JkMSQ=')
-        });
-
-        // send cloned request with header to the next handler.
-        return next.handle(authReq);
-   }
-
-    return next.handle(request);
-  }
-}
index 8dfae3d..b391672 100644 (file)
@@ -21,7 +21,7 @@ SPDX-License-Identifier: Apache-2.0
 */
 
 import { Injectable } from '@angular/core';
-import { HttpClient, HttpErrorResponse, HttpHeaders } from '@angular/common/http';
+import { HttpClient, HttpErrorResponse } from '@angular/common/http';
 import { BpmnInfraRequest } from './model/bpmnInfraRequest.model';
 import { catchError } from 'rxjs/operators';
 import { Observable } from 'rxjs';
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/error.interceptor.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/error.interceptor.ts
deleted file mode 100644 (file)
index afe792c..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- ============LICENSE_START=======================================================
- Copyright (C) 2019 Samsung. All rights reserved.
- ================================================================================
- Licensed 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.
-
- SPDX-License-Identifier: Apache-2.0
- ============LICENSE_END=========================================================
-
- @authors: k.kazak@samsung.com
- **/
-
-import { Injectable } from '@angular/core';
-import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from '@angular/common/http';
-import { Observable, throwError } from 'rxjs';
-import { catchError } from 'rxjs/operators';
-import {AuthenticationService} from "./authentication.service";
-
-@Injectable()
-export class ErrorInterceptor implements HttpInterceptor {
-  constructor(private authenticationService: AuthenticationService) {}
-
-  intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
-    return next.handle(request).pipe(catchError(err => {
-      if (err.status === 401) {
-        // auto logout if 401 response returned from api
-        this.authenticationService.logout();
-        location.reload(true);
-      }
-
-      const error = err.error.message || err.statusText;
-      return throwError(error);
-    }))
-  }
-}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.html b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.html
deleted file mode 100644 (file)
index 107e1da..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<!--
-============LICENSE_START=======================================================
-Copyright (C) 2019 Samsung. All rights reserved.
-================================================================================
-Licensed 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.
-
-SPDX-License-Identifier: Apache-2.0
-============LICENSE_END=========================================================
-
-@authors: k.kazak@samsung.com
--->
-<h2>Login</h2>
-<form [formGroup]="loginForm" (ngSubmit)="onSubmit()">
-  <div class="form-group">
-    <label for="username">Username</label>
-    <input type="text" formControlName="username" class="form-control" [ngClass]="{ 'is-invalid': submitted && f.username.errors }" />
-    <div *ngIf="submitted && f.username.errors" class="invalid-feedback">
-      <div *ngIf="f.username.errors.required">Username is required</div>
-    </div>
-  </div>
-  <div class="form-group">
-    <label for="password">Password</label>
-    <input type="password" formControlName="password" class="form-control" [ngClass]="{ 'is-invalid': submitted && f.password.errors }" />
-    <div *ngIf="submitted && f.password.errors" class="invalid-feedback">
-      <div *ngIf="f.password.errors.required">Password is required</div>
-    </div>
-  </div>
-  <div class="form-group">
-    <button [disabled]="loading" class="btn btn-primary">Login</button>
-    <img *ngIf="loading" src="data:image/gif;base64,R0lGODlhEAAQAPIAAP///wAAAMLCwkJCQgAAAGJiYoKCgpKSkiH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAADMwi63P4wyklrE2MIOggZnAdOmGYJRbExwroUmcG2LmDEwnHQLVsYOd2mBzkYDAdKa+dIAAAh+QQJCgAAACwAAAAAEAAQAAADNAi63P5OjCEgG4QMu7DmikRxQlFUYDEZIGBMRVsaqHwctXXf7WEYB4Ag1xjihkMZsiUkKhIAIfkECQoAAAAsAAAAABAAEAAAAzYIujIjK8pByJDMlFYvBoVjHA70GU7xSUJhmKtwHPAKzLO9HMaoKwJZ7Rf8AYPDDzKpZBqfvwQAIfkECQoAAAAsAAAAABAAEAAAAzMIumIlK8oyhpHsnFZfhYumCYUhDAQxRIdhHBGqRoKw0R8DYlJd8z0fMDgsGo/IpHI5TAAAIfkECQoAAAAsAAAAABAAEAAAAzIIunInK0rnZBTwGPNMgQwmdsNgXGJUlIWEuR5oWUIpz8pAEAMe6TwfwyYsGo/IpFKSAAAh+QQJCgAAACwAAAAAEAAQAAADMwi6IMKQORfjdOe82p4wGccc4CEuQradylesojEMBgsUc2G7sDX3lQGBMLAJibufbSlKAAAh+QQJCgAAACwAAAAAEAAQAAADMgi63P7wCRHZnFVdmgHu2nFwlWCI3WGc3TSWhUFGxTAUkGCbtgENBMJAEJsxgMLWzpEAACH5BAkKAAAALAAAAAAQABAAAAMyCLrc/jDKSatlQtScKdceCAjDII7HcQ4EMTCpyrCuUBjCYRgHVtqlAiB1YhiCnlsRkAAAOwAAAAAAAAAAAA==" />
-  </div>
-  <div *ngIf="error" class="alert alert-danger">{{error}}</div>
-</form>
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.spec.ts
deleted file mode 100644 (file)
index 8cf379d..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- ============LICENSE_START=======================================================
- Copyright (C) 2019 Samsung. All rights reserved.
- ================================================================================
- Licensed 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.
-
- SPDX-License-Identifier: Apache-2.0
- ============LICENSE_END=========================================================
-
- @authors: k.kazak@samsung.com
- **/
-
-import {async, ComponentFixture, inject, TestBed} from '@angular/core/testing';
-
-import {LoginComponent} from './login.component';
-import {AuthenticationService} from "../authentication.service";
-import {CUSTOM_ELEMENTS_SCHEMA} from "@angular/core";
-import {FormsModule, ReactiveFormsModule} from '@angular/forms';
-import {RouterTestingModule} from "@angular/router/testing";
-import {ActivatedRoute, Router, RouterModule} from "@angular/router";
-
-describe('LoginComponent', () => {
-  // Create SPY Object for Jasmine tests to mock DataService
-  let spyDataService: jasmine.SpyObj<AuthenticationService>;
-  let component: LoginComponent;
-  let fixture: ComponentFixture<LoginComponent>;
-  let router: Router;
-
-  beforeEach(async(() => {
-    spyDataService = jasmine.createSpyObj('AuthenticationService', ['login', 'logout']);
-
-    TestBed.configureTestingModule({
-      providers: [LoginComponent,
-        {provide: AuthenticationService, useValue: spyDataService},
-        {provide: ActivatedRoute, useValue: { snapshot: {queryParams: { returnUrl: 'test'}}}}
-      ],
-      imports: [RouterTestingModule, ReactiveFormsModule, FormsModule, RouterModule.forRoot([])],
-      declarations: [LoginComponent],
-      schemas: [
-        CUSTOM_ELEMENTS_SCHEMA
-      ]
-    });
-
-    fixture = TestBed.createComponent(LoginComponent);
-    component = fixture.componentInstance;
-    router = TestBed.get(Router);
-  }));
-
-
-  it('should create', inject([LoginComponent],
-    (component: LoginComponent) => {
-      expect(component).toBeTruthy();
-    }));
-
-  it('should logout and route to test directory', inject([LoginComponent],
-    (component: LoginComponent) => {
-      component.ngOnInit();
-      expect(component.returnUrl).toBe('test');
-    }));
-
-  it('should logout and route to root directory', inject([LoginComponent],
-    (component: LoginComponent) => {
-      router.initialNavigation();
-      component.ngOnInit();
-      expect(component.returnUrl).toBe('test');
-    }));
-
-  it('should submit without success', inject([LoginComponent],
-    (component: LoginComponent) => {
-      component.ngOnInit();
-      expect(component.loginForm.valid).toBe(false);
-      component.onSubmit();
-      expect(component.submitted).toBe(true);
-    }));
-
-  it('should submit without success', inject([LoginComponent],
-    (component: LoginComponent) => {
-      component.ngOnInit();
-      expect(component.loginForm.valid).toBe(false);
-      spyDataService.login.and.returnValue(Promise.resolve());
-
-      let compiled = fixture.debugElement.nativeElement;
-      let username = compiled.querySelector('input[type="text"]');
-      let password = compiled.querySelector('input[type="password"]');
-
-      fixture.detectChanges();
-
-      // Change value
-      username.value = 'test';
-      password.value = 'password';
-
-      // dispatch input event
-      dispatchEvent(new Event('input'));
-
-      component.onSubmit();
-      expect(component.submitted).toBe(true);
-    }));
-});
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/login/login.component.ts
deleted file mode 100644 (file)
index 4a3f4e6..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- ============LICENSE_START=======================================================
- Copyright (C) 2019 Samsung. All rights reserved.
- ================================================================================
- Licensed 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.
-
- SPDX-License-Identifier: Apache-2.0
- ============LICENSE_END=========================================================
-
- @authors: k.kazak@samsung.com
- **/
-
-import { Component, OnInit } from '@angular/core';
-import {FormBuilder, FormGroup, Validators, ReactiveFormsModule} from "@angular/forms";
-import {ActivatedRoute, Router} from "@angular/router";
-import {AuthenticationService} from "../authentication.service";
-import {first} from "rxjs/internal/operators";
-
-@Component({
-  selector: 'app-login',
-  templateUrl: './login.component.html',
-  styleUrls: []
-})
-export class LoginComponent implements OnInit {
-
-  loginForm: FormGroup;
-  loading = false;
-  submitted = false;
-  returnUrl: string;
-  error = '';
-
-  constructor(private formBuilder: FormBuilder,
-              private route: ActivatedRoute,
-              private router: Router,
-              private authenticationService: AuthenticationService) { }
-
-  ngOnInit() {
-    this.loginForm = this.formBuilder.group({
-      username: ['', Validators.required],
-      password: ['', Validators.required]
-    });
-
-    // logout
-    this.authenticationService.logout();
-
-    this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/';
-  }
-
-  // convenience getter for easy access to form fields
-  get f() { return this.loginForm.controls; }
-
-  onSubmit() {
-    this.submitted = true;
-
-    // stop here if form is invalid
-    if (this.loginForm.invalid) {
-      return;
-    }
-
-    this.loading = true;
-    this.authenticationService.login(this.f.username.value, this.f.password.value)
-    .subscribe(
-       next => {
-           this.router.navigate([this.returnUrl]);
-         },
-         error => {
-           this.error = error;
-           this.loading = false;
-         });
-  }
-}
index 1c62351..e8b54d7 100644 (file)
@@ -1,34 +1,29 @@
-<!--
-============LICENSE_START=======================================================
- Copyright (C) 2018 Ericsson. All rights reserved.
-================================================================================
- Modifications Copyright (c) 2019 Samsung
-================================================================================
-Licensed 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.
-
-SPDX-License-Identifier: Apache-2.0
-============LICENSE_END=========================================================
-
-@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com
--->
-
-<nav>
-  <ul>
-    <li>
-      <a routerLink="/">Home</a>
-    </li>
-    <li>
-      <a routerLink="/login">Logout</a>
-    </li>
-  </ul>
-</nav>
+<!--\r
+============LICENSE_START=======================================================\r
+ Copyright (C) 2018 Ericsson. All rights reserved.\r
+================================================================================\r
+Licensed under the Apache License, Version 2.0 (the "License");\r
+you may not use this file except in compliance with the License.\r
+You may obtain a copy of the License at\r
+\r
+    http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+Unless required by applicable law or agreed to in writing, software\r
+distributed under the License is distributed on an "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
+SPDX-License-Identifier: Apache-2.0\r
+============LICENSE_END=========================================================\r
+\r
+@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com\r
+-->\r
+\r
+<nav>\r
+  <ul>\r
+    <li>\r
+      <a routerLink="/">Home</a>\r
+    </li>\r
+  </ul>\r
+</nav>\r
index 484a156..f0c63fe 100644 (file)
@@ -1,8 +1,6 @@
 /**
 ============LICENSE_START=======================================================
  Copyright (C) 2018 Ericsson. All rights reserved.
-================================================================================
- Modifications Copyright (c) 2019 Samsung
 ================================================================================
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
@@ -26,6 +24,5 @@ SPDX-License-Identifier: Apache-2.0
 export const environment = {
   production: false,
 
-  soMonitoringBackendURL: 'http://so-monitoring:30224/so/monitoring/',
-  authBackendURL: 'http://so-monitoring:30224/user'
+  soMonitoringBackendURL: 'http://so-monitoring:30224/so/monitoring/'
 };