Search in sources :

Example 76 with GeneralBuildingBlock

use of org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock in project so by onap.

the class InputParameterRetrieverTaskTest method testGetInputParameters_SdncAndUserParamInputParameterStoredInExecutionContext.

@Test
public void testGetInputParameters_SdncAndUserParamInputParameterStoredInExecutionContext() throws BBObjectNotFoundException {
    final InputParameterRetrieverTask objUnderTest = new InputParameterRetrieverTask(sdncInputParametersProvider, userParamsinputParametersProvider, extractPojosForBB);
    final GeneralBuildingBlock buildingBlock = getGeneralBuildingBlock(getUserParamsMap(ADDITIONAL_PARAMS_VALUE, EXT_VIRTUAL_LINKS_VALUE));
    stubbedxecution.setGeneralBuildingBlock(buildingBlock);
    final InputParameter inputParameter = new InputParameter(getAdditionalParams(), getExternalVirtualLink());
    when(sdncInputParametersProvider.getInputParameter(Mockito.any(GenericVnf.class))).thenReturn(inputParameter);
    when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(new GenericVnf());
    objUnderTest.getInputParameters(stubbedxecution);
    final Object actual = stubbedxecution.getVariable(Constants.INPUT_PARAMETER);
    assertNotNull(actual);
    assertTrue(actual instanceof InputParameter);
    final InputParameter actualInputParameter = (InputParameter) actual;
    final Map<String, String> actualAdditionalParams = actualInputParameter.getAdditionalParams();
    assertEquals(4, actualAdditionalParams.size());
    final String actualInstanceType = actualAdditionalParams.get(INSTANCE_TYPE);
    assertEquals(INSTANCE_TYPE_VALUE_1, actualInstanceType);
    assertEquals(FLAVOR_VALUE, actualAdditionalParams.get(FLAVOR));
    final List<ExternalVirtualLink> actualExtVirtualLinks = actualInputParameter.getExtVirtualLinks();
    assertEquals(2, actualExtVirtualLinks.size());
    final Optional<ExternalVirtualLink> externalVirtualLink0 = actualExtVirtualLinks.stream().filter(extVirtualLink -> EXT_VIRTUAL_LINK_ID.equals(extVirtualLink.getId())).findAny();
    assertTrue(externalVirtualLink0.isPresent());
    assertEquals(EXT_VIRTUAL_LINK_ID, externalVirtualLink0.get().getId());
    final Optional<ExternalVirtualLink> externalVirtualLink1 = actualExtVirtualLinks.stream().filter(extVirtualLink -> RANDOM_EXT_VIRTUAL_LINK_ID.equals(extVirtualLink.getId())).findAny();
    assertTrue(externalVirtualLink1.isPresent());
    assertEquals(RANDOM_EXT_VIRTUAL_LINK_ID, externalVirtualLink1.get().getId());
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) EXT_VIRTUAL_LINK_ID(org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.EXT_VIRTUAL_LINK_ID) Arrays(java.util.Arrays) TestConstants.getUserParamsMap(org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.getUserParamsMap) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) Mock(org.mockito.Mock) InputParameterRetrieverTask(org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.InputParameterRetrieverTask) ADDITIONAL_PARAMS_VALUE(org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.ADDITIONAL_PARAMS_VALUE) HashMap(java.util.HashMap) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) EXT_VIRTUAL_LINKS_VALUE(org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.EXT_VIRTUAL_LINKS_VALUE) ExternalVirtualLinkCpConfig(org.onap.so.adapters.etsisol003adapter.lcm.v1.model.ExternalVirtualLinkCpConfig) RequiredExecutionVariableExeception(org.onap.so.bpmn.common.exceptions.RequiredExecutionVariableExeception) ExternalVirtualLinkExtCps(org.onap.so.adapters.etsisol003adapter.lcm.v1.model.ExternalVirtualLinkExtCps) ExternalVirtualLink(org.onap.so.adapters.etsisol003adapter.lcm.v1.model.ExternalVirtualLink) Map(java.util.Map) RequestParameters(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters) ResourceKey(org.onap.so.bpmn.servicedecomposition.entities.ResourceKey) BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) Assert.assertNotNull(org.junit.Assert.assertNotNull) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) UUID(java.util.UUID) SDNCClient(org.onap.so.client.sdnc.SDNCClient) Serializable(java.io.Serializable) Mockito(org.mockito.Mockito) List(java.util.List) BuildingBlockExecution(org.onap.so.bpmn.common.BuildingBlockExecution) Constants(org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants) Optional(java.util.Optional) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) Collections(java.util.Collections) Assert.assertEquals(org.junit.Assert.assertEquals) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) ExternalVirtualLink(org.onap.so.adapters.etsisol003adapter.lcm.v1.model.ExternalVirtualLink) InputParameterRetrieverTask(org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.InputParameterRetrieverTask) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Example 77 with GeneralBuildingBlock

