use of com.woorea.openstack.heat.model.Stack in project so by onap.
the class MsoHeatUtilsTest method postProcessStackDelete_Stack_Test.
@Test
public final void postProcessStackDelete_Stack_Test() throws MsoException, IOException {
Stack deletedStack = new Stack();
deletedStack.setId("id");
deletedStack.setStackName("stackName");
deletedStack.setStackStatus("DELETE_FAILED");
deletedStack.setStackStatusReason("Stack DID NOT DELETE");
exceptionRule.expect(StackRollbackException.class);
exceptionRule.expectMessage("Stack Deletion completed with status: DELETE_FAILED Status Reason: Stack DID NOT DELETE");
heatUtils.postProcessStackDelete(deletedStack);
}
use of com.woorea.openstack.heat.model.Stack in project so by onap.
the class MsoHeatUtilsTest method handleUnknownCreateStackFailure_Null_Stack_Test.
@Test
public final void handleUnknownCreateStackFailure_Null_Stack_Test() throws MsoException, IOException {
Stack stack = null;
exceptionRule.expect(StackCreationException.class);
exceptionRule.expectMessage("Cannot Find Stack Name or Id");
heatUtils.handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
}
use of com.woorea.openstack.heat.model.Stack in project so by onap.
the class MsoHeatUtilsWithUpdateTest method updateStackWithEnvironmentTest.
@Test
public void updateStackWithEnvironmentTest() throws JsonParseException, JsonMappingException, IOException, MsoException {
String environmentString = "environmentString";
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);
assertThat(actualStackInfo, sameBeanAs(expectedStackInfo));
}
use of com.woorea.openstack.heat.model.Stack in project so by onap.
the class StackStatusHandlerTest method recordExists_Test.
@Test
public final void recordExists_Test() throws MsoException, IOException {
RequestProcessingData requestProcessingData = new RequestProcessingData();
requestProcessingData.setValue("testMe");
String requestId = getRequestId();
doReturn(requestProcessingData).when(requestDBClient).getRequestProcessingDataBySoRequestIdAndNameAndGrouping(requestId, "stackName", "id");
Stack latestStack = new Stack();
latestStack.setId("id");
latestStack.setStackName("stackName");
latestStack.setStackStatus("CREATE_COMPLETE");
latestStack.setStackStatusReason("Stack Finished");
statusHandler.updateStackStatus(latestStack, requestId);
Mockito.verify(requestDBClient, times(1)).updateRequestProcessingData(requestProcessingData);
assertNotEquals("testMe", requestProcessingData.getValue());
}
use of com.woorea.openstack.heat.model.Stack in project so by onap.
the class StackStatusHandlerTest method record_Not_Exists_Test.
@Test
public final void record_Not_Exists_Test() throws MsoException, IOException {
String requestId = getRequestId();
ArgumentCaptor<RequestProcessingData> requestCaptor = ArgumentCaptor.forClass(RequestProcessingData.class);
doReturn(null).when(requestDBClient).getRequestProcessingDataBySoRequestIdAndNameAndGrouping(requestId, "stackName", "id");
Stack latestStack = new Stack();
latestStack.setId("id");
latestStack.setStackName("stackName");
latestStack.setStackStatus("CREATE_COMPLETE");
latestStack.setStackStatusReason("Stack Finished");
statusHandler.updateStackStatus(latestStack, requestId);
Mockito.verify(requestDBClient, times(1)).saveRequestProcessingData(requestCaptor.capture());
RequestProcessingData actualRequest = requestCaptor.getValue();
assertEquals("id", actualRequest.getGroupingId());
assertEquals("StackInformation", actualRequest.getTag());
assertEquals("stackName", actualRequest.getName());
assertNotNull(actualRequest.getValue());
}
Aggregations