diff options
Diffstat (limited to 'ecomp-sdk/epsdk-app-common')
3 files changed, 72 insertions, 10 deletions
diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/LogoutControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/LogoutControllerTest.java index a6ffb038..8883cfa8 100644 --- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/LogoutControllerTest.java +++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/LogoutControllerTest.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 @@ -108,7 +108,7 @@ public class LogoutControllerTest { ServletRequestAttributes ServletRequestAttributes = new ServletRequestAttributes(mockedRequest); Mockito.when(RequestContextHolder.currentRequestAttributes()).thenReturn(ServletRequestAttributes); Mockito.when(PortalApiProperties - .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp"); + .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm"); logoutController.globalLogout(mockedRequest); } @@ -117,20 +117,20 @@ public class LogoutControllerTest { PowerMockito.mockStatic(PortalApiProperties.class); PowerMockito.mockStatic(PortalApiConstants.class); Mockito.when(PortalApiProperties - .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp"); + .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm"); assertNull(logoutController.globalLogout(mockedRequest)); } @Test public void appLogoutTest(){ - ModelAndView actualModelView = new ModelAndView("redirect:https://portal.openecomp.org/ecompportal/process_csp"); + ModelAndView actualModelView = new ModelAndView("redirect:http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm"); PowerMockito.mockStatic(PortalApiProperties.class); PowerMockito.mockStatic(PortalApiConstants.class); PowerMockito.mockStatic(RequestContextHolder.class); ServletRequestAttributes ServletRequestAttributes = new ServletRequestAttributes(mockedRequest); Mockito.when(RequestContextHolder.currentRequestAttributes()).thenReturn(ServletRequestAttributes); Mockito.when(PortalApiProperties - .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp"); + .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm"); ModelAndView expectedModelView = logoutController.appLogout(mockedRequest); assertEquals(actualModelView.getViewName(), expectedModelView.getViewName()); } @@ -140,7 +140,7 @@ public class LogoutControllerTest { PowerMockito.mockStatic(PortalApiProperties.class); PowerMockito.mockStatic(PortalApiConstants.class); Mockito.when(PortalApiProperties - .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp"); + .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm"); assertNull(logoutController.appLogout(mockedRequest)); } diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/MenuListControllerTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/MenuListControllerTest.java index 2d6c0cd1..cc935b38 100644 --- a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/MenuListControllerTest.java +++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/controller/core/MenuListControllerTest.java @@ -193,7 +193,7 @@ public class MenuListControllerTest { Mockito.when(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME)).thenReturn("user"); Mockito.when(session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME))).thenReturn(user); Mockito.when(PortalApiProperties - .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp"); + .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm"); StringWriter sw = new StringWriter(); PrintWriter writer = new PrintWriter(sw); Mockito.when(mockedResponse.getWriter()).thenReturn(writer); @@ -206,7 +206,7 @@ public class MenuListControllerTest { PowerMockito.mockStatic(PortalApiConstants.class); Mockito.when(mockedRequest.getParameter("page")).thenReturn("contact"); Mockito.when(PortalApiProperties - .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp"); + .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm"); StringWriter sw = new StringWriter(); PrintWriter writer = new PrintWriter(sw); Mockito.when(mockedResponse.getWriter()).thenReturn(writer); @@ -219,7 +219,7 @@ public class MenuListControllerTest { PowerMockito.mockStatic(PortalApiConstants.class); Mockito.when(mockedRequest.getParameter("page")).thenReturn("access"); Mockito.when(PortalApiProperties - .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp"); + .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm"); StringWriter sw = new StringWriter(); PrintWriter writer = new PrintWriter(sw); Mockito.when(mockedResponse.getWriter()).thenReturn(writer); @@ -231,7 +231,7 @@ public class MenuListControllerTest { PowerMockito.mockStatic(PortalApiProperties.class); PowerMockito.mockStatic(PortalApiConstants.class); Mockito.when(PortalApiProperties - .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("https://portal.openecomp.org/ecompportal/process_csp"); + .getProperty(PortalApiConstants.ECOMP_REDIRECT_URL)).thenReturn("http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm"); StringWriter sw = new StringWriter(); PrintWriter writer = new PrintWriter(sw); Mockito.when(mockedResponse.getWriter()).thenReturn(writer); diff --git a/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/model/ResultTest.java b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/model/ResultTest.java new file mode 100644 index 00000000..e1e298a8 --- /dev/null +++ b/ecomp-sdk/epsdk-app-common/src/test/java/org/onap/portalapp/model/ResultTest.java @@ -0,0 +1,62 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2018 IBM Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portalapp.model; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.Before; + +public class ResultTest { + + private Result result; + + @Before + public void setUp() + { + result = new Result("Success"); + } + + @Test + public void testGetSetResult() + { + result.setResult("failure"); + assertEquals("failure", result.getResult()); + } +} |