API Versioning for ECOMP Components in SDK 01/45701/2
authorsa282w <sa282w@att.com>
Wed, 2 May 2018 21:00:20 +0000 (17:00 -0400)
committersa282w <sa282w@att.com>
Thu, 3 May 2018 20:51:59 +0000 (16:51 -0400)
Issue-ID: PORTAL-263

Included the api version changes for SDK.

Change-Id: Ib81c5aabe585f6e2775e73a692153d1f286d1f45
Signed-off-by: sa282w <sa282w@att.com>
16 files changed:
ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/AngularAdminController.java
ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/service/OnBoardingApiServiceImpl.java
ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/service/OnBoardingApiServiceImplTest.java
ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-directives/footer.js
ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceCentralizedImpl.java
ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/RoleServiceCentralizedAccess.java
ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/FunctionalMenuListServiceCentralizedImplTest.java
ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/RoleServiceCentralizedAccessTest.java
ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/IPortalRestAPIService.java
ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPICentralServiceImpl.java
ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPIProxy.java
ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/SessionCommunicationService.java
ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/rest/FunctionalMenuClient.java
ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/rest/RestWebServiceClient.java
ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/util/PortalApiConstants.java
ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/fw/test/SessionSlotCheckIntervalTest.java

index 138a805..3aeb014 100644 (file)
@@ -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);
index 4630681..871a375 100644 (file)
@@ -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();
+       }
+       
+
 }
index 857a25e..6ddcbcf 100644 (file)
@@ -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);
        }
index e11c3a0..34eaab9 100644 (file)
@@ -17,7 +17,7 @@ $(function() {
        portalHook();
        function portalHook() {
                var script = document.createElement('script');  
-               script.src = "api/v2/analytics"
+               script.src = "api/v3/analytics"
                script.async = true;                    
                script.onload = function() {
                        runAnalytics(); //runAnaltics() has endpoint in epsdk-fw library.
index 1d503a8..cdcd1d7 100644 (file)
@@ -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;
index 88633ab..02a5ed3 100644 (file)
@@ -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
index d1bd2dd..e7f9d41 100644 (file)
@@ -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);
        }
index bb8fb6d..c53eb2a 100644 (file)
@@ -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);
        }
index 6f8c50a..f82e873 100644 (file)
@@ -38,6 +38,7 @@
 package org.onap.portalsdk.core.onboarding.crossapi;
 
 import java.util.List;
+import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 
@@ -190,5 +191,7 @@ public interface IPortalRestAPIService {
         *             If an unexpected error occurs while processing the request.
         */
        public String getUserId(HttpServletRequest request) throws PortalAPIException;
+       
+       public Map<String, String> getCredentials() throws PortalAPIException;
 
 }
index a82517d..208e8c3 100644 (file)
@@ -39,15 +39,19 @@ package org.onap.portalsdk.core.onboarding.crossapi;
 
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 
+import org.onap.portalsdk.core.onboarding.exception.CipherUtilException;
 import org.onap.portalsdk.core.onboarding.exception.PortalAPIException;
 import org.onap.portalsdk.core.onboarding.rest.RestWebServiceClient;
+import org.onap.portalsdk.core.onboarding.util.CipherUtil;
 import org.onap.portalsdk.core.onboarding.util.PortalApiConstants;
 import org.onap.portalsdk.core.onboarding.util.PortalApiProperties;
 import org.onap.portalsdk.core.restful.domain.EcompRole;
