Merge "removed code smells"
authorSunder Tattavarada <statta@research.att.com>
Mon, 18 May 2020 20:27:09 +0000 (20:27 +0000)
committerGerrit Code Review <gerrit@onap.org>
Mon, 18 May 2020 20:27:09 +0000 (20:27 +0000)
37 files changed:
3.2.1-container-portal-docker.yaml [new file with mode: 0644]
deliveries/build_portalapps_dockers.sh
ecomp-portal-BE-common/pom.xml
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/controller/sessionmgt/SessionCommunicationController.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/AppsControllerExternalRequest.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AuditLogController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/AuxApiRequestMapperController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/FunctionalMenuController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/domain/SharedContext.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/interceptor/PortalResourceInterceptor.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduler/SchedulerRestInterface.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/scheduleraux/SchedulerAuxUtil.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/AppsCacheServiceImple.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/BasicAuthenticationCredentialServiceImpl.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/LanguageService.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/FunctionalMenuControllerTest.java
ecomp-portal-BE-os/pom.xml
ecomp-portal-BE-os/src/main/webapp/WEB-INF/conf/system.properties
ecomp-portal-widget-ms/widget-ms/pom.xml
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/controller/WidgetsCatalogController.java
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/App.java
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/MicroserviceData.java
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/MicroserviceParameter.java
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/RoleApp.java
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/WidgetCatalog.java
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/hibernate/HibernateConfiguration.java
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/service/impl/MicroserviceServiceImpl.java
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/service/impl/WidgetCatalogServiceImpl.java
ecomp-portal-widget-ms/widget-ms/src/main/resources/application.properties
ecomp-portal-widget-ms/widget-ms/src/test/java/org/onap/portalapp/widget/service/impl/WidgetCatalogServiceImplTest.java
ecomp-portal-widget-ms/widget-ms/src/test/java/org/onap/portalapp/widget/test/controller/WidgetsCatalogControllerTest.java
pom.xml
portal-FE-common/src/app/layout/components/header/header.component.html
portal-FE-common/src/app/layout/components/header/header.component.ts
portal-FE-os/src/favicon.ico

diff --git a/3.2.1-container-portal-docker.yaml b/3.2.1-container-portal-docker.yaml
new file mode 100644 (file)
index 0000000..8872a0a
--- /dev/null
@@ -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
index fdaf9a1..d2349b8 100755 (executable)
@@ -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."
index 19d3243..82e9827 100644 (file)
                <dependency>
                        <groupId>org.apache.cxf</groupId>
                        <artifactId>cxf-rt-rs-client</artifactId>
-                       <version>3.3.3</version>
+                       <version>3.3.4</version>
                </dependency>
                <!-- Mapper -->
                <dependency>
index 33006c9..1553991 100644 (file)
@@ -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;
index 6ff16fc..714d3ab 100644 (file)
@@ -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;
index e9119de..0bf75fb 100644 (file)
@@ -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;
index 28ec0e1..ce29900 100644 (file)
@@ -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;
 
index ae64be1..dc5127c 100644 (file)
@@ -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;
 
