use of org.onap.so.openstack.beans.StackInfo in project so by onap.
the class MsoHeatUtilsITTest method createStackSuccessTest.
@Test
public final void createStackSuccessTest() throws MsoException, IOException {
CloudSite cloudSite = getCloudSite(getCloudIdentity());
StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
StubOpenStack.mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack_Created.json");
StubOpenStack.mockOpenStackGet(wireMockServer, "TEST-stack/stackId");
StackInfo stackInfo = heatUtils.createStack(cloudSite.getId(), "CloudOwner", "tenantId", "TEST-stack", null, "TEST-heat", new HashMap<>(), false, 1, "TEST-env", new HashMap<>(), new HashMap<>(), false, false);
assertNotNull(stackInfo);
}
use of org.onap.so.openstack.beans.StackInfo in project so by onap.
the class MsoMulticloudUtilsTest method createStackSuccess.
@Test
public void createStackSuccess() throws MsoException, IOException {
wireMockServer.stubFor(post(urlEqualTo(MULTICLOUD_CREATE_PATH)).inScenario("CREATE").willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(CREATE_STACK_RESPONSE).withStatus(HttpStatus.SC_CREATED)).willSetStateTo("CREATING"));
wireMockServer.stubFor(get(urlPathEqualTo(MULTICLOUD_GET_PATH)).inScenario("CREATE").whenScenarioStateIs("CREATING").willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("MulticloudGetCreateResponse.json").withStatus(HttpStatus.SC_OK)));
wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_UPDATE_PATH)).inScenario("CREATE").willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(UPDATE_STACK_RESPONSE).withStatus(HttpStatus.SC_ACCEPTED)).willSetStateTo("UPDATING"));
wireMockServer.stubFor(get(urlEqualTo(MULTICLOUD_GET_PATH)).inScenario("CREATE").whenScenarioStateIs("UPDATING").willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("MulticloudGetUpdateResponse.json").withStatus(HttpStatus.SC_OK)));
StackInfo result = multicloudUtils.createStack("MTN14", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(), "TEST-heat", new HashMap<>(), true, 200, "TEST-env", new HashMap<>(), new HashMap<>(), false, false);
wireMockServer.resetScenarios();
assertNotNull(result);
assertEquals("TEST-stack", result.getName());
}
use of org.onap.so.openstack.beans.StackInfo in project so by onap.
the class MsoMulticloudUtilsTest method deleteStack.
@Test
public void deleteStack() throws MsoException {
wireMockServer.stubFor(delete(urlEqualTo(MULTICLOUD_DELETE_PATH)).willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NO_CONTENT)));
wireMockServer.stubFor(get(urlEqualTo(MULTICLOUD_GET_PATH)).willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("MulticloudGetDeleteResponse.json").withStatus(HttpStatus.SC_OK)));
StackInfo result = multicloudUtils.deleteStack("MTN14", "CloudOwner", "TEST-tenant", "TEST-stack/TEST-workload");
assertNotNull(result);
assertTrue(HeatStatus.NOTFOUND == result.getStatus());
}
use of org.onap.so.openstack.beans.StackInfo in project so by onap.
the class MsoMulticloudUtilsTest method queryStack.
@Test
public void queryStack() throws MsoException {
StackInfo result = multicloudUtils.queryStack("MTN13", "CloudOwner", "TEST-tenant", "instanceId");
assertTrue(HeatStatus.NOTFOUND == result.getStatus());
}
use of org.onap.so.openstack.beans.StackInfo in project so by onap.
the class MsoMulticloudUtilsTest method createStackEmptyResponseEntity.
@Test
public void createStackEmptyResponseEntity() throws MsoException {
wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_CREATE_PATH)).willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_CREATED).withBody("{}")));
StackInfo result = multicloudUtils.createStack("MTN14", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(), "TEST-heat", new HashMap<>(), false, 200, "TEST-env", new HashMap<>(), new HashMap<>(), false, false);
assertNotNull(result);
assertEquals("TEST-stack", result.getName());
}
Aggregations