use of org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput in project so by onap.
the class AbstractCDSProcessingBBUtils method constructExecutionServiceInputObject.
/**
* Extracting data from execution object and building the ExecutionServiceInput Object
*
* @param execution DelegateExecution object
*/
public void constructExecutionServiceInputObject(DelegateExecution execution) {
logger.trace("Start AbstractCDSProcessingBBUtils.preProcessRequest for DelegateExecution object.");
try {
AbstractCDSPropertiesBean executionObject = (AbstractCDSPropertiesBean) execution.getVariable(EXECUTION_OBJECT);
ExecutionServiceInput executionServiceInput = prepareExecutionServiceInput(executionObject);
execution.setVariable(EXEC_INPUT, executionServiceInput);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
use of org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput in project so by onap.
the class AbstractCDSProcessingBBUtils method sendRequestToCDSClient.
/**
* get the executionServiceInput object from execution and send a request to CDS Client and wait for TIMEOUT period
*
* @param execution DelegateExecution object
*/
public void sendRequestToCDSClient(DelegateExecution execution) {
logger.trace("Start AbstractCDSProcessingBBUtils.sendRequestToCDSClient for DelegateExecution object.");
try {
ExecutionServiceInput executionServiceInput = (ExecutionServiceInput) execution.getVariable(EXEC_INPUT);
CDSResponse cdsResponse = getCdsResponse(executionServiceInput);
execution.setVariable(CDS_STATUS, cdsResponse.status);
if (cdsResponse.payload != null) {
String payload = JsonFormat.printer().print(cdsResponse.payload);
execution.setVariable(RESPONSE_PAYLOAD, payload);
}
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
use of org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput in project so by onap.
the class AbstractCDSProcessingBBUtils method constructExecutionServiceInputObjectBB.
/**
* Extracting data from execution object and building the ExecutionServiceInput Object
*
* @param execution BuildingBlockExecution object
*/
public void constructExecutionServiceInputObjectBB(BuildingBlockExecution execution) {
logger.trace("Start AbstractCDSProcessingBBUtils.preProcessRequest for BuildingBlockExecution object.");
try {
AbstractCDSPropertiesBean executionObject = execution.getVariable(EXECUTION_OBJECT);
ExecutionServiceInput executionServiceInput = prepareExecutionServiceInput(executionObject);
execution.setVariable(EXEC_INPUT, executionServiceInput);
logger.debug("Input payload: " + executionServiceInput.getPayload());
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
use of org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput in project so by onap.
the class CreateVcpeResCustServiceSimplifiedTest method workflow_validInput_expectedOuput.
@Test
public void workflow_validInput_expectedOuput() throws InterruptedException {
mockCatalogDb();
mockRequestDb();
mockAai();
mockDmaapForPnf();
grpcNettyServer.resetList();
final String msoRequestId = UUID.randomUUID().toString();
executionVariables.put("mso-request-id", msoRequestId);
ProcessInstance pi = runtimeService.startProcessInstanceByKey(TEST_PROCESSINSTANCE_KEY, testBusinessKey, executionVariables);
int waitCount = 10;
while (!isProcessInstanceEnded() && waitCount >= 0) {
Thread.sleep(WORKFLOW_WAIT_TIME);
waitCount--;
}
assertThat(pi).isEnded().hasPassedInOrder("createVCPE_startEvent", "preProcessRequest_ScriptTask", "sendSyncAckResponse_ScriptTask", "ScriptTask_0cdtchu", "DecomposeService", "ScriptTask_0lpv2da", "ScriptTask_1y241p8", "CallActivity_1vc4jeh", "ScriptTask_1y5lvl7", "GeneratePnfUuid", "Task_14l19kv", "Pnf_Con", "setPONR_ScriptTask", "postProcessAndCompletionRequest_ScriptTask", "callCompleteMsoProcess_CallActivity", "ScriptTask_2", "CreateVCPE_EndEvent");
List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages();
assertThat(detailedMessages.size() == 2);
int count = 0;
try {
for (ExecutionServiceInput eSI : detailedMessages) {
if ("config-assign".equals(eSI.getActionIdentifiers().getActionName())) {
checkConfigAssign(eSI, msoRequestId);
count++;
}
if ("config-deploy".equals(eSI.getActionIdentifiers().getActionName())) {
checkConfigDeploy(eSI, msoRequestId);
count++;
}
}
} catch (Exception e) {
e.printStackTrace();
fail("ConfigAssign/deploy request exception", e);
}
assertThat(count == 2);
}
use of org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput in project so by onap.
the class GenericPnfSoftwareUpgradeTest method workflow_validInput_expectedOutput.
@Test
public void workflow_validInput_expectedOutput() throws InterruptedException {
mockCatalogDb();
mockRequestDb();
mockAai();
grpcNettyServer.resetList();
final String msoRequestId = UUID.randomUUID().toString();
executionVariables.put(ExecutionVariableNames.MSO_REQUEST_ID, msoRequestId);
final String testBusinessKey = UUID.randomUUID().toString();
logger.info("Test the process instance: {} with business key: {}", TEST_PROCESSINSTANCE_KEY, testBusinessKey);
ProcessInstance pi = runtimeService.startProcessInstanceByKey(TEST_PROCESSINSTANCE_KEY, testBusinessKey, executionVariables);
int waitCount = 10;
while (!isProcessInstanceEnded() && waitCount >= 0) {
Thread.sleep(WORKFLOW_WAIT_TIME);
waitCount--;
}
// Layout is to reflect the bpmn visual layout
assertThat(pi).isStarted().hasPassedInOrder("softwareUpgrade_startEvent", "ServiceTask_042uz7n", "ScriptTask_10klpg8", "ServiceTask_0slpahe", "ExclusiveGateway_0x6h0ni", "ServiceTask_0x5cje8", "ExclusiveGateway_0v3l3wv", "ServiceTask_02lxf48", "ExclusiveGateway_0ch3fef", "ServiceTask_0y2uysu", "ExclusiveGateway_1ny9b1z", "ScriptTask_1igtc83", "CallActivity_0o1mi8u", "softwareUpgrade_endEvent");
List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages();
assertEquals(4, detailedMessages.size());
int count = 0;
try {
for (ExecutionServiceInput eSI : detailedMessages) {
for (String action : actionNames) {
if (action.equals(eSI.getActionIdentifiers().getActionName()) && eSI.getCommonHeader().getRequestId().equals(msoRequestId)) {
checkWithActionName(eSI, action);
count++;
}
}
}
} catch (Exception e) {
e.printStackTrace();
fail("GenericPnfSoftwareUpgrade request exception", e);
}
assertTrue(count == actionNames.length);
}
Aggregations