use of org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock in project so by onap.

the class InputParameterRetrieverTaskTest method getGeneralBuildingBlock.

private GeneralBuildingBlock getGeneralBuildingBlock(final Map<String, Object> userParams) {
    final GeneralBuildingBlock buildingBlock = new GeneralBuildingBlock();
    final RequestContext requestContext = new RequestContext();
    final RequestParameters requestParameters = new RequestParameters();
    requestParameters.setUserParams(Arrays.asList(userParams));
    requestContext.setRequestParameters(requestParameters);
    buildingBlock.setRequestContext(requestContext);
    return buildingBlock;
}
Also used : GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) RequestParameters(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters)

Example 78 with GeneralBuildingBlock

use of org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock in project so by onap.

the class StubbedBuildingBlockExecution method getGeneralBuildingBlockValue.

private GeneralBuildingBlock getGeneralBuildingBlockValue() {
    final GeneralBuildingBlock buildingBlock = new GeneralBuildingBlock();
    buildingBlock.setCloudRegion(getCloudRegion());
    return buildingBlock;
}
Also used : GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)

Example 79 with GeneralBuildingBlock

use of org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock in project so by onap.

the class TestDataSetup method buildingBlockTestDataSetupBefore.

@Before
public void buildingBlockTestDataSetupBefore() {
    collectionCounter = 0;
    configurationCounter = 0;
    customerCounter = 0;
    genericVnfCounter = 0;
    instanceGroupCounter = 0;
    l3NetworkCounter = 0;
    owningEntityCounter = 0;
    pnfCounter = 0;
    projectCounter = 0;
    serviceInstanceCounter = 0;
    serviceProxyCounter = 0;
    serviceSubscriptionCounter = 0;
    vfModuleCounter = 0;
    volumeGroupCounter = 0;
    vpnBindingCounter = 0;
    vpnBondingLinkCounter = 0;
    execution = new DelegateExecutionImpl(new ExecutionImpl());
    execution.setVariable("testProcessKey", "testProcessKeyValue");
    gBBInput = new GeneralBuildingBlock();
    execution.setVariable("gBBInput", gBBInput);
    lookupKeyMap = new HashMap<ResourceKey, String>();
    execution.setVariable("lookupKeyMap", lookupKeyMap);
    ExecutionImpl mockExecutionImpl = mock(ExecutionImpl.class);
    doReturn("test").when(mockExecutionImpl).getProcessInstanceId();
    ExecutionImpl executionImpl = new ExecutionImpl();
    executionImpl.setProcessInstance(mockExecutionImpl);
    delegateExecution = (DelegateExecution) executionImpl;
    delegateExecution.setVariable("testProcessKey", "testProcessKeyValue");
}
Also used : GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) DelegateExecutionImpl(org.onap.so.bpmn.common.DelegateExecutionImpl) DelegateExecutionImpl(org.onap.so.bpmn.common.DelegateExecutionImpl) ExecutionImpl(org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl) ResourceKey(org.onap.so.bpmn.servicedecomposition.entities.ResourceKey) Before(org.junit.Before)

Example 80 with GeneralBuildingBlock

use of org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock in project so by onap.

the class ExtractPojosForBBTest method before.

@Before
public void before() {
    execution = new DelegateExecutionImpl(new ExecutionImpl());
    execution.setVariable("testProcessKey", "AAICreateTasksTests");
    gBBInput = new GeneralBuildingBlock();
    execution.setVariable("gBBInput", gBBInput);
    lookupKeyMap = new HashMap<>();
    execution.setVariable("lookupKeyMap", lookupKeyMap);
}
Also used : GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) DelegateExecutionImpl(org.onap.so.bpmn.common.DelegateExecutionImpl) ExecutionImpl(org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl) DelegateExecutionImpl(org.onap.so.bpmn.common.DelegateExecutionImpl) Before(org.junit.Before)

Aggregations

GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)117 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)61 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)51 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)40 Test (org.junit.Test)37 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)37 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)35 File (java.io.File)34 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)34 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)29 Service (org.onap.so.db.catalog.beans.Service)27 VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)25 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)23 HashMap (java.util.HashMap)22 BuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock)22 L3Network (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)20 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)19 SDNCRequest (org.onap.so.client.sdnc.beans.SDNCRequest)19 ConfigurationResourceKeys (org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys)16 BBObjectNotFoundException (org.onap.so.client.exception.BBObjectNotFoundException)16