Added Junits 95/32595/1
authorGUJJA <kg811t@research.att.com>
Thu, 22 Feb 2018 17:21:33 +0000 (12:21 -0500)
committerGUJJA <kg811t@research.att.com>
Thu, 22 Feb 2018 17:22:29 +0000 (12:22 -0500)
Issue-ID: PORTAL-136

Includes JUNITS

Change-Id: I859aa9de0ce51a1ac699c81e98c2af7fda7ae660
Signed-off-by:GUJJA <kg811t@research.att.com>

13 files changed:
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/SecurityInitializer.java [new file with mode: 0644]
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/RoleManageController.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/logging/format/EPAppMessagesEnum.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesService.java
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImpl.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/RoleManageControllerTest.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/AdminRolesServiceImplTest.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/EPLeftMenuServiceImplTest.java [new file with mode: 0644]
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/EPLoginServiceImplTest.java [new file with mode: 0644]
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/ExternalAccessRolesServiceImplTest.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/MicroserviceServiceImplTest.java [new file with mode: 0644]
ecomp-portal-BE-os/src/main/java/org/onap/portalapp/controller/LoginController.java
ecomp-portal-FE-common/client/app/views/role/rolefunctionpopupController.js

diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/SecurityInitializer.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/config/SecurityInitializer.java
new file mode 100644 (file)
index 0000000..2a0a4b1
--- /dev/null
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *             http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *             https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalapp.config;
+
+import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;
+
+public class SecurityInitializer extends AbstractSecurityWebApplicationInitializer {
+
+}
index c9a6f5d..d0932d2 100644 (file)
@@ -108,6 +108,8 @@ import com.fasterxml.jackson.databind.type.TypeFactory;
 @EnableAspectJAutoProxy
 @EPAuditLog
 public class RoleManageController extends EPRestrictedBaseController {
+       private static final String PIPE = "|";
+
        private static final String ROLE_INVALID_CHARS = "%=():,\"\"";
 
        private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RoleManageController.class);
@@ -340,7 +342,7 @@ public class RoleManageController extends EPRestrictedBaseController {
                                                                                + " and action: " + roleFunction.getAction() + " found while saving!");
                                                        }
                                                        roleFunction.setCode(externalAccessRolesService.encodeFunctionCode(roleFunction.getCode()));
-                                                       roleFunction.setCode(roleFunction.getType() + "|" + roleFunction.getCode() + "|"
+                                                       roleFunction.setCode(roleFunction.getType() + PIPE + roleFunction.getCode() + PIPE
                                                                        + roleFunction.getAction());
                                                        domainRole.addRoleFunction((CentralV2RoleFunction) roleFunction);
                                                }
