use of org.onap.so.client.cds.beans.AbstractCDSPropertiesBean in project so by onap.
the class GenericPnfCDSControllerRunnableBBTest method prepareTest.
@Test
public void prepareTest() throws BBObjectNotFoundException, PayloadGenerationException {
// given
prepareData();
// when
genericPnfCDSControllerRunnableBB.prepare(controllerContext);
// then
final AbstractCDSPropertiesBean abstractCDSPropertiesBean = execution.getVariable(EXECUTION_OBJECT);
final JSONObject actionProperties = new JSONObject(abstractCDSPropertiesBean.getRequestObject()).getJSONObject("action-request").getJSONObject("action-properties");
assertThat(abstractCDSPropertiesBean).isNotNull();
assertThat(abstractCDSPropertiesBean.getRequestObject()).isNotNull();
assertThat(abstractCDSPropertiesBean.getRequestObject()).isInstanceOf(String.class);
assertThat(execution.getGeneralBuildingBlock()).isNotNull();
assertEquals(blueprintName, abstractCDSPropertiesBean.getBlueprintName());
assertEquals(blueprintVersion, abstractCDSPropertiesBean.getBlueprintVersion());
assertEquals(msoRequestId, abstractCDSPropertiesBean.getRequestId());
assertEquals(action, abstractCDSPropertiesBean.getActionName());
assertEquals("sync", abstractCDSPropertiesBean.getMode());
assertEquals("SO", abstractCDSPropertiesBean.getOriginatorId());
assertEquals(pnfID, actionProperties.get("pnf-id"));
assertEquals(serviceInstanceID, actionProperties.get("service-instance-id"));
assertEquals(serviceModelUUID, actionProperties.get("service-model-uuid"));
assertEquals(pnfName, actionProperties.get("pnf-name"));
assertEquals(pnfCustomizationUUID, actionProperties.get("pnf-customization-uuid"));
}
use of org.onap.so.client.cds.beans.AbstractCDSPropertiesBean in project so by onap.
the class GeneratePayloadForCds method prepareAndSetCdsPropertyBean.
private AbstractCDSPropertiesBean prepareAndSetCdsPropertyBean(CDSRequestProvider requestProvider, String requestPayload, String requestId, String action, String mode) {
final AbstractCDSPropertiesBean cdsPropertiesBean = new AbstractCDSPropertiesBean();
cdsPropertiesBean.setRequestObject(requestPayload);
cdsPropertiesBean.setBlueprintName(requestProvider.getBlueprintName());
cdsPropertiesBean.setBlueprintVersion(requestProvider.getBlueprintVersion());
cdsPropertiesBean.setRequestId(requestId);
cdsPropertiesBean.setOriginatorId(ORIGINATOR_ID);
cdsPropertiesBean.setSubRequestId(UUID.randomUUID().toString());
cdsPropertiesBean.setActionName(action);
cdsPropertiesBean.setMode(mode);
return cdsPropertiesBean;
}
use of org.onap.so.client.cds.beans.AbstractCDSPropertiesBean 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.so.client.cds.beans.AbstractCDSPropertiesBean 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.so.client.cds.beans.AbstractCDSPropertiesBean in project so by onap.
the class PrepareCdsCallDelegate method execute.
@Override
public void execute(DelegateExecution delegateExecution) {
logger.debug("Running execute block for activity:{}", delegateExecution.getCurrentActivityId());
AbstractCDSPropertiesBean cdsPropertiesBean = new AbstractCDSPropertiesBean();
cdsPropertiesBean.setBlueprintName((String) delegateExecution.getVariable(PRC_BLUEPRINT_NAME));
cdsPropertiesBean.setBlueprintVersion((String) delegateExecution.getVariable(PRC_BLUEPRINT_VERSION));
cdsPropertiesBean.setOriginatorId(ORIGINATOR_ID);
cdsPropertiesBean.setActionName(getActionName());
cdsPropertiesBean.setMode(getMode());
cdsPropertiesBean.setRequestId((String) delegateExecution.getVariable(MSO_REQUEST_ID));
cdsPropertiesBean.setSubRequestId((String) delegateExecution.getVariable(PNF_UUID));
cdsPropertiesBean.setRequestObject(getRequestObject(delegateExecution));
delegateExecution.setVariable(EXECUTION_OBJECT, cdsPropertiesBean);
}
Aggregations