diff options
Diffstat (limited to 'ecomp-sdk/epsdk-app-common')
3 files changed, 17 insertions, 9 deletions
diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AngularAdminController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AngularAdminController.java index 138a805d..3aeb0147 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AngularAdminController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AngularAdminController.java @@ -49,8 +49,9 @@ import org.springframework.web.servlet.ModelAndView; @Controller @RequestMapping("/") public class AngularAdminController extends RestrictedBaseController{ + public static final String API_VERSION = "/v3"; - @RequestMapping(value = {"/userProfile" }, method = RequestMethod.GET) + @RequestMapping(value = {API_VERSION + "/userProfile" }, method = RequestMethod.GET) public ModelAndView view() { Map<String, Object> model = new HashMap<>(); return new ModelAndView("user_profile_list","model", model); 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 46306817..871a3750 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 @@ -106,7 +106,7 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService, IPortalR .getProperty(PortalApiConstants.ROLE_ACCESS_CENTRALIZED); private static final String isCentralized = "remote"; - private static String portalApiVersion = "/v1"; + private static String portalApiVersion = "/v3"; public OnBoardingApiServiceImpl() { // Defend against null-pointer exception during server startup @@ -267,7 +267,7 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService, IPortalR if (isCentralized.equals(isAccessCentralized)) { List<EcompUser> UsersList = new ArrayList<>(); List<EcompUser> finalUsersList = new ArrayList<>(); - users_List = restApiRequestBuilder.getViaREST("/users", true, null); + users_List = restApiRequestBuilder.getViaREST(portalApiVersion + "/users", true, null); ObjectMapper mapper = new ObjectMapper(); UsersList = mapper.readValue(users_List, TypeFactory.defaultInstance().constructCollectionType(List.class, EcompUser.class)); @@ -476,4 +476,11 @@ public class OnBoardingApiServiceImpl implements IPortalRestAPIService, IPortalR credentialsMap.put("appName", appName); return credentialsMap; } + + @Override + public Map<String, String> getCredentials() throws PortalAPIException{ + return getAppCredentials(); + } + + } 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 857a25eb..6ddcbcfb 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 @@ -172,7 +172,7 @@ public class OnBoardingApiServiceImplTest { Mockito.when(PortalApiProperties.getProperty(PortalApiConstants.ROLE_ACCESS_CENTRALIZED)).thenReturn("remote"); String responseString = "Response"; - Mockito.when(restApiRequestBuilder.getViaREST("/v1/user/" + loginId, true, loginId)).thenReturn(responseString); + Mockito.when(restApiRequestBuilder.getViaREST("/v3/user/" + loginId, true, loginId)).thenReturn(responseString); Mockito.when(userService.userMapper(responseString)).thenReturn(new User()); OnBoardingApiServiceImpl onBoardingApiServiceImpl = new OnBoardingApiServiceImpl(); @@ -200,7 +200,7 @@ public class OnBoardingApiServiceImplTest { PowerMockito.mockStatic(PortalApiProperties.class); Mockito.when(PortalApiProperties.getProperty(PortalApiConstants.ROLE_ACCESS_CENTRALIZED)).thenReturn("local"); String responseString = "Response"; - Mockito.when(restApiRequestBuilder.getViaREST("/v1/user/" + loginId, true, loginId)).thenThrow(IOException.class); + Mockito.when(restApiRequestBuilder.getViaREST("/v3/user/" + loginId, true, loginId)).thenThrow(IOException.class); Mockito.when(userService.userMapper(responseString)).thenReturn(null); OnBoardingApiServiceImpl onBoardingApiServiceImpl = new OnBoardingApiServiceImpl(); @@ -215,7 +215,7 @@ public class OnBoardingApiServiceImplTest { OnBoardingApiServiceImpl onBoardingApiServiceImpl = new OnBoardingApiServiceImpl(); String responseString = "[ {\"firstName\":\"Name\"}]"; - Mockito.when(restApiRequestBuilder.getViaREST("/users", true, null)).thenReturn(responseString); + Mockito.when(restApiRequestBuilder.getViaREST("/v3/users", true, null)).thenReturn(responseString); List<EcompUser> users = onBoardingApiServiceImpl.getUsers(); Assert.assertNotNull(users); } @@ -227,7 +227,7 @@ public class OnBoardingApiServiceImplTest { OnBoardingApiServiceImpl onBoardingApiServiceImpl = new OnBoardingApiServiceImpl(); String responseString = " { [ {\"firstName\":\"Name\"} ] }"; - Mockito.when(restApiRequestBuilder.getViaREST("/users", true, null)).thenReturn(responseString); + Mockito.when(restApiRequestBuilder.getViaREST("/v3/users", true, null)).thenReturn(responseString); onBoardingApiServiceImpl.getUsers(); } @@ -319,7 +319,7 @@ public class OnBoardingApiServiceImplTest { public void getUserRolesTest() throws Exception { String loginId = "123"; String responseString = "Response"; - Mockito.when(restApiRequestBuilder.getViaREST("/v1/user/" + loginId, true, loginId)).thenReturn(responseString); + Mockito.when(restApiRequestBuilder.getViaREST("/v3/user/" + loginId, true, loginId)).thenReturn(responseString); User user = new User(); SortedSet<Role> currentRoles = new TreeSet<>(); Role role = new Role(); @@ -335,7 +335,7 @@ public class OnBoardingApiServiceImplTest { @Test(expected = org.onap.portalsdk.core.onboarding.exception.PortalAPIException.class) public void getUserRolesExceptionTest() throws Exception { String loginId = "123"; - Mockito.when(restApiRequestBuilder.getViaREST("/v1/user/" + loginId, true, loginId)).thenThrow(IOException.class); + Mockito.when(restApiRequestBuilder.getViaREST("/v3/user/" + loginId, true, loginId)).thenThrow(IOException.class); OnBoardingApiServiceImpl onBoardingApiServiceImpl = new OnBoardingApiServiceImpl(); onBoardingApiServiceImpl.getUserRoles(loginId); } |