use of org.onap.so.openstack.beans.StackInfo in project so by onap.
the class MsoHeatUtilsWithUpdateTest method updateStackWithFilesTest.
@Test
public void updateStackWithFilesTest() throws MsoException, JsonParseException, JsonMappingException, IOException {
String environmentString = "environmentString";
Map<String, Object> files = new HashMap<>();
files.put("file1", new Object());
CloudSite cloudSite = new CloudSite();
Heat heatClient = new Heat("endpoint");
Stack heatStack = mapper.readValue(new File(RESOURCE_PATH + "HeatStack.json"), Stack.class);
Stack updateStack = mapper.readValue(new File(RESOURCE_PATH + "UpdateStack.json"), Stack.class);
StackInfo expectedStackInfo = new StackInfo("stackName", HeatStatus.UPDATED, "stackStatusReason", null);
expectedStackInfo.setCanonicalName("stackName/id");
doReturn(heatClient).when(heatUtils).getHeatClient(isA(String.class), isA(String.class));
doReturn(null).when(heatUtils).executeAndRecordOpenstackRequest(isA(OpenStackRequest.class));
doReturn("0").when(environment).getProperty(isA(String.class), isA(String.class));
doReturn(updateStack).when(heatUtils).queryHeatStack(isA(Heat.class), isA(String.class));
StackInfo actualStackInfo = heatUtils.updateStack(cloudSiteId, cloudOwner, tenantId, stackName, heatTemplate, stackInputs, pollForCompletion, timeoutMinutes, environmentString, files);
assertThat(actualStackInfo, sameBeanAs(expectedStackInfo));
}
use of org.onap.so.openstack.beans.StackInfo in project so by onap.
the class MsoHeatUtilsWithUpdateTest method updateStackTest.
@Test
public void updateStackTest() throws MsoException, JsonParseException, JsonMappingException, IOException {
CloudSite cloudSite = new CloudSite();
Heat heatClient = new Heat("endpoint");
Stack heatStack = mapper.readValue(new File(RESOURCE_PATH + "HeatStack.json"), Stack.class);
Stack updateStack = mapper.readValue(new File(RESOURCE_PATH + "UpdateStack.json"), Stack.class);
StackInfo expectedStackInfo = new StackInfo("stackName", HeatStatus.UPDATED, "stackStatusReason", null);
expectedStackInfo.setCanonicalName("stackName/id");
doReturn(heatClient).when(heatUtils).getHeatClient(isA(String.class), isA(String.class));
doReturn(null).when(heatUtils).executeAndRecordOpenstackRequest(isA(OpenStackRequest.class));
doReturn("0").when(environment).getProperty(isA(String.class), isA(String.class));
doReturn(updateStack).when(heatUtils).queryHeatStack(isA(Heat.class), isA(String.class));
StackInfo actualStackInfo = heatUtils.updateStack(cloudSiteId, cloudOwner, tenantId, stackName, heatTemplate, stackInputs, pollForCompletion, timeoutMinutes);
assertThat(actualStackInfo, sameBeanAs(expectedStackInfo));
}
use of org.onap.so.openstack.beans.StackInfo in project so by onap.
the class MsoMulticloudUtilsTest method queryStackWithNullMulticloudQueryBody.
@Test
public void queryStackWithNullMulticloudQueryBody() throws MsoException {
wireMockServer.stubFor(get(urlPathEqualTo("/api/multicloud/v1/CloudOwner/MTN13/infra_workload/instanceId")).willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(CREATE_STACK_RESPONSE).withStatus(HttpStatus.SC_OK)));
StackInfo result = multicloudUtils.queryStack("MTN13", "CloudOwner", "TEST-tenant", "instanceName/instanceId");
assertTrue(HeatStatus.FAILED == result.getStatus());
assertEquals(MULTICLOUD_QUERY_BODY_NULL, result.getStatusMessage());
}
Aggregations