From: Sunder Tattavarada Date: Mon, 18 May 2020 20:26:42 +0000 (+0000) Subject: Merge "lower code smells" X-Git-Tag: 3.4.0~76 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=ad71ab45da79247f3ef1f695aa1a732434d70eca;hp=071c46beff5157c7114689ea726b70746b259524;p=portal.git Merge "lower 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/portal/controller/FunctionalMenuController.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/FunctionalMenuController.java index 65abc280..dd5f5f4d 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 @@ -575,14 +575,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(); @@ -622,6 +628,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/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..5f458c1d 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 @@ -37,12 +37,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 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 @@ -