Search in sources :

Example 41 with Stack

use of com.woorea.openstack.heat.model.Stack 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));
}
Also used : Heat(com.woorea.openstack.heat.Heat) CloudSite(org.onap.so.db.catalog.beans.CloudSite) OpenStackRequest(com.woorea.openstack.base.client.OpenStackRequest) File(java.io.File) StackInfo(org.onap.so.openstack.beans.StackInfo) Stack(com.woorea.openstack.heat.model.Stack) Test(org.junit.Test)

Aggregations

Stack (com.woorea.openstack.heat.model.Stack)41 Test (org.junit.Test)26 CreateStack (com.woorea.openstack.heat.StackResource.CreateStack)15 DeleteStack (com.woorea.openstack.heat.StackResource.DeleteStack)15 CreateStackParam (com.woorea.openstack.heat.model.CreateStackParam)10 Heat (com.woorea.openstack.heat.Heat)9 StackInfo (org.onap.so.openstack.beans.StackInfo)9 StackInfoMapper (org.onap.so.openstack.mappers.StackInfoMapper)7 MsoException (org.onap.so.openstack.exceptions.MsoException)5 OpenStackRequest (com.woorea.openstack.base.client.OpenStackRequest)3 File (java.io.File)3 HashMap (java.util.HashMap)3 CloudSite (org.onap.so.db.catalog.beans.CloudSite)3 MsoOpenstackException (org.onap.so.openstack.exceptions.MsoOpenstackException)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 RequestProcessingData (org.onap.so.db.request.beans.RequestProcessingData)2 TypeReference (com.fasterxml.jackson.core.type.TypeReference)1 OpenStackBaseException (com.woorea.openstack.base.client.OpenStackBaseException)1 OpenStackConnectException (com.woorea.openstack.base.client.OpenStackConnectException)1 OpenStackResponseException (com.woorea.openstack.base.client.OpenStackResponseException)1