Merge "Junit for RoleFunctionException"
authorSunder Tattavarada <statta@research.att.com>
Wed, 29 Apr 2020 19:38:52 +0000 (19:38 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 29 Apr 2020 19:38:52 +0000 (19:38 +0000)
17 files changed:
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepositoryHandler.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppCatalogController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppContactUsController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/SchedulerAuxController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/UserRolesController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/WidgetsCatalogController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/FunctionalMenuItemWithAppID.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/MicroserviceData.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPServiceCookieTest.java [new file with mode: 0644]
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/DuplicateRecordExceptionTest.java [new file with mode: 0644]
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/NotValidDataExceptionTest.java [new file with mode: 0644]
portal-FE-os/src/app/app.component.html
portal-FE-os/src/app/app.component.scss
portal-FE-os/src/app/app.component.ts
portal-FE-os/src/environments/environment.prod.ts
portal-FE-os/src/environments/environment.ts

index d36cf6c..33006c9 100644 (file)
@@ -54,6 +54,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 
 import io.swagger.annotations.ApiOperation;
 
@@ -75,14 +77,14 @@ public class SessionCommunicationController  extends EPRestrictedRESTfulBaseCont
        
        @ApiOperation(value = "Gets session slot-check interval, a duration in milliseconds.",
     response = Integer.class)
-       @RequestMapping(value={"/getSessionSlotCheckInterval"}, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value={"/getSessionSlotCheckInterval"}, produces = "application/json")
        public Integer getSessionSlotCheckInterval(HttpServletRequest request, HttpServletResponse response) throws Exception {
                return manageService.fetchSessionSlotCheckInterval();
        }
        
        @ApiOperation(value = "Extends session timeout values for all on-boarded applications.",
     response = Boolean.class)
-       @RequestMapping(value={"/extendSessionTimeOuts"}, method = RequestMethod.POST)
+       @PostMapping(value={"/extendSessionTimeOuts"})
        public Boolean extendSessionTimeOuts(HttpServletRequest request, HttpServletResponse response, @RequestParam String sessionMap) {
                manageService.extendSessionTimeOuts(sessionMap);
                
index 46f96d6..12deabe 100644 (file)
@@ -4,6 +4,8 @@
  * ===================================================================
  * Copyright © 2018 AT&T Intellectual Property. All rights reserved.
  * ===================================================================
+ * Modifications Copyright (c) 2020 IBM
+ * ===================================================================
  *
  * Unless otherwise specified, all software contained herein is licensed
  * under the Apache License, Version 2.0 (the "License");
@@ -55,12 +57,11 @@ public class MusicSessionRepositoryHandler {
        
        public Session get(String id) {
                if(musicCache){
-                // todo need to add the clean up for "sessions" map if musicCache is enabled        
+                // need to add the clean up for "sessions" map if musicCache is enabled
                        return this.sessions.get(id);
                }else{
                        try {
-                               Session session = MusicService.getMetaAttribute(id);
-                               return session;
+                               return MusicService.getMetaAttribute(id);
                        } catch (Exception e) {
                                logger.error(EELFLoggerDelegate.errorLogger, "get failed with id " + id, e);
                                return null;
@@ -72,7 +73,7 @@ public class MusicSessionRepositoryHandler {
 
        public void remove(String id) {
                if(musicCache){
-                        // todo need to add the clean up for "sessions" map if musicCache is enabled        
+                        // need to add the clean up for "sessions" map if musicCache is enabled
                        sessions.remove(id);    
                }else{
                        try {
@@ -87,7 +88,7 @@ public class MusicSessionRepositoryHandler {
 
        public void put(String id, MusicSession musicSession) {
                if(musicCache){
-                        // todo need to add the clean up for "sessions" map if musicCache is enabled        
+                        //need to add the clean up for "sessions" map if musicCache is enabled
                        sessions.put(id, musicSession);         
                }else{
                        try {
index 557e4dc..6ff16fc 100644 (file)
@@ -62,6 +62,9 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+
 
 @RestController
 @org.springframework.context.annotation.Configuration
@@ -90,7 +93,7 @@ public class AppCatalogController extends EPRestrictedBaseController {
         * @throws IOException If sendError fails
         * @return List of items suitable for display
         */
-       @RequestMapping(value = { "/portalApi/appCatalog" }, method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = { "/portalApi/appCatalog" }, produces = "application/json")
        public List<AppCatalogItem> getAppCatalog(HttpServletRequest request, HttpServletResponse response)
                        throws IOException {
                EPUser user = EPUserUtils.getUserSession(request);
@@ -125,7 +128,7 @@ public class AppCatalogController extends EPRestrictedBaseController {
         * @return FieldsValidator
         * @throws IOException If sendError fails
         */
-       @RequestMapping(value = { "/portalApi/appCatalog" }, method = RequestMethod.PUT, produces = "application/json")
+       @PutMapping(value = { "/portalApi/appCatalog" }, produces = "application/json")
        public FieldsValidator putAppCatalogSelection(HttpServletRequest request,
                        @RequestBody AppCatalogPersonalization persRequest, HttpServletResponse response) throws IOException {
                FieldsValidator result = new FieldsValidator();
index 8f456fd..e9119de 100644 (file)
@@ -63,6 +63,8 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 
 @RestController
 @RequestMapping("/portalApi/contactus")
@@ -94,7 +96,7 @@ public class AppContactUsController extends EPRestrictedBaseController {
         * @param request HttpServletRequest
         * @return PortalRestResponse
         */
-       @RequestMapping(value = "/feedback", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/feedback", produces = "application/json")
        public PortalRestResponse<String> getPortalDetails(HttpServletRequest request) {
                PortalRestResponse<String> portalRestResponse;
                try {
@@ -123,7 +125,7 @@ public class AppContactUsController extends EPRestrictedBaseController {
         * @param request HttpServletRequest
         * @return PortalRestResponse<List<AppContactUsItem>>
         */
-       @RequestMapping(value = "/list", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/list", produces = "application/json")
        public PortalRestResponse<List<AppContactUsItem>> getAppContactUsList(HttpServletRequest request) {
                PortalRestResponse<List<AppContactUsItem>> portalRestResponse;
                try {
@@ -145,7 +147,7 @@ public class AppContactUsController extends EPRestrictedBaseController {
         * @param request HttpServletRequest
         * @return PortalRestResponse<List<AppContactUsItem>>
         */
-       @RequestMapping(value = "/allapps", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/allapps", produces = "application/json")
        public PortalRestResponse<List<AppContactUsItem>> getAppsAndContacts(HttpServletRequest request) {
                PortalRestResponse<List<AppContactUsItem>> portalRestResponse;
                try {
@@ -167,7 +169,7 @@ public class AppContactUsController extends EPRestrictedBaseController {
         * @param request HttpServletRequest
         * @return PortalRestResponse<List<AppCategoryFunctionsItem>>
         */
-       @RequestMapping(value = "/functions", method = RequestMethod.GET, produces = "application/json")
+       @GetMapping(value = "/functions", produces = "application/json")
        public PortalRestResponse<List<AppCategoryFunctionsItem>> getAppCategoryFunctions(HttpServletRequest request) {
                PortalRestResponse<List<AppCategoryFunctionsItem>> portalRestResponse;
                try {
@@ -190,7 +192,7 @@ public class AppContactUsController extends EPRestrictedBaseController {
         * @param contactUs AppContactUsItem
         * @return PortalRestResponse<String>
         */
-       @RequestMapping(value = "/save", method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = "/save", produces = "application/json")
        public PortalRestResponse<String> save(@RequestBody AppContactUsItem contactUs) {
 
                if (contactUs == null || contactUs.getAppName() == null) {
@@ -210,7 +212,7 @@ public class AppContactUsController extends EPRestrictedBaseController {
                return new PortalRestResponse<>(PortalRestStatusEnum.OK, saveAppContactUs, "");
        }
 
-       @RequestMapping(value = "/saveAll", method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = "/saveAll", produces = "application/json")
        public PortalRestResponse<String> save(@RequestBody List<AppContactUsItem> contactUsList) {
 
                if (contactUsList == null) {
@@ -237,7 +239,7 @@ public class AppContactUsController extends EPRestrictedBaseController {
         * @param id app ID
         * @return PortalRestResponse<String>
         */
-       @RequestMapping(value = "/delete/{appid}", method = RequestMethod.POST, produces = "application/json")
+       @PostMapping(value = "/delete/{appid}", produces = "application/json")
        public PortalRestResponse<String> delete(@PathVariable("appid") Long id) {
 
                String saveAppContactUs = FAILURE;
index aa180b0..b3d64db 100644 (file)
@@ -46,7 +46,6 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import org.apache.cxf.transport.http.HTTPException;
 import org.onap.portalapp.controller.EPRestrictedBaseController;
-import org.onap.portalapp.portal.domain.EPApp;
 import org.onap.portalapp.portal.domain.EPRole;
 import org.onap.portalapp.portal.domain.EPUser;
 import org.onap.portalapp.portal.domain.EPUserAppCatalogRoles;
@@ -59,7 +58,6 @@ import org.onap.portalapp.portal.logging.aop.EPEELFLoggerAdvice;
 import org.onap.portalapp.portal.logging.logic.EPLogUtil;
 import org.onap.portalapp.portal.service.AdminRolesService;
 import org.onap.portalapp.portal.service.ApplicationsRestClientService;
-import org.onap.portalapp.portal.service.EPAppService;
 import org.onap.portalapp.portal.service.SearchService;
 import org.onap.portalapp.portal.service.UserRolesService;
 import org.onap.portalapp.portal.transport.AppNameIdIsAdmin;
index 015e6c4..a403737 100644 (file)
@@ -40,7 +40,6 @@ package org.onap.portalapp.portal.controller;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
-import java.io.IOException;
 import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.List;
index 9900827..583b43a 100644 (file)
@@ -44,7 +44,6 @@ import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.Transient;
-import javax.validation.constraints.DecimalMax;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.Max;
 import javax.validation.constraints.NotNull;
index b8f79d0..6db834e 100644 (file)
@@ -39,11 +39,6 @@ package org.onap.portalapp.portal.domain;
 
 import java.util.List;
 
-import javax.persistence.Column;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-
 import javax.validation.Valid;
 import org.hibernate.validator.constraints.SafeHtml;
 import org.onap.portalsdk.core.domain.support.DomainVo;
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPServiceCookieTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/domain/EPServiceCookieTest.java
new file mode 100644 (file)
index 0000000..27118a4
--- /dev/null
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2020 IBM Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software 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.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *             https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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.
+ *
+ * ============LICENSE_END============================================
+ *
+ *
+ */
+package org.onap.portalapp.portal.domain;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
+
+public class EPServiceCookieTest {
+    EPServiceCookie ep=new EPServiceCookie();
+
+    @Test
+    public void testGetValue() throws NullPointerException{
+        Map<String, String> mymap = new HashMap<>();
+        mymap.put("1", "one");
+        ep.setValue(mymap);
+        assertNotNull(ep.getValue());
+        assertTrue(ep.getValue().equals(mymap));
+    }
+
+}
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/DuplicateRecordExceptionTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/DuplicateRecordExceptionTest.java
new file mode 100644 (file)
index 0000000..9154e8d
--- /dev/null
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2020 IBM Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software 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.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *             https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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.
+ *
+ * ============LICENSE_END============================================
+ *
+ *
+ */
+package org.onap.portalapp.portal.exceptions;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class DuplicateRecordExceptionTest {
+    @Test
+    public void Test1()
+    {
+        String s1 = "Duplicate Record";
+        DuplicateRecordException mde=new DuplicateRecordException(s1);
+        assertEquals(mde.getMessage(),"Duplicate Record");
+
+    }
+}
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/NotValidDataExceptionTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/exceptions/NotValidDataExceptionTest.java
new file mode 100644 (file)
index 0000000..889b28f
--- /dev/null
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START============================================
+ * ONAP Portal
+ * =====================================================================
+ * Copyright (C) 2020 IBM Intellectual Property. All rights reserved.
+ * =====================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software 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.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *             https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * 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.
+ *
+ * ============LICENSE_END================================================
+ *
+ *
+ */
+package org.onap.portalapp.portal.exceptions;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+public class NotValidDataExceptionTest {
+
+    @Test
+    public void TestException2() {
+        String s1 = "data";
+        NotValidDataException nca = new NotValidDataException(s1);
+        assertEquals(nca.toString(),"NotValidDataException{}: data");
+    }
+}
index dea5177..2c914c5 100644 (file)
@@ -35,5 +35,7 @@
  
   
   -->
-
+<div class="diaplay-banner" *ngIf="diaplayBanner">
+    <span>{{browserCompatibilityMsg}}</span>
+</div> 
 <router-outlet></router-outlet>
index 7a77339..e739496 100644 (file)
  * ============LICENSE_END============================================
  *
  * 
- */
\ No newline at end of file
+ */
+
+ .diaplay-banner{
+    margin-top: 14px;
+    background-color: yellow;
+    font-weight: bold;
+    position: fixed;
+    z-index: 9999;
+    margin-left: 34em;
+    height: 24px;
+}
\ No newline at end of file
index dbfb568..389153b 100644 (file)
  *
  * 
  */
-import { Component } from '@angular/core';
+import { Component, OnInit } from '@angular/core';
+import { environment } from 'src/environments/environment';
 
 @Component({
   selector: 'app-root',
   templateUrl: './app.component.html',
   styleUrls: ['./app.component.scss']
 })
-export class AppComponent {
-  
-}
+export class AppComponent implements OnInit {
+  diaplayBanner : boolean  = false;
+  api = environment.api;
+  browserCompatibilityMsg: string;
+
+  ngOnInit() {
+    this.diaplayBanner = false;
+    this.browserCompatibilityMsg = this.api.browserCompatibilityMsg;
+    this.getBrowserName();
+  }
+
+  /**
+   * Identify Browser
+  */
+  getBrowserName() {
+    const agent = window.navigator.userAgent.toLowerCase();
+    switch (true) {
+      case agent.indexOf('edge') > -1:
+        return 'edge';
+      case agent.indexOf('opr') > -1 && !!(<any>window).opr:
+        this.diaplayBanner = true;
+        return 'opera';
+      case agent.indexOf('chrome') > -1 && !!(<any>window).chrome:
+        return 'chrome';
+      case agent.indexOf('trident') > -1:
+        this.diaplayBanner = true;
+        return 'ie';
+      case agent.indexOf('firefox') > -1:
+        return 'firefox';
+      case agent.indexOf('safari') > -1:
+        this.diaplayBanner = true;
+        return 'safari';
+      default:
+        this.diaplayBanner = true;
+        return 'other';
+    }
+  }
+}
\ No newline at end of file
index db6b5bf..7cc34da 100644 (file)
@@ -125,7 +125,8 @@ export const environment = {
     "footerLogoImagePath": "",
     "footerLogoText": "",
     "intraSearcLink": "",
-    "extraSearcLink": "https://wiki.onap.org/dosearchsite.action?cql=siteSearch+~+searchStringPlaceHolder&queryString=searchStringPlaceHolder"
+    "extraSearcLink": "https://wiki.onap.org/dosearchsite.action?cql=siteSearch+~+searchStringPlaceHolder&queryString=searchStringPlaceHolder",
+    "browserCompatibilityMsg": "This Application is best viewed on Firefox, Chrome and Edge."
    },
     "getAccessUrl": "",
     "getAccessName":"",
index 0482c20..d412522 100644 (file)
@@ -129,7 +129,8 @@ export const environment = {
     "footerLogoImagePath": "",
     "footerLogoText": "",
     "intraSearcLink": "",
-    "extraSearcLink": "https://wiki.onap.org/dosearchsite.action?cql=siteSearch+~+searchStringPlaceHolder&queryString=searchStringPlaceHolder"
+    "extraSearcLink": "https://wiki.onap.org/dosearchsite.action?cql=siteSearch+~+searchStringPlaceHolder&queryString=searchStringPlaceHolder",
+    "browserCompatibilityMsg": "This Application is best viewed on Firefox, Chrome and Edge."
   },
   "getAccessUrl": "",
   "getAccessName": "",