+ .thenReturn(epRoleList);
+ Mockito.when(EcompPortalUtils.checkIfRemoteCentralAccessAllowed()).thenReturn(true);
+ HttpHeaders headers = new HttpHeaders();
+ Mockito.when(EcompPortalUtils.base64encodeKeyForAAFBasicAuth()).thenReturn(headers);
+ JSONObject mockJsonObjectFinalRole = new JSONObject();
+ ResponseEntity<String> getResponse = new ResponseEntity<>(mockJsonObjectFinalRole.toString(), HttpStatus.OK);
+ Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.GET),
+ Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(getResponse);
+ ResponseEntity<String> addRoleResponse = new ResponseEntity<>(HttpStatus.CREATED);
+ Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.POST),
+ Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(addRoleResponse);
+ final Map<String, String> params = new HashMap<>();
+ params.put("uebKey", app.getUebKey());
+ params.put("roleId", String.valueOf(getEPRole.getId()));
+ List<BulkUploadUserRoles> userRolesList = new ArrayList<>();
+ BulkUploadUserRoles bulkUploadUserRoles = new BulkUploadUserRoles();
+ bulkUploadUserRoles.setAppNameSpace("com.test.app");
+ bulkUploadUserRoles.setOrgUserId("guestT");
+ bulkUploadUserRoles.setRoleName("Test2");
+ userRolesList.add(bulkUploadUserRoles);
+ Mockito.when(dataAccessService.executeNamedQuery("getBulkUsersForSingleRole", params, null))
+ .thenReturn(userRolesList);
+ Mockito.when(
+ EPCommonSystemProperties.containsProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN))
+ .thenReturn(true);
+ Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN))
+ .thenReturn("@test.com");
+ List<EPAppRoleFunction> appRoleFunctionList = new ArrayList<>();
+ final Map<String, Long> appRoleFuncsParams = new HashMap<>();
+ appRoleFuncsParams.put("appId", app.getId());
+ appRoleFuncsParams.put("roleId", getEPRole.getId());
+ Mockito.when(
+ dataAccessService.executeNamedQuery("getAppRoleFunctionOnRoleIdandAppId", appRoleFuncsParams, null))
+ .thenReturn(appRoleFunctionList);
+ Mockito.when(EcompPortalUtils.getFunctionCode(roleFunc.getCode())).thenReturn("test_instance");
+ Mockito.when(EcompPortalUtils.getFunctionCode(roleFunc2.getCode())).thenReturn("test_instance3");
+ final Map<String, String> getAppFunctionParams = new HashMap<>();
+ getAppFunctionParams.put("appId", String.valueOf(app.getId()));
+ getAppFunctionParams.put(FUNCTION_CODE_PARAMS, roleFunc.getCode());
+ List<CentralV2RoleFunction> v2RoleFunction = new ArrayList<>();
+ CentralV2RoleFunction v2RoleFunction1 = new CentralV2RoleFunction("test_type|test_instance|*", "Test Name");
+ v2RoleFunction.add(v2RoleFunction1);
+ Mockito.when(dataAccessService.executeNamedQuery(GET_ROLE_FUNCTION_QUERY, getAppFunctionParams, null))
+ .thenReturn(v2RoleFunction);
+ final Map<String, String> getAppFunctionParams2 = new HashMap<>();
+ getAppFunctionParams2.put("appId", String.valueOf(app.getId()));
+ getAppFunctionParams2.put(FUNCTION_CODE_PARAMS, roleFunc2.getCode());
+ List<CentralV2RoleFunction> v2RoleFunction2 = new ArrayList<>();
+ CentralV2RoleFunction v2RoleFunction3 = new CentralV2RoleFunction("test_type3|test_instance3|*", "Test Name3");
+ v2RoleFunction2.add(v2RoleFunction3);
+ Mockito.when(dataAccessService.executeNamedQuery(GET_ROLE_FUNCTION_QUERY, getAppFunctionParams2, null))
+ .thenReturn(v2RoleFunction2);
+ ExternalRequestFieldsValidator actual = externalAccessRolesServiceImpl.saveRoleForApplication(addRoleTest,
+ app.getUebKey());
+ ExternalRequestFieldsValidator expected = new ExternalRequestFieldsValidator(true, "");
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ public void saveGlobalRoleForPortalApplicationUpdateTest() throws Exception {
+ EPApp app = mockApp();
+ app.setId(1l);
+ Role addRoleTest = new Role();
+ SortedSet<RoleFunction> roleFuncSet = new TreeSet<>();
+ RoleFunction roleFunc = new RoleFunction();
+ roleFunc.setName("Test Name");
+ roleFunc.setCode("test_type|test_instance|*");
+ RoleFunction roleFunc2 = new RoleFunction();
+ roleFunc2.setName("Test Name3");
+ roleFunc2.setCode("test_type3|test_instance3|*");
+ roleFuncSet.add(roleFunc);
+ roleFuncSet.add(roleFunc2);
+ addRoleTest.setActive(true);
+ addRoleTest.setName("global_test2");
+ addRoleTest.setId(1111l);
+ addRoleTest.setRoleFunctions(roleFuncSet);
+ List<EPApp> appList = new ArrayList<>();
+ final Map<String, String> appUebkeyParams = new HashMap<>();
+ appList.add(app);
+ appUebkeyParams.put("appKey", app.getUebKey());
+ Mockito.when(dataAccessService.executeNamedQuery("getMyAppDetailsByUebKey", appUebkeyParams, null))
+ .thenReturn(appList);
+ List<EPRole> globalRoles = new ArrayList<>();
+ EPRole globalRole = new EPRole();
+ globalRole.setName("global_test");
+ globalRole.setId(1111l);
+ globalRole.setActive(true);
+ globalRoles.add(globalRole);
+ Mockito.when(dataAccessService.executeNamedQuery("getGlobalRolesOfPortal", null, null)).thenReturn(globalRoles);
+ List<EPRole> epRoleList = new ArrayList<>();
+ EPRole getEPRole = new EPRole();
+ getEPRole.setName("global_test");
+ getEPRole.setId(1111l);
+ getEPRole.setActive(true);
+ epRoleList.add(getEPRole);
+ final Map<String, Long> getPortalAppRoleParams = new HashMap<>();
+ getPortalAppRoleParams.put("roleId", addRoleTest.getId());
+ Mockito.when(dataAccessService.executeNamedQuery("getPortalAppRoleByRoleId", getPortalAppRoleParams, null))
+ .thenReturn(epRoleList);
+ Mockito.when(EcompPortalUtils.checkIfRemoteCentralAccessAllowed()).thenReturn(true);
+ HttpHeaders headers = new HttpHeaders();
+ Mockito.when(EcompPortalUtils.base64encodeKeyForAAFBasicAuth()).thenReturn(headers);
+ JSONObject mockJsonObjectRole = new JSONObject();
+ JSONObject mockJsonObjectFinalRole = new JSONObject();
+ JSONObject mockJsonObjectPerm1 = new JSONObject();
+ JSONObject mockJsonObjectPerm2 = new JSONObject();
+ mockJsonObjectPerm1.put("type", "com.test.app.test_type");
+ mockJsonObjectPerm1.put("instance", "test_instance");
+ mockJsonObjectPerm1.put("action", "*");
+ mockJsonObjectPerm2.put("type", "com.test.app.test_type2");
+ mockJsonObjectPerm2.put("instance", "test_instance2");
+ mockJsonObjectPerm2.put("action", "*");
+ List<JSONObject> permsList = new ArrayList<>();
+ permsList.add(mockJsonObjectPerm1);
+ permsList.add(mockJsonObjectPerm2);
+ mockJsonObjectRole.put("name", "com.test.app.global_test");
+ mockJsonObjectRole.put("perms", permsList);
+ mockJsonObjectRole.put("description",
+ "{\"id\":\"1111\",\"name\":\"global_test\",\"active\":\"true\",\"priority\":\"null\",\"appId\":\"null\",\"appRoleId\":\"null\"}");
+ List<JSONObject> roleList = new ArrayList<>();
+ roleList.add(mockJsonObjectRole);
+ mockJsonObjectFinalRole.put("role", roleList);
+ ResponseEntity<String> getResponse = new ResponseEntity<>(mockJsonObjectFinalRole.toString(), HttpStatus.OK);
+ Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.GET),
+ Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(getResponse);
+ ResponseEntity<String> delResponse = new ResponseEntity<>(roleList.toString(), HttpStatus.OK);
+ Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.DELETE),
+ Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(delResponse);
+ ResponseEntity<String> addRoleResponse = new ResponseEntity<>(HttpStatus.CREATED);
+ Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.POST),
+ Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(addRoleResponse);
+ final Map<String, String> params = new HashMap<>();
+ params.put("uebKey", app.getUebKey());
+ params.put("roleId", String.valueOf(getEPRole.getId()));
+ List<BulkUploadUserRoles> userRolesList = new ArrayList<>();
+ BulkUploadUserRoles bulkUploadUserRoles = new BulkUploadUserRoles();
+ bulkUploadUserRoles.setAppNameSpace("com.test.app");
+ bulkUploadUserRoles.setOrgUserId("guestT");
+ bulkUploadUserRoles.setRoleName("Test2");
+ userRolesList.add(bulkUploadUserRoles);
+ Mockito.when(dataAccessService.executeNamedQuery("getBulkUsersForSingleRole", params, null))
+ .thenReturn(userRolesList);
+ Mockito.when(
+ EPCommonSystemProperties.containsProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN))
+ .thenReturn(true);
+ Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN))
+ .thenReturn("@test.com");
+ ResponseEntity<String> mockBulkUsersUpload = new ResponseEntity<>(HttpStatus.OK);
+ Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.POST),
+ Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(mockBulkUsersUpload);
+ List<EPAppRoleFunction> appRoleFunctionList = new ArrayList<>();
+ final Map<String, Long> appRoleFuncsParams = new HashMap<>();
+ appRoleFuncsParams.put("appId", app.getId());
+ appRoleFuncsParams.put("roleId", getEPRole.getId());
+ Mockito.when(
+ dataAccessService.executeNamedQuery("getAppRoleFunctionOnRoleIdandAppId", appRoleFuncsParams, null))
+ .thenReturn(appRoleFunctionList);
+ Mockito.when(EcompPortalUtils.getFunctionCode(roleFunc.getCode())).thenReturn("test_instance");
+ Mockito.when(EcompPortalUtils.getFunctionCode(roleFunc2.getCode())).thenReturn("test_instance3");
+ final Map<String, String> getAppFunctionParams = new HashMap<>();
+ getAppFunctionParams.put("appId", String.valueOf(app.getId()));
+ getAppFunctionParams.put(FUNCTION_CODE_PARAMS, roleFunc.getCode());
+ List<CentralV2RoleFunction> v2RoleFunction = new ArrayList<>();
+ CentralV2RoleFunction v2RoleFunction1 = new CentralV2RoleFunction("test_type|test_instance|*", "Test Name");
+ v2RoleFunction.add(v2RoleFunction1);
+ Mockito.when(dataAccessService.executeNamedQuery(GET_ROLE_FUNCTION_QUERY, getAppFunctionParams, null))
+ .thenReturn(v2RoleFunction);
+ final Map<String, String> getAppFunctionParams2 = new HashMap<>();
+ getAppFunctionParams2.put("appId", String.valueOf(app.getId()));
+ getAppFunctionParams2.put(FUNCTION_CODE_PARAMS, roleFunc2.getCode());
+ List<CentralV2RoleFunction> v2RoleFunction2 = new ArrayList<>();
+ CentralV2RoleFunction v2RoleFunction3 = new CentralV2RoleFunction("test_type3|test_instance3|*", "Test Name3");
+ v2RoleFunction2.add(v2RoleFunction3);
+ Mockito.when(dataAccessService.executeNamedQuery(GET_ROLE_FUNCTION_QUERY, getAppFunctionParams2, null))
+ .thenReturn(v2RoleFunction2);
+ ExternalRequestFieldsValidator actual = externalAccessRolesServiceImpl.saveRoleForApplication(addRoleTest,
+ app.getUebKey());
+ ExternalRequestFieldsValidator expected = new ExternalRequestFieldsValidator(true, "");
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ public void saveRoleForPartnerApplicationUpdateTest() throws Exception {
+ EPApp app = mockApp();
+ app.setId(2l);
+ Role addRoleTest = new Role();
+ SortedSet<RoleFunction> roleFuncSet = new TreeSet<>();
+ RoleFunction roleFunc = new RoleFunction();
+ roleFunc.setName("Test Name");
+ roleFunc.setCode("test_type|test_instance|*");
+ RoleFunction roleFunc2 = new RoleFunction();
+ roleFunc2.setName("Test Name3");
+ roleFunc2.setCode("test_type3|test_instance3|*");
+ roleFuncSet.add(roleFunc);
+ roleFuncSet.add(roleFunc2);
+ addRoleTest.setActive(false);
+ addRoleTest.setName("Test2");
+ addRoleTest.setId(22l);
+ addRoleTest.setRoleFunctions(roleFuncSet);
+ List<EPApp> appList = new ArrayList<>();
+ final Map<String, String> appUebkeyParams = new HashMap<>();
+ appList.add(app);
+ appUebkeyParams.put("appKey", app.getUebKey());
+ Mockito.when(dataAccessService.executeNamedQuery("getMyAppDetailsByUebKey", appUebkeyParams, null))
+ .thenReturn(appList);
+ List<EPRole> globalRoles = new ArrayList<>();
+ EPRole globalRole = new EPRole();
+ globalRole.setName("global_test");
+ globalRole.setId(1111l);
+ globalRole.setActive(true);
+ globalRoles.add(globalRole);
+ Mockito.when(dataAccessService.executeNamedQuery("getGlobalRolesOfPortal", null, null)).thenReturn(globalRoles);
+ List<EPRole> epRoleList = new ArrayList<>();
+ EPRole getEPRole = new EPRole();
+ getEPRole.setName("Test2");
+ getEPRole.setId(2l);
+ getEPRole.setActive(true);
+ getEPRole.setAppRoleId(22l);
+ epRoleList.add(getEPRole);
+ final Map<String, Long> getPortalAppRoleParams = new HashMap<>();
+ getPortalAppRoleParams.put("appRoleId", addRoleTest.getId());
+ getPortalAppRoleParams.put("appId", app.getId());
+ Mockito.when(dataAccessService.executeNamedQuery("getPartnerAppRoleByRoleId", getPortalAppRoleParams, null))
+ .thenReturn(epRoleList);
+ Mockito.when(EcompPortalUtils.checkIfRemoteCentralAccessAllowed()).thenReturn(true);
+ HttpHeaders headers = new HttpHeaders();
+ Mockito.when(EcompPortalUtils.base64encodeKeyForAAFBasicAuth()).thenReturn(headers);
+ JSONObject mockJsonObjectRole = new JSONObject();
+ JSONObject mockJsonObjectFinalRole = new JSONObject();
+ JSONObject mockJsonObjectPerm1 = new JSONObject();
+ JSONObject mockJsonObjectPerm2 = new JSONObject();
+ mockJsonObjectPerm1.put("type", "com.test.app.test_type");
+ mockJsonObjectPerm1.put("instance", "test_instance");
+ mockJsonObjectPerm1.put("action", "*");
+ mockJsonObjectPerm2.put("type", "com.test.app.test_type2");
+ mockJsonObjectPerm2.put("instance", "test_instance2");
+ mockJsonObjectPerm2.put("action", "*");
+ List<JSONObject> permsList = new ArrayList<>();
+ permsList.add(mockJsonObjectPerm1);
+ permsList.add(mockJsonObjectPerm2);
+ mockJsonObjectRole.put("name", "com.test.app.Test");
+ mockJsonObjectRole.put("perms", permsList);
+ mockJsonObjectRole.put("description",
+ "{\"id\":\"2\",\"name\":\"Test2\",\"active\":\"true\",\"priority\":\"null\",\"appId\":\"2\",\"appRoleId\":\"22\"}");
+ List<JSONObject> roleList = new ArrayList<>();
+ roleList.add(mockJsonObjectRole);
+ mockJsonObjectFinalRole.put("role", roleList);
+ ResponseEntity<String> getResponse = new ResponseEntity<>(mockJsonObjectFinalRole.toString(), HttpStatus.OK);
+ Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.GET),
+ Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(getResponse);
+ ResponseEntity<String> delResponse = new ResponseEntity<>(roleList.toString(), HttpStatus.OK);
+ final Map<String, String> getPartnerAppRoleParams = new HashMap<>();
+ getPartnerAppRoleParams.put(APP_ROLE_NAME_PARAM, addRoleTest.getName());
+ getPartnerAppRoleParams.put("appId", String.valueOf(app.getId()));
+ Mockito.when(dataAccessService.executeNamedQuery(GET_ROLE_TO_UPDATE_IN_EXTERNAL_AUTH_SYSTEM,
+ getPartnerAppRoleParams, null)).thenReturn(epRoleList);
+ ResponseEntity<String> updateRoleResponse = new ResponseEntity<>(HttpStatus.OK);
+ Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.PUT),
+ Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(updateRoleResponse);
+ Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.DELETE),
+ Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(delResponse);
+ ResponseEntity<String> addRoleResponse = new ResponseEntity<>(HttpStatus.CREATED);
+ Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.POST),
+ Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(addRoleResponse);
+ final Map<String, String> params = new HashMap<>();
+ params.put("uebKey", app.getUebKey());
+ params.put("roleId", String.valueOf(getEPRole.getId()));
+ List<BulkUploadUserRoles> userRolesList = new ArrayList<>();
+ BulkUploadUserRoles bulkUploadUserRoles = new BulkUploadUserRoles();
+ bulkUploadUserRoles.setAppNameSpace("com.test.app");
+ bulkUploadUserRoles.setOrgUserId("guestT");
+ bulkUploadUserRoles.setRoleName("Test2");
+ userRolesList.add(bulkUploadUserRoles);
+ Mockito.when(dataAccessService.executeNamedQuery("getBulkUsersForSingleRole", params, null))
+ .thenReturn(userRolesList);
+ Mockito.when(
+ EPCommonSystemProperties.containsProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN))
+ .thenReturn(true);
+ Mockito.when(SystemProperties.getProperty(EPCommonSystemProperties.EXTERNAL_CENTRAL_ACCESS_USER_DOMAIN))
+ .thenReturn("@test.com");
+ ResponseEntity<String> mockBulkUsersUpload = new ResponseEntity<>(HttpStatus.OK);
+ Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.POST),
+ Matchers.<HttpEntity<String>>any(), Matchers.eq(String.class))).thenReturn(mockBulkUsersUpload);
+ List<EPAppRoleFunction> appRoleFunctionList = new ArrayList<>();
+ final Map<String, Long> appRoleFuncsParams = new HashMap<>();
+ appRoleFuncsParams.put("appId", app.getId());
+ appRoleFuncsParams.put("roleId", getEPRole.getId());
+ Mockito.when(
+ dataAccessService.executeNamedQuery("getAppRoleFunctionOnRoleIdandAppId", appRoleFuncsParams, null))
+ .thenReturn(appRoleFunctionList);
+ Mockito.when(EcompPortalUtils.getFunctionCode(roleFunc.getCode())).thenReturn("test_instance");
+ Mockito.when(EcompPortalUtils.getFunctionCode(roleFunc2.getCode())).thenReturn("test_instance3");
+ final Map<String, String> getAppFunctionParams = new HashMap<>();
+ getAppFunctionParams.put("appId", String.valueOf(app.getId()));
+ getAppFunctionParams.put(FUNCTION_CODE_PARAMS, roleFunc.getCode());
+ List<CentralV2RoleFunction> v2RoleFunction = new ArrayList<>();
+ CentralV2RoleFunction v2RoleFunction1 = new CentralV2RoleFunction("test_type|test_instance|*", "Test Name");
+ v2RoleFunction.add(v2RoleFunction1);
+ Mockito.when(dataAccessService.executeNamedQuery(GET_ROLE_FUNCTION_QUERY, getAppFunctionParams, null))
+ .thenReturn(v2RoleFunction);
+ final Map<String, String> getAppFunctionParams2 = new HashMap<>();
+ getAppFunctionParams2.put("appId", String.valueOf(app.getId()));
+ getAppFunctionParams2.put(FUNCTION_CODE_PARAMS, roleFunc2.getCode());
+ List<CentralV2RoleFunction> v2RoleFunction2 = new ArrayList<>();
+ CentralV2RoleFunction v2RoleFunction3 = new CentralV2RoleFunction("test_type3|test_instance3|*", "Test Name3");
+ v2RoleFunction2.add(v2RoleFunction3);
+ Mockito.when(dataAccessService.executeNamedQuery(GET_ROLE_FUNCTION_QUERY, getAppFunctionParams2, null))
+ .thenReturn(v2RoleFunction2);
+ ExternalRequestFieldsValidator actual = externalAccessRolesServiceImpl.saveRoleForApplication(addRoleTest,
+ app.getUebKey());
+ ExternalRequestFieldsValidator expected = new ExternalRequestFieldsValidator(true, "");
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ public void saveGlobalRoleFunctionsForPartnerApplicationUpdateTest() throws Exception {
+ EPApp app = mockApp();
+ app.setId(2l);
+ Role addRoleTest = new Role();
+ SortedSet<RoleFunction> roleFuncSet = new TreeSet<>();
+ RoleFunction roleFunc = new RoleFunction();
+ roleFunc.setName("Test Name");
+ roleFunc.setCode("test_type|test_instance|*");
+ RoleFunction roleFunc2 = new RoleFunction();
+ roleFunc2.setName("Test Name3");
+ roleFunc2.setCode("test_type3|test_instance3|*");
+ roleFuncSet.add(roleFunc);
+ roleFuncSet.add(roleFunc2);
+ addRoleTest.setActive(true);
+ addRoleTest.setName("global_test");
+ addRoleTest.setId(1111l);
+ addRoleTest.setRoleFunctions(roleFuncSet);
+ List<EPApp> appList = new ArrayList<>();
+ final Map<String, String> appUebkeyParams = new HashMap<>();
+ appList.add(app);
+ appUebkeyParams.put("appKey", app.getUebKey());
+ Mockito.when(dataAccessService.executeNamedQuery("getMyAppDetailsByUebKey", appUebkeyParams, null))
+ .thenReturn(appList);
+ List<EPRole> globalRoles = new ArrayList<>();
+ EPRole globalRole = new EPRole();
+ globalRole.setName("global_test");
+ globalRole.setId(1111l);
+ globalRole.setActive(true);
+ EPRole globalRole2 = new EPRole();
+ globalRole2.setName("global_test2");
+ globalRole2.setId(2222l);
+ globalRole2.setActive(true);
+ globalRoles.add(globalRole);
+ globalRoles.add(globalRole2);
+ Mockito.when(dataAccessService.executeNamedQuery("getGlobalRolesOfPortal", null, null)).thenReturn(globalRoles);
+ List<EPRole> getGlobalRoles = new ArrayList<>();
+ EPRole getEPGlobalRole = new EPRole();
+ getEPGlobalRole.setName("global_test");
+ getEPGlobalRole.setId(1111l);
+ getEPGlobalRole.setActive(true);
+ getGlobalRoles.add(getEPGlobalRole);
+ final Map<String, Long> getPortalAppRoleParams = new HashMap<>();
+ getPortalAppRoleParams.put("roleId", globalRole.getId());
+ Mockito.when(dataAccessService.executeNamedQuery("getPortalAppRoleByRoleId", getPortalAppRoleParams, null))
+ .thenReturn(getGlobalRoles);