summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/test/java/org
diff options
context:
space:
mode:
authorKrzysztof Gajewski <krzysztof.gajewski@nokia.com>2020-07-29 12:54:01 +0200
committerKrzysztof Gajewski <krzysztof.gajewski@nokia.com>2020-07-29 17:51:25 +0200
commit15edb7791ddb8cc75421274fab812558219ddaf7 (patch)
treeba412f8f325db8eb95831b4d1dfafdcbae11b11e /mso-api-handlers/mso-api-handler-infra/src/test/java/org
parent852b16f2d60356becf222d2360ac85c977601b8c (diff)
Bug fix - SO GR Api sends wrong reposnse after service instantiation
Issue-ID: SO-2836 Signed-off-by: Krzysztof Gajewski <krzysztof.gajewski@nokia.com> Change-Id: Ib37b7972a939cd353a6cbb0370aed126534315d4
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/test/java/org')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandlerTest.java11
4 files changed, 20 insertions, 2 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java
index 5da16f4326..0ca98883c9 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java
@@ -70,6 +70,10 @@ public abstract class BaseTest {
return "http://localhost:" + port + uri;
}
+ protected String createURLWithPort(String uri, String orchestrationPath) {
+ return "http://localhost:" + port + orchestrationPath + uri;
+ }
+
protected String createURLWithPort(String uri, int iPort) {
return "http://localhost:" + iPort + uri;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java
index 33ed5fa700..7b2e502892 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java
@@ -71,6 +71,7 @@ public class InstanceManagementTest extends BaseTest {
private String wiremockPort;
private final String instanceManagementUri = "/onap/so/infra/instanceManagement/";
+ private final String orchestration_path = "/onap/so/infra";
private String uri;
private URL selfLink;
@@ -92,7 +93,7 @@ public class InstanceManagementTest extends BaseTest {
headers.set(ONAP_PARTNER_NAME, "VID");
headers.set(REQUESTOR_ID, "xxxxxx");
try { // generate one-time port number to avoid RANDOM port number later.
- initialUrl = new URL(createURLWithPort(Constants.ORCHESTRATION_REQUESTS_PATH));
+ initialUrl = new URL(createURLWithPort(Constants.ORCHESTRATION_REQUESTS_PATH, orchestration_path));
initialPort = initialUrl.getPort();
} catch (MalformedURLException e) {
e.printStackTrace();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
index ef90b22b01..1910b54067 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
@@ -97,6 +97,8 @@ public class ServiceInstancesTest extends BaseTest {
private final String servInstanceuri = "/onap/so/infra/serviceInstantiation/";
private final String servInstanceUriPrev7 = "/onap/so/infra/serviceInstances/";
+ private final String orchestration_path = "/onap/so/infra";
+
private String uri;
private URL selfLink;
private URL initialUrl;
@@ -115,7 +117,7 @@ public class ServiceInstancesTest extends BaseTest {
headers.set(ONAP_PARTNER_NAME, "VID");
headers.set(REQUESTOR_ID, "xxxxxx");
try { // generate one-time port number to avoid RANDOM port number later.
- initialUrl = new URL(createURLWithPort(Constants.ORCHESTRATION_REQUESTS_PATH));
+ initialUrl = new URL(createURLWithPort(Constants.ORCHESTRATION_REQUESTS_PATH, orchestration_path));
initialPort = initialUrl.getPort();
} catch (MalformedURLException e) {
e.printStackTrace();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandlerTest.java
index d39192cdf0..6c643c77d7 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandlerTest.java
@@ -61,4 +61,15 @@ public class AbstractRestHandlerTest {
restHandler.createResponse("instanceId", "requestId", mockRequestContext);
assertThat(actualResponse, sameBeanAs(expectedResponse));
}
+
+ @Test
+ public void test_buildSelfLinkUrl() throws MalformedURLException {
+ String initialLink = "http://some.domain.com:30277/onap/so/infra/serviceInstantiation/v7/serviceInstances";
+ String requestId = "4d0437c3-ee48-4361-a4f7-e1613c82493a";
+ Optional<URL> expectedLink = Optional.of(new URL(
+ "http://some.domain.com:30277/onap/so/infra/orchestrationRequests/v7/4d0437c3-ee48-4361-a4f7-e1613c82493a"));
+ Optional<URL> resultURL = restHandler.buildSelfLinkUrl(initialLink, requestId);
+
+ assertThat(resultURL, sameBeanAs(expectedLink));
+ }
}