diff options
Diffstat (limited to 'ecomp-sdk/epsdk-app-common/src')
8 files changed, 19 insertions, 29 deletions
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ManifestController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ManifestController.java index 65964fe5..0fd3cfbb 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ManifestController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ManifestController.java @@ -45,7 +45,6 @@ import java.util.jar.Attributes; import java.util.jar.Manifest; import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; import org.onap.portalsdk.core.controller.RestrictedBaseController; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ProfileController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ProfileController.java index 74c18850..c7edfb81 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ProfileController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/ProfileController.java @@ -88,7 +88,7 @@ public class ProfileController extends RestrictedBaseController { @RequestMapping(value = { "/profile" }, method = RequestMethod.GET) public ModelAndView profile(HttpServletRequest request) throws IOException { - Map<String, Object> model = new HashMap<String, Object>(); + Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); User user = UserUtils.getUserSession(request); @@ -138,7 +138,7 @@ public class ProfileController extends RestrictedBaseController { @RequestMapping(value = { "/get_self_profile" }, method = RequestMethod.GET) public void getSelfProfile(HttpServletRequest request, HttpServletResponse response) { - Map<String, Object> model = new HashMap<String, Object>(); + Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); User user = UserUtils.getUserSession(request); diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/AngularSinglePageController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/AngularSinglePageController.java index b5d78768..96b602c3 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/AngularSinglePageController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/AngularSinglePageController.java @@ -59,7 +59,7 @@ public class AngularSinglePageController extends RestrictedBaseController { @RequestMapping(value = { "/singlePageSample" }, method = RequestMethod.GET) public ModelAndView view(HttpServletRequest request) { - Map<String, Object> model = new HashMap<String, Object>(); + Map<String, Object> model = new HashMap<>(); return new ModelAndView("single_page_sample", "model", model); } diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastController.java index ec300780..ba90f46f 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/BroadcastController.java @@ -73,7 +73,7 @@ public class BroadcastController extends RestrictedBaseController { @RequestMapping(value = { "/broadcast" }, method = RequestMethod.GET) public ModelAndView broadcast(HttpServletRequest request) { - Map<String, Object> model = new HashMap<String, Object>(); + Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); try { @@ -87,7 +87,7 @@ public class BroadcastController extends RestrictedBaseController { @RequestMapping(value = { "/get_broadcast" }, method = RequestMethod.GET) public void getBroadcast(HttpServletRequest request, HttpServletResponse response) { - Map<String, Object> model = new HashMap<String, Object>(); + Map<String, Object> model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); try { diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/ElementModelController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/ElementModelController.java index 361a4187..9588a7e4 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/ElementModelController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/ElementModelController.java @@ -89,18 +89,6 @@ public class ElementModelController extends RestrictedBaseController { return yamlString; } - /* - public ModelAndView callflowAdditional(HttpServletRequest request, HttpServletResponse response) throws Exception { - Map<String, Object> model = new HashMap<String, Object>(); - String callFlowName = request.getParameter("callFlowName"); - String callFlowStep = request.getParameter("callFlowStep"); - - ElementLinkService main = new ElementLinkService(); - String yamlString = main.main2(new String[] { callFlowName, callFlowStep }); - model.put("output_string", yamlString); - return new ModelAndView("data_out", "model", model); - } - */ } diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/PostDroolsController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/PostDroolsController.java index fb0338ea..43d548f9 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/PostDroolsController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/PostDroolsController.java @@ -75,7 +75,7 @@ public class PostDroolsController extends RestrictedBaseController { @RequestMapping(value = { "/getDrools" }, method = RequestMethod.GET) public void getDrools(HttpServletRequest request, HttpServletResponse response) { - // Map<String, Object> model = new HashMap<String, Object>(); + ObjectMapper mapper = new ObjectMapper(); try { @@ -97,7 +97,6 @@ public class PostDroolsController extends RestrictedBaseController { PostDroolsBean postDroolsBean = new PostDroolsBean(); String selectedFile = request.getParameter("selectedFile"); postDroolsBean.setDroolsFile(selectedFile);// sample populated - // postDroolsBean.setSelectedRules("[\"NJ\",\"NY\",\"KY\"]"); postDroolsBean.setClassName(postDroolsService.retrieveClass(selectedFile)); JsonMessage msg = new JsonMessage(mapper.writeValueAsString(postDroolsBean)); @@ -126,7 +125,6 @@ public class PostDroolsController extends RestrictedBaseController { request.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); - // String responseString = mapper.writeValueAsString(resultsString); JSONObject j = new JSONObject("{resultsString: " + resultsString + "}"); out.write(j.toString()); diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java index 871a3750..966eb8f2 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java @@ -279,7 +279,7 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService, IPortalR } else { List<User> users = userProfileService.findAllActive(); - List<EcompUser> ecompUsers = new ArrayList<EcompUser>(); + List<EcompUser> ecompUsers = new ArrayList<>(); for (User user : users) ecompUsers.add(UserUtils.convertToEcompUser(user)); return ecompUsers; @@ -299,7 +299,7 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService, IPortalR public List<EcompRole> getAvailableRoles(String requestedLoginId) throws PortalAPIException { try { List<Role> roles = roleService.getActiveRoles(requestedLoginId); - List<EcompRole> ecompRoles = new ArrayList<EcompRole>(); + List<EcompRole> ecompRoles = new ArrayList<>(); for (Role role : roles) ecompRoles.add(UserUtils.convertToEcompRole(role)); return ecompRoles; @@ -323,7 +323,7 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService, IPortalR * TypeFactory.defaultInstance().constructCollectionType(List.class, * EcompRole.class)); */ - SortedSet<Role> roles = new TreeSet<Role>(); + SortedSet<Role> roles = new TreeSet<>(); for (EcompRole role : rolesJson) { roles.add(roleService.getRole(loginId,role.getId())); } @@ -357,7 +357,7 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService, IPortalR public List<EcompRole> getUserRoles(String loginId) throws PortalAPIException { if (logger.isDebugEnabled()) logger.debug(EELFLoggerDelegate.debugLogger, "## REST API ## loginId: {}", loginId); - List<EcompRole> ecompRoles = new ArrayList<EcompRole>(); + List<EcompRole> ecompRoles = new ArrayList<>(); try { if (isCentralized.equals(isAccessCentralized)) { diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/service/OnBoardingApiServiceImplTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/service/OnBoardingApiServiceImplTest.java index 6ddcbcfb..989394d6 100644 --- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/service/OnBoardingApiServiceImplTest.java +++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/service/OnBoardingApiServiceImplTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START========================================== * ONAP Portal SDK * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed @@ -264,6 +264,8 @@ public class OnBoardingApiServiceImplTest { @Test public void pushUserRoleTest() throws Exception { String loginId = "123"; + App app = new App(); + app.setId(1l); List<EcompRole> rolesJson = new ArrayList<>(); EcompRole role1 = new EcompRole(); role1.setId(123L); @@ -274,12 +276,13 @@ public class OnBoardingApiServiceImplTest { Role role = new Role(); role.setId(123L); userApp.setRole(role); + userApp.setApp(app); UserApp userApp2 = new UserApp(); Role role2 = new Role(); role2.setId(124L); userApp2.setRole(role2); - + userApp2.setApp(app); userApps.add(userApp); userApps.add(userApp2); User user = new User(); @@ -292,9 +295,10 @@ public class OnBoardingApiServiceImplTest { Assert.assertTrue(true); } - @Test(expected = PortalAPIException.class) + @Test public void pushUserRoleExceptionTest() throws Exception { String loginId = "123"; + App app = new App(); List<EcompRole> rolesJson = new ArrayList<>(); EcompRole role1 = new EcompRole(); role1.setId(123L); @@ -304,7 +308,8 @@ public class OnBoardingApiServiceImplTest { UserApp userApp = new UserApp(); Role role = new Role(); role.setId(123L); - + userApp.setApp(app); + userApp.setRole(role); userApps.add(userApp); User user = new User(); user.setUserApps(userApps); |