Search in sources :

Example 1 with CreateStack

use of com.woorea.openstack.heat.StackResource.CreateStack in project so by onap.

the class MsoHeatUtilsTest method handleKeyPairConflict_Test.

@Test
public final void handleKeyPairConflict_Test() throws MsoException, IOException, NovaClientException {
    Stack stack = new Stack();
    stack.setId("id");
    stack.setStackName("stackName");
    stack.setStackStatus("CREATE_FAILED");
    stack.setStackStatusReason("Resource CREATE failed: Conflict: resources.my_keypair: Key pair 'hst3bbfnm0011vm001' already exists. (HTTP 409) (Request-ID: req-941b0af6-63ae-4d6a-afbc-90b728bacf82");
    Stack createdStack = new Stack();
    createdStack.setId("id");
    createdStack.setStackName("stackName");
    createdStack.setStackStatus("CREATE_COMPLETE");
    createdStack.setStackStatusReason("Stack Created");
    CreateStackParam createStackParam = new CreateStackParam();
    createStackParam.setStackName("stackName");
    doReturn(null).when(heatUtils).handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
    doReturn(createdStack).when(heatUtils).createStack(createStackParam, cloudSiteId, tenantId);
    doReturn(createdStack).when(heatUtils).processCreateStack(cloudSiteId, tenantId, 120, true, createdStack, createStackParam, false);
    heatUtils.handleKeyPairConflict(cloudSiteId, tenantId, createStackParam, 120, true, stack);
    Mockito.verify(novaClient, times(1)).deleteKeyPair(cloudSiteId, tenantId, "hst3bbfnm0011vm001");
    Mockito.verify(heatUtils, times(1)).handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
    Mockito.verify(heatUtils, times(1)).createStack(createStackParam, cloudSiteId, tenantId);
    Mockito.verify(heatUtils, times(1)).processCreateStack(cloudSiteId, tenantId, 120, true, createdStack, createStackParam, false);
}
Also used : CreateStackParam(com.woorea.openstack.heat.model.CreateStackParam) Stack(com.woorea.openstack.heat.model.Stack) CreateStack(com.woorea.openstack.heat.StackResource.CreateStack) DeleteStack(com.woorea.openstack.heat.StackResource.DeleteStack) Test(org.junit.Test)

Aggregations

CreateStack (com.woorea.openstack.heat.StackResource.CreateStack)1 DeleteStack (com.woorea.openstack.heat.StackResource.DeleteStack)1 CreateStackParam (com.woorea.openstack.heat.model.CreateStackParam)1 Stack (com.woorea.openstack.heat.model.Stack)1 Test (org.junit.Test)1