summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-BE-os/src/test/java/org
diff options
context:
space:
mode:
author“Kruthi <krutbhat@att.com>2020-06-04 19:34:07 +0530
committer“Kruthi <krutbhat@att.com>2020-06-10 01:34:23 +0530
commit2bd47b537ff4fa78ae8f38758900022df6344cdb (patch)
tree793ee95cdaa550eb6fab92e5b52b0ac01170a702 /ecomp-portal-BE-os/src/test/java/org
parent30fde7dffdeb16add93ff772c8e2e212cb6850e8 (diff)
Resubmitting KeyProperty code change since tests failed
Change-Id: I14c0f9b59229e32de45b1652e64c01dd6c1d39e3 Issue-ID: PORTAL-914 Signed-off-by: krutbhat@att.com
Diffstat (limited to 'ecomp-portal-BE-os/src/test/java/org')
-rw-r--r--ecomp-portal-BE-os/src/test/java/org/onap/portalapp/portal/service/RemoteWebServiceCallServiceImplTest.java27
1 files changed, 15 insertions, 12 deletions
diff --git a/ecomp-portal-BE-os/src/test/java/org/onap/portalapp/portal/service/RemoteWebServiceCallServiceImplTest.java b/ecomp-portal-BE-os/src/test/java/org/onap/portalapp/portal/service/RemoteWebServiceCallServiceImplTest.java
index 5b7f7d45..1f346459 100644
--- a/ecomp-portal-BE-os/src/test/java/org/onap/portalapp/portal/service/RemoteWebServiceCallServiceImplTest.java
+++ b/ecomp-portal-BE-os/src/test/java/org/onap/portalapp/portal/service/RemoteWebServiceCallServiceImplTest.java
@@ -57,6 +57,8 @@ import org.onap.portalapp.portal.domain.EPApp;
import org.onap.portalapp.portal.framework.MockitoTestSuite;
import org.onap.portalapp.service.RemoteWebServiceCallServiceImpl;
import org.onap.portalsdk.core.onboarding.util.CipherUtil;
+import org.onap.portalsdk.core.onboarding.util.KeyConstants;
+import org.onap.portalsdk.core.onboarding.util.KeyProperties;
import org.onap.portalsdk.core.service.DataAccessService;
import org.onap.portalsdk.core.util.SystemProperties;
import org.powermock.api.mockito.PowerMockito;
@@ -64,7 +66,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class)
-@PrepareForTest({ CipherUtil.class , SystemProperties.class})
+@PrepareForTest({ CipherUtil.class , SystemProperties.class, KeyProperties.class, KeyConstants.class})
public class RemoteWebServiceCallServiceImplTest {
@@ -93,7 +95,8 @@ public class RemoteWebServiceCallServiceImplTest {
public void verifyRESTCredentialTest() throws Exception
{
PowerMockito.mockStatic(CipherUtil.class);
- PowerMockito.mockStatic(SystemProperties.class);
+ PowerMockito.mockStatic(KeyProperties.class);
+ PowerMockito.mockStatic(KeyConstants.class);
String criteria= " where ueb_key = 'requestUebKey'";
List<EPApp> appList = new ArrayList<>();
EPApp app = new EPApp();
@@ -101,9 +104,8 @@ public class RemoteWebServiceCallServiceImplTest {
appList.add(app);
Mockito.when(dataAccessService.getList(EPApp.class, criteria.toString(), null, null)).thenReturn(appList);
String secretKey = null;
- Mockito.when(SystemProperties.getProperty(SystemProperties.Decryption_Key)).thenReturn(secretKey);
- Mockito.when(CipherUtil.decryptPKC("password",
- secretKey == null ? null : secretKey)).thenReturn("pwd");
+ Mockito.when(KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY)).thenReturn(secretKey);
+ Mockito.when(CipherUtil.decryptPKC("password",secretKey == null ? null : secretKey)).thenReturn("pwd");
assertFalse(remoteWebServiceCallServiceImpl.verifyRESTCredential(secretKey,"requestUebKey","requestAppName","requestPassword"));
}
@@ -111,7 +113,8 @@ public class RemoteWebServiceCallServiceImplTest {
public void verifyRESTCredentialExceptionTest() throws Exception
{
PowerMockito.mockStatic(CipherUtil.class);
- PowerMockito.mockStatic(SystemProperties.class);
+ PowerMockito.mockStatic(KeyProperties.class);
+ PowerMockito.mockStatic(KeyConstants.class);
String criteria= " where ueb_key = 'requestUebKey'";
List<EPApp> appList = new ArrayList<>();
EPApp app = new EPApp();
@@ -120,9 +123,8 @@ public class RemoteWebServiceCallServiceImplTest {
appList.add(app);
Mockito.when(dataAccessService.getList(EPApp.class, criteria.toString(), null, null)).thenReturn(appList);
String secretKey = null;
- Mockito.when(SystemProperties.getProperty(SystemProperties.Decryption_Key)).thenReturn(secretKey);
- Mockito.when(CipherUtil.decryptPKC("password",
- secretKey == null ? null : secretKey)).thenReturn("pwd");
+ Mockito.when(KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY)).thenReturn(secretKey);
+ Mockito.when(CipherUtil.decryptPKC("password",secretKey == null ? null : secretKey)).thenReturn("pwd");
assertTrue(remoteWebServiceCallServiceImpl.verifyRESTCredential(secretKey,"requestUebKey","requestAppName","pwd"));
}
@@ -131,6 +133,8 @@ public class RemoteWebServiceCallServiceImplTest {
{
PowerMockito.mockStatic(CipherUtil.class);
PowerMockito.mockStatic(SystemProperties.class);
+ PowerMockito.mockStatic(KeyProperties.class);
+ PowerMockito.mockStatic(KeyConstants.class);
String criteria= " where ueb_key = 'requestUebKey'";
List<EPApp> appList = new ArrayList<>();
EPApp app = new EPApp();
@@ -139,9 +143,8 @@ public class RemoteWebServiceCallServiceImplTest {
appList.add(app);
Mockito.when(dataAccessService.getList(EPApp.class, criteria.toString(), null, null)).thenReturn(null);
String secretKey = null;
- Mockito.when(SystemProperties.getProperty(SystemProperties.Decryption_Key)).thenReturn(secretKey);
- Mockito.when(CipherUtil.decryptPKC("password",
- secretKey == null ? null : secretKey)).thenReturn("pwd");
+ Mockito.when(KeyProperties.getProperty(KeyConstants.CIPHER_ENCRYPTION_KEY)).thenReturn(secretKey);
+ Mockito.when(CipherUtil.decryptPKC("password",secretKey == null ? null : secretKey)).thenReturn("pwd");
assertFalse(remoteWebServiceCallServiceImpl.verifyRESTCredential(secretKey,"requestUebKey","requestAppName","pwd"));
}