use of org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext in project so by onap.
the class GenericCDSProcessingBBTest method testExecutionObjectCreationForVnf.
@Test
public void testExecutionObjectCreationForVnf() throws Exception {
// given
ControllerContext<BuildingBlockExecution> controllerContext = new ControllerContext<>();
controllerContext.setExecution(buildingBlockExecution);
controllerContext.setControllerActor("CDS");
controllerContext.setControllerScope("vnf");
setScopeAndAction(VNF_SCOPE, DEPLOY_ACTION_FOR_CDS);
AbstractCDSPropertiesBean cdsBean = prepareCDSBean();
doReturn(cdsBean).when(generatePayloadForCds).buildCdsPropertiesBean(buildingBlockExecution);
doNothing().when(cdsDispather).constructExecutionServiceInputObjectBB(buildingBlockExecution);
doNothing().when(cdsDispather).sendRequestToCDSClientBB(buildingBlockExecution);
// when
Boolean isUnderstandable = controllerRunnable.understand(controllerContext);
Boolean isReady = controllerRunnable.ready(controllerContext);
controllerRunnable.prepare(controllerContext);
controllerRunnable.run(controllerContext);
// verify
assertEquals(isUnderstandable, true);
assertEquals(isReady, true);
AbstractCDSPropertiesBean executionObject = buildingBlockExecution.getVariable(EXECUTION_OBJECT);
assertNotNull(executionObject);
assertThat(executionObject).isInstanceOf(AbstractCDSPropertiesBean.class);
assertEquals(BLUEPRINT_NAME, executionObject.getBlueprintName());
assertEquals(BLUEPRINT_VERSION, executionObject.getBlueprintVersion());
assertEquals(TEST_MSO_REQUEST_ID, executionObject.getRequestId());
assertNotNull(executionObject.getRequestObject());
}
use of org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext in project so by onap.
the class GenericPnfCDSProcessingDETest method testExecution_validPnf_action_executionObjectCreated.
@Test
public void testExecution_validPnf_action_executionObjectCreated() {
try {
// given
ControllerContext controllerContext = new ControllerContext();
controllerContext.setExecution(execution);
controllerContext.setControllerActor("cds");
controllerContext.setControllerAction(this.action);
controllerContext.setControllerScope(this.scope);
AbstractCDSPropertiesBean bean = new AbstractCDSPropertiesBean();
doNothing().when(cdsDispather).constructExecutionServiceInputObject(execution);
doNothing().when(cdsDispather).sendRequestToCDSClient(execution);
doReturn(bean).when(generatePayloadForCds).buildCdsPropertiesBean(execution);
// when
Boolean isUnderstandable = controllerRunnable.understand(controllerContext);
Boolean isReady = controllerRunnable.ready(controllerContext);
controllerRunnable.prepare(controllerContext);
controllerRunnable.run(controllerContext);
// verify
assertEquals(isUnderstandable, true);
assertEquals(isReady, true);
Object executionObject = execution.getVariable(EXECUTION_OBJECT);
assertThat(executionObject).isNotNull();
assertThat(executionObject).isInstanceOf(AbstractCDSPropertiesBean.class);
} catch (Exception e) {
e.printStackTrace();
fail("Exception thrown" + e.getMessage());
}
}
Aggregations