Search in sources :

Example 1 with RainyDayHandlerStatus

use of org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus in project so by onap.

the class ExecuteBuildingBlockRainyDayTest method queryRainyDayTableRollbackToCreated.

@Test
public void queryRainyDayTableRollbackToCreated() throws Exception {
    customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
    serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
    vnf.setVnfType("vnft1");
    delegateExecution.setVariable("aLaCarte", true);
    delegateExecution.setVariable("suppressRollback", false);
    delegateExecution.setVariable("WorkflowExceptionCode", "7000");
    RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus();
    rainyDayHandlerStatus.setErrorCode("7000");
    rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB");
    rainyDayHandlerStatus.setServiceType("st1");
    rainyDayHandlerStatus.setVnfType("vnft1");
    rainyDayHandlerStatus.setPolicy("RollbackToCreated");
    rainyDayHandlerStatus.setWorkStep(ASTERISK);
    rainyDayHandlerStatus.setSecondaryPolicy("Abort");
    doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB", "st1", "vnft1", "7000", "*", "errorMessage", "*");
    executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
    assertEquals("RollbackToCreated", delegateExecution.getVariable("handlingCode"));
    assertEquals(Status.ROLLED_BACK_TO_CREATED.toString(), delegateExecution.getVariable("rollbackTargetState"));
}
Also used : RainyDayHandlerStatus(org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus) Test(org.junit.Test) BaseTest(org.onap.so.BaseTest)

Example 2 with RainyDayHandlerStatus

use of org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus in project so by onap.

the class ExecuteBuildingBlockRainyDayTest method queryRainyDayTableExists.

@Test
public void queryRainyDayTableExists() throws Exception {
    customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
    serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
    vnf.setVnfType("vnft1");
    delegateExecution.setVariable("aLaCarte", true);
    delegateExecution.setVariable("suppressRollback", false);
    delegateExecution.setVariable("WorkflowExceptionCode", "7000");
    RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus();
    rainyDayHandlerStatus.setErrorCode("7000");
    rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB");
    rainyDayHandlerStatus.setServiceType("st1");
    rainyDayHandlerStatus.setVnfType("vnft1");
    rainyDayHandlerStatus.setPolicy("Rollback");
    rainyDayHandlerStatus.setWorkStep(ASTERISK);
    doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB", "st1", "vnft1", "7000", "*", "errorMessage", "*");
    executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
    assertEquals("Rollback", delegateExecution.getVariable("handlingCode"));
}
Also used : RainyDayHandlerStatus(org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus) Test(org.junit.Test) BaseTest(org.onap.so.BaseTest)

Example 3 with RainyDayHandlerStatus

use of org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus in project so by onap.

the class ExecuteBuildingBlockRainyDayTest method queryRainyDayTableSecondaryPolicyExists.

@Test
public void queryRainyDayTableSecondaryPolicyExists() throws Exception {
    customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
    serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
    vnf.setVnfType("vnft1");
    delegateExecution.setVariable("aLaCarte", true);
    delegateExecution.setVariable("suppressRollback", false);
    delegateExecution.setVariable("WorkflowExceptionCode", "7000");
    RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus();
    rainyDayHandlerStatus.setErrorCode("7000");
    rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB");
    rainyDayHandlerStatus.setServiceType("st1");
    rainyDayHandlerStatus.setVnfType("vnft1");
    rainyDayHandlerStatus.setPolicy("Retry");
    rainyDayHandlerStatus.setWorkStep(ASTERISK);
    rainyDayHandlerStatus.setSecondaryPolicy("Abort");
    doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB", "st1", "vnft1", "7000", "*", "errorMessage", "*");
    executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, false);
    assertEquals("Abort", delegateExecution.getVariable("handlingCode"));
}
Also used : RainyDayHandlerStatus(org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus) Test(org.junit.Test) BaseTest(org.onap.so.BaseTest)

Example 4 with RainyDayHandlerStatus

use of org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus in project so by onap.

the class ExecuteBuildingBlockRainyDayTest method queryRainyDayTableDefault.

@Test
public void queryRainyDayTableDefault() throws Exception {
    customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
    serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
    vnf.setVnfType("vnft1");
    delegateExecution.setVariable("aLaCarte", true);
    delegateExecution.setVariable("suppressRollback", false);
    delegateExecution.setVariable("WorkflowExceptionCode", ASTERISK);
    RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus();
    rainyDayHandlerStatus.setErrorCode(ASTERISK);
    rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB");
    rainyDayHandlerStatus.setServiceType(ASTERISK);
    rainyDayHandlerStatus.setVnfType(ASTERISK);
    rainyDayHandlerStatus.setPolicy("Rollback");
    rainyDayHandlerStatus.setWorkStep(ASTERISK);
    doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB", "st1", "vnft1", ASTERISK, ASTERISK, "errorMessage", "*");
    executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
    assertEquals("Rollback", delegateExecution.getVariable("handlingCode"));
    assertEquals(5, delegateExecution.getVariable("maxRetries"));
}
Also used : RainyDayHandlerStatus(org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus) Test(org.junit.Test) BaseTest(org.onap.so.BaseTest)

Example 5 with RainyDayHandlerStatus

use of org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus in project so by onap.

the class ExecuteBuildingBlockRainyDayTest method queryRainyDayTableRollbackToAssignedALaCarte.

@Test
public void queryRainyDayTableRollbackToAssignedALaCarte() throws Exception {
    customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
    serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
    vnf.setVnfType("vnft1");
    delegateExecution.setVariable("aLaCarte", true);
    delegateExecution.setVariable("suppressRollback", false);
    delegateExecution.setVariable("WorkflowExceptionCode", "7000");
    RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus();
    rainyDayHandlerStatus.setErrorCode("7000");
    rainyDayHandlerStatus.setFlowName("AssignServiceInstanceBB");
    rainyDayHandlerStatus.setServiceType("st1");
    rainyDayHandlerStatus.setVnfType("vnft1");
    rainyDayHandlerStatus.setPolicy("RollbackToAssigned");
    rainyDayHandlerStatus.setWorkStep(ASTERISK);
    rainyDayHandlerStatus.setSecondaryPolicy("Abort");
    doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AssignServiceInstanceBB", "st1", "vnft1", "7000", "*", "errorMessage", "*");
    executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
    assertEquals("RollbackToAssigned", delegateExecution.getVariable("handlingCode"));
    assertEquals(Status.ROLLED_BACK_TO_ASSIGNED.toString(), delegateExecution.getVariable("rollbackTargetState"));
}
Also used : RainyDayHandlerStatus(org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus) Test(org.junit.Test) BaseTest(org.onap.so.BaseTest)

Aggregations

RainyDayHandlerStatus (org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus)12 Test (org.junit.Test)11 BaseTest (org.onap.so.BaseTest)9 CatalogDbAdapterBaseTest (org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest)2 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)2 Map (java.util.Map)1 WorkflowException (org.onap.so.bpmn.core.WorkflowException)1 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)1 BuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock)1 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)1 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)1 InfraActiveRequests (org.onap.so.db.request.beans.InfraActiveRequests)1