use of org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.TestConstants.EXT_VIRTUAL_LINKS_VALUE 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());
}
Aggregations