diff options
author | 2019-09-09 18:02:15 +0000 | |
---|---|---|
committer | 2019-09-09 18:02:15 +0000 | |
commit | 42b399ea943940ef1e37c267a9aea03b5f01f2d0 (patch) | |
tree | a0897a9888ea2ba45102b79e76207e01adf0ca9f /asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java | |
parent | d9a8e5a77e5c7857225704d81189583d78c26d2f (diff) | |
parent | cf77e72ced2f815b3d011afcba17b91ae45d1858 (diff) |
Merge "Add SO Update Check if SDC activities deployment end point for custom worlflows is alive"
Diffstat (limited to 'asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java')
-rw-r--r-- | asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java index 81977da278..b41fbaf658 100644 --- a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java +++ b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java @@ -22,7 +22,10 @@ package org.onap.asdc.activity; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.putRequestedFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; +import static com.github.tomakehurst.wiremock.client.WireMock.verify; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.when; import org.junit.Test; @@ -73,4 +76,32 @@ public class DeployActivitySpecsITTest extends BaseTest { deployActivitySpecs.deployActivities(); assertTrue(activitySpecCreateResponse.getId().equals("testActivityId")); } + + @Test + public void deployActivitySpecsIT_SDCEndpointDown_Test() throws Exception { + ActivitySpecCreateResponse activitySpecCreateResponse = new ActivitySpecCreateResponse(); + activitySpecCreateResponse.setId("testActivityId"); + HttpHeaders headers = new HttpHeaders(); + headers.set("Accept", MediaType.APPLICATION_JSON); + headers.set("Content-Type", MediaType.APPLICATION_JSON); + + ObjectMapper mapper = new ObjectMapper(); + String body = mapper.writeValueAsString(activitySpecCreateResponse); + + wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.OK.value()).withBody(body))); + + when(env.getProperty("mso.asdc.config.activity.endpoint")).thenReturn("http://localhost:8090"); + + String urlPath = "/v1.0/activity-spec/testActivityId/versions/latest/actions"; + + wireMockServer.stubFor( + put(urlPathMatching(urlPath)).willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.OK.value()))); + + deployActivitySpecs.deployActivities(); + verify(0, putRequestedFor(urlEqualTo(urlPath))); + } + } |