Search in sources :

Example 6 with BuildingBlockExecution

use of org.onap.so.bpmn.common.BuildingBlockExecution in project so by onap.

the class UnassignServiceInstanceBBTest method sunnyDayUnassignServiceInstanceSDNC.

@Test
public void sunnyDayUnassignServiceInstanceSDNC() throws InterruptedException {
    mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
    BuildingBlockExecution bbe = new DelegateExecutionImpl(new ExecutionImpl());
    variables.put("gBuildingBlockExecution", bbe);
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignServiceInstanceBB", variables);
    assertThat(pi).isNotNull();
    assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignServiceInstanceBB", "Task_SdncUnassignServiceInstance", "CallActivity_sdncHandlerCall", "Task_AAIDeleteServiceInstance", "End_UnassignServiceInstanceBB");
    assertThat(pi).isEnded();
}
Also used : BuildingBlockExecution(org.onap.so.bpmn.common.BuildingBlockExecution) DelegateExecutionImpl(org.onap.so.bpmn.common.DelegateExecutionImpl) ExecutionImpl(org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl) DelegateExecutionImpl(org.onap.so.bpmn.common.DelegateExecutionImpl) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Test(org.junit.Test) BaseBPMNTest(org.onap.so.bpmn.BaseBPMNTest)

Example 7 with BuildingBlockExecution

use of org.onap.so.bpmn.common.BuildingBlockExecution in project so by onap.

the class ConfigAssignVnfTest method invalidServiceJsonContentWhenPrepareCDSBean_flowExIsThrown.

@Test
public void invalidServiceJsonContentWhenPrepareCDSBean_flowExIsThrown() throws Exception {
    // given
    BuildingBlockExecution buildingBlockExecution = createBuildingBlockExecution("{invalidJsonContent}");
    prepareExtractPojosForBB(buildingBlockExecution);
    // when
    testedObject.preProcessAbstractCDSProcessing(buildingBlockExecution);
    // then
    verify(exceptionBuilderMock).buildAndThrowWorkflowException(eq(buildingBlockExecution), eq(7000), any(IOException.class));
}
Also used : BuildingBlockExecution(org.onap.so.bpmn.common.BuildingBlockExecution) IOException(java.io.IOException) Test(org.junit.Test)

Example 8 with BuildingBlockExecution

use of org.onap.so.bpmn.common.BuildingBlockExecution in project so by onap.

the class ConfigAssignVnfTest method vnfIsNotFoundWhenPrepareCDSBean_flowExIsThrown.

@Test
public void vnfIsNotFoundWhenPrepareCDSBean_flowExIsThrown() throws Exception {
    // given
    BuildingBlockExecution buildingBlockExecution = createBuildingBlockExecution(createService(Collections.emptyList()));
    prepareExtractPojosForBB(buildingBlockExecution);
    // when
    testedObject.preProcessAbstractCDSProcessing(buildingBlockExecution);
    // then
    verify(exceptionBuilderMock).buildAndThrowWorkflowException(eq(buildingBlockExecution), eq(7000), any(VnfNotFoundException.class));
}
Also used : BuildingBlockExecution(org.onap.so.bpmn.common.BuildingBlockExecution) VnfNotFoundException(org.onap.so.bpmn.infrastructure.flowspecific.exceptions.VnfNotFoundException) Test(org.junit.Test)

Example 9 with BuildingBlockExecution

use of org.onap.so.bpmn.common.BuildingBlockExecution in project so by onap.

the class ConfigAssignVnfTest method prepareAbstractCDSPropertiesBean_success.

@Test
public void prepareAbstractCDSPropertiesBean_success() throws Exception {
    // given
    BuildingBlockExecution buildingBlockExecution = createBuildingBlockExecution(createService(createVnfList()));
    prepareExtractPojosForBB(buildingBlockExecution);
    // when
    testedObject.preProcessAbstractCDSProcessing(buildingBlockExecution);
    // then
    verifyConfigAssignPropertiesJsonContent(buildingBlockExecution);
}
Also used : BuildingBlockExecution(org.onap.so.bpmn.common.BuildingBlockExecution) Test(org.junit.Test)

Example 10 with BuildingBlockExecution

use of org.onap.so.bpmn.common.BuildingBlockExecution in project so by onap.

the class AppcRunTasksTest method mapRollbackVariablesTest.

@Test
public void mapRollbackVariablesTest() {
    BuildingBlockExecution mock = mock(BuildingBlockExecution.class);
    appcRunTasks.mapRollbackVariables(mock, Action.Lock, "1");
    verify(mock, times(0)).setVariable(any(String.class), any());
    appcRunTasks.mapRollbackVariables(mock, Action.Lock, "0");
    verify(mock, times(1)).setVariable("rollbackVnfLock", true);
    appcRunTasks.mapRollbackVariables(mock, Action.Unlock, "0");
    verify(mock, times(1)).setVariable("rollbackVnfLock", false);
    appcRunTasks.mapRollbackVariables(mock, Action.Start, "0");
    verify(mock, times(1)).setVariable("rollbackVnfStop", false);
    appcRunTasks.mapRollbackVariables(mock, Action.Stop, "0");
    verify(mock, times(1)).setVariable("rollbackVnfStop", true);
    appcRunTasks.mapRollbackVariables(mock, Action.QuiesceTraffic, "0");
    verify(mock, times(1)).setVariable("rollbackQuiesceTraffic", true);
    appcRunTasks.mapRollbackVariables(mock, Action.ResumeTraffic, "0");
    verify(mock, times(1)).setVariable("rollbackQuiesceTraffic", false);
}
Also used : BuildingBlockExecution(org.onap.so.bpmn.common.BuildingBlockExecution) Test(org.junit.Test)

Aggregations

BuildingBlockExecution (org.onap.so.bpmn.common.BuildingBlockExecution)39 Test (org.junit.Test)27 HashMap (java.util.HashMap)10 DelegateExecutionImpl (org.onap.so.bpmn.common.DelegateExecutionImpl)10 DelegateExecutionFake (org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake)7 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)6 ArrayList (java.util.ArrayList)5 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)5 Resource (org.onap.so.bpmn.infrastructure.workflow.tasks.Resource)4 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)4 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)4 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)4 ServiceInstancesRequest (org.onap.so.serviceinstancebeans.ServiceInstancesRequest)4 List (java.util.List)3 Optional (java.util.Optional)3 Collectors (java.util.stream.Collectors)3 DelegateExecution (org.camunda.bpm.engine.delegate.DelegateExecution)3 AbstractCDSPropertiesBean (org.onap.so.client.cds.beans.AbstractCDSPropertiesBean)3 Logger (org.slf4j.Logger)3 LoggerFactory (org.slf4j.LoggerFactory)3