summaryrefslogtreecommitdiffstats
path: root/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/core/TestMsbApiProvider.java
diff options
context:
space:
mode:
Diffstat (limited to 'nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/core/TestMsbApiProvider.java')
-rw-r--r--nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/core/TestMsbApiProvider.java51
1 files changed, 51 insertions, 0 deletions
diff --git a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/core/TestMsbApiProvider.java b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/core/TestMsbApiProvider.java
index e6d8ebb4..aefe63a2 100644
--- a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/core/TestMsbApiProvider.java
+++ b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/core/TestMsbApiProvider.java
@@ -119,6 +119,57 @@ public class TestMsbApiProvider extends TestBase {
assertEquals("http://1.2.3.4:234/lead/nslcm/v1", msbApiProvider.getMicroServiceUrl("serviceName", "v1"));
}
+
+ /**
+ * use HTTPS for known ports (443) should be removed if https://jira.onap.org/browse/MSB-151 is solved
+ */
+ @Test
+ public void testMsb151IssueHack() throws Exception {
+ NodeInfo nonDocker = new NodeInfo();
+ nonDocker.setIp("173.1.2.3");
+ nonDocker.setPort("443");
+ microServiceInfo.setServiceName("serviceName");
+ microServiceInfo.setVersion("v1");
+ microServiceInfo.setUrl("/lead/nslcm/v1");
+ when(environment.getProperty(IpMappingProvider.IP_MAP, String.class, "")).thenReturn("173.1.2.3->1.2.3.4");
+ nodes.add(nonDocker);
+ msbApiProvider = new MsbApiProvider(environment) {
+ @Override
+ public MSBServiceClient getMsbClient() {
+ return msbClient;
+ }
+ };
+ when(msbClient.queryMicroServiceInfo("serviceName", "v1")).thenReturn(microServiceInfo);
+ msbApiProvider.afterPropertiesSet();
+ //when
+ assertEquals("https://1.2.3.4:443/lead/nslcm/v1", msbApiProvider.getMicroServiceUrl("serviceName", "v1"));
+ }
+
+ /**
+ * use HTTPS for known ports (443) should be removed if https://jira.onap.org/browse/MSB-151 is solved
+ */
+ @Test
+ public void testMsb151IssueHack2() throws Exception {
+ NodeInfo nonDocker = new NodeInfo();
+ nonDocker.setIp("173.1.2.3");
+ nonDocker.setPort("8443");
+ microServiceInfo.setServiceName("serviceName");
+ microServiceInfo.setVersion("v1");
+ microServiceInfo.setUrl("/lead/nslcm/v1");
+ when(environment.getProperty(IpMappingProvider.IP_MAP, String.class, "")).thenReturn("173.1.2.3->1.2.3.4");
+ nodes.add(nonDocker);
+ msbApiProvider = new MsbApiProvider(environment) {
+ @Override
+ public MSBServiceClient getMsbClient() {
+ return msbClient;
+ }
+ };
+ when(msbClient.queryMicroServiceInfo("serviceName", "v1")).thenReturn(microServiceInfo);
+ msbApiProvider.afterPropertiesSet();
+ //when
+ assertEquals("https://1.2.3.4:8443/lead/nslcm/v1", msbApiProvider.getMicroServiceUrl("serviceName", "v1"));
+ }
+
/**
* if unable to get micro service info the error is propagated
*/