@@ -500,8 +502,12 @@ public class RoleManageController extends EPRestrictedBaseController {
                        if (isAuthorizedUser(user, requestedApp)) {
                                fieldsValidation(requestedApp);
                                if (requestedApp.getCentralAuth()) {
-                                       CentralV2RoleFunction domainRoleFunction = externalAccessRolesService.getRoleFunction(roleFunc.getCode(),
+                                       String code = roleFunc.getType()+PIPE+roleFunc.getCode()+PIPE+roleFunc.getAction();
+                                       CentralV2RoleFunction domainRoleFunction = externalAccessRolesService.getRoleFunction(code,
                                                        requestedApp.getUebKey());
+                                       if(domainRoleFunction.getType() == null || domainRoleFunction.getAction() == null) {
+                                               addIfTypeActionDoesNotExits(domainRoleFunction);
+                                       }
                                        if (domainRoleFunction != null && domainRoleFunction.getCode().equals(roleFunc.getCode())
                                                        && domainRoleFunction.getType().equals(roleFunc.getType())
                                                        && domainRoleFunction.getAction().equals(roleFunc.getAction())) {
@@ -558,6 +564,24 @@ public class RoleManageController extends EPRestrictedBaseController {
                return new PortalRestResponse<>(PortalRestStatusEnum.OK, "Saved Successfully!", "Success");
        }
 
+
+
+       private void addIfTypeActionDoesNotExits(CentralV2RoleFunction domainRoleFunction) {
+               if(domainRoleFunction.getCode().contains(PIPE)) {
+                       String newfunctionCodeFormat = EcompPortalUtils.getFunctionCode(domainRoleFunction.getCode());
+                       String newfunctionTypeFormat = EcompPortalUtils.getFunctionType(domainRoleFunction.getCode());
+                       String newfunctionActionFormat = EcompPortalUtils.getFunctionAction(domainRoleFunction.getCode());
+                       domainRoleFunction.setType(newfunctionTypeFormat);
+                       domainRoleFunction.setAction(newfunctionActionFormat);
+                       domainRoleFunction.setCode(newfunctionCodeFormat);
+               } else {
+                       String type = externalAccessRolesService.getFunctionCodeType(domainRoleFunction.getCode());
+                       String action = externalAccessRolesService.getFunctionCodeAction(domainRoleFunction.getCode());
+                       domainRoleFunction.setType(type);
+                       domainRoleFunction.setAction(action);
+               }
+       }
+
        @RequestMapping(value = { "/portalApi/role_function_list/removeRoleFunction/{appId}" }, method = RequestMethod.POST)
        public PortalRestResponse<String> removeRoleFunction(HttpServletRequest request, HttpServletResponse response,
                        @RequestBody String roleFunc, @PathVariable("appId") Long appId) throws Exception {
@@ -571,17 +595,12 @@ public class RoleManageController extends EPRestrictedBaseController {
                                        String data = roleFunc;
                                        boolean getDelFuncResponse = false;
                                        CentralV2RoleFunction availableRoleFunction = mapper.readValue(data, CentralV2RoleFunction.class);
-                                       String code = availableRoleFunction.getType() + "|" + availableRoleFunction.getCode() + "|"
+                                       String code = availableRoleFunction.getType() + PIPE + availableRoleFunction.getCode() + PIPE
                                                        + availableRoleFunction.getAction();
                                        CentralV2RoleFunction domainRoleFunction = externalAccessRolesService.getRoleFunction(code,
                                                        requestedApp.getUebKey());
-                                       if (domainRoleFunction.getCode().contains("|")) {
-                                               getDelFuncResponse = externalAccessRolesService
-                                                               .deleteCentralRoleFunction(code, requestedApp);
-                                       } else {
-                                               getDelFuncResponse = externalAccessRolesService
-                                                               .deleteCentralRoleFunction(domainRoleFunction.getCode(), requestedApp);
-                                       }
+                                       getDelFuncResponse = externalAccessRolesService
+                                                       .deleteCentralRoleFunction(domainRoleFunction.getCode(), requestedApp);
                                        if (getDelFuncResponse) {
                                                logger.info(EELFLoggerDelegate.applicationLogger,
                                                                "deleteRoleFunction: succeeded for app {}, role {}", requestedApp.getId(),
index d7536bf..a93be65 100644 (file)
@@ -224,7 +224,7 @@ public enum EPAppMessagesEnum {
                        "ERR540E", "Unexpected Scheduler error", "Details: {0}.", "Please check logs for more information."),
     
     SchedulerInvalidAttributeError(EPErrorCodesEnum.SCHEDULER_INVALID_ATTRIBUTEERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR,
-                       "ERR505E", "Unable to create Scheduler", "Details: {0}.", "Please check logs for more information."),
+                       "ERR515E", "Unable to create Scheduler", "Details: {0}.", "Please check logs for more information."),
 
        ;
        
index 1d198f7..bcf806b 100644 (file)
@@ -433,5 +433,23 @@ public interface ExternalAccessRolesService {
                        ObjectMapper mapper, JSONArray extRole) throws IOException, JsonParseException, JsonMappingException;
        
        public JSONArray getAllUsersByRole(String roleName) throws Exception;
+       
+       /**
+        * 
+        * It check function code has any pipes, if found return function type
+        * 
+        * @param roleFuncItem
+        * @param type
+        * @return function type
+        */
+       String getFunctionCodeType(String roleFuncItem);
+       
+       /**
+        * It return function action
+        * 
+        * @param roleFuncItem
+        * @return String action
+        */
+       String getFunctionCodeAction(String roleFuncItem);
 
 }
index b1804d8..39bd92d 100644 (file)
@@ -513,8 +513,8 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
                String action = "";
                if (roleFunc.getCode().contains(FUNCTION_PIPE)) {
                        code = EcompPortalUtils.getFunctionCode(roleFunc.getCode());
-                       type = getFunctionType(roleFunc.getCode());
-                       action = getFunctionAction(roleFunc.getCode());
+                       type = getFunctionCodeType(roleFunc.getCode());
+                       action = getFunctionCodeAction(roleFunc.getCode());
                } else {
                        code = roleFunc.getCode();
                        type = roleFunc.getCode().contains("menu") ? "menu" : "url";
@@ -663,8 +663,8 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
                                String action = "";
                                if (addFunction.getCode().contains(FUNCTION_PIPE)) {
                                        code = EcompPortalUtils.getFunctionCode(addFunction.getCode());
-                                       type = getFunctionType(addFunction.getCode());
-                                       action = getFunctionAction(addFunction.getCode());
+                                       type = getFunctionCodeType(addFunction.getCode());
+                                       action = getFunctionCodeAction(addFunction.getCode());
                                } else {
                                        code = addFunction.getCode();
                                        type = addFunction.getCode().contains("menu") ? "menu" : "url";
@@ -720,8 +720,8 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
                        String action = "";
                        if (roleFunc.getCode().contains(FUNCTION_PIPE)) {
                                code = EcompPortalUtils.getFunctionCode(roleFunc.getCode());
-                               type = getFunctionType(roleFunc.getCode());
-                               action = getFunctionAction(roleFunc.getCode());
+                               type = getFunctionCodeType(roleFunc.getCode());
+                               action = getFunctionCodeAction(roleFunc.getCode());
                        } else {
                                code = roleFunc.getCode();
                                type = roleFunc.getCode().contains("menu") ? "menu" : "url";
@@ -1191,8 +1191,8 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
                List<CentralV2RoleFunction> getRoleFuncList = dataAccessService.executeNamedQuery("getAllRoleFunctions", params, null);
                for (CentralV2RoleFunction roleFuncItem : getRoleFuncList) {
                        String code = EcompPortalUtils.getFunctionCode(roleFuncItem.getCode());
-                       String type = getFunctionType(roleFuncItem.getCode());
-                       String action = getFunctionAction(roleFuncItem.getCode());
+                       String type = getFunctionCodeType(roleFuncItem.getCode());
+                       String action = getFunctionCodeAction(roleFuncItem.getCode());
                        roleFuncItem.setCode(EPUserUtils.decodeFunctionCode(code));
                        roleFuncItem.setType(type);
                        roleFuncItem.setAction(action);
@@ -1202,26 +1202,14 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
        }
 
 
-       /**
-        * It return function action
-        * 
-        * @param roleFuncItem
-        * @return String action
-        */
-       private String getFunctionAction(String roleFuncItem) {
+       @Override
+       public String getFunctionCodeAction(String roleFuncItem) {
                return (!roleFuncItem.contains(FUNCTION_PIPE)) ? "*"
                                : EcompPortalUtils.getFunctionAction(roleFuncItem);
        }
 
-       /**
-        * 
-        * It check function code has any pipes, if found return function type
-        * 
-        * @param roleFuncItem
-        * @param type
-        * @return function type
-        */
-       private String getFunctionType(String roleFuncItem) {
+       @Override
+       public String getFunctionCodeType(String roleFuncItem) {
                String type = null;
                if ((roleFuncItem.contains(FUNCTION_PIPE) && roleFuncItem.contains("menu"))
                                || (!roleFuncItem.contains(FUNCTION_PIPE) && roleFuncItem.contains("menu"))) {
@@ -1467,8 +1455,8 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
                        for (CentralV2RoleFunction roleFunc : cenRoleFuncList) {
                                String functionCode = EcompPortalUtils.getFunctionCode(roleFunc.getCode());
                                functionCode = EPUserUtils.decodeFunctionCode(functionCode);
-                               String type = getFunctionType(roleFunc.getCode());
-                               String action = getFunctionAction(roleFunc.getCode());
+                               String type = getFunctionCodeType(roleFunc.getCode());
+                               String action = getFunctionCodeAction(roleFunc.getCode());
                                CentralV2RoleFunction cenRoleFunc = new CentralV2RoleFunction(role.getId(), functionCode,
                                                roleFunc.getName(), null, type, action, null);
                                roleFunctionSet.add(cenRoleFunc);
@@ -1509,15 +1497,14 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
                                if (getRoleFuncList.isEmpty()) {
                                        return roleFunc;
                                }
+                       }
+                       if (getRoleFuncList.size() > 1) {
+                               CentralV2RoleFunction cenV2RoleFunction = appFunctionListFilter(encodedCode, getRoleFuncList);
+                               if (cenV2RoleFunction == null)
+                                       return roleFunc;
+                               roleFunc = checkIfPipesExitsInFunctionCode(cenV2RoleFunction);
                        } else {
-                               if (getRoleFuncList.size() > 1) {
-                                       CentralV2RoleFunction cenV2RoleFunction = appFunctionListFilter(encodedCode, getRoleFuncList);
-                                       if (cenV2RoleFunction == null)
-                                               return roleFunc;
-                                       roleFunc = checkIfPipesExitsInFunctionCode(cenV2RoleFunction);
-                               } else {
-                                       roleFunc = checkIfPipesExitsInFunctionCode(getRoleFuncList.get(0));
-                               }
+                               roleFunc = getRoleFuncList.get(0);
                        }
                } catch (Exception e) {
                        logger.error(EELFLoggerDelegate.errorLogger, "getRoleFunction: failed", e);
@@ -1693,8 +1680,8 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
                        ObjectMapper mapper = new ObjectMapper();
                        ExternalAccessPerms extPerms = new ExternalAccessPerms();
                        String instanceValue = EcompPortalUtils.getFunctionCode(domainCentralRoleFunction.getCode());
-                       String checkType = getFunctionType(domainCentralRoleFunction.getCode());
-                       String actionValue = getFunctionAction(domainCentralRoleFunction.getCode());
+                       String checkType = getFunctionCodeType(domainCentralRoleFunction.getCode());
+                       String actionValue = getFunctionCodeAction(domainCentralRoleFunction.getCode());
                        HttpHeaders headers = EcompPortalUtils.base64encodeKeyForAAFBasicAuth();
                        extPerms.setAction(actionValue);
                        extPerms.setInstance(instanceValue);
@@ -3290,8 +3277,8 @@ public class ExternalAccessRolesServiceImpl implements ExternalAccessRolesServic
                        action = EcompPortalUtils.getFunctionAction(role.getFunctionCd());
                        cenRoleFun = new CentralV2RoleFunction(null, instance, role.getFunctionName(), null, type, action, null);
                } else{
-                       type = getFunctionType(role.getFunctionCd());
-                       action = getFunctionAction(role.getFunctionCd());
+                       type = getFunctionCodeType(role.getFunctionCd());
+                       action = getFunctionCodeAction(role.getFunctionCd());
                        cenRoleFun = new CentralV2RoleFunction(null, role.getFunctionCd(), role.getFunctionName(), null, type, action, null);
                }
                return cenRoleFun;
index e63ea43..a4970f8 100644 (file)
@@ -332,7 +332,6 @@ public class RoleManageControllerTest {
                addNewFunc.setCode("Test");
                addNewFunc.setName("Test");
                Mockito.when(appService.getApp((long) 1)).thenReturn(NonCentralApp());
-               String roleFun = "{\"name\":\"Test\",\"code\":\"Test\"}";
                roleManageController.saveRoleFunction(mockedRequest, mockedResponse, addNewFunc, (long) 1);
        }
 
index ef9bda0..d9beb4d 100644 (file)
@@ -39,6 +39,7 @@ package org.onap.portalapp.portal.service;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import java.util.ArrayList;
@@ -127,6 +128,8 @@ public class AdminRolesServiceImplTest {
 
        private Long ACCOUNT_ADMIN_ROLE_ID = 999L;
        
+       private Long ECOMP_APP_ID = 1L;
+       
        public EPApp mockApp() {
                EPApp app = new EPApp();
                app.setName("Test");
@@ -178,7 +181,12 @@ public class AdminRolesServiceImplTest {
                userAppList.add(epUserApp);
                Mockito.when(dataAccessService.getList(EPUserApp.class,
                                " where userId = " + user.getId() + " and role.id = " + 999, null, null)).thenReturn(userAppList);
-               adminRolesServiceImpl.getAppsWithAdminRoleStateForUser(user.getOrgUserId());
+               List<EPApp> appsList = new ArrayList<>();
+               appsList.add(app);
+               Mockito.when(dataAccessService.getList(EPApp.class,
+                               "  where ( enabled = 'Y' or id = " + ECOMP_APP_ID + ")", null, null)).thenReturn(appsList);
+               AppsListWithAdminRole  actual = adminRolesServiceImpl.getAppsWithAdminRoleStateForUser(user.getOrgUserId());
+               assertNotNull(actual);
        }
 
        @SuppressWarnings({ "deprecation", "unchecked" })
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/EPLeftMenuServiceImplTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/EPLeftMenuServiceImplTest.java
new file mode 100644 (file)
index 0000000..3cc6762
--- /dev/null
@@ -0,0 +1,117 @@
+/*-
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *             http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *             https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalapp.portal.service;
+
+import static org.junit.Assert.assertNotEquals;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.json.JSONObject;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.portal.core.MockEPUser;
+import org.onap.portalapp.portal.domain.CentralizedApp;
+import org.onap.portalapp.portal.domain.EPUser;
+import org.onap.portalsdk.core.domain.MenuData;
+import org.onap.portalsdk.core.service.DataAccessService;
+import org.onap.portalsdk.core.service.DataAccessServiceImpl;
+
+public class EPLeftMenuServiceImplTest {
+
+       @Mock
+       DataAccessService dataAccessService = new DataAccessServiceImpl();
+       
+       @Mock
+       ExternalAccessRolesServiceImpl externalAccessRolesServiceImpl = new ExternalAccessRolesServiceImpl();
+
+       @Before
+       public void setup() {
+               MockitoAnnotations.initMocks(this);
+       }
+       
+       @InjectMocks
+       EPLeftMenuServiceImpl epLeftMenuServiceImpl = new EPLeftMenuServiceImpl();
+       
+       
+       MockEPUser mockUser = new MockEPUser();
+       
+       @Test
+       public void getLeftMenuItemsTest() {
+               EPUser user = mockUser.mockEPUser();
+               Set<MenuData> fullMenuSet = new TreeSet<>();
+               MenuData menuData =  new MenuData();
+               menuData.setAction("test");
+               menuData.setFunctionCd("test_1");
+               menuData.setActive(true);
+               menuData.setExternalUrl("test");
+               menuData.setId(1l);
+               menuData.setMenuSetCode("test");
+               menuData.setSortOrder((short) 1);
+               menuData.setSeparator(true);
+               fullMenuSet.add(menuData);
+               Set<String> roleFunctionSet = new TreeSet<>();
+               roleFunctionSet.add("test");
+               roleFunctionSet.add("test2");
+               Map<String, String> params = new HashMap<>();
+               params.put("userId", user.getOrgUserId());
+               List<CentralizedApp> applicationsList = new ArrayList<>();
+               List<CentralizedApp> applicationsList2 = new ArrayList<>();
+               CentralizedApp centralizedApp = new CentralizedApp();
+               centralizedApp.setAppId(1);
+               centralizedApp.setAppName("test");
+               applicationsList.add(centralizedApp);
+               applicationsList2.add(centralizedApp);
+               Mockito.when(dataAccessService.executeNamedQuery(Matchers.anyString(), Matchers.anyMap(), Matchers.anyMap())).thenReturn(applicationsList);
+               Mockito.when(externalAccessRolesServiceImpl.getCentralizedAppsOfUser(Matchers.anyString())).thenReturn(applicationsList2);
+               String actual = epLeftMenuServiceImpl.getLeftMenuItems(user, fullMenuSet, roleFunctionSet);
+               JSONObject notExpected = new JSONObject();
+               assertNotEquals(notExpected.toString(), actual);
+       }
+
+
+}
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/EPLoginServiceImplTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/EPLoginServiceImplTest.java
new file mode 100644 (file)
index 0000000..5eaa40f
--- /dev/null
@@ -0,0 +1,239 @@
+/*-
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *             http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *             https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalapp.portal.service;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.command.EPLoginBean;
+import org.onap.portalapp.portal.core.MockEPUser;
+import org.onap.portalapp.portal.domain.EPApp;
+import org.onap.portalapp.portal.domain.EPUser;
+import org.onap.portalapp.portal.utils.EPCommonSystemProperties;
+import org.onap.portalapp.portal.utils.EcompPortalUtils;
+import org.onap.portalapp.util.EPUserUtils;
+import org.onap.portalsdk.core.onboarding.util.CipherUtil;
+import org.onap.portalsdk.core.service.DataAccessService;
+import org.onap.portalsdk.core.service.DataAccessServiceImpl;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.onap.portalsdk.core.web.support.AppUtils;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.springframework.web.client.RestTemplate;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({ EPUserUtils.class, CipherUtil.class, AppUtils.class, SystemProperties.class,
+               EPCommonSystemProperties.class })
+public class EPLoginServiceImplTest {
+
+       @Mock
+       DataAccessService dataAccessService = new DataAccessServiceImpl();
+
+       @Mock
+       EPAppCommonServiceImpl epAppCommonServiceImpl = new EPAppCommonServiceImpl();
+
+       @Mock
+       SearchServiceImpl searchServiceImpl = new SearchServiceImpl();
+
+       @Mock
+       RestTemplate template = new RestTemplate();
+
+       @Before
+       public void setup() {
+               MockitoAnnotations.initMocks(this);
+       }
+       
+       @InjectMocks
+       EPLoginServiceImpl epLoginServiceImpl = new EPLoginServiceImpl();
+       
+       public EPApp mockApp() {
+               EPApp app = new EPApp();
+               app.setName("Test");
+               app.setImageUrl("test");
+               app.setNameSpace("com.test.app");
+               app.setCentralAuth(true);
+               app.setDescription("test");
+               app.setNotes("test");
+               app.setUrl("test");
+               app.setId((long) 1);
+               app.setAppRestEndpoint("test");
+               app.setAlternateUrl("test");
+               app.setName("test");
+               app.setMlAppName("test");
+               app.setMlAppAdminId("test");
+               app.setUsername("test");
+               app.setAppPassword("test");
+               app.setOpen(false);
+               app.setEnabled(true);
+               app.setUebKey("test");
+               app.setUebSecret("test");
+               app.setUebTopicName("test");
+               app.setAppType(1);
+               return app;
+       }
+
+       MockEPUser mockUser = new MockEPUser();
+       
+       @SuppressWarnings({ "rawtypes", "unchecked" })
+       @Test
+       public void findUserTest() throws Exception {
+               EPUser user = mockUser.mockEPUser();
+               EPLoginBean expected = new EPLoginBean();
+               expected.setOrgUserId("guestT");
+               Map<String, String> params = new HashMap<>();
+               params.put("org_user_id", expected.getOrgUserId());
+               List list = new ArrayList<>();
+               list.add(user);
+               Mockito.when(dataAccessService.executeNamedQuery("getEPUserByOrgUserId", params, new HashMap())).thenReturn(list);
+               EPLoginBean actual =  epLoginServiceImpl.findUser(expected, "test", new HashMap<>());
+               assertNotNull(actual);
+       }
+       
+       @SuppressWarnings({ "rawtypes", "unchecked" })
+       @Test
+       public void findUserPasswordMatchTest() throws Exception {
+               PowerMockito.mockStatic(EPCommonSystemProperties.class);
+               PowerMockito.mockStatic(EcompPortalUtils.class);
+               PowerMockito.mockStatic(SystemProperties.class);
+               PowerMockito.mockStatic(AppUtils.class);
+               PowerMockito.mockStatic(CipherUtil.class);
+               EPUser user = mockUser.mockEPUser();
+               user.setLoginId("guestT");
+               user.setLoginPwd("abc");
+               EPLoginBean expected = new EPLoginBean();
+               expected.setLoginId(user.getLoginId());
+               expected.setLoginPwd("xyz");
+               Map<String, String> params = new HashMap<>();
+               params.put("org_user_id", user.getOrgUserId());
+               List list = new ArrayList<>();
+               list.add(user);
+               Mockito.when(dataAccessService.executeNamedQuery("getEPUserByOrgUserId", params, new HashMap())).thenReturn(list);
+               Map<String, String> params2 = new HashMap<>();
+               params2.put("login_id", user.getOrgUserId());
+               List list2 = new ArrayList<>();
+               list2.add(user);
+               Mockito.when(dataAccessService.executeNamedQuery("getEPUserByLoginId", params2, new HashMap())).thenReturn(list2);
+               Mockito.when(CipherUtil.decryptPKC(user.getLoginPwd())).thenReturn("xyz");
+               EPLoginBean actual =  epLoginServiceImpl.findUser(expected, "test", new HashMap<>());
+               assertNotNull(actual);
+       }
+       
+       @SuppressWarnings({ "rawtypes", "unchecked" })
+       @Test
+       public void findUserExcpetionTest() throws Exception {
+               PowerMockito.mockStatic(EPCommonSystemProperties.class);
+               PowerMockito.mockStatic(EcompPortalUtils.class);
+               PowerMockito.mockStatic(SystemProperties.class);
+               PowerMockito.mockStatic(AppUtils.class);
+               PowerMockito.mockStatic(CipherUtil.class);
+               EPUser user = mockUser.mockEPUser();
+               user.setLoginId("guestT");
+               user.setLoginPwd("abc");
+               EPLoginBean expected = new EPLoginBean();
+               expected.setLoginId(user.getLoginId());
+               expected.setLoginPwd("xyz");
+               Map<String, String> params = new HashMap<>();
+               params.put("org_user_id", user.getOrgUserId());
+               List list = new ArrayList<>();
+               list.add(user);
+               Mockito.when(dataAccessService.executeNamedQuery("getEPUserByOrgUserId", params, new HashMap())).thenReturn(list);
+               Map<String, String> params2 = new HashMap<>();
+               params2.put("login_id", user.getOrgUserId());
+               List list2 = new ArrayList<>();
+               list2.add(user);
+               Mockito.doThrow(new NullPointerException()).when(dataAccessService).executeNamedQuery("getEPUserByLoginId", params2, new HashMap());
+               Mockito.when(CipherUtil.decryptPKC(user.getLoginPwd())).thenReturn("xyz");
+               EPLoginBean actual =  epLoginServiceImpl.findUser(expected, "test", new HashMap<>());
+               assertEquals(expected,actual);
+       }
+       
+       @SuppressWarnings({ "rawtypes", "unchecked" })
+       @Test
+       public void findUserAppUtilsExcpetionTest() throws Exception {
+               PowerMockito.mockStatic(EPCommonSystemProperties.class);
+               PowerMockito.mockStatic(EPUserUtils.class);
+               PowerMockito.mockStatic(SystemProperties.class);
+               PowerMockito.mockStatic(AppUtils.class);
+               PowerMockito.mockStatic(CipherUtil.class);
+               EPUser user = mockUser.mockEPUser();
+               user.setLoginId("guestT");
+               user.setLoginPwd("abc");
+               user.setActive(false);
+               EPLoginBean expected = new EPLoginBean();
+               expected.setOrgUserId(user.getOrgUserId());
+               Map<String, String> params = new HashMap<>();
+               params.put("org_user_id", user.getOrgUserId());
+               List list = new ArrayList<>();
+               list.add(user);
+               Mockito.when(dataAccessService.executeNamedQuery("getEPUserByOrgUserId", params, new HashMap())).thenReturn(list);
+               Mockito.when(EPUserUtils.hasRole(user, SystemProperties.getProperty(SystemProperties.SYS_ADMIN_ROLE_ID))).thenReturn(false);
+               Mockito.when(AppUtils.isApplicationLocked()).thenReturn(true);
+               Mockito.when(EPUserUtils.hasRole(user, SystemProperties.getProperty(SystemProperties.SYS_ADMIN_ROLE_ID))).thenReturn(false);
+               Mockito.when(AppUtils.isApplicationLocked()).thenReturn(true);
+               EPLoginBean actual =  epLoginServiceImpl.findUser(expected, "test", new HashMap<>());
+               assertEquals(expected,actual);
+       }
+       
+       
+       @SuppressWarnings({ "rawtypes", "unchecked" })
+       @Test 
+       public void findUserWithoutPwdTest() {
+               EPUser user = mockUser.mockEPUser();
+               Map<String, String> params = new HashMap<>();
+               params.put("login_id", user.getOrgUserId());
+               List list = new ArrayList<>();
+               list.add(user);
+               Mockito.when(dataAccessService.executeNamedQuery("getEPUserByLoginId", params, new HashMap())).thenReturn(list);
+               EPUser actual = epLoginServiceImpl.findUserWithoutPwd(user.getOrgUserId());
+               assertEquals(user.getOrgUserId(), actual.getOrgUserId());
+       }
+}
index 726a235..172b942 100644 (file)
@@ -520,8 +520,6 @@ public class ExternalAccessRolesServiceImplTest {
                appUebkeyParams.put("appKey", app.getUebKey());
                Mockito.when(dataAccessService.executeNamedQuery("getMyAppDetailsByUebKey", appUebkeyParams, null))
                                .thenReturn(appList);
-               CentralV2RoleFunction expected = new CentralV2RoleFunction(null, "type_code", "test_name", null, "test_type",
-                               "*", null);
                Mockito.when(EcompPortalUtils.getFunctionCode("test_type|type_code|*")).thenReturn("type_code");
                Mockito.when(EcompPortalUtils.getFunctionType("test_type|type_code|*")).thenReturn("test_type");
                Mockito.when(EcompPortalUtils.getFunctionAction("test_type|type_code|*")).thenReturn("*");
@@ -535,7 +533,7 @@ public class ExternalAccessRolesServiceImplTest {
                                .thenReturn(getRoleFuncList);
                CentralV2RoleFunction actual = externalAccessRolesServiceImpl.getRoleFunction("test_type|type_code|*",
                                app.getUebKey());
-               assertEquals(expected.getCode(), actual.getCode());
+               assertEquals(getCenRole.getCode(), actual.getCode());
        }
 
        @Test
diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/MicroserviceServiceImplTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/service/MicroserviceServiceImplTest.java
new file mode 100644 (file)
index 0000000..fba7e6d
--- /dev/null
@@ -0,0 +1,207 @@
+/*-
+ * ============LICENSE_START==========================================
+ * ONAP Portal
+ * ===================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ===================================================================
+ *
+ * Unless otherwise specified, all software contained herein is licensed
+ * under the Apache License, Version 2.0 (the "License");
+ * you may not use this software except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *             http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Unless otherwise specified, all documentation contained herein is licensed
+ * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
+ * you may not use this documentation except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *             https://creativecommons.org/licenses/by/4.0/
+ *
+ * Unless required by applicable law or agreed to in writing, documentation
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END============================================
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ */
+package org.onap.portalapp.portal.service;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.crypto.BadPaddingException;
+
+import org.hibernate.criterion.Criterion;
+import org.hibernate.criterion.Restrictions;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Matchers;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalapp.portal.domain.MicroserviceData;
+import org.onap.portalapp.portal.domain.MicroserviceParameter;
+import org.onap.portalapp.portal.utils.EPCommonSystemProperties;
+import org.onap.portalsdk.core.onboarding.util.CipherUtil;
+import org.onap.portalsdk.core.service.DataAccessService;
+import org.onap.portalsdk.core.service.DataAccessServiceImpl;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({Criterion.class, Restrictions.class, CipherUtil.class, EPCommonSystemProperties.class, SystemProperties.class, Restrictions.class})
+public class MicroserviceServiceImplTest {
+       
+       @Mock
+       DataAccessService dataAccessService = new DataAccessServiceImpl();
+
+       @Before
+       public void setup() {
+               MockitoAnnotations.initMocks(this);
+       }
+       
+       @InjectMocks
+       MicroserviceServiceImpl microserviceServiceImpl = new MicroserviceServiceImpl();
+
+       @Test
+       public void saveMicroserviceTest() throws Exception {
+               MicroserviceData microserviceData = new MicroserviceData();
+               List<MicroserviceParameter> microserviceParameters = new ArrayList<>();
+               MicroserviceParameter microserviceParameter = new MicroserviceParameter();
+               microserviceParameter.setId(1l);
+               microserviceParameter.setPara_key("test");
+               microserviceParameter.setPara_value("test");
+               microserviceParameters.add(microserviceParameter);
+               microserviceData.setActive("true");
+               microserviceData.setAppId(1l);
+               microserviceData.setId(1l);
+               microserviceData.setParameterList(microserviceParameters); 
+               Long actual = microserviceServiceImpl.saveMicroservice(microserviceData);
+               assertEquals((Long)1l, actual);
+       }
+       
+       @Test
+       public void saveServiceParametersTest() throws Exception {
+               MicroserviceData microserviceData = new MicroserviceData();
+               List<MicroserviceParameter> microserviceParameters = new ArrayList<>();
+               MicroserviceParameter microserviceParameter = new MicroserviceParameter();
+               microserviceParameter.setId(1l);
+               microserviceParameter.setPara_key("test");
+               microserviceParameter.setPara_value("test");
+               microserviceParameters.add(microserviceParameter);
+               microserviceData.setActive("true");
+               microserviceData.setAppId(1l);
+               microserviceData.setId(1l);
+               microserviceData.setParameterList(microserviceParameters); 
+               microserviceServiceImpl.saveServiceParameters(1l, microserviceParameters);
+       }
+       
+       @SuppressWarnings("unchecked")
+       @Test
+       public void getMicroserviceDataByIdTest() throws Exception {
+               PowerMockito.mockStatic(Restrictions.class);
+               PowerMockito.mockStatic(Criterion.class);
+               MicroserviceData microserviceData = new MicroserviceData();
+               List<MicroserviceParameter> microserviceParameters = new ArrayList<>();
+               MicroserviceParameter microserviceParameter = new MicroserviceParameter();
+               microserviceParameter.setId(1l);
+               microserviceParameter.setPara_key("test");
+               microserviceParameter.setPara_value("test");
+               microserviceParameters.add(microserviceParameter);
+               microserviceData.setActive("true");
+               microserviceData.setAppId(1l);
+               microserviceData.setId(1l);
+               List<Criterion> restrictionsList = new ArrayList<Criterion>();
+               Criterion idCriterion = Restrictions.eq("id", 1l);
+               restrictionsList.add(idCriterion);
+               List<MicroserviceData> microserviceDatas = new ArrayList<>();
+               microserviceDatas.add(microserviceData);
+               Mockito.when((List<MicroserviceData>) dataAccessService.getList(MicroserviceData.class, null, restrictionsList, null)).thenReturn(microserviceDatas);
+               List<Criterion> restrictionsList2 = new ArrayList<Criterion>();
+               Criterion serviceIdCriterion = Restrictions.eq("serviceId", 1l);
+               restrictionsList2.add(serviceIdCriterion);
+               Mockito.when((List<MicroserviceParameter>) dataAccessService.getList(MicroserviceParameter.class, null, restrictionsList2, null)).thenReturn(microserviceParameters);
+               MicroserviceData actual = microserviceServiceImpl.getMicroserviceDataById(1l);
+               assertNotNull(actual);
+       }
+       
+       @SuppressWarnings({ "unchecked", "deprecation" })
+       @Test
+       public void getMicroserviceDataTest() throws Exception {
+               PowerMockito.mockStatic(SystemProperties.class);
+               PowerMockito.mockStatic(CipherUtil.class);
+               PowerMockito.mockStatic(Restrictions.class);
+               PowerMockito.mockStatic(Criterion.class);
+               List<MicroserviceParameter> microserviceParameters = new ArrayList<>();
+               MicroserviceData microserviceData = new MicroserviceData();
+               MicroserviceParameter microserviceParameter = new MicroserviceParameter();
+               microserviceParameter.setId(1l);
+               microserviceParameter.setPara_key("test");
+               microserviceParameter.setPara_value("test");
+               microserviceParameters.add(microserviceParameter);
+               microserviceData.setActive("true");
+               microserviceData.setAppId(1l);
+               microserviceData.setPassword("xyz");
+               microserviceData.setId(1l);
+               List<MicroserviceData> microserviceDatas = new ArrayList<>();
+               microserviceDatas.add(microserviceData);
+               Mockito.when((List<MicroserviceData>) dataAccessService.getList(MicroserviceData.class, null)).thenReturn(microserviceDatas);
+               List<Criterion> restrictionsList2 = new ArrayList<Criterion>();
+               Criterion serviceIdCriterion = Restrictions.eq("serviceId", 1l);
+               restrictionsList2.add(serviceIdCriterion);
+               Mockito.when((List<MicroserviceParameter>) dataAccessService.getList(MicroserviceParameter.class, null, restrictionsList2, null)).thenReturn(microserviceParameters);
+               Mockito.when(CipherUtil.decryptPKC("xyz",
+                               SystemProperties.getProperty(SystemProperties.Decryption_Key))).thenReturn("abc");
+               List<MicroserviceData> actual = microserviceServiceImpl.getMicroserviceData();
+               assertNotNull(actual);
+       }
+       
+       @SuppressWarnings({ "unchecked", "deprecation", "static-access" })
+       @Test
+       public void getMicroserviceDataBadPaddingExceptionTest() throws Exception {
+               PowerMockito.mockStatic(SystemProperties.class);
+               PowerMockito.mockStatic(CipherUtil.class);
+               PowerMockito.mockStatic(Restrictions.class);
+               PowerMockito.mockStatic(Criterion.class);
+               List<MicroserviceParameter> microserviceParameters = new ArrayList<>();
+               MicroserviceData microserviceData = new MicroserviceData();
+               MicroserviceParameter microserviceParameter = new MicroserviceParameter();
+               microserviceParameter.setId(1l);
+               microserviceParameter.setPara_key("test");
+               microserviceParameter.setPara_value("test");
+               microserviceParameters.add(microserviceParameter);
+               microserviceData.setActive("true");
+               microserviceData.setAppId(1l);
+               microserviceData.setPassword("xyz");
+               microserviceData.setId(1l);
+               List<MicroserviceData> microserviceDatas = new ArrayList<>();
+               microserviceDatas.add(microserviceData);
+               Mockito.when((List<MicroserviceData>) dataAccessService.getList(MicroserviceData.class, null)).thenReturn(microserviceDatas);
+               List<Criterion> restrictionsList2 = new ArrayList<Criterion>();
+               Criterion serviceIdCriterion = Restrictions.eq("serviceId", 1l);
+               restrictionsList2.add(serviceIdCriterion);
+               Mockito.when((List<MicroserviceParameter>) dataAccessService.getList(MicroserviceParameter.class, null, restrictionsList2, null)).thenReturn(microserviceParameters);
+               Mockito.when(CipherUtil.decryptPKC("xyz",
+                               SystemProperties.getProperty(SystemProperties.Decryption_Key))).thenThrow(BadPaddingException.class);
+               List<MicroserviceData> actual = microserviceServiceImpl.getMicroserviceData();
+               assertNotNull(actual);
+       }
+}
index b301976..88f7651 100644 (file)
@@ -130,7 +130,7 @@ public class LoginController extends EPUnRestrictedBaseController implements Log
                String loginId = root.get("loginId").textValue();
                String password = root.get("password").textValue();
                commandBean.setLoginId(loginId);
-               commandBean.setLoginPwd(CipherUtil.encryptPKC(password));
+               commandBean.setLoginPwd(password);
                
                HashMap additionalParamsMap = new HashMap();
                StringBuilder sbAdditionalInfo = new StringBuilder();
index 0fa84f3..4573eff 100644 (file)
@@ -124,8 +124,11 @@ app.controller('rolefunctionpopupController',function($scope, confirmBoxService,
                                                                break;
                                                        }
                                                        if (!isEditing) {
-                                                               if (message.availableRoleFunctions[x].code == availableRoleFunction.code) {
-                                                                       confirmBoxService.showInformation("Code already exists. Please create a role function with a different code to proceed.");
+                                                               if (message.availableRoleFunctions[x].type == availableRoleFunction.type
+                                                                               && message.availableRoleFunctions[x].code == availableRoleFunction.code
+                                                                               && message.availableRoleFunctions[x].action == availableRoleFunction.action
+                                                                       ) {
+                                                                       confirmBoxService.showInformation("Please make sure code, type and action is unique. Please create a role function with a different code or type or action to proceed.");
                                                                        exists = true;
                                                                        availableRoleFunction.name = $scope.tempText;
                                                                        break;