diff options
15 files changed, 164 insertions, 241 deletions
diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ExportToscaTest.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ExportToscaTest.java index 192f6759c3..6bf0786a4b 100644 --- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ExportToscaTest.java +++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ExportToscaTest.java @@ -49,6 +49,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstInputsMap; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceInput; +import org.openecomp.sdc.be.model.ComponentInstancePropInput; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.GroupProperty; @@ -472,10 +473,10 @@ public class ExportToscaTest extends ComponentBaseTest { // 6 add instance inputs in service RestResponse getComponentInstanceInputsResponse = InputsRestUtils.getComponentInstanceInputs(service, vfi); BaseValidationUtils.checkSuccess(getComponentInstanceInputsResponse); - List<InputDefinition> instanceInputs = new Gson().fromJson(getComponentInstanceInputsResponse.getResponse(), new TypeToken<ArrayList<InputDefinition>>() { + List<ComponentInstancePropInput> instanceInputs = new Gson().fromJson(getComponentInstanceInputsResponse.getResponse(), new TypeToken<ArrayList<ComponentInstancePropInput>>() { }.getType()); // Take only the 2 first inputs - List<InputDefinition> inputsToAdd = instanceInputs.stream().limit(2).collect(Collectors.toList()); + List<ComponentInstancePropInput> inputsToAdd = instanceInputs.stream().limit(2).collect(Collectors.toList()); // 7 Build component instances input map to add to server ComponentInstInputsMap buildComponentInstInputsMap = buildComponentInstInputsMap(vfi.getUniqueId(), inputsToAdd); @@ -674,8 +675,8 @@ public class ExportToscaTest extends ComponentBaseTest { return masterArtifact; } - private ComponentInstInputsMap buildComponentInstInputsMap(String addToInput, List<InputDefinition> inputs) { - Map<String, List<InputDefinition>> map = new HashMap<>(); + private ComponentInstInputsMap buildComponentInstInputsMap(String addToInput, List<ComponentInstancePropInput> inputs) { + Map<String, List<ComponentInstancePropInput>> map = new HashMap<>(); map.put(addToInput, inputs); ComponentInstInputsMap componentInstInputsMap = new ComponentInstInputsMap(); componentInstInputsMap.setComponentInstanceInputsMap(map); diff --git a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/inputs/InputsApiTests.java b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/inputs/InputsApiTests.java index b71240b527..633ce45178 100644 --- a/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/inputs/InputsApiTests.java +++ b/asdc-tests/src/main/java/org/openecomp/sdc/ci/tests/execute/inputs/InputsApiTests.java @@ -141,10 +141,10 @@ public class InputsApiTests extends ComponentBaseTest { ComponentInstance vfInstance = serviceInstances.get(0); RestResponse getComponentInstanceInputsResponse = InputsRestUtils.getComponentInstanceInputs(service, vfInstance); BaseValidationUtils.checkSuccess(getComponentInstanceInputsResponse); - List<InputDefinition> instanceInputs = new Gson().fromJson(getComponentInstanceInputsResponse.getResponse(), new TypeToken<ArrayList<InputDefinition>>(){}.getType()); + List<ComponentInstancePropInput> instanceInputs = new Gson().fromJson(getComponentInstanceInputsResponse.getResponse(), new TypeToken<ArrayList<ComponentInstancePropInput>>(){}.getType()); // Take only the 2 first inputs - List<InputDefinition> inputsToAdd = instanceInputs.stream().limit(2).collect(Collectors.toList()); + List<ComponentInstancePropInput> inputsToAdd = instanceInputs.stream().limit(2).collect(Collectors.toList()); // Build component instances input map to add to server ComponentInstInputsMap buildComponentInstInputsMap = buildComponentInstInputsMap(vfInstance.getUniqueId(), inputsToAdd); @@ -321,8 +321,8 @@ public class InputsApiTests extends ComponentBaseTest { * @param inputs * @return {@link org.openecomp.sdc.be.model.ComponentInstInputsMap} */ - private ComponentInstInputsMap buildComponentInstInputsMap (String addToInput, List<InputDefinition> inputs) { - Map<String, List<InputDefinition>> map = new HashMap<>(); + private ComponentInstInputsMap buildComponentInstInputsMap (String addToInput, List<ComponentInstancePropInput> inputs) { + Map<String, List<ComponentInstancePropInput>> map = new HashMap<>(); map.put(addToInput, inputs); ComponentInstInputsMap componentInstInputsMap = new ComponentInstInputsMap(); componentInstInputsMap.setComponentInstanceInputsMap(map); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java index cb04cfcdc9..cec045d8a3 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java @@ -3515,11 +3515,12 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { private String generateHeatEnvPayload(ArtifactDefinition artifactDefinition) { List<HeatParameterDefinition> heatParameters = artifactDefinition.getListHeatParameters(); - heatParameters.sort(Comparator.comparing(e -> e.getName())); StringBuilder sb = new StringBuilder(); sb.append(ConfigurationManager.getConfigurationManager().getConfiguration().getHeatEnvArtifactHeader()); sb.append("parameters:\n"); if (heatParameters != null) { + heatParameters.sort(Comparator.comparing(e -> e.getName())); + List<HeatParameterDefinition> empltyHeatValues = new ArrayList<>(); for (HeatParameterDefinition heatParameterDefinition : heatParameters) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java index 643b35d17b..5da416ec0b 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java @@ -383,14 +383,14 @@ public abstract class ComponentInstanceBusinessLogic extends BaseBusinessLogic { StorageOperationStatus artStatus = toscaOperationFacade.addDeploymentArtifactsToInstance(containerComponent.getUniqueId(), componentInstance, finalDeploymentArtifacts); if ( artStatus != StorageOperationStatus.OK){ log.debug("Failed to add instance deployment artifacts for instance {} in conatiner {} error {}", componentInstance.getUniqueId(), containerComponent.getUniqueId(), artStatus); - return Either.left(componentsUtils.convertFromStorageResponseForResourceInstance(artStatus, false)); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponseForResourceInstance(artStatus, false))); } StorageOperationStatus result = toscaOperationFacade .addGroupInstancesToComponentInstance(containerComponent, componentInstance, filteredGroups, groupInstancesArtifacts); if (result != StorageOperationStatus.OK) { log.debug("failed to update group instance for component instance {}", componentInstance.getUniqueId()); - return Either.left(componentsUtils.convertFromStorageResponse(result)); + return Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(result))); } componentInstance.setDeploymentArtifacts(finalDeploymentArtifacts); return Either.left(ActionStatus.OK); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java index 4f4ad7f838..d6497b58ea 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java @@ -46,6 +46,7 @@ import org.openecomp.sdc.be.model.ComponentInstancePropInput; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.DataTypeDefinition; +import org.openecomp.sdc.be.model.IComponentInstanceConnectedElement; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.User; @@ -443,10 +444,19 @@ public class InputsBusinessLogic extends BaseBusinessLogic { ////////////////////////////////////////////////////////////////////////////////////////////////////// List<InputDefinition> resList = new ArrayList<InputDefinition>(); - Map<String, List<InputDefinition>> newInputsMap = componentInstInputsMapUi.getComponentInstanceInputsMap(); + Map<String, List<ComponentInstancePropInput>> newInputsMap = componentInstInputsMapUi.getComponentInstanceInputsMap(); List<ComponentInstance> ciList = component.getComponentInstances(); if (newInputsMap != null && !newInputsMap.isEmpty()) { - int index = 0; + + result = createInputsFromProperty(component, origComponentMap, inputsToCreate, propertiesToCreateMap, inputsValueToCreateMap, dataTypes, resList, newInputsMap, true); + + if (result.isRight()) { + log.debug("Failed to create inputs of resource for id {} error {}", component.getUniqueId(), result.right().value()); + return result; + } + resList = result.left().value(); + + /*int index = 0; for (Entry<String, List<InputDefinition>> entry : newInputsMap.entrySet()) { String compInstId = entry.getKey(); @@ -486,14 +496,14 @@ public class InputsBusinessLogic extends BaseBusinessLogic { } } - } + }*/ } Map<String, List<ComponentInstancePropInput>> newInputsPropsMap = componentInstInputsMapUi.getComponentInstanceProperties(); if (newInputsPropsMap != null && !newInputsPropsMap.isEmpty()) { - result = createInputsFromProperty(component, origComponentMap, inputsToCreate, propertiesToCreateMap, dataTypes, resList, newInputsPropsMap); + result = createInputsFromProperty(component, origComponentMap, inputsToCreate, propertiesToCreateMap, inputsValueToCreateMap, dataTypes, resList, newInputsPropsMap, false); if (result.isRight()) { log.debug("Failed to create inputs of resource for id {} error {}", component.getUniqueId(), result.right().value()); @@ -895,25 +905,20 @@ public class InputsBusinessLogic extends BaseBusinessLogic { if(inputsValue != null && !inputsValue.isEmpty()){ for(ComponentInstanceInput inputValue: inputsValue){ - inputValue.setValue(inputValue.getDefaultValue()); - List<GetInputValueDataDefinition> getInputsValues = inputValue.getGetInputValues(); - if(getInputsValues != null && !getInputsValues.isEmpty()){ - Optional<GetInputValueDataDefinition> op = getInputsValues.stream().filter(gi -> gi.getInputId().equals(inputForDelete.getUniqueId())).findAny(); - if(op.isPresent()){ - getInputsValues.remove(op.get()); - } - } - inputValue.setGetInputValues(getInputsValues); + String compInstId = inputValue.getComponentInstanceId(); + prepareValueBeforeDelete(compInstId, inputForDelete, inputValue, inputValue.getPath()); + + status = toscaOperationFacade.updateComponentInstanceInput(component, compInstId, inputValue); List<ComponentInstanceInput> inputList = null; - String ciId = inputValue.getComponentInstanceId(); - status = toscaOperationFacade.updateComponentInstanceInput(component, ciId, inputValue); if(status != StorageOperationStatus.OK){ - log.debug("Component id: {} delete component instance input id: {} failed", componentId, inputId); + log.debug("Component id: {} update component instance property {} id: {} failed", componentId, inputValue.getUniqueId(), inputId); deleteEither = Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(status), component.getName())); return deleteEither; } + } + } // US848813 delete service input that relates to VL / CP property @@ -923,42 +928,9 @@ public class InputsBusinessLogic extends BaseBusinessLogic { //propertyList = propertyValueStatus.left().value(); for(ComponentInstanceProperty propertyValue: propertiesValue){ - String value = propertyValue.getValue(); - Map<String, Object> mappedToscaTemplate = (Map<String, Object>) new Yaml().load(value); - - resetInputName(mappedToscaTemplate, inputForDelete.getName()); - - value = ""; - if(!mappedToscaTemplate.isEmpty()){ - Either result = cleanNestedMap(mappedToscaTemplate , true); - Map modifiedMappedToscaTemplate = mappedToscaTemplate; - if (result.isLeft()) - modifiedMappedToscaTemplate = (Map)result.left().value(); - else - Log.warn("Map cleanup failed -> " +result.right().value().toString()); //continue, don't break operation - value = gson.toJson(modifiedMappedToscaTemplate); - } - propertyValue.setValue(value); String compInstId = propertyValue.getComponentInstanceId(); - propertyValue.setRules(null); - List<GetInputValueDataDefinition> getInputsValues = propertyValue.getGetInputValues(); - if(getInputsValues != null && !getInputsValues.isEmpty()){ - Optional<GetInputValueDataDefinition> op = getInputsValues.stream().filter(gi -> gi.getInputId().equals(inputForDelete.getUniqueId())).findAny(); - if(op.isPresent()){ - getInputsValues.remove(op.get()); - } - } - propertyValue.setGetInputValues(getInputsValues); - - Either<String, TitanOperationStatus> findDefaultValue = propertyOperation.findDefaultValueFromSecondPosition(propertyValue.getPath(), propertyValue.getUniqueId(), propertyValue.getDefaultValue()); - if (findDefaultValue.isRight()) { - deleteEither = Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(findDefaultValue.right().value())))); - return deleteEither; - - } - String defaultValue = findDefaultValue.left().value(); - propertyValue.setDefaultValue(defaultValue); - log.debug("The returned default value in ResourceInstanceProperty is {}", defaultValue); + prepareValueBeforeDelete(compInstId, inputForDelete, propertyValue, propertyValue.getPath()); + status = toscaOperationFacade.updateComponentInstanceProperty(component, compInstId, propertyValue); if(status != StorageOperationStatus.OK){ log.debug("Component id: {} update component instance property {} id: {} failed", componentId, propertyValue.getUniqueId(), inputId); @@ -984,6 +956,47 @@ public class InputsBusinessLogic extends BaseBusinessLogic { } } + private Either<InputDefinition, ResponseFormat> prepareValueBeforeDelete(String compInstId, InputDefinition inputForDelete, PropertyDefinition inputValue, List<String> pathOfComponentInstances) { + Either<InputDefinition, ResponseFormat> deleteEither = Either.left(inputForDelete); + String value = inputValue.getValue(); + Map<String, Object> mappedToscaTemplate = (Map<String, Object>) new Yaml().load(value); + + resetInputName(mappedToscaTemplate, inputForDelete.getName()); + + value = ""; + if(!mappedToscaTemplate.isEmpty()){ + Either result = cleanNestedMap(mappedToscaTemplate , true); + Map modifiedMappedToscaTemplate = mappedToscaTemplate; + if (result.isLeft()) + modifiedMappedToscaTemplate = (Map)result.left().value(); + else + Log.warn("Map cleanup failed -> " +result.right().value().toString()); //continue, don't break operation + value = gson.toJson(modifiedMappedToscaTemplate); + } + inputValue.setValue(value); + + + List<GetInputValueDataDefinition> getInputsValues = inputValue.getGetInputValues(); + if(getInputsValues != null && !getInputsValues.isEmpty()){ + Optional<GetInputValueDataDefinition> op = getInputsValues.stream().filter(gi -> gi.getInputId().equals(inputForDelete.getUniqueId())).findAny(); + if(op.isPresent()){ + getInputsValues.remove(op.get()); + } + } + inputValue.setGetInputValues(getInputsValues); + + Either<String, TitanOperationStatus> findDefaultValue = propertyOperation.findDefaultValueFromSecondPosition(pathOfComponentInstances, inputValue.getUniqueId(), inputValue.getDefaultValue()); + if (findDefaultValue.isRight()) { + deleteEither = Either.right(componentsUtils.getResponseFormat(componentsUtils.convertFromStorageResponse(DaoStatusConverter.convertTitanStatusToStorageStatus(findDefaultValue.right().value())))); + return deleteEither; + + } + String defaultValue = findDefaultValue.left().value(); + inputValue.setDefaultValue(defaultValue); + log.debug("The returned default value in ResourceInstanceProperty is {}", defaultValue); + return deleteEither; + } + private Either<InputDefinition, ResponseFormat> prepareAndValidateInputBeforeCreate(InputDefinition newInputDefinition, Map<String, DataTypeDefinition> dataTypes) { @@ -1196,7 +1209,7 @@ public class InputsBusinessLogic extends BaseBusinessLogic { - private Either<List<InputDefinition>, ResponseFormat> createInputsFromProperty(org.openecomp.sdc.be.model.Component component, Map<String, org.openecomp.sdc.be.model.Component> origComponentMap, Map<String, InputDefinition> inputsToCreate, Map<String, List<ComponentInstanceProperty>> propertiesToCreateMap, Map<String, DataTypeDefinition> dataTypes, List<InputDefinition> resList, Map<String, List<ComponentInstancePropInput>> newInputsPropsMap) { + private Either<List<InputDefinition>, ResponseFormat> createInputsFromProperty(org.openecomp.sdc.be.model.Component component, Map<String, org.openecomp.sdc.be.model.Component> origComponentMap, Map<String, InputDefinition> inputsToCreate, Map<String, List<ComponentInstanceProperty>> propertiesToCreateMap, Map<String, List<ComponentInstanceInput>> inputsValueToCreateMap, Map<String, DataTypeDefinition> dataTypes, List<InputDefinition> resList, Map<String, List<ComponentInstancePropInput>> newInputsPropsMap, boolean isInputValue) { List<ComponentInstance> ciList = component.getComponentInstances(); String componentId = component.getUniqueId(); for (Entry<String, List<ComponentInstancePropInput>> entry : newInputsPropsMap.entrySet()) { @@ -1206,7 +1219,14 @@ public class InputsBusinessLogic extends BaseBusinessLogic { propertiesToCreate = propertiesToCreateMap.get(compInstId); }else{ propertiesToCreate = new ArrayList<>(); - } + } + + List<ComponentInstanceInput> inputsValueToCreate = null; + if(propertiesToCreateMap.containsKey(compInstId)){ + inputsValueToCreate = inputsValueToCreateMap.get(compInstId); + }else{ + inputsValueToCreate = new ArrayList<>(); + } List<ComponentInstancePropInput> properties = entry.getValue(); @@ -1238,7 +1258,7 @@ public class InputsBusinessLogic extends BaseBusinessLogic { propInput.setOwnerId(null); propInput.setParentUniqueId(null); - Either<InputDefinition, StorageOperationStatus> createInputRes = createInputForComponentInstance(component, origComponent,ci, inputsToCreate, propertiesToCreate, dataTypes, inputName, propInput); + Either<InputDefinition, StorageOperationStatus> createInputRes = createInputForComponentInstance(component, origComponent,ci, inputsToCreate, propertiesToCreate, inputsValueToCreate, dataTypes, inputName, propInput, isInputValue); if (createInputRes.isRight()) { log.debug("Failed to create input of resource instance for id {} error {}", compInstId, createInputRes.right().value()); @@ -1249,14 +1269,19 @@ public class InputsBusinessLogic extends BaseBusinessLogic { resList.add(createInputRes.left().value()); } - propertiesToCreateMap.put(compInstId, propertiesToCreate); + if(! isInputValue){ + propertiesToCreateMap.put(compInstId, propertiesToCreate); + } + else{ + inputsValueToCreateMap.put(compInstId, inputsValueToCreate); + } } } return Either.left(resList); } - private Either<InputDefinition, StorageOperationStatus> createInputForComponentInstance(org.openecomp.sdc.be.model.Component component,org.openecomp.sdc.be.model.Component orignComponent, ComponentInstance ci, Map<String, InputDefinition> inputsToCreate, List<ComponentInstanceProperty> propertiesToCreate, Map<String, DataTypeDefinition> dataTypes, String inputName, ComponentInstancePropInput propInput) { + private Either<InputDefinition, StorageOperationStatus> createInputForComponentInstance(org.openecomp.sdc.be.model.Component component,org.openecomp.sdc.be.model.Component orignComponent, ComponentInstance ci, Map<String, InputDefinition> inputsToCreate, List<ComponentInstanceProperty> propertiesToCreate, List<ComponentInstanceInput> inputsValueToCreate, Map<String, DataTypeDefinition> dataTypes, String inputName, ComponentInstancePropInput propInput, boolean isInputValue) { String propertiesName = propInput.getPropertiesName() ; PropertyDefinition selectedProp = propInput.getInput(); String[] parsedPropNames = propInput.getParsedPropNames(); @@ -1270,14 +1295,22 @@ public class InputsBusinessLogic extends BaseBusinessLogic { } InputDefinition input = null; - ComponentInstanceProperty prop = propInput; + PropertyDefinition prop = propInput; - if(CollectionUtils.isNotEmpty(propertiesToCreate)){ + if(CollectionUtils.isNotEmpty(propertiesToCreate) && !isInputValue){ Optional<ComponentInstanceProperty> propOpt = propertiesToCreate.stream().filter(p -> p.getName().equals(propInput.getName())).findFirst(); if(propOpt.isPresent()){ prop = propOpt.get(); } + }else{ + if(CollectionUtils.isNotEmpty(inputsValueToCreate) && isInputValue){ + Optional<ComponentInstanceInput> propOpt = inputsValueToCreate.stream().filter(p -> p.getName().equals(propInput.getName())).findFirst(); + if(propOpt.isPresent()){ + prop = propOpt.get(); + } + } } + boolean complexProperty = false; if(propertiesName != null && !propertiesName.isEmpty() && selectedProp != null){ complexProperty = true; @@ -1317,7 +1350,7 @@ public class InputsBusinessLogic extends BaseBusinessLogic { if(!complexProperty){ jobject.put(GET_INPUT, input.getName()); prop.setValue(jobject.toJSONString()); - prop.setRules(null); + }else{ Map<String, Object> mappedToscaTemplate = (Map<String, Object>) objValue; @@ -1325,18 +1358,19 @@ public class InputsBusinessLogic extends BaseBusinessLogic { String json = gson.toJson(mappedToscaTemplate); prop.setValue(json); - prop.setRules(null); + } }else{ jobject.put(GET_INPUT, input.getName()); prop.setValue(jobject.toJSONString()); - prop.setRules(null); + } } - prop.setComponentInstanceId(ci.getUniqueId()); - prop.setComponentInstanceName(ci.getName()); + + ((IComponentInstanceConnectedElement)prop).setComponentInstanceId(ci.getUniqueId()); + ((IComponentInstanceConnectedElement)prop).setComponentInstanceName(ci.getName()); if(CollectionUtils.isEmpty(prop.getGetInputValues())){ prop.setGetInputValues(new ArrayList<>()); @@ -1348,17 +1382,31 @@ public class InputsBusinessLogic extends BaseBusinessLogic { getInputValueDataDefinition.setInputName(input.getName()); getInputValues.add(getInputValueDataDefinition); - if(!propertiesToCreate.contains(prop)){ - propertiesToCreate.add(prop); + if(!isInputValue){ + if(!propertiesToCreate.contains(prop)){ + propertiesToCreate.add((ComponentInstanceProperty)prop); + } + + inputsToCreate.put(input.getName(), input); + List<ComponentInstanceProperty> propertiesList = input.getProperties(); + if(propertiesList == null) + propertiesList = new ArrayList<>(); // adding the property with the new value for UI + propertiesList.add((ComponentInstanceProperty)prop); + input.setProperties(propertiesList); + }else{ + ComponentInstanceInput inputValue = new ComponentInstanceInput(prop); + if(!inputsValueToCreate.contains(inputValue)){ + inputsValueToCreate.add(inputValue);; + } + + inputsToCreate.put(input.getName(), input); + List<ComponentInstanceInput> inputsValueList = input.getInputs(); + if(inputsValueList == null) + inputsValueList = new ArrayList<>(); // adding the property with the new value for UI + inputsValueList.add(inputValue); + input.setInputs(inputsValueList); } - inputsToCreate.put(input.getName(), input); - List<ComponentInstanceProperty> propertiesList = input.getProperties(); - if(propertiesList == null) - propertiesList = new ArrayList<>(); // adding the property with the new value for UI - propertiesList.add(prop); - input.setProperties(propertiesList); - return Either.left(input); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/CrudExternalServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/CrudExternalServlet.java index 529d2aba4d..b4240777a8 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/CrudExternalServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/CrudExternalServlet.java @@ -120,7 +120,7 @@ public class CrudExternalServlet extends AbstractValidationsServlet { @ApiOperation(value = "creates a resource", httpMethod = "POST", notes = "Creates a resource") @ApiResponses(value = { @ApiResponse(code = 200, message = "ECOMP component is authenticated and Asset created", response = Resource.class), - @ApiResponse(code = 400, message = "Missing X-ECOMP-InstanceID HTTP header - POL5001"), + @ApiResponse(code = 400, message = "Missing 'X-ECOMP-InstanceID' HTTP header - POL5001"), @ApiResponse(code = 401, message = "ECOMP component should authenticate itself and to re-send again HTTP request with its Basic Authentication credentials - POL5002"), @ApiResponse(code = 403, message = "ECOMP component is not authorized - POL5003"), @ApiResponse(code = 404, message = "Error: Requested '%1' (uuid) resource was not found - SVC4063"), @@ -269,7 +269,7 @@ public class CrudExternalServlet extends AbstractValidationsServlet { @ApiOperation(value = "Change Resource lifecycle State", httpMethod = "POST") @ApiResponses(value = { @ApiResponse(code = 200, message = "Resource state changed", response = AssetMetadata.class), - @ApiResponse(code = 400, message = "Missing X-ECOMP-InstanceID HTTP header - POL5001"), + @ApiResponse(code = 400, message = "Missing 'X-ECOMP-InstanceID' HTTP header - POL5001"), @ApiResponse(code = 401, message = "ECOMP component should authenticate itself and to re-send again HTTP request with its Basic Authentication credentials - POL5002"), @ApiResponse(code = 403, message = "ECOMP component is not authorized - POL5003"), @ApiResponse(code = 404, message = "Error: Requested '%1' (uuid) resource was not found - SVC4063"), diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstInputsMap.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstInputsMap.java index 9d016c0799..e436548f60 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstInputsMap.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstInputsMap.java @@ -31,14 +31,14 @@ public class ComponentInstInputsMap implements Serializable{ */ private static final long serialVersionUID = 1136631343963488131L; - Map<String, List<InputDefinition>> componentInstanceInputsMap; + Map<String, List<ComponentInstancePropInput>> componentInstanceInputsMap; Map<String, List<ComponentInstancePropInput>> componentInstanceProperties; - public Map<String, List<InputDefinition>> getComponentInstanceInputsMap() { + public Map<String, List<ComponentInstancePropInput>> getComponentInstanceInputsMap() { return componentInstanceInputsMap; } - public void setComponentInstanceInputsMap(Map<String, List<InputDefinition>> componentInstanceInputsMap) { + public void setComponentInstanceInputsMap(Map<String, List<ComponentInstancePropInput>> componentInstanceInputsMap) { this.componentInstanceInputsMap = componentInstanceInputsMap; } diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstanceProperty.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstanceProperty.java index 8bd3a9c809..25bbb50da4 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstanceProperty.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstanceProperty.java @@ -23,11 +23,11 @@ package org.openecomp.sdc.be.model; import java.io.Serializable; import java.util.List; - import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyRule; -public class ComponentInstanceProperty extends PropertyDefinition implements IComponentInstanceConnectedElement, Serializable { + +public class ComponentInstanceProperty extends PropertyDefinition implements IComponentInstanceConnectedElement, Serializable{ /** * diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/IComponentInstanceConnectedElement.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/IComponentInstanceConnectedElement.java index 86de3a1584..80e898626e 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/IComponentInstanceConnectedElement.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/IComponentInstanceConnectedElement.java @@ -26,4 +26,9 @@ public interface IComponentInstanceConnectedElement { String getValueUniqueUid(); void setValueUniqueUid(String value); + + String getComponentInstanceName(); + void setComponentInstanceName(String componentInstanceName); + String getComponentInstanceId(); + void setComponentInstanceId(String componentInstanceId); } diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java index 29247996a5..33db64234b 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java @@ -598,26 +598,8 @@ public class NodeTemplateOperation extends BaseOperation { if (status != StorageOperationStatus.OK) { return status; } - status = addInstanceDeploymentArtifacts(originNodeType, componentInstance, updatedContainerVertex, user, envType); - if (status != StorageOperationStatus.OK) { - return status; - } + return addCalculatedCapReqFromNodeType(originNodeType, componentInstance, updatedContainerVertex); - - } - - private StorageOperationStatus addInstanceDeploymentArtifacts(ToscaElement originNodeType, ComponentInstanceDataDefinition componentInstance, GraphVertex updatedContainerVertex, User user, String envType) { - Map<String, ArtifactDataDefinition> deploymentArtifacts = originNodeType.getDeploymentArtifacts(); - MapArtifactDataDefinition instArtifacts = prepareInstDeploymentArtifactPerInstance(deploymentArtifacts, componentInstance.getUniqueId(), user, envType); - if (instArtifacts != null) { - StorageOperationStatus calculatedResult = addToscaDataDeepElementsBlockToToscaElement(updatedContainerVertex, EdgeLabelEnum.INST_DEPLOYMENT_ARTIFACTS, VertexTypeEnum.INST_DEPLOYMENT_ARTIFACTS, instArtifacts, - componentInstance.getUniqueId()); - - if (calculatedResult != StorageOperationStatus.OK) { - return calculatedResult; - } - } - return StorageOperationStatus.OK; } public MapArtifactDataDefinition prepareInstDeploymentArtifactPerInstance(Map<String, ArtifactDataDefinition> deploymentArtifacts, String componentInstanceId, User user, String envType) { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IInputsOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IInputsOperation.java index 386864a8b0..8b44229df1 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IInputsOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IInputsOperation.java @@ -43,8 +43,6 @@ public interface IInputsOperation { Either<List<InputDefinition>, TitanOperationStatus> addInputsToGraph(String componentId, NodeTypeEnum nodeType, Map<String, InputDefinition> inputs, Map<String, DataTypeDefinition> dataTypes); - Either<List<InputDefinition>, StorageOperationStatus> addInputsToComponent(String resourceId, NodeTypeEnum nodeType, ComponentInstInputsMap componentInsInputs, Map<String, DataTypeDefinition> dataTypes); - TitanOperationStatus findNodeNonInheretedInputs(String uniqueId, List<InputDefinition> inputs); Either<List<InputDefinition>, StorageOperationStatus> getInputsOfComponent(String compId, String fromName, int amount); diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InputsOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InputsOperation.java index dba4ff9b75..d3db95df65 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InputsOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InputsOperation.java @@ -1210,121 +1210,7 @@ public class InputsOperation extends AbstractOperation implements IInputsOperati } - public Either<List<InputDefinition>, StorageOperationStatus> addInputsToComponent(String resourceId, NodeTypeEnum nodeType, ComponentInstInputsMap componentInsInputs, Map<String, DataTypeDefinition> dataTypes) { - List<InputDefinition> resList = new ArrayList<InputDefinition>(); - Map<String, List<InputDefinition>> newInputsMap = componentInsInputs.getComponentInstanceInputsMap(); - if (newInputsMap != null && !newInputsMap.isEmpty()) { - for (Entry<String, List<InputDefinition>> entry : newInputsMap.entrySet()) { - String compInstId = entry.getKey(); - Either<TitanVertex, TitanOperationStatus> ciVertexEither = titanGenericDao.getVertexByProperty(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), compInstId); - if (ciVertexEither.isRight()) { - log.debug("Failed to fetch vertex of resource instance for id {} error {}", compInstId, ciVertexEither.right().value()); - return Either.right( DaoStatusConverter.convertTitanStatusToStorageStatus(ciVertexEither.right().value())); - } - TitanVertex ciVertex = ciVertexEither.left().value(); - - - //String originType = (String) titanGenericDao.getProperty(originVertex, GraphPropertiesDictionary.LABEL.getProperty()); - String compInstname = (String) titanGenericDao.getProperty(ciVertex, GraphPropertiesDictionary.NORMALIZED_NAME.getProperty()); - - List<InputDefinition> inputs = entry.getValue(); - - if (inputs != null && !inputs.isEmpty()) { - for (InputDefinition input : inputs) { - - - Either<Integer, StorageOperationStatus> counterRes = componentInstanceOperation.increaseAndGetResourceInstanceSpecificCounter(compInstId, GraphPropertiesDictionary.INPUT_COUNTER, true); - if (counterRes.isRight()) { - log.debug("increaseAndGetResourceInputCounter failed resource instance {}", compInstId); - StorageOperationStatus status = counterRes.right().value(); - return Either.right(status); - } - - Either<InputDefinition, TitanOperationStatus> oldInputEither = getInputFromGraph(input.getUniqueId(), true, true); - if (oldInputEither.isRight()) { - log.error("Failed to get input {} ", input.getUniqueId()); - - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(oldInputEither.right().value())); - } - - InputDefinition oldInput = oldInputEither.left().value(); - String serviceInputName = compInstname + "_" + input.getName(); - input.setName(serviceInputName); - - JSONObject jobject = new JSONObject(); - jobject.put(GET_INPUT, input.getName()); - - ComponentInstanceInput inputValue = new ComponentInstanceInput(oldInput, jobject.toJSONString(), null); - Integer index = counterRes.left().value(); - - Either<ComponentInstanceInput, StorageOperationStatus> eitherStatus = componentInstanceOperation.addInputValueToResourceInstance(inputValue, compInstId, index, true); - - if (eitherStatus.isRight()) { - log.error("Failed to add input value {} to resource instance {} in Graph. status is {}", inputValue, compInstId, eitherStatus.right().value().name()); - - return Either.right(eitherStatus.right().value()); - } - ComponentInstanceInput inputValueData = eitherStatus.left().value(); - - input.setSchema(oldInputEither.left().value().getSchema()); - input.setDefaultValue(oldInput.getDefaultValue()); - input.setConstraints(oldInput.getConstraints()); - input.setDescription(oldInput.getDescription()); - input.setHidden(oldInput.isHidden()); - input.setImmutable(oldInput.isImmutable()); - input.setDefinition(oldInput.isDefinition()); - input.setRequired(oldInput.isRequired()); - - StorageOperationStatus validateAndUpdateProperty = validateAndUpdateProperty(input, dataTypes); - if (validateAndUpdateProperty != StorageOperationStatus.OK) { - log.error("Property {} is invalid. Status is {}", input, validateAndUpdateProperty); - return Either.right(validateAndUpdateProperty); - } - - Either<InputsData, TitanOperationStatus> addPropertyToGraph = addInputToGraph(serviceInputName, input, resourceId, nodeType); - if (addPropertyToGraph.isRight()) { - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(addPropertyToGraph.right().value())); - } - InputDefinition createdInputyDefinition = convertInputDataToInputDefinition(addPropertyToGraph.left().value()); - createdInputyDefinition.setName(serviceInputName); - createdInputyDefinition.setParentUniqueId(resourceId); - - Map<String, Object> props = new HashMap<String, Object>(); - props.put(GraphEdgePropertiesDictionary.NAME.getProperty(), createdInputyDefinition.getName()); - props.put(GraphEdgePropertiesDictionary.OWNER_ID.getProperty(), compInstId); - - GraphNode propertyData = new UniqueIdData(NodeTypeEnum.InputValue, inputValueData.getValueUniqueUid()); - - Either<GraphRelation, TitanOperationStatus> addPropRefResult = titanGenericDao.createRelation(addPropertyToGraph.left().value(), propertyData, GraphEdgeLabels.GET_INPUT, props); - - if (addPropRefResult.isRight()) { - TitanOperationStatus status = addPropRefResult.right().value(); - String description = "Failed to associate input " + addPropertyToGraph.left().value().getUniqueId() + " to input value " + inputValueData.getUniqueId() + " in graph. Status is " + status; - BeEcompErrorManager.getInstance().logInternalFlowError(ASSOCIATING_INPUT_TO_PROP, description, ErrorSeverity.ERROR); - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status)); - } - - resList.add(createdInputyDefinition); - - } - } - - } - } - Map<String, List<ComponentInstancePropInput>> newInputsPropsMap = componentInsInputs.getComponentInstanceProperties(); - if (newInputsPropsMap != null && !newInputsPropsMap.isEmpty()) { - Either<List<InputDefinition>, StorageOperationStatus> result = createInputsFromProperty(resourceId, nodeType, dataTypes, resList, newInputsPropsMap); - - if (result.isRight()) { - log.debug("Failed to create inputs of resource for id {} error {}", resourceId, result.right().value()); - return result; - } - resList = result.left().value(); - - } - return Either.left(resList); - } private Either<List<InputDefinition>, StorageOperationStatus> createInputsFromProperty(String resourceId, NodeTypeEnum nodeType, Map<String, DataTypeDefinition> dataTypes, List<InputDefinition> resList, Map<String, List<ComponentInstancePropInput>> newInputsPropsMap) { for (Entry<String, List<ComponentInstancePropInput>> entry : newInputsPropsMap.entrySet()) { diff --git a/catalog-ui/src/app/ng2/pages/properties-assignment/properties.utils.ts b/catalog-ui/src/app/ng2/pages/properties-assignment/properties.utils.ts index a3507feb6f..f876af7f8a 100644 --- a/catalog-ui/src/app/ng2/pages/properties-assignment/properties.utils.ts +++ b/catalog-ui/src/app/ng2/pages/properties-assignment/properties.utils.ts @@ -56,21 +56,21 @@ export class PropertiesUtils { if (newFEProp.getInputValues && newFEProp.getInputValues.length) { //if this prop (or any children) are declared, set isDeclared and disable checkbox on parents/children newFEProp.getInputValues.forEach(propInputDetail => { let inputPath = propInputDetail.inputPath; - if (!isVF && !inputPath) { //TODO: this is a workaround until Marina adds inputPath + if (!inputPath) { //TODO: this is a workaround until Marina adds inputPath let input = inputs.find(input => input.uniqueId == propInputDetail.inputId); if (!input) { console.log("CANNOT FIND INPUT FOR " + propInputDetail.inputId); return; } else inputPath = input.inputPath; } - if (isVF || inputPath == newFEProp.name) inputPath = undefined; + if (inputPath == newFEProp.name) inputPath = undefined; // if not complex we need to remove the inputPath from FEModel so we not look for a child newFEProp.setAsDeclared(inputPath); //if a path is sent, its a child prop. this param is optional this.propertiesService.disableRelatedProperties(newFEProp, inputPath); }); - } + } this.initValueObjectRef(newFEProp); //initialize valueObj. propertyFeArray.push(newFEProp); newFEProp.updateExpandedChildPropertyId(newFEProp.name); //display only the first level of children this.dataTypeService.checkForCustomBehavior(newFEProp); - } + } }); instanceFePropertiesMap[instanceId] = propertyFeArray; @@ -101,8 +101,8 @@ export class PropertiesUtils { this.dataTypeService.getDerivedDataTypeProperties(dataTypeObj, tempProps, parentName); return tempProps; } - - /* Sets the valueObj of parent property and its children. + + /* Sets the valueObj of parent property and its children. * Note: This logic is different than assignflattenedchildrenvalues - here we merge values, there we pick either the parents value, props value, or default value - without merging. */ public initValueObjectRef = (property: PropertyFEModel): void => { @@ -138,7 +138,7 @@ export class PropertiesUtils { let propNameInObj = prop.propertiesName.substring(prop.propertiesName.indexOf(parentName) + parentName.length + 1).split('#').join('.'); //extract everything after parent name prop.valueObj = _.get(parentValueJSON, propNameInObj, prop.value || prop.defaultValue); //assign value -first value of parent if exists. If not, prop.value if not, prop.defaultvalue - + if ((prop.derivedDataType == DerivedPropertyType.SIMPLE || prop.isDeclared) && typeof prop.valueObj == 'object') { //Stringify objects that should be strings prop.valueObj = JSON.stringify(prop.valueObj); } else { //parse strings that should be objects @@ -148,7 +148,7 @@ export class PropertiesUtils { prop.valueObj = JSON.parse(prop.valueObj || '[]'); } else if (prop.derivedDataType == DerivedPropertyType.MAP && typeof prop.valueObj != 'object' && (!prop.isChildOfListOrMap || !prop.schema.property.isSimpleType)) { //dont parse values for children of map of simple prop.valueObj = JSON.parse(prop.valueObj || '{}'); - } + } if ((prop.derivedDataType == DerivedPropertyType.LIST || prop.derivedDataType == DerivedPropertyType.MAP) && typeof prop.valueObj == 'object' && Object.keys(prop.valueObj).length) { let newProps: Array<DerivedFEProperty> = []; Object.keys(prop.valueObj).forEach((key) => { diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ExportToscaTest.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ExportToscaTest.java index 163504fbb0..a6088deac0 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ExportToscaTest.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/imports/ExportToscaTest.java @@ -50,6 +50,7 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstInputsMap; import org.openecomp.sdc.be.model.ComponentInstance; import org.openecomp.sdc.be.model.ComponentInstanceInput; +import org.openecomp.sdc.be.model.ComponentInstancePropInput; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.GroupDefinition; import org.openecomp.sdc.be.model.InputDefinition; @@ -316,9 +317,9 @@ public class ExportToscaTest extends ComponentBaseTest { //6 add instance inputs in service RestResponse getComponentInstanceInputsResponse = InputsRestUtils.getComponentInstanceInputs(service, vfi); BaseValidationUtils.checkSuccess(getComponentInstanceInputsResponse); - List<InputDefinition> instanceInputs = new Gson().fromJson(getComponentInstanceInputsResponse.getResponse(), new TypeToken<ArrayList<InputDefinition>>(){}.getType()); + List<ComponentInstancePropInput> instanceInputs = new Gson().fromJson(getComponentInstanceInputsResponse.getResponse(), new TypeToken<ArrayList<ComponentInstancePropInput>>(){}.getType()); // Take only the 2 first inputs - List<InputDefinition> inputsToAdd = instanceInputs.stream().limit(2).collect(Collectors.toList()); + List<ComponentInstancePropInput> inputsToAdd = instanceInputs.stream().limit(2).collect(Collectors.toList()); //7 Build component instances input map to add to server ComponentInstInputsMap buildComponentInstInputsMap = buildComponentInstInputsMap(vfi.getUniqueId(), inputsToAdd); @@ -447,8 +448,8 @@ public class ExportToscaTest extends ComponentBaseTest { } return masterArtifact; } - private ComponentInstInputsMap buildComponentInstInputsMap (String addToInput, List<InputDefinition> inputs) { - Map<String, List<InputDefinition>> map = new HashMap<>(); + private ComponentInstInputsMap buildComponentInstInputsMap (String addToInput, List<ComponentInstancePropInput> inputs) { + Map<String, List<ComponentInstancePropInput>> map = new HashMap<>(); map.put(addToInput, inputs); ComponentInstInputsMap componentInstInputsMap = new ComponentInstInputsMap(); componentInstInputsMap.setComponentInstanceInputsMap(map); diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/inputs/InputsApiTests.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/inputs/InputsApiTests.java index 345b81eb3e..560e5389fe 100644 --- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/inputs/InputsApiTests.java +++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/execute/inputs/InputsApiTests.java @@ -37,6 +37,7 @@ import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstInputsMap; import org.openecomp.sdc.be.model.ComponentInstance; +import org.openecomp.sdc.be.model.ComponentInstancePropInput; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; @@ -130,10 +131,10 @@ public class InputsApiTests extends ComponentBaseTest { ComponentInstance vfInstance = serviceInstances.get(0); RestResponse getComponentInstanceInputsResponse = InputsRestUtils.getComponentInstanceInputs(service, vfInstance); BaseValidationUtils.checkSuccess(getComponentInstanceInputsResponse); - List<InputDefinition> instanceInputs = new Gson().fromJson(getComponentInstanceInputsResponse.getResponse(), new TypeToken<ArrayList<InputDefinition>>(){}.getType()); + List<ComponentInstancePropInput> instanceInputs = new Gson().fromJson(getComponentInstanceInputsResponse.getResponse(), new TypeToken<ArrayList<ComponentInstancePropInput>>(){}.getType()); // Take only the 2 first inputs - List<InputDefinition> inputsToAdd = instanceInputs.stream().limit(2).collect(Collectors.toList()); + List<ComponentInstancePropInput> inputsToAdd = instanceInputs.stream().limit(2).collect(Collectors.toList()); // Build component instances input map to add to server ComponentInstInputsMap buildComponentInstInputsMap = buildComponentInstInputsMap(vfInstance.getUniqueId(), inputsToAdd); @@ -214,8 +215,8 @@ public class InputsApiTests extends ComponentBaseTest { * @param inputs * @return {@link org.openecomp.sdc.be.model.ComponentInstInputsMap} */ - private ComponentInstInputsMap buildComponentInstInputsMap (String addToInput, List<InputDefinition> inputs) { - Map<String, List<InputDefinition>> map = new HashMap<>(); + private ComponentInstInputsMap buildComponentInstInputsMap (String addToInput, List<ComponentInstancePropInput> inputs) { + Map<String, List<ComponentInstancePropInput>> map = new HashMap<>(); map.put(addToInput, inputs); ComponentInstInputsMap componentInstInputsMap = new ComponentInstInputsMap(); componentInstInputsMap.setComponentInstanceInputsMap(map); |