diff options
author | sa282w <sa282w@att.com> | 2018-05-02 17:00:20 -0400 |
---|---|---|
committer | sa282w <sa282w@att.com> | 2018-05-03 16:51:59 -0400 |
commit | 22ed5d7b533cec97713c3b5aef37319d5dead6a3 (patch) | |
tree | df40d050750cab3cf9b78e9820dd0bde8d16eaa9 /ecomp-sdk/epsdk-core/src | |
parent | c607da68bfb7f7440d5be7f0396609dc01eb0e90 (diff) |
API Versioning for ECOMP Components in SDK
Issue-ID: PORTAL-263
Included the api version changes for SDK.
Change-Id: Ib81c5aabe585f6e2775e73a692153d1f286d1f45
Signed-off-by: sa282w <sa282w@att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-core/src')
4 files changed, 10 insertions, 9 deletions
diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceCentralizedImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceCentralizedImpl.java index 1d503a81..cdcd1d7a 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceCentralizedImpl.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceCentralizedImpl.java @@ -51,6 +51,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.type.TypeFactory; public class FunctionalMenuListServiceCentralizedImpl implements FunctionalMenuListService { + private static String portalApiVersion = "/v3"; @Autowired private RestApiRequestBuilder restApiRequestBuilder; @@ -59,7 +60,7 @@ public class FunctionalMenuListServiceCentralizedImpl implements FunctionalMenuL public List<RoleFunction> getFunctionCDList(HttpServletRequest request) throws IOException { User user = UserUtils.getUserSession(request); ObjectMapper mapper = new ObjectMapper(); - String menuList = restApiRequestBuilder.getViaREST("/menuFunctions", true, user.getOrgUserId()); + String menuList = restApiRequestBuilder.getViaREST( portalApiVersion + "/menuFunctions", true, user.getOrgUserId()); List<RoleFunction> roleFunctionFinalList = mapper.readValue(menuList, TypeFactory.defaultInstance().constructCollectionType(List.class, String.class)); return roleFunctionFinalList; diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/RoleServiceCentralizedAccess.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/RoleServiceCentralizedAccess.java index 88633abe..02a5ed30 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/RoleServiceCentralizedAccess.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/RoleServiceCentralizedAccess.java @@ -61,7 +61,7 @@ public class RoleServiceCentralizedAccess implements RoleService { @Autowired private RestApiRequestBuilder restApiRequestBuilder; - private static String portalApiVersion = "/v1"; + private static String portalApiVersion = "/v3"; @Override public List<RoleFunction> getRoleFunctions(String loginId) throws IOException { @@ -137,7 +137,7 @@ public class RoleServiceCentralizedAccess implements RoleService { @Override public void deleteRole(String loginId, Role domainRole) throws IOException { Long roleId = domainRole.getId(); - restApiRequestBuilder.deleteViaRest("v2/deleteRole/" + roleId, true, null, loginId); + restApiRequestBuilder.deleteViaRest("v3/deleteRole/" + roleId, true, null, loginId); } @Override diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceCentralizedImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceCentralizedImplTest.java index d1bd2dd3..e7f9d41b 100644 --- a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceCentralizedImplTest.java +++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceCentralizedImplTest.java @@ -70,7 +70,7 @@ public class FunctionalMenuListServiceCentralizedImplTest { user.setOrgId(123L); PowerMockito.mockStatic(UserUtils.class); Mockito.when(UserUtils.getUserSession(mockedRequest)).thenReturn(user); - Mockito.when(restApiRequestBuilder.getViaREST("/menuFunctions", true, user.getOrgUserId())).thenReturn(""); + Mockito.when(restApiRequestBuilder.getViaREST("/v3/menuFunctions", true, user.getOrgUserId())).thenReturn(""); fmServiceCentralizedImpl.getFunctionCDList(mockedRequest); } diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RoleServiceCentralizedAccessTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RoleServiceCentralizedAccessTest.java index bb8fb6da..c53eb2a4 100644 --- a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RoleServiceCentralizedAccessTest.java +++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RoleServiceCentralizedAccessTest.java @@ -74,7 +74,7 @@ public class RoleServiceCentralizedAccessTest { String loginId = "123"; Long roleId = null; String response ="[ { \"active\" : true, \"name\" : \"xyz\" } ]"; - Mockito.when(restApiRequestBuilder.getViaREST("/v1/roles", true, loginId)).thenReturn(response); + Mockito.when(restApiRequestBuilder.getViaREST("/v3/roles", true, loginId)).thenReturn(response); List<Role> roles = roleServiceCntrlAccess.getAvailableChildRoles(loginId, roleId); Assert.assertNotNull(roles); } @@ -84,7 +84,7 @@ public class RoleServiceCentralizedAccessTest { String loginId = "123"; Long roleId = 0L; String response ="[ { \"active\" : true, \"name\" : \"xyz\" } ]"; - Mockito.when(restApiRequestBuilder.getViaREST("/v1/roles", true, loginId)).thenReturn(response); + Mockito.when(restApiRequestBuilder.getViaREST("/v3/roles", true, loginId)).thenReturn(response); List<Role> roles = roleServiceCntrlAccess.getAvailableChildRoles(loginId, roleId); Assert.assertNotNull(roles); } @@ -94,9 +94,9 @@ public class RoleServiceCentralizedAccessTest { String loginId = "123"; Long roleId = 123L; String response ="[ { \"active\" : false, \"name\" : \"xyz\" } ]"; - Mockito.when(restApiRequestBuilder.getViaREST("/v1/roles", true, loginId)).thenReturn(response); + Mockito.when(restApiRequestBuilder.getViaREST("/v3/roles", true, loginId)).thenReturn(response); String roleResponse =" { \"active\" : true, \"name\" : \"xyz\", \"roleFunctions\" : [ { \"code\" : \"abc\", \"name\" : \"RF1\" , \"type\" : \"abc\", \"action\" : \"abc\" }, { \"code\" : \"pqr\", \"name\" : \"RF2\" , \"type\" : \"abc\", \"action\" : \"abc\" } ] , \"parentRoles\": [ {\"active\" : false, \"name\" : \"XYZ-ABC\"}, {\"active\" : true, \"name\" : \"ABC\"} ] } "; - Mockito.when(restApiRequestBuilder.getViaREST("/v1/role/" + roleId, true, loginId)).thenReturn(roleResponse); + Mockito.when(restApiRequestBuilder.getViaREST("/v3/role/" + roleId, true, loginId)).thenReturn(roleResponse); roleServiceCntrlAccess.getAvailableChildRoles(loginId, roleId); Assert.assertTrue(true); } @@ -122,7 +122,7 @@ public class RoleServiceCentralizedAccessTest { public void getActiveRolesTest() throws Exception { String requestedLoginId ="1234"; String response ="[ { \"active\" : true, \"name\" : \"role1\" }, { \"active\" : false, \"name\" : \"role2\" } ]"; - Mockito.when(restApiRequestBuilder.getViaREST("/v1/activeRoles", true, requestedLoginId)).thenReturn(response); + Mockito.when(restApiRequestBuilder.getViaREST("/v3/activeRoles", true, requestedLoginId)).thenReturn(response); List<Role> roles = roleServiceCntrlAccess.getActiveRoles(requestedLoginId); Assert.assertNotNull(roles); } |