index ab13095..2f4f788 100644 (file)
@@ -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<String> handleRequest(HttpServletRequest request, HttpServletResponse response,
                        @RequestBody String ticketEventJson) throws Exception {
 
index 65abc28..dd5f5f4 100644 (file)
@@ -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
index 421a2fb..14837db 100644 (file)
@@ -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;
index 3209f35..78b4047 100644 (file)
  */
 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;
index 93310a9..6a581c1 100644 (file)
@@ -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;
 
index 3a70da8..94498f6 100644 (file)
@@ -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
index da09c17..618e9ba 100644 (file)
@@ -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;
index 570d1e9..ee39dd4 100644 (file)
@@ -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 {
 
index bee5d93..80099d5 100644 (file)
@@ -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();
index 4ad50df..398520c 100644 (file)
                        <artifactId>tiles-jsp</artifactId>
                        <version>3.0.5</version>
                </dependency>
-               <dependency>
-                       <groupId>org.apache.cxf</groupId>
-                       <artifactId>cxf-rt-rs-client</artifactId>
-                       <version>3.0.0-milestone1</version>
-               </dependency>
                <!-- Mapper -->
                <dependency>
                        <groupId>com.fasterxml.jackson.core</groupId>
                        <version>1.8.5</version>
                        <scope>test</scope>
                </dependency>
-               <dependency>
-                       <groupId>commons-beanutils</groupId>
-                       <artifactId>commons-beanutils</artifactId>
-                       <version>1.9.3</version>
-               </dependency>
                <!-- OpenID Connect Dependencies -->
                <dependency>
                        <groupId>org.mitre</groupId>
index 041458d..3ca32b8 100644 (file)
@@ -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
index 4095388..f427506 100644 (file)
@@ -7,7 +7,7 @@
        <parent>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-parent</artifactId>
-               <version>1.5.11.RELEASE</version>
+               <version>2.2.5.RELEASE</version>
                <relativePath /> <!-- lookup parent from repository -->
        </parent>
 
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
                <java.version>1.8</java.version>
-               <hibernate.version>4.3.11.Final</hibernate.version>
+               <hibernate.version>5.4.14.Final</hibernate.version>
                <skipTests>false</skipTests>
                <!-- Replicate this from OParent -->
-               <jacocoVersion>0.7.6.201602180812</jacocoVersion>
+               <jacocoVersion>0.8.2</jacocoVersion>
        </properties>
 
        <dependencies>
@@ -68,7 +68,7 @@
                <dependency>
                        <groupId>org.hibernate</groupId>
                        <artifactId>hibernate-core</artifactId>
-                       <!-- <version>${hibernate.version}</version> -->
+                       <version>${hibernate.version}</version>
                </dependency>
                <dependency>
                        <groupId>org.springframework.boot</groupId>
@@ -96,7 +96,7 @@
                <dependency>
                        <groupId>com.github.ulisesbocchio</groupId>
                        <artifactId>jasypt-spring-boot-starter</artifactId>
-                       <version>1.9</version>
+                       <version>2.1.0</version>
                </dependency>
                <dependency>
                        <groupId>org.jsoup</groupId>
                <dependency>
                        <groupId>dom4j</groupId>
                        <artifactId>dom4j</artifactId>
-                       <!-- <version>1.6.1</version> -->
+                       <version>1.6.1</version>
                        <exclusions>
                                <exclusion>
                                        <groupId>jaxme</groupId>
                <dependency>
                <groupId>org.apache.tomcat.embed</groupId>
                <artifactId>tomcat-embed-core</artifactId>
-               <version>8.5.28</version>
+               <version>9.0.33</version>
                </dependency>
                <dependency>
                        <groupId>ch.qos.logback</groupId>
                <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-web</artifactId>
-               <version>4.2.13.RELEASE</version>
+               <version>5.2.3.RELEASE</version>
                </dependency>
                <dependency>
                        <groupId>org.projectlombok</groupId>
index b1450b6..5f458c1 100644 (file)
@@ -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
index 212826c..46ee814 100644 (file)
@@ -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;
 
index 43e7b2b..2ed49ab 100644 (file)
@@ -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")
index 7207d0a..cd9236d 100644 (file)
@@ -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;
 
index aae9bfe..173a143 100644 (file)
@@ -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;
 
index 1dc0582..a822c5a 100644 (file)
@@ -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;
        
index b52631f..ac25077 100644 (file)
@@ -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;
 
index fed70ad..a02667d 100644 (file)
@@ -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<MicroserviceData> services = criteria.list();
                logger.debug("MicroserviceServiceImpl.getMicroserviceByName: result={}", services);
-               session.flush();
+//             session.flush();
                session.close();
                
                return (services.size() > 0) ? services.get(0).getId() : null;
index 59180d3..f5558e2 100644 (file)
@@ -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<MicroserviceData> widgets = criteria.list();
                logger.debug("WidgetCatalogServiceImpl.getWidgetIdByName: result={}", widgets);
-               session.flush();
+//             session.flush();
                session.close();
                
                return (widgets.size() > 0) ? true : false;
index 42483b7..82b26d6 100644 (file)
@@ -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==
index 933710d..2d1fd27 100644 (file)
@@ -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() {
index d3dc1cb..0d01ee5 100644 (file)
@@ -134,7 +134,7 @@ public class WidgetsCatalogControllerTest {
                List<WidgetCatalog> list = new ArrayList<WidgetCatalog>();
                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 19d8c34..7c48401 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
        <properties>
                <!-- Jenkins should invoke mvn with argument -Dbuild.number=${BUILD_NUMBER} -->
                <build.number>0</build.number>
-               <epsdk.version>2.6.0</epsdk.version>
+               <epsdk.version>3.3.0-SNAPSHOT</epsdk.version>
                <springframework.version>4.3.24.RELEASE</springframework.version>
                <springframework.security.version>4.2.13.RELEASE</springframework.security.version>
                <hibernate.version>4.3.11.Final</hibernate.version>
                          </execution>
                        </executions>
                  </plugin>
-                 
+                 <plugin>
+                     <groupId>org.apache.maven.plugins</groupId>
+                     <artifactId>maven-enforcer-plugin</artifactId>
+                     <version>3.0.0-M2</version>
+                     <executions>
+                      <execution>
+                      <id>enforce-no-snapshots</id>
+                      <goals>
+                      <goal>enforce</goal>
+                      </goals>
+                    <configuration>
+                    <rules>
+                    <requireReleaseVersion>
+                     <message>No Snapshots Allowed!</message>
+                    </requireReleaseVersion>
+                    </rules>
+                    <fail>false</fail>
+                    </configuration>
+                  </execution>
+                 </executions>
+                 </plugin>
                </plugins>
        </build>
 
index f3b3a5f..97f4a26 100644 (file)
@@ -76,7 +76,7 @@
 <li class="dropdown-item" style="font-weight: lighter">
     {{firstName}}, {{lastName}}
 </li>
-<li class="dropdown-item">
+<li class="dropdown-item" *ngIf=(!isSystemUser)>
     <span class="dropdown-item-name"> {{ 'Email'}}: </span>
     <div>
         <span class="dropdown-item-value">
@@ -85,7 +85,8 @@
     </div>
 </li>
 <li class="dropdown-item">
-    <span class="dropdown-item-name"> {{ 'User Id' }}: </span>
+    <span class="dropdown-item-name" *ngIf=(!isSystemUser)> {{ 'User Id' }}: </span>
+    <span class="dropdown-item-name" *ngIf=(isSystemUser)> {{ 'System Id' }}: </span>
     <div>
         <span class="dropdown-item-value">
             {{loginSnippetUserid}}
index 09dd4c1..429587d 100644 (file)
@@ -59,6 +59,7 @@ export class HeaderComponent implements OnInit {
     api = environment.api;
     brandName: string;
     brandLogoImagePath: string;
+    isSystemUser: boolean = false;
 
     constructor(public router: Router, private userProfileService: UserProfileService, private menusService: MenusService, private cookieService: CookieService) {
 
@@ -90,7 +91,7 @@ export class HeaderComponent implements OnInit {
 
     getUserInformation() {
         this.userProfileService.getFunctionalMenuStaticInfo().toPromise().then((res: any) => {
-            if (res == null || res.firstName == null || res.firstName == '' || res.lastName == null || res.lastName == '') {
+            if (res === null || res.firstName === null || res.firstName === '' || res.lastName === null || res.lastName === '') {
                 // $log.info('HeaderCtrl: failed to get all required data, trying user profile');
                 this.userProfileService.getUserProfile().toPromise().then((profile: any) => {
                     this.firstName = profile.firstName;
@@ -105,6 +106,9 @@ export class HeaderComponent implements OnInit {
                 this.loginSnippetUserid = res.userId;
                 this.lastLogin = Date.parse(res.last_login);
             }
+            if(res != null && res.isSystemUser === 'true'){
+                this.isSystemUser = true;
+            }
             sessionStorage.userId = res.userId;
             this.menusService.getFunctionalMenuForUser().toPromise().then((jsonHeaderMenu: any) => {
                 // $scope.menuItems = unflatten(jsonHeaderMenu);
index d2c5e0f..cb712eb 100644 (file)
Binary files a/portal-FE-os/src/favicon.ico and b/portal-FE-os/src/favicon.ico differ