import org.onap.portalapp.portal.domain.CentralV2RoleFunction;
import org.onap.portalapp.portal.domain.EPApp;
import org.onap.portalapp.portal.domain.EPUser;
import org.onap.portalapp.portal.domain.CentralV2RoleFunction;
import org.onap.portalapp.portal.domain.EPApp;
import org.onap.portalapp.portal.domain.EPUser;
import org.onap.portalapp.portal.ecomp.model.PortalRestResponse;
import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum;
import org.onap.portalapp.portal.framework.MockitoTestSuite;
import org.onap.portalapp.portal.ecomp.model.PortalRestResponse;
import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum;
import org.onap.portalapp.portal.framework.MockitoTestSuite;
PrintWriter writer = new PrintWriter(sw);
Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
EPApp app = mockApp();
PrintWriter writer = new PrintWriter(sw);
Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
EPApp app = mockApp();
List<EPApp> appList = new ArrayList<>();
appList.add(app);
Mockito.when(mockedRequest.getHeader("uebkey")).thenReturn(uebKey);
List<EPApp> appList = new ArrayList<>();
appList.add(app);
Mockito.when(mockedRequest.getHeader("uebkey")).thenReturn(uebKey);
List<EPApp> appList = new ArrayList<>();
appList.add(app);
Mockito.when(mockedRequest.getHeader("uebkey")).thenReturn(uebKey);
List<EPApp> appList = new ArrayList<>();
appList.add(app);
Mockito.when(mockedRequest.getHeader("uebkey")).thenReturn(uebKey);
List<EPApp> appList = new ArrayList<>();
appList.add(app);
Mockito.when(mockedRequest.getHeader("uebkey")).thenReturn(uebKey);
List<EPApp> appList = new ArrayList<>();
appList.add(app);
Mockito.when(mockedRequest.getHeader("uebkey")).thenReturn(uebKey);
List<CentralV2Role> centralV2RoleList = new ArrayList<>();
List<CentralRole> centralRoleList = new ArrayList<>();
EPApp app = mockApp();
List<CentralV2Role> centralV2RoleList = new ArrayList<>();
List<CentralRole> centralRoleList = new ArrayList<>();
EPApp app = mockApp();
applicationList.add(app);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.FOUND);
Mockito.when(externalAccessRolesService.getNameSpaceIfExists(applicationList.get(0))).thenReturn(response);
applicationList.add(app);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.FOUND);
Mockito.when(externalAccessRolesService.getNameSpaceIfExists(applicationList.get(0))).thenReturn(response);
List<CentralV2Role> centralV2RoleList = new ArrayList<>();
List<CentralRole> centralRoleList = new ArrayList<>();
EPApp app = mockApp();
List<CentralV2Role> centralV2RoleList = new ArrayList<>();
List<CentralRole> centralRoleList = new ArrayList<>();
EPApp app = mockApp();
applicationList.add(app);
ResponseEntity<String> response = null;
Mockito.when(externalAccessRolesService.getNameSpaceIfExists(applicationList.get(0))).thenReturn(response);
applicationList.add(app);
ResponseEntity<String> response = null;
Mockito.when(externalAccessRolesService.getNameSpaceIfExists(applicationList.get(0))).thenReturn(response);
List<EPApp> applicationList = new ArrayList<>();
List<CentralV2Role> centralV2Role = new ArrayList<>();
EPApp app = mockApp();
List<EPApp> applicationList = new ArrayList<>();
List<CentralV2Role> centralV2Role = new ArrayList<>();
EPApp app = mockApp();
applicationList.add(app);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.FOUND);
Mockito.when(externalAccessRolesService.getNameSpaceIfExists(applicationList.get(0))).thenReturn(response);
applicationList.add(app);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.FOUND);
Mockito.when(externalAccessRolesService.getNameSpaceIfExists(applicationList.get(0))).thenReturn(response);
List<EPApp> applicationList = new ArrayList<>();
List<CentralV2Role> centralV2Role = new ArrayList<>();
EPApp app = mockApp();
List<EPApp> applicationList = new ArrayList<>();
List<CentralV2Role> centralV2Role = new ArrayList<>();
EPApp app = mockApp();
applicationList.add(app);
ResponseEntity<String> response = null;
Mockito.when(externalAccessRolesService.getNameSpaceIfExists(applicationList.get(0))).thenReturn(response);
applicationList.add(app);
ResponseEntity<String> response = null;
Mockito.when(externalAccessRolesService.getNameSpaceIfExists(applicationList.get(0))).thenReturn(response);
List<EPApp> applicationList = new ArrayList<>();
List<CentralV2RoleFunction> centralV2RoleFunction = new ArrayList<>();
EPApp app = mockApp();
List<EPApp> applicationList = new ArrayList<>();
List<CentralV2RoleFunction> centralV2RoleFunction = new ArrayList<>();
EPApp app = mockApp();
applicationList.add(app);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.FOUND);
Mockito.when(externalAccessRolesService.getNameSpaceIfExists(applicationList.get(0))).thenReturn(response);
applicationList.add(app);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.FOUND);
Mockito.when(externalAccessRolesService.getNameSpaceIfExists(applicationList.get(0))).thenReturn(response);
List<EPApp> applicationList = new ArrayList<>();
List<CentralV2RoleFunction> centralV2RoleFunction = new ArrayList<>();
EPApp app = mockApp();
List<EPApp> applicationList = new ArrayList<>();
List<CentralV2RoleFunction> centralV2RoleFunction = new ArrayList<>();
EPApp app = mockApp();
applicationList.add(app);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.FOUND);
Mockito.when(externalAccessRolesService.getNameSpaceIfExists(applicationList.get(0))).thenReturn(response);
applicationList.add(app);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.FOUND);
Mockito.when(externalAccessRolesService.getNameSpaceIfExists(applicationList.get(0))).thenReturn(response);
applicationList.add(app);
Mockito.when(mockedRequest.getHeader("uebkey")).thenReturn(uebKey);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.FOUND);
applicationList.add(app);
Mockito.when(mockedRequest.getHeader("uebkey")).thenReturn(uebKey);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.FOUND);
StringWriter sw = new StringWriter();
PrintWriter writer = new PrintWriter(sw);
Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
StringWriter sw = new StringWriter();
PrintWriter writer = new PrintWriter(sw);
Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
applicationList.add(app);
Mockito.when(mockedRequest.getHeader("uebkey")).thenReturn(uebKey);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.FOUND);
applicationList.add(app);
Mockito.when(mockedRequest.getHeader("uebkey")).thenReturn(uebKey);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.FOUND);
StringWriter sw = new StringWriter();
PrintWriter writer = new PrintWriter(sw);
Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
StringWriter sw = new StringWriter();
PrintWriter writer = new PrintWriter(sw);
Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
CentralV2RoleFunction centralV2RoleFunction = new CentralV2RoleFunction();
centralV2RoleFunction.setCode("test");
EPApp app = mockApp();
CentralV2RoleFunction centralV2RoleFunction = new CentralV2RoleFunction();
centralV2RoleFunction.setCode("test");
EPApp app = mockApp();
applicationList.add(app);
Mockito.when(mockedRequest.getHeader("uebkey")).thenReturn(uebKey);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.FOUND);
applicationList.add(app);
Mockito.when(mockedRequest.getHeader("uebkey")).thenReturn(uebKey);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.FOUND);
applicationList.add(app);
Mockito.when(mockedRequest.getHeader("uebkey")).thenReturn(uebKey);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.FOUND);
applicationList.add(app);
Mockito.when(mockedRequest.getHeader("uebkey")).thenReturn(uebKey);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.FOUND);
List<EPApp> mockAppList = new ArrayList<>();
mockAppList.add(mockApp);
StringWriter sw = new StringWriter();
List<EPApp> mockAppList = new ArrayList<>();
mockAppList.add(mockApp);
StringWriter sw = new StringWriter();
public void getRoleFunctionXSSTest() throws Exception {
String expected = getXSSKeyJson();
EPApp mockApp = mockApp();
public void getRoleFunctionXSSTest() throws Exception {
String expected = getXSSKeyJson();
EPApp mockApp = mockApp();
List<EPApp> mockAppList = new ArrayList<>();
mockAppList.add(mockApp);
StringWriter sw = new StringWriter();
List<EPApp> mockAppList = new ArrayList<>();
mockAppList.add(mockApp);
StringWriter sw = new StringWriter();
public void saveRoleFunctionExceptionTest() throws Exception {
List<EPApp> applicationList = new ArrayList<>();
EPApp app = mockApp();
public void saveRoleFunctionExceptionTest() throws Exception {
List<EPApp> applicationList = new ArrayList<>();
EPApp app = mockApp();
applicationList.add(app);
Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
PortalRestResponse<String> portalRestResponse = null;
PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<>();
applicationList.add(app);
Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
PortalRestResponse<String> portalRestResponse = null;
PortalRestResponse<String> expectedportalRestResponse = new PortalRestResponse<>();
expectedportalRestResponse.setResponse("Failed");
expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
Mockito.when(mockedRequest.getHeader("uebkey")).thenReturn(uebKey);
expectedportalRestResponse.setResponse("Failed");
expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
Mockito.when(mockedRequest.getHeader("uebkey")).thenReturn(uebKey);
applicationList.add(app);
JSONObject roleFunc = new JSONObject();
roleFunc.put("type", "test_type");
applicationList.add(app);
JSONObject roleFunc = new JSONObject();
roleFunc.put("type", "test_type");
applicationList.add(app);
JSONObject roleFunc = new JSONObject();
roleFunc.put("type", "<script>alert(“XSS”)</script> ");
applicationList.add(app);
JSONObject roleFunc = new JSONObject();
roleFunc.put("type", "<script>alert(“XSS”)</script> ");
List<EPApp> appList = new ArrayList<>();
appList.add(app);
expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK);
List<EPApp> appList = new ArrayList<>();
appList.add(app);
expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK);
public void getActiveRolesValidationTest() throws Exception {
List<CentralRole> expectedRolesList = null;
EPApp app = mockApp();
public void getActiveRolesValidationTest() throws Exception {
List<CentralRole> expectedRolesList = null;
EPApp app = mockApp();
Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
List<EPApp> applicationList = new ArrayList<>();
EPApp app = mockApp();
Mockito.when(mockedResponse.getWriter()).thenReturn(writer);
List<EPApp> applicationList = new ArrayList<>();
EPApp app = mockApp();
applicationList.add(app);
Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
Mockito.when(externalAccessRolesService.getAllAppUsers(mockedRequest.getHeader(uebKey))).thenReturn(users);
applicationList.add(app);
Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
Mockito.when(externalAccessRolesService.getAllAppUsers(mockedRequest.getHeader(uebKey))).thenReturn(users);
applicationList.add(app);
Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.OK);
applicationList.add(app);
Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.OK);
applicationList.add(app);
Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.OK);
applicationList.add(app);
Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.OK);
public void getEpUserExceptionTest() throws Exception {
List<EPApp> applicationList = new ArrayList<>();
EPApp app = mockApp();
public void getEpUserExceptionTest() throws Exception {
List<EPApp> applicationList = new ArrayList<>();
EPApp app = mockApp();
Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
StringWriter sw = new StringWriter();
PrintWriter writer = new PrintWriter(sw);
Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
StringWriter sw = new StringWriter();
PrintWriter writer = new PrintWriter(sw);
applicationList.add(app);
Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.OK);
applicationList.add(app);
Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.OK);
applicationList.add(app);
Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.OK);
Mockito.when(externalAccessRolesService.getNameSpaceIfExists(app)).thenReturn(response);
Mockito.doNothing().when(externalAccessRolesService).syncApplicationRolesWithEcompDB(app);
List<CentralV2Role> cenRoleList = new ArrayList<>();
applicationList.add(app);
Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
ResponseEntity<String> response = new ResponseEntity<>(HttpStatus.OK);
Mockito.when(externalAccessRolesService.getNameSpaceIfExists(app)).thenReturn(response);
Mockito.doNothing().when(externalAccessRolesService).syncApplicationRolesWithEcompDB(app);
List<CentralV2Role> cenRoleList = new ArrayList<>();
public void getEPRolesOfApplicationExceptionTest() throws Exception {
List<EPApp> applicationList = new ArrayList<>();
EPApp app = mockApp();
public void getEPRolesOfApplicationExceptionTest() throws Exception {
List<EPApp> applicationList = new ArrayList<>();
EPApp app = mockApp();
Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
StringWriter sw = new StringWriter();
PrintWriter writer = new PrintWriter(sw);
Mockito.when(externalAccessRolesService.getApp(mockedRequest.getHeader(uebKey))).thenReturn(applicationList);
StringWriter sw = new StringWriter();
PrintWriter writer = new PrintWriter(sw);
List<EPApp> appList = new ArrayList<>();
appList.add(app);
expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK);
List<EPApp> appList = new ArrayList<>();
appList.add(app);
expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK);
List<EPApp> appList = new ArrayList<>();
appList.add(app);
expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
List<EPApp> appList = new ArrayList<>();
appList.add(app);
expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
List<EPApp> appList = new ArrayList<>();
appList.add(app);
expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
List<EPApp> appList = new ArrayList<>();
appList.add(app);
expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
List<EPApp> appList = new ArrayList<>();
appList.add(app);
expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK);
List<EPApp> appList = new ArrayList<>();
appList.add(app);
expectedportalRestResponse.setStatus(PortalRestStatusEnum.OK);
List<EPApp> appList = new ArrayList<>();
appList.add(app);
expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);
List<EPApp> appList = new ArrayList<>();
appList.add(app);
expectedportalRestResponse.setStatus(PortalRestStatusEnum.ERROR);