diff options
author | Lott, Christopher (cl778h) <cl778h@att.com> | 2019-07-29 11:41:36 -0400 |
---|---|---|
committer | Lott, Christopher (cl778h) <cl778h@att.com> | 2019-07-30 13:35:33 -0400 |
commit | 19087734d0cd4d7e7c892490a795b01e93ba00d0 (patch) | |
tree | dc18fcd42374b9c74098b09f20ca99245b13bad5 /ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding | |
parent | 69d4e12be832b560ed5ee1bb84a4ab3b0855310f (diff) |
Publish fixed strings as public constants
Change-Id: I47c8458a0f16251ef19043eb63cf5f392990efdf
Issue-ID: PORTAL-657
Signed-off-by: Lott, Christopher (cl778h) <cl778h@att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding')
2 files changed, 14 insertions, 13 deletions
diff --git a/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPIProxyTest.java b/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPIProxyTest.java index 897f84a1..35b8bf4d 100644 --- a/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPIProxyTest.java +++ b/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPIProxyTest.java @@ -138,7 +138,7 @@ public class PortalRestAPIProxyTest { @Test public void testDoPost_WhenRequestForStoreAnalytics() throws Exception { Mockito.when(portalRestAPICentralServiceImpl.getUserId(request)).thenReturn("test"); - Mockito.when(portalRestAPICentralServiceImpl.getCredentials()).thenReturn(new HashMap(){{put("username","test");put("password","test");}}); + Mockito.when(portalRestAPICentralServiceImpl.getCredentials()).thenReturn(new HashMap(){{put(IPortalRestCentralService.CREDENTIALS_USER,"test");put(IPortalRestCentralService.CREDENTIALS_PASS,"test");}}); Mockito.when(request.getRequestURI()).thenReturn(PortalApiConstants.API_PREFIX+"/storeAnalytics"); doPost.invoke(portalRestAPIProxyObj, new Object[] {request, response}); } @@ -228,7 +228,7 @@ public class PortalRestAPIProxyTest { @Test public void testDoGet_WhenRequestForAnalytics() throws Exception { Mockito.when(portalRestAPICentralServiceImpl.getUserId(request)).thenReturn("test"); - Mockito.when(portalRestAPICentralServiceImpl.getCredentials()).thenReturn(new HashMap(){{put("username","test");put("password","test");}}); + Mockito.when(portalRestAPICentralServiceImpl.getCredentials()).thenReturn(new HashMap(){{put(IPortalRestCentralService.CREDENTIALS_USER,"test");put(IPortalRestCentralService.CREDENTIALS_PASS,"test");}}); Mockito.when(request.getRequestURI()).thenReturn(PortalApiConstants.API_PREFIX+"/analytics"); doGet.invoke(portalRestAPIProxyObj, new Object[] {request, response}); } diff --git a/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/util/AuthUtilTest.java b/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/util/AuthUtilTest.java index 00745922..ec3135f1 100644 --- a/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/util/AuthUtilTest.java +++ b/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/util/AuthUtilTest.java @@ -48,6 +48,7 @@ import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mockito; import org.onap.aaf.cadi.CadiWrap; +import org.onap.portalsdk.core.onboarding.crossapi.IPortalRestCentralService; import org.onap.portalsdk.core.onboarding.exception.PortalAPIException; public class AuthUtilTest { @@ -77,29 +78,29 @@ public class AuthUtilTest { @Test(expected = PortalAPIException.class) public void isAccessAllowedExceptionTest() throws PortalAPIException { Map<String, String> appCreds = new HashMap<>(); - appCreds.put("username", "test"); - appCreds.put("password", "test1"); + appCreds.put(IPortalRestCentralService.CREDENTIALS_USER, "test"); + appCreds.put(IPortalRestCentralService.CREDENTIALS_PASS, "test1"); AuthUtil.isAccessAllowed(request, "com.test", appCreds); } @Test public void isAccessAllowedTest() throws PortalAPIException { - Mockito.when(request.getHeader("username")).thenReturn("test"); - Mockito.when(request.getHeader("password")).thenReturn("test1"); + Mockito.when(request.getHeader(IPortalRestCentralService.CREDENTIALS_USER)).thenReturn("test"); + Mockito.when(request.getHeader(IPortalRestCentralService.CREDENTIALS_PASS)).thenReturn("test1"); Map<String, String> appCreds = new HashMap<>(); - appCreds.put("username", "test"); - appCreds.put("password", "test1"); + appCreds.put(IPortalRestCentralService.CREDENTIALS_USER, "test"); + appCreds.put(IPortalRestCentralService.CREDENTIALS_PASS, "test1"); assertTrue(AuthUtil.isAccessAllowed(request, "com.test", appCreds)); } @Test public void isAccessAllowedFalseTest() throws PortalAPIException { - Mockito.when(request.getHeader("username")).thenReturn("test"); - Mockito.when(request.getHeader("password")).thenReturn("test1"); + Mockito.when(request.getHeader(IPortalRestCentralService.CREDENTIALS_USER)).thenReturn("test"); + Mockito.when(request.getHeader(IPortalRestCentralService.CREDENTIALS_PASS)).thenReturn("test1"); Map<String, String> appCreds = new HashMap<>(); - appCreds.put("username", "test"); - appCreds.put("password", "test123"); - appCreds.put("appName", "testApp"); + appCreds.put(IPortalRestCentralService.CREDENTIALS_USER, "test"); + appCreds.put(IPortalRestCentralService.CREDENTIALS_PASS, "test123"); + appCreds.put(IPortalRestCentralService.CREDENTIALS_APP, "testApp"); assertFalse(AuthUtil.isAccessAllowed(request, "com.test", appCreds)); } |