diff options
author | Lukasz Muszkieta <lukasz.muszkieta@nokia.com> | 2020-07-30 15:24:48 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-07-30 15:24:48 +0000 |
commit | bcda6a5963d2c59f6c41d649a1636289c5eda0f9 (patch) | |
tree | 05853a8dfb4c1ed0578026beb6635da7f26108b1 /mso-api-handlers/mso-api-handler-infra/src/test/java | |
parent | 2bfa3106bdf29f55460cf43f76c22c442988b047 (diff) | |
parent | 15edb7791ddb8cc75421274fab812558219ddaf7 (diff) |
Merge "Bug fix - SO GR Api sends wrong reposnse after service instantiation"
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/test/java')
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)); + } } |