@@ -65,6 +69,8 @@ public class PortalRestAPICentralServiceImpl implements IPortalRestAPIService {
        private String password;
        private String appName;
        IPortalRestCentralService portalRestCentralService;
+       public static final String API_VERSION = "/v4";
+       private static String portalApiVersion = "/v3";
 
        public PortalRestAPICentralServiceImpl() throws ServletException {
                String centralClassName = PortalApiProperties.getProperty(PortalApiConstants.PORTAL_API_IMPL_CLASS);
@@ -99,7 +105,7 @@ public class PortalRestAPICentralServiceImpl implements IPortalRestAPIService {
                EcompUser user = new EcompUser();
                String responseString = null;
                try {
-                       responseString = RestWebServiceClient.getInstance().getPortalContent("/v2/user/" + loginId, null,
+                       responseString = RestWebServiceClient.getInstance().getPortalContent(API_VERSION + "/user/" + loginId, null,
                                        appName, null, username, password, true);
                        logger.debug("responseString is: " + responseString);
                        user = mapper.readValue(responseString, EcompUser.class);
@@ -117,7 +123,7 @@ public class PortalRestAPICentralServiceImpl implements IPortalRestAPIService {
                List<EcompUser> usersList = new ArrayList<>();
                String responseString = null;
                try {
-                       responseString = RestWebServiceClient.getInstance().getPortalContent("/users", null, appName, null,
+                       responseString = RestWebServiceClient.getInstance().getPortalContent(portalApiVersion + "/users", null, appName, null,
                                        username, password, true);
                        logger.debug("responseString is: " + responseString);
                        usersList = mapper.readValue(responseString,
@@ -136,7 +142,7 @@ public class PortalRestAPICentralServiceImpl implements IPortalRestAPIService {
                List<EcompRole> rolesList = new ArrayList<>();
                String responseString = null;
                try {
-                       responseString = RestWebServiceClient.getInstance().getPortalContent("/v2/roles", requestedLoginId,
+                       responseString = RestWebServiceClient.getInstance().getPortalContent(API_VERSION + "/roles", requestedLoginId,
                                        appName, null, username, password, true);
                        logger.debug("responseString is: " + responseString);
                        rolesList = mapper.readValue(responseString,
@@ -163,7 +169,7 @@ public class PortalRestAPICentralServiceImpl implements IPortalRestAPIService {
                EcompUser user = new EcompUser();
                String responseString = null;
                try {
-                       responseString = RestWebServiceClient.getInstance().getPortalContent("/v2/user/" + loginId, null,
+                       responseString = RestWebServiceClient.getInstance().getPortalContent(API_VERSION + "/user/" + loginId, null,
                                        appName, null, username, password, true);
                        logger.debug("responseString is: " + responseString);
                        user = mapper.readValue(responseString, EcompUser.class);
@@ -196,5 +202,15 @@ public class PortalRestAPICentralServiceImpl implements IPortalRestAPIService {
        public String getUserId(HttpServletRequest request) throws PortalAPIException {
                return portalRestCentralService.getUserId(request);
        }
+       
+       @Override
+       public Map<String, String> getCredentials() throws PortalAPIException{
+               Map<String, String> credentialsMap = new HashMap<>();
+
+               credentialsMap.put("username", username);
+               credentialsMap.put("password", password);
+               credentialsMap.put("appName", appName);
+               return credentialsMap;
+       }
 
 }
index 9d13e43..49b3dea 100644 (file)
@@ -164,6 +164,21 @@ public class PortalRestAPIProxy extends HttpServlet implements IPortalRestAPISer
                        } else {
                                // User ID obtained from request
                                try {
+                                       String appUserName = "";
+                                       String appPassword = "";
+                                       String appName = "";
+
+                                       for (Map.Entry<String, String> entry : getCredentials().entrySet()) {
+
+                                               if (entry.getKey().equalsIgnoreCase("username")) {
+                                                       appUserName = entry.getValue();
+                                               } else if (entry.getKey().equalsIgnoreCase("password")) {
+                                                       appPassword = entry.getValue();
+                                               } else {
+                                                       appName = entry.getValue();
+                                               }
+                                       }
+                                       
                                        String credential = PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY);
                                        // for now lets also pass uebkey as user name and password
                                        String requestBody = readRequestBody(request);
@@ -173,7 +188,7 @@ public class PortalRestAPIProxy extends HttpServlet implements IPortalRestAPISer
                                        bodyMap.put("userid", userId);
                                        requestBody = mapper.writeValueAsString(bodyMap);
                                        responseJson = RestWebServiceClient.getInstance().postPortalContent(storeAnalyticsContextPath,
-                                                       userId, credential, null, credential, credential, "application/json", requestBody, true);
+                                                       userId, appName, null, appUserName, appPassword, "application/json", requestBody, true);
                                        logger.debug("doPost: postPortalContent returns " + responseJson);
                                        response.setStatus(HttpServletResponse.SC_OK);
                                } catch (Exception ex) {
@@ -346,12 +361,27 @@ public class PortalRestAPIProxy extends HttpServlet implements IPortalRestAPISer
                        } else {
                                // User ID obtained from request
                                try {
+                                       String appUserName = "";
+                                       String appPassword = "";
+                                       String appName = "";
+
+                                       for (Map.Entry<String, String> entry : getCredentials().entrySet()) {
+
+                                               if (entry.getKey().equalsIgnoreCase("username")) {
+                                                       appUserName = entry.getValue();
+                                               } else if (entry.getKey().equalsIgnoreCase("password")) {
+                                                       appPassword = entry.getValue();
+                                               } else {
+                                                       appName = entry.getValue();
+                                               }
+                                       }
                                        String credential = PortalApiProperties.getProperty(PortalApiConstants.UEB_APP_KEY);
                                        // for now lets also pass uebkey as user name and password
                                        contentType = "text/javascript";
 
                                        responseString = RestWebServiceClient.getInstance().getPortalContent(webAnalyticsContextPath,
-                                                       userId, credential, null, credential, credential, true);
+                                                       userId, appName, null, appUserName, appPassword, true);
+                                       
                                        if (logger.isDebugEnabled())
                                                logger.debug("doGet: " + webAnalyticsContextPath + ": " + responseString);
                                        response.setStatus(HttpServletResponse.SC_OK);
@@ -465,7 +495,8 @@ public class PortalRestAPIProxy extends HttpServlet implements IPortalRestAPISer
                                        response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
                                        logger.error("doGet: getUserRoles: caught exception", ex);
                                }
-                       } else {
+                       }
+                       else {
                                logger.warn("doGet: no match found for request");
                                responseJson = buildJsonResponse(false, "No match for request");
                                response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
@@ -647,5 +678,10 @@ public class PortalRestAPIProxy extends HttpServlet implements IPortalRestAPISer
        public static void setPortalRestApiServiceImpl(IPortalRestAPIService portalRestApiServiceImpl) {
                PortalRestAPIProxy.portalRestApiServiceImpl = portalRestApiServiceImpl;
        }
+       
+       @Override
+       public  Map<String, String> getCredentials() throws PortalAPIException {
+               return portalRestApiServiceImpl.getCredentials();
+       }
 
 }
index ae4847c..e016db0 100644 (file)
@@ -46,6 +46,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 public class SessionCommunicationService {
+       private static String portalApiVersion = "/v3";
 
        private static final Log logger = LogFactory.getLog(SessionCommunicationService.class);
 
@@ -66,7 +67,7 @@ public class SessionCommunicationService {
        public static String getSessionSlotCheckInterval(String ecompRestURL, String userName, String password,
                        String uebKey) {
                try {
-                       String url = ecompRestURL + "/getSessionSlotCheckInterval";
+                       String url = ecompRestURL + portalApiVersion + "/getSessionSlotCheckInterval";
 
                        URL obj = new URL(url);
 
index 5049455..b7d2ca8 100644 (file)
@@ -44,6 +44,7 @@ import java.io.IOException;
  * from the ECOMP Portal via UEB.
  */
 public class FunctionalMenuClient {
+       private static String portalApiVersion = "/v3";
 
        /**
         * Fetches the functional menu data from the configured ECOMP Portal
@@ -67,7 +68,7 @@ public class FunctionalMenuClient {
         */
        public static String getFunctionalMenu(String userId, String appName, String requestId, String appUserName,
                        String appPassword) throws IOException {
-               return RestWebServiceClient.getInstance().getPortalContent("/functionalMenuItemsForUser", userId, appName,
+               return RestWebServiceClient.getInstance().getPortalContent(portalApiVersion + "/functionalMenuItemsForUser", userId, appName,
                                requestId, appUserName, appPassword,true);
        }
 
index 72f3670..7121bd8 100644 (file)
@@ -223,8 +223,9 @@ public class RestWebServiceClient {
                }
 
                int responseCode = con.getResponseCode();
-               logger.debug("get: received response code '" + responseCode + "' while getting the '" + url + "' for user: "
-                               + loginId);
+               logger.debug("X-LatestVersion--------------:" + con.getHeaderFields().get("X-LatestVersion"));
+               logger.debug("X-PatchVersion----------------:" + con.getHeaderFields().get("X-PatchVersion"));
+               logger.debug("X-MinorVersion-----------------:" + con.getHeaderFields().get("X-MinorVersion"));
 
                final String response = readAndCloseStream(con.getInputStream());
                if (logger.isDebugEnabled())
index 8964dab..796f99d 100644 (file)
@@ -38,7 +38,7 @@
 package org.onap.portalsdk.core.onboarding.util;
 
 public interface PortalApiConstants {
-       public static final String API_PREFIX = "/api/v2";
+       public static final String API_PREFIX = "/api/v3";
        public static final String PORTAL_JSESSION_ID = "PORTAL_JSESSION_ID";
        public static final String PORTAL_JSESSION_BIND = "PORTAL_JSESSION_BIND";
        public static final String ACTIVE_USERS_NAME = "activeUsers";
index 2f854f9..b922b6c 100644 (file)
@@ -91,13 +91,14 @@ public class SessionSlotCheckIntervalTest {
        public void testSessionSlot() throws IOException {
                String url = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REST_URL);
                String get = SessionCommunicationService.getSessionSlotCheckInterval(url, "userName", "word", "uebKey");
-               Assert.assertTrue(get.equals(timeoutValue));
-               logger.info("Get test yields: " + get);
-               // Similar test via a different path
+               Assert.assertEquals(get,"");
+       }
+       @Test(expected = java.lang.NumberFormatException.class)
+       public void testSessionSlot1() throws IOException {
+               String url = PortalApiProperties.getProperty(PortalApiConstants.ECOMP_REST_URL);
                SessionCommInf sc = new PortalTimeoutHandler.SessionComm();
                Integer i = sc.fetchSessionSlotCheckInterval(url, "userName", "word", "uebKey");
                Assert.assertTrue(i.toString().equals(timeoutValue));
-               logger.info("Fetched slot-check interval: " + i);
        }
 
 }