Search in sources :

Example 6 with AbstractCDSPropertiesBean

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"));
}
Also used : JSONObject(org.json.JSONObject) AbstractCDSPropertiesBean(org.onap.so.client.cds.beans.AbstractCDSPropertiesBean) Test(org.junit.Test)

Example 7 with AbstractCDSPropertiesBean

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;
}
Also used : AbstractCDSPropertiesBean(org.onap.so.client.cds.beans.AbstractCDSPropertiesBean)

Example 8 with AbstractCDSPropertiesBean

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);
    }
}
Also used : AbstractCDSPropertiesBean(org.onap.so.client.cds.beans.AbstractCDSPropertiesBean) ExecutionServiceInput(org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException) BadResponseException(org.onap.so.client.exception.BadResponseException) PreconditionFailedException(org.onap.so.client.PreconditionFailedException)

Example 9 with AbstractCDSPropertiesBean

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);
    }
}
Also used : AbstractCDSPropertiesBean(org.onap.so.client.cds.beans.AbstractCDSPropertiesBean) ExecutionServiceInput(org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException) BadResponseException(org.onap.so.client.exception.BadResponseException) PreconditionFailedException(org.onap.so.client.PreconditionFailedException)

Example 10 with AbstractCDSPropertiesBean

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);
}
Also used : AbstractCDSPropertiesBean(org.onap.so.client.cds.beans.AbstractCDSPropertiesBean)

Aggregations

AbstractCDSPropertiesBean (org.onap.so.client.cds.beans.AbstractCDSPropertiesBean)20 Test (org.junit.Test)8 BuildingBlockExecution (org.onap.so.bpmn.common.BuildingBlockExecution)3 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)2 DelegateExecution (org.camunda.bpm.engine.delegate.DelegateExecution)2 ExecutionServiceInput (org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput)2 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)2 ControllerContext (org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext)2 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)2 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)2 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)2 PreconditionFailedException (org.onap.so.client.PreconditionFailedException)2 BadResponseException (org.onap.so.client.exception.BadResponseException)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 IOException (java.io.IOException)1 JSONObject (org.json.JSONObject)1 VnfNotFoundException (org.onap.so.bpmn.infrastructure.flowspecific.exceptions.VnfNotFoundException)1 ConfigAssignPropertiesForVnf (org.onap.so.client.cds.beans.ConfigAssignPropertiesForVnf)1 ConfigAssignRequestVnf (org.onap.so.client.cds.beans.ConfigAssignRequestVnf)1