From: Sunder Tattavarada Date: Tue, 19 May 2020 18:01:01 +0000 (+0000) Subject: Merge "removed code smells" X-Git-Tag: 3.4.0~71 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=0a538f1113c1236e1ce8ba589a9446f6848e1844;hp=e4fae46259c1d5b877e2ac6c394e2f43cea16d22;p=portal.git Merge "removed code smells" --- diff --git a/3.2.1-container-portal-docker.yaml b/3.2.1-container-portal-docker.yaml new file mode 100644 index 00000000..8872a0a6 --- /dev/null +++ b/3.2.1-container-portal-docker.yaml @@ -0,0 +1,7 @@ +distribution_type: container +container_release_tag: 3.2.1 +project: portal +ref: b310e558488c48cadc251a3d87b1f10f044c2499 +containers: + - name: portal-app + version: 3.2.0-STAGING-latest diff --git a/deliveries/build_portalapps_dockers.sh b/deliveries/build_portalapps_dockers.sh index fdaf9a15..d2349b8e 100755 --- a/deliveries/build_portalapps_dockers.sh +++ b/deliveries/build_portalapps_dockers.sh @@ -76,7 +76,7 @@ else if [ "$SDK_DOCKERFILE" != "skip" ] && [ "SDK_APP_DIR" != "skip" ]; then echo "Build Portal-SDK app" cd $BASEDIR/$SDK_APP_DIR - ${MVN} ${MVN_EXTRA_SDK} clean package + ${MVN} ${MVN_EXTRA_SDK} clean package -Dskiptests=true fi echo "Java build complete." diff --git a/ecomp-portal-BE-common/pom.xml b/ecomp-portal-BE-common/pom.xml index 19d32431..82e9827c 100644 --- a/ecomp-portal-BE-common/pom.xml +++ b/ecomp-portal-BE-common/pom.xml @@ -284,7 +284,7 @@ org.apache.cxf cxf-rt-rs-client - 3.3.3 + 3.3.4 diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationController.java index 33006c92..15539912 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationController.java @@ -51,7 +51,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; 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; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppCatalogController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppCatalogController.java index 6ff16fc8..714d3aba 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppCatalogController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppCatalogController.java @@ -59,8 +59,6 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; 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; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppContactUsController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppContactUsController.java index e9119de8..0bf75fbe 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppContactUsController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppContactUsController.java @@ -61,7 +61,6 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.web.bind.annotation.PathVariable; 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; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppsControllerExternalRequest.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppsControllerExternalRequest.java index 28ec0e1a..ce29900f 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppsControllerExternalRequest.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AppsControllerExternalRequest.java @@ -68,7 +68,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AuditLogController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AuditLogController.java index ae64be12..dc5127c6 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AuditLogController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AuditLogController.java @@ -49,7 +49,6 @@ import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AuxApiRequestMapperController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AuxApiRequestMapperController.java index ab130956..2f4f7883 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AuxApiRequestMapperController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AuxApiRequestMapperController.java @@ -358,7 +358,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B } @ApiOperation(value = "Extends session timeout values for all on-boarded applications.", response = Boolean.class) - @RequestMapping(value = { "/v3/extendSessionTimeOuts" }, method = RequestMethod.POST) + @PostMapping(value = { "/v3/extendSessionTimeOuts" }) public Boolean extendSessionTimeOuts(HttpServletRequest request, HttpServletResponse response, @RequestParam String sessionMap) throws Exception { @@ -865,7 +865,7 @@ public class AuxApiRequestMapperController implements ApplicationContextAware, B @SuppressWarnings("unchecked") @ApiOperation(value = "Accepts messages from external ticketing systems and creates notifications for Portal users.", response = PortalRestResponse.class) - @RequestMapping(value = { "/v3/ticketevent" }, method = RequestMethod.POST) + @PostMapping(value = { "/v3/ticketevent" }) public PortalRestResponse handleRequest(HttpServletRequest request, HttpServletResponse response, @RequestBody String ticketEventJson) throws Exception { diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BEPropertyReaderController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BEPropertyReaderController.java index 4ebe6b59..60164967 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BEPropertyReaderController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BEPropertyReaderController.java @@ -41,7 +41,6 @@ import javax.servlet.http.HttpServletRequest; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.onap.portalapp.portal.domain.BEProperty; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BasicAuthAccountController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BasicAuthAccountController.java index ab040bb0..24c08f3a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BasicAuthAccountController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/BasicAuthAccountController.java @@ -59,12 +59,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @RestController diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/CommonWidgetController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/CommonWidgetController.java index 417a2940..66b9df20 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/CommonWidgetController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/CommonWidgetController.java @@ -47,9 +47,7 @@ import org.onap.portalapp.portal.service.DashboardSearchService; import org.onap.portalapp.portal.transport.CommonWidgetMeta; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardController.java index 17a28476..ff89bb88 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardController.java @@ -80,9 +80,6 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardSearchResultController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardSearchResultController.java index 2a1b9e80..6ad88aef 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardSearchResultController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/DashboardSearchResultController.java @@ -70,9 +70,6 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/EncryptAdminController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/EncryptAdminController.java index 258a7fd5..c57dc4f9 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/EncryptAdminController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/EncryptAdminController.java @@ -59,6 +59,7 @@ import org.onap.portalsdk.core.service.DataAccessService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @@ -75,7 +76,7 @@ public class EncryptAdminController implements BasicAuthenticationController { EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(EncryptAdminController.class); - @RequestMapping(value = { "/executeEncryptQuery" }, method = RequestMethod.POST) + @PostMapping(value = { "/executeEncryptQuery" }) public Map executeEncrypt(HttpServletRequest request, HttpServletResponse response) throws CipherUtilException { diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ExternalAccessRolesController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ExternalAccessRolesController.java index 103e3386..83b5155d 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ExternalAccessRolesController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/ExternalAccessRolesController.java @@ -94,9 +94,7 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.fasterxml.jackson.databind.DeserializationFeature; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/FunctionalMenuController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/FunctionalMenuController.java index 3233a5fe..3442d5a6 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/FunctionalMenuController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/FunctionalMenuController.java @@ -573,14 +573,20 @@ public class FunctionalMenuController extends EPRestrictedBaseController { String lastNameStr = null; String emailStr = null; String lastLogin = null; + boolean isSystemUser = false; EPUser user = EPUserUtils.getUserSession(request); firstNameStr = user.getFirstName(); lastNameStr = user.getLastName(); orgUserIdStr = user.getOrgUserId(); + isSystemUser = user.isSystemUser(); emailStr = user.getEmail(); if (emailStr == null || emailStr.equals("")) { - EPUser userResult = searchService.searchUserByUserId(orgUserIdStr); - emailStr = userResult.getEmail(); + try { + EPUser userResult = searchService.searchUserByUserId(orgUserIdStr); + emailStr = userResult.getEmail(); + }catch(Exception ex) { + logger.error(EELFLoggerDelegate.errorLogger, "searchUserByUserId call failed", ex); + } } SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss Z a"); Date lastLoginDate = user.getLastLoginDate(); @@ -620,6 +626,7 @@ public class FunctionalMenuController extends EPRestrictedBaseController { map.put("userId", orgUserIdStr != null ? orgUserIdStr : (orgUserIdSC != null ? orgUserIdSC.getCvalue() : null)); map.put("last_login", lastLogin); + map.put("isSystemUser", String.valueOf(isSystemUser)); JSONObject j = new JSONObject(map); fnMenuStaticResponse = j.toString(); // Be chatty in the log diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/HealthCheckController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/HealthCheckController.java index 6900c9d6..d78d6146 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/HealthCheckController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/HealthCheckController.java @@ -4,6 +4,8 @@ * =================================================================== * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== + * Modification Copyright © 2020 IBM. + * =================================================================== * * Unless otherwise specified, all software contained herein is licensed * under the Apache License, Version 2.0 (the "License"); diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/LanguageController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/LanguageController.java index 5ee59584..d371dd5c 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/LanguageController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/LanguageController.java @@ -1,6 +1,8 @@ /** * Copyright (C) 2019 CMCC, Inc. and others. All rights reserved. * + * Modification Copyright © 2020 IBM. + * =================================================================== * 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 diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/MicroserviceController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/MicroserviceController.java index 89e8fe75..6bb5b693 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/MicroserviceController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/MicroserviceController.java @@ -4,6 +4,8 @@ * =================================================================== * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== + * Modification Copyright © 2020 IBM. + * =================================================================== * * Unless otherwise specified, all software contained herein is licensed * under the Apache License, Version 2.0 (the "License"); @@ -64,6 +66,10 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; @@ -85,7 +91,7 @@ public class MicroserviceController extends EPRestrictedBaseController { @Autowired private MicroserviceService microserviceService; - @RequestMapping(value = { "/portalApi/microservices" }, method = RequestMethod.POST) + @PostMapping(value = { "/portalApi/microservices" }) public PortalRestResponse createMicroservice(HttpServletRequest request, HttpServletResponse response, @Valid @RequestBody MicroserviceData newServiceData) throws Exception { if (newServiceData == null) { @@ -108,13 +114,13 @@ public class MicroserviceController extends EPRestrictedBaseController { return new PortalRestResponse<>(PortalRestStatusEnum.OK, "SUCCESS", ""); } - @RequestMapping(value = { "/portalApi/microservices" }, method = RequestMethod.GET) + @GetMapping(value = { "/portalApi/microservices" }) public List getMicroservice(HttpServletRequest request, HttpServletResponse response) throws Exception { return microserviceService.getMicroserviceData(); } - @RequestMapping(value = { "/portalApi/microservices/{serviceId}" }, method = RequestMethod.PUT) + @PutMapping(value = { "/portalApi/microservices/{serviceId}" }) public PortalRestResponse updateMicroservice(HttpServletRequest request, HttpServletResponse response, @PathVariable("serviceId") long serviceId, @Valid @RequestBody MicroserviceData newServiceData) { @@ -135,7 +141,7 @@ public class MicroserviceController extends EPRestrictedBaseController { return new PortalRestResponse<>(PortalRestStatusEnum.OK, "SUCCESS", ""); } - @RequestMapping(value = { "/portalApi/microservices/{serviceId}" }, method = RequestMethod.DELETE) + @DeleteMapping(value = { "/portalApi/microservices/{serviceId}" }) public PortalRestResponse deleteMicroservice(HttpServletRequest request, HttpServletResponse response, @PathVariable("serviceId") long serviceId) { try { diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/MicroserviceProxyController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/MicroserviceProxyController.java index fed3b98e..134d99ef 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/MicroserviceProxyController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/MicroserviceProxyController.java @@ -4,6 +4,8 @@ * =================================================================== * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== + * Modification Copyright © 2020 IBM. + * =================================================================== * * Unless otherwise specified, all software contained herein is licensed * under the Apache License, Version 2.0 (the "License"); @@ -52,6 +54,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.HttpClientErrorException; @@ -69,8 +72,7 @@ public class MicroserviceProxyController extends EPUnRestrictedBaseController { @Autowired private MicroserviceProxyService microserviceProxyService; - @RequestMapping(value = { "/portalApi/microservice/proxy/{serviceId}" }, method = { - RequestMethod.GET }, produces = "application/json") + @GetMapping(value = { "/portalApi/microservice/proxy/{serviceId}" }, produces = "application/json") public String getMicroserviceProxy(HttpServletRequest request, HttpServletResponse response, @PathVariable("serviceId") long serviceId) throws Exception { EPUser user = EPUserUtils.getUserSession(request); @@ -83,8 +85,7 @@ public class MicroserviceProxyController extends EPUnRestrictedBaseController { return isValidJSON(answer) ? answer : "{\"error\":\"" + answer.replace(System.getProperty("line.separator"), "") + "\"}"; } - @RequestMapping(value = { "/portalApi/microservice/proxy/parameter/{widgetId}" }, method = { - RequestMethod.GET }, produces = "application/json") + @GetMapping(value = { "/portalApi/microservice/proxy/parameter/{widgetId}" }, produces = "application/json") public String getMicroserviceProxyByWidgetId(HttpServletRequest request, HttpServletResponse response, @PathVariable("widgetId") long widgetId) throws Exception { EPUser user = EPUserUtils.getUserSession(request); diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/PortalAdminController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/PortalAdminController.java index 32b28c7d..563a387a 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/PortalAdminController.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/PortalAdminController.java @@ -4,6 +4,8 @@ * =================================================================== * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== + * Modification Copyright © 2020 IBM. + * =================================================================== * * Unless otherwise specified, all software contained herein is licensed * under the Apache License, Version 2.0 (the "License"); @@ -69,6 +71,10 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @@ -92,7 +98,7 @@ public class PortalAdminController extends EPRestrictedBaseController { this.auditService = auditService; } - @RequestMapping(value = { "/portalApi/portalAdmins" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { "/portalApi/portalAdmins" }, produces = "application/json") public List getPortalAdmins(HttpServletRequest request, HttpServletResponse response) { EPUser user = EPUserUtils.getUserSession(request); List portalAdmins = null; @@ -120,7 +126,7 @@ public class PortalAdminController extends EPRestrictedBaseController { * @param response * @return FieldsValidator */ - @RequestMapping(value = { "/portalApi/portalAdmin" }, method = RequestMethod.POST) + @PostMapping(value = { "/portalApi/portalAdmin" }) public FieldsValidator createPortalAdmin(HttpServletRequest request, @RequestBody String userId, HttpServletResponse response) { EPUser user = EPUserUtils.getUserSession(request); @@ -167,7 +173,7 @@ public class PortalAdminController extends EPRestrictedBaseController { return fieldsValidator; } - @RequestMapping(value = { "/portalApi/portalAdmin/{userInfo}" }, method = RequestMethod.DELETE) + @DeleteMapping(value = { "/portalApi/portalAdmin/{userInfo}" }) public FieldsValidator deletePortalAdmin(HttpServletRequest request, @PathVariable("userInfo") String userInfo, HttpServletResponse response) { @@ -225,8 +231,8 @@ public class PortalAdminController extends EPRestrictedBaseController { return fieldsValidator; } - @RequestMapping(value = { - "/portalApi/adminAppsRoles/{appId}" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { + "/portalApi/adminAppsRoles/{appId}" }, produces = "application/json") public List getRolesByApp(HttpServletRequest request, @PathVariable("appId") Long appId, HttpServletResponse response) { EPUser user = EPUserUtils.getUserSession(request); diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/SharedContext.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/SharedContext.java index 421a2fbc..14837dbf 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/SharedContext.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/SharedContext.java @@ -43,7 +43,6 @@ import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.validation.constraints.Digits; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/interceptor/PortalResourceInterceptor.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/interceptor/PortalResourceInterceptor.java index 3209f35a..78b40473 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/interceptor/PortalResourceInterceptor.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/interceptor/PortalResourceInterceptor.java @@ -39,19 +39,12 @@ */ package org.onap.portalapp.portal.interceptor; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; import java.util.HashMap; import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.mockito.internal.stubbing.answers.ThrowsException; import org.onap.aaf.cadi.CadiWrap; import org.onap.portalapp.controller.sessionmgt.SessionCommunicationController; import org.onap.portalapp.portal.controller.BasicAuthenticationController; @@ -60,7 +53,6 @@ import org.onap.portalapp.portal.controller.SharedContextRestController; import org.onap.portalapp.portal.controller.WebAnalyticsExtAppController; import org.onap.portalapp.portal.domain.BasicAuthCredentials; import org.onap.portalapp.portal.domain.EPApp; -import org.onap.portalapp.portal.domain.EPEndpoint; import org.onap.portalapp.portal.domain.EPUser; import org.onap.portalapp.portal.logging.aop.EPEELFLoggerAdvice; import org.onap.portalapp.portal.logging.format.EPAppMessagesEnum; @@ -68,7 +60,6 @@ import org.onap.portalapp.portal.logging.logic.EPLogUtil; import org.onap.portalapp.portal.service.AdminRolesService; import org.onap.portalapp.portal.service.AppsCacheService; import org.onap.portalapp.portal.service.BasicAuthenticationCredentialService; -import org.onap.portalapp.portal.service.ExternalAccessRolesService; import org.onap.portalapp.portal.utils.EPCommonSystemProperties; import org.onap.portalapp.portal.utils.EcompPortalUtils; import org.onap.portalapp.service.RemoteWebServiceCallService; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerRestInterface.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerRestInterface.java index 93310a97..6a581c19 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerRestInterface.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerRestInterface.java @@ -41,7 +41,6 @@ import java.util.Collections; import java.util.Date; import javax.security.auth.login.CredentialException; -import javax.ws.rs.client.Entity; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedHashMap; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxUtil.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxUtil.java index 4d81c6d0..869a9de5 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxUtil.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxUtil.java @@ -40,7 +40,6 @@ package org.onap.portalapp.portal.scheduleraux; import org.glassfish.jersey.client.ClientResponse; -import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; public class SchedulerAuxUtil { diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AppsCacheServiceImple.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AppsCacheServiceImple.java index 3a70da84..94498f6e 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AppsCacheServiceImple.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AppsCacheServiceImple.java @@ -54,7 +54,6 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalapp.portal.service.AppsCacheService; import org.onap.portalapp.portal.service.AppsCacheServiceImple; import org.onap.portalapp.portal.transport.OnboardingApp; -import org.onap.portalapp.portal.utils.EPCommonSystemProperties; @Service("appsCacheService") @org.springframework.context.annotation.Configuration diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthenticationCredentialServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthenticationCredentialServiceImpl.java index da09c172..618e9ba9 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthenticationCredentialServiceImpl.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthenticationCredentialServiceImpl.java @@ -50,7 +50,6 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.onboarding.exception.CipherUtilException; import org.onap.portalsdk.core.onboarding.util.CipherUtil; import org.onap.portalsdk.core.service.DataAccessService; -import org.onap.portalsdk.core.util.SystemProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/LanguageService.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/LanguageService.java index 570d1e92..ee39dd48 100644 --- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/LanguageService.java +++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/LanguageService.java @@ -16,9 +16,6 @@ package org.onap.portalapp.portal.service; import com.alibaba.fastjson.JSONObject; -import org.onap.portalapp.portal.domain.Language; - -import java.util.List; public interface LanguageService { diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/FunctionalMenuControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/FunctionalMenuControllerTest.java index bee5d932..80099d57 100644 --- a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/FunctionalMenuControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/FunctionalMenuControllerTest.java @@ -292,7 +292,7 @@ public class FunctionalMenuControllerTest extends MockitoTestSuite { @Test public void getFunctionalMenuStaticInfoTest(){ String fnMenuStaticactualResponse = null; - String fnMenuStaticexpectedResponse = "{\"firstName\":\"test\",\"lastName\":\"test\",\"last_login\":\"09/08/2017 03:48:13 -0400 am\",\"userId\":\"guestT\",\"email\":\"test\"}"; + String fnMenuStaticexpectedResponse = "{\"firstName\":\"test\",\"lastName\":\"test\",\"last_login\":\"09/08/2017 03:48:13 -0400 am\",\"userId\":\"guestT\",\"isSystemUser\":\"false\",\"email\":\"test\"}"; String orgUserIdStr = null; EPUser user = mockUser.mockEPUser(); diff --git a/ecomp-portal-BE-os/pom.xml b/ecomp-portal-BE-os/pom.xml index 4ad50dfd..398520cb 100644 --- a/ecomp-portal-BE-os/pom.xml +++ b/ecomp-portal-BE-os/pom.xml @@ -314,11 +314,6 @@ tiles-jsp 3.0.5 - - org.apache.cxf - cxf-rt-rs-client - 3.0.0-milestone1 - com.fasterxml.jackson.core @@ -629,11 +624,6 @@ 1.8.5 test - - commons-beanutils - commons-beanutils - 1.9.3 - org.mitre diff --git a/ecomp-portal-BE-os/src/main/webapp/WEB-INF/conf/system.properties b/ecomp-portal-BE-os/src/main/webapp/WEB-INF/conf/system.properties index 041458d3..3ca32b85 100644 --- a/ecomp-portal-BE-os/src/main/webapp/WEB-INF/conf/system.properties +++ b/ecomp-portal-BE-os/src/main/webapp/WEB-INF/conf/system.properties @@ -151,7 +151,7 @@ ext_central_access_url = https://aaftest.test.onap.org:8095/proxy/authz/ ext_central_access_user_domain = @csp.onap.org # External Central Auth system access -remote_centralized_system_access = false +remote_centralized_system_access = true #left menu with root value or non-root portal_left_menu = non-root \ No newline at end of file diff --git a/ecomp-portal-widget-ms/widget-ms/pom.xml b/ecomp-portal-widget-ms/widget-ms/pom.xml index 4095388c..f4275067 100644 --- a/ecomp-portal-widget-ms/widget-ms/pom.xml +++ b/ecomp-portal-widget-ms/widget-ms/pom.xml @@ -7,7 +7,7 @@ org.springframework.boot spring-boot-starter-parent - 1.5.11.RELEASE + 2.2.5.RELEASE @@ -22,10 +22,10 @@ UTF-8 UTF-8 1.8 - 4.3.11.Final + 5.4.14.Final false - 0.7.6.201602180812 + 0.8.2 @@ -68,7 +68,7 @@ org.hibernate hibernate-core - + ${hibernate.version} org.springframework.boot @@ -96,7 +96,7 @@ com.github.ulisesbocchio jasypt-spring-boot-starter - 1.9 + 2.1.0 org.jsoup @@ -109,7 +109,7 @@ dom4j dom4j - + 1.6.1 jaxme @@ -151,7 +151,7 @@ org.apache.tomcat.embed tomcat-embed-core - 8.5.28 + 9.0.33 ch.qos.logback @@ -181,7 +181,7 @@ org.springframework.security spring-security-web - 4.2.13.RELEASE + 5.2.3.RELEASE org.projectlombok diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/controller/WidgetsCatalogController.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/controller/WidgetsCatalogController.java index b1450b6d..2bea2352 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/controller/WidgetsCatalogController.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/controller/WidgetsCatalogController.java @@ -4,7 +4,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.onap.portalapp.widget.domain.ValidationRespond; @@ -22,6 +22,10 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; @@ -37,12 +41,12 @@ public class WidgetsCatalogController { @Value("${server.port}") String port; - @Value("${server.contextPath}") + @Value("${server.servlet.context-path}") String context; - @Value("${security.user.name}") + @Value("${spring.security.user.name}") String security_user; - @Value("${security.user.password}") + @Value("${spring.security.user.password}") String security_pass; @Autowired @@ -59,7 +63,7 @@ public class WidgetsCatalogController { private static final Logger logger = LoggerFactory.getLogger(WidgetsCatalogController.class); @ResponseBody - @RequestMapping(value = { "/microservices/widgetCatalog" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { "/microservices/widgetCatalog" }, produces = "application/json") public List getWidgetCatalog(HttpServletRequest request, HttpServletResponse response ,@RequestHeader(value="Authorization") String auth) throws IOException{ @@ -79,7 +83,7 @@ public class WidgetsCatalogController { } @ResponseBody - @RequestMapping(value = { "/microservices/widgetCatalog/{loginName}" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { "/microservices/widgetCatalog/{loginName}" }, produces = "application/json") public List getUserWidgetCatalog(HttpServletRequest request, HttpServletResponse response, @PathVariable("loginName") String loginName, @RequestHeader(value="Authorization") String auth) throws IOException { List widgetCatalog = null; @@ -98,7 +102,7 @@ public class WidgetsCatalogController { } @ResponseBody - @RequestMapping(value = { "/microservices/widgetCatalog/{widgetId}" }, method = RequestMethod.PUT, produces = "application/json") + @PutMapping(value = { "/microservices/widgetCatalog/{widgetId}" }, produces = "application/json") public void updateWidgetCatalog(HttpServletRequest request, HttpServletResponse response, @RequestBody WidgetCatalog newWidgetCatalog, @PathVariable("widgetId") long widgetId, @RequestHeader(value="Authorization") String auth) throws IOException { @@ -117,7 +121,7 @@ public class WidgetsCatalogController { } @ResponseBody - @RequestMapping(value = { "/microservices/widgetCatalog" }, method = RequestMethod.POST, produces = "application/json") + @PostMapping(value = { "/microservices/widgetCatalog" }, produces = "application/json") public ValidationRespond saveWidgetCatalog(HttpServletRequest request, HttpServletResponse response, @RequestHeader(value="Authorization") String auth, @RequestParam("file") MultipartFile file, @RequestParam("widget") String widget) throws IOException { @@ -148,7 +152,7 @@ public class WidgetsCatalogController { } @ResponseBody - @RequestMapping(value = { "/microservices/widgetCatalog/{widgetId}" }, method = RequestMethod.POST, produces = "application/json") + @PostMapping(value = { "/microservices/widgetCatalog/{widgetId}" }, produces = "application/json") public ValidationRespond updateWidgetCatalogwithFiles(HttpServletRequest request, HttpServletResponse response, @RequestHeader(value="Authorization") String auth, @RequestParam("file") MultipartFile file, @RequestParam("widget") String widget, @PathVariable("widgetId") long widgetId) throws IOException { logger.debug("microserivces updating with files {}", widgetId); @@ -176,8 +180,7 @@ public class WidgetsCatalogController { } @ResponseBody - @RequestMapping(value = { "/microservices/widgetCatalog/{widgetId}" }, method = { - RequestMethod.DELETE }, produces = "application/json") + @DeleteMapping(value = { "/microservices/widgetCatalog/{widgetId}" }, produces = "application/json") public void deleteOnboardingWidget(HttpServletRequest request, HttpServletResponse response, @PathVariable("widgetId") long widgetId, @RequestHeader(value="Authorization") String auth) throws IOException{ if(!util.authorization(auth, security_user, security_pass)){ @@ -196,7 +199,7 @@ public class WidgetsCatalogController { } @ResponseBody - @RequestMapping(value = { "/microservices/widgetCatalog/parameters/{widgetId}" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { "/microservices/widgetCatalog/parameters/{widgetId}" }, produces = "application/json") public Long getServiceIdByWidget(HttpServletRequest request, HttpServletResponse response, @PathVariable("widgetId") Long widgetId, @RequestHeader(value="Authorization") String auth) throws IOException { @@ -217,7 +220,7 @@ public class WidgetsCatalogController { @ResponseBody - @RequestMapping(value = { "/microservices/widgetCatalog/service/{serviceId}" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { "/microservices/widgetCatalog/service/{serviceId}" }, produces = "application/json") public List getWidgetByServiceId(HttpServletRequest request, HttpServletResponse response, @PathVariable("serviceId") Long serviceId, @RequestHeader(value="Authorization") String auth) throws IOException { List list = new ArrayList<>(); @@ -237,7 +240,7 @@ public class WidgetsCatalogController { @ResponseBody - @RequestMapping(value = { "/microservices/download/{widgetId}" }, method = RequestMethod.GET, produces = "application/json") + @GetMapping(value = { "/microservices/download/{widgetId}" }, produces = "application/json") public byte[] getWidgetZipFile(HttpServletRequest request, HttpServletResponse response, @PathVariable("widgetId") long widgetId, @RequestHeader(value="Authorization") String auth) throws Exception { byte[] byteFile = null; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/App.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/App.java index 212826cd..46ee814c 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/App.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/App.java @@ -21,7 +21,7 @@ public class App implements Serializable{ @Id @Column(name = "APP_ID") - @GeneratedValue(strategy=GenerationType.AUTO) + @GeneratedValue(strategy=GenerationType.IDENTITY) @Digits(integer = 11, fraction = 0) private Long appId; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/MicroserviceData.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/MicroserviceData.java index 43e7b2b0..2ed49ab4 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/MicroserviceData.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/MicroserviceData.java @@ -26,7 +26,7 @@ public class MicroserviceData { @Id @Column(name = "id") @Digits(integer = 11, fraction = 0) - @GeneratedValue(strategy=GenerationType.AUTO) + @GeneratedValue(strategy=GenerationType.IDENTITY) private Long id; @Column(name = "name") diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/MicroserviceParameter.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/MicroserviceParameter.java index 7207d0ae..cd9236da 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/MicroserviceParameter.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/MicroserviceParameter.java @@ -24,7 +24,7 @@ public class MicroserviceParameter { @Id @Column(name = "id") - @GeneratedValue(strategy=GenerationType.AUTO) + @GeneratedValue(strategy=GenerationType.IDENTITY) @Digits(integer = 11, fraction = 0) private Long id; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/RoleApp.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/RoleApp.java index aae9bfed..173a1430 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/RoleApp.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/RoleApp.java @@ -33,7 +33,7 @@ public class RoleApp implements Serializable{ @Id @Column(name = "ROLE_ID") - @GeneratedValue(strategy=GenerationType.AUTO) + @GeneratedValue(strategy=GenerationType.IDENTITY) @Digits(integer = 11, fraction = 0) private Long roleId; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/WidgetCatalog.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/WidgetCatalog.java index 1dc0582c..a822c5a2 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/WidgetCatalog.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/WidgetCatalog.java @@ -30,7 +30,7 @@ public class WidgetCatalog{ @Id @Column(name = "widget_id") - @GeneratedValue(strategy=GenerationType.AUTO) + @GeneratedValue(strategy=GenerationType.IDENTITY) @Digits(integer = 11, fraction = 0) private long id; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/hibernate/HibernateConfiguration.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/hibernate/HibernateConfiguration.java index b52631f1..ac25077b 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/hibernate/HibernateConfiguration.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/hibernate/HibernateConfiguration.java @@ -6,7 +6,7 @@ import javax.sql.DataSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; -import org.springframework.orm.hibernate4.LocalSessionFactoryBean; +import org.springframework.orm.hibernate5.LocalSessionFactoryBean; import org.springframework.orm.jpa.JpaTransactionManager; import org.springframework.transaction.PlatformTransactionManager; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/service/impl/MicroserviceServiceImpl.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/service/impl/MicroserviceServiceImpl.java index fed70ad9..a02667de 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/service/impl/MicroserviceServiceImpl.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/service/impl/MicroserviceServiceImpl.java @@ -41,7 +41,7 @@ public class MicroserviceServiceImpl implements MicroserviceService{ Transaction tx = session.beginTransaction(); session.save(newService); tx.commit(); - session.flush(); +// session.flush(); session.close(); } catch(Exception e){ @@ -58,7 +58,7 @@ public class MicroserviceServiceImpl implements MicroserviceService{ Transaction tx = session.beginTransaction(); session.save(newParameter); tx.commit(); - session.flush(); +// session.flush(); session.close(); } catch(Exception e){ @@ -77,7 +77,7 @@ public class MicroserviceServiceImpl implements MicroserviceService{ List services = criteria.list(); logger.debug("MicroserviceServiceImpl.getMicroserviceByName: result={}", services); - session.flush(); +// session.flush(); session.close(); return (services.size() > 0) ? services.get(0).getId() : null; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/service/impl/WidgetCatalogServiceImpl.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/service/impl/WidgetCatalogServiceImpl.java index 59180d37..f5558e2e 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/service/impl/WidgetCatalogServiceImpl.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/service/impl/WidgetCatalogServiceImpl.java @@ -191,7 +191,7 @@ public class WidgetCatalogServiceImpl implements WidgetCatalogService { Transaction tx = session.beginTransaction(); session.save(newWidgetCatalog); tx.commit(); - session.flush(); + //session.flush(); session.close(); updateAppId(newWidgetCatalog.getId(), newWidgetCatalog.getWidgetRoles()); } @@ -217,7 +217,7 @@ public class WidgetCatalogServiceImpl implements WidgetCatalogService { Transaction tx = session.beginTransaction(); session.update(newWidgetCatalog); tx.commit(); - session.flush(); + //session.flush(); session.close(); updateAppId(newWidgetCatalog.getId(), newWidgetCatalog.getWidgetRoles()); }catch(Exception e){ @@ -268,7 +268,7 @@ public class WidgetCatalogServiceImpl implements WidgetCatalogService { List widgets = criteria.list(); logger.debug("WidgetCatalogServiceImpl.getWidgetIdByName: result={}", widgets); - session.flush(); +// session.flush(); session.close(); return (widgets.size() > 0) ? true : false; diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/resources/application.properties b/ecomp-portal-widget-ms/widget-ms/src/main/resources/application.properties index 42483b7f..82b26d6e 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/resources/application.properties +++ b/ecomp-portal-widget-ms/widget-ms/src/main/resources/application.properties @@ -1,22 +1,22 @@ ## General App Properties -server.contextPath=/widget +server.servlet.context-path=/widget server.port=9082 -spring.http.multipart.max-file-size=128MB -spring.http.multipart.max-request-size=128MB +spring.servlet.multipart.max-file-size=128MB +spring.servlet.multipart.max-request-size=128MB microservice.widget.location=/tmp ## App DB Properties spring.datasource.url=jdbc:mariadb://localhost:3306/portal spring.datasource.username=root -spring.datasource.password=root +spring.datasource.password=welcome2ibm spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect spring.database.driver.classname=org.mariadb.jdbc.Driver spring.jpa.show-sql=false spring.jpa.properties.hibernate.format_sql=false ## Basic Authentication Properties -security.user.name=widget_user -security.user.password=ENC(IjywcRnI9+nuVEh9+OFFiRWAjBT1n718) +spring.security.user.name=widget_user +spring.security.user.password=ENC(IjywcRnI9+nuVEh9+OFFiRWAjBT1n718) account.user.name=portal account.user.password=6APqvG4AU2rfLgCvMdySwQ== diff --git a/ecomp-portal-widget-ms/widget-ms/src/test/java/org/onap/portalapp/widget/service/impl/WidgetCatalogServiceImplTest.java b/ecomp-portal-widget-ms/widget-ms/src/test/java/org/onap/portalapp/widget/service/impl/WidgetCatalogServiceImplTest.java index 933710d2..2d1fd273 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/test/java/org/onap/portalapp/widget/service/impl/WidgetCatalogServiceImplTest.java +++ b/ecomp-portal-widget-ms/widget-ms/src/test/java/org/onap/portalapp/widget/service/impl/WidgetCatalogServiceImplTest.java @@ -59,6 +59,7 @@ import org.mockito.MockitoAnnotations; import org.onap.portalapp.widget.domain.App; import org.onap.portalapp.widget.domain.RoleApp; import org.onap.portalapp.widget.domain.WidgetCatalog; +import org.hibernate.query.NativeQuery; public class WidgetCatalogServiceImplTest { @@ -75,7 +76,7 @@ public class WidgetCatalogServiceImplTest { Criteria criteria; @Mock - SQLQuery query; + NativeQuery query; @Before public void init() { diff --git a/ecomp-portal-widget-ms/widget-ms/src/test/java/org/onap/portalapp/widget/test/controller/WidgetsCatalogControllerTest.java b/ecomp-portal-widget-ms/widget-ms/src/test/java/org/onap/portalapp/widget/test/controller/WidgetsCatalogControllerTest.java index d3dc1cbf..0d01ee50 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/test/java/org/onap/portalapp/widget/test/controller/WidgetsCatalogControllerTest.java +++ b/ecomp-portal-widget-ms/widget-ms/src/test/java/org/onap/portalapp/widget/test/controller/WidgetsCatalogControllerTest.java @@ -134,7 +134,7 @@ public class WidgetsCatalogControllerTest { List list = new ArrayList(); WidgetCatalog widget = new WidgetCatalog(); list.add(widget); - Mockito.when(widgetService.getWidgetCatalog()).thenReturn(list); + Mockito.lenient().when(widgetService.getWidgetCatalog()).thenReturn(list); mockMvc.perform(get("/microservices/widgetCatalog/")) .andExpect(status().isBadRequest()); @@ -148,7 +148,7 @@ public class WidgetsCatalogControllerTest { widget.setId(1); widget.setName("junit"); list.add(widget); - Mockito.when(widgetService.getUserWidgetCatalog("test")).thenReturn(list); + Mockito.lenient().when(widgetService.getUserWidgetCatalog("test")).thenReturn(list); String security_user = "user"; String security_pass = "password"; @@ -170,7 +170,7 @@ public class WidgetsCatalogControllerTest { widget.setId(1); widget.setName("junit"); list.add(widget); - Mockito.when(widgetService.getUserWidgetCatalog("test")).thenReturn(list); + Mockito.lenient().when(widgetService.getUserWidgetCatalog("test")).thenReturn(list); String security_user = "user"; String security_pass = "password"; @@ -190,7 +190,7 @@ public class WidgetsCatalogControllerTest { @Test public void saveWidgetCatalog_ValidAuthorization_NoError() throws Exception { ValidationRespond respond = new ValidationRespond(true, null); - Mockito.when(storageService.checkZipFile(any(MultipartFile.class))).thenReturn(respond); + Mockito.lenient().when(storageService.checkZipFile(any(MultipartFile.class))).thenReturn(respond); String security_user = "user"; String security_pass = "password"; @@ -211,7 +211,7 @@ public class WidgetsCatalogControllerTest { @Test public void saveWidgetCatalog_Authorization_Error() throws Exception { ValidationRespond respond = new ValidationRespond(true, null); - Mockito.when(storageService.checkZipFile(any(MultipartFile.class))).thenReturn(respond); + Mockito.lenient().when(storageService.checkZipFile(any(MultipartFile.class))).thenReturn(respond); String security_user = "user"; String security_pass = "password"; @@ -270,7 +270,7 @@ public class WidgetsCatalogControllerTest { @Test public void updateWidgetCatalogwithFiles_ValidAuthorization_NoError() throws Exception { ValidationRespond respond = new ValidationRespond(true, null); - Mockito.when(storageService.checkZipFile(any(MultipartFile.class))).thenReturn(respond); + Mockito.lenient().when(storageService.checkZipFile(any(MultipartFile.class))).thenReturn(respond); String security_user = "user"; String security_pass = "password"; @@ -420,7 +420,7 @@ public class WidgetsCatalogControllerTest { widget.setId(1); widget.setName("junit"); list.add(widget); - Mockito.when(widgetService.getWidgetsByServiceId(serviceId)).thenReturn(list); + Mockito.lenient().when(widgetService.getWidgetsByServiceId(serviceId)).thenReturn(list); String security_user = "user"; String security_pass = "password"; @@ -462,7 +462,7 @@ public class WidgetsCatalogControllerTest { String wrong_pass = "wrong"; Long widgetId = new Long(1); byte[] bytes="Test".getBytes(); - Mockito.when(storageService.getWidgetCatalogContent(widgetId)).thenReturn(bytes); + Mockito.lenient().when(storageService.getWidgetCatalogContent(widgetId)).thenReturn(bytes); ReflectionTestUtils.setField(controller, "security_user", security_user, String.class); ReflectionTestUtils.setField(controller, "security_pass", security_pass, String.class); diff --git a/pom.xml b/pom.xml index 19d8c34e..7c484016 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ 0 - 2.6.0 + 3.3.0-SNAPSHOT 4.3.24.RELEASE 4.2.13.RELEASE 4.3.11.Final @@ -297,7 +297,27 @@ - + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M2 + + + enforce-no-snapshots + + enforce + + + + + No Snapshots Allowed! + + + false + + + + diff --git a/portal-FE-common/src/app/layout/components/header/header.component.html b/portal-FE-common/src/app/layout/components/header/header.component.html index f3b3a5f7..97f4a260 100644 --- a/portal-FE-common/src/app/layout/components/header/header.component.html +++ b/portal-FE-common/src/app/layout/components/header/header.component.html @@ -76,7 +76,7 @@ -