summaryrefslogtreecommitdiffstats
path: root/catalog-be/src
diff options
context:
space:
mode:
authorJvD_Ericsson <jeff.van.dam@est.tech>2022-06-13 14:09:06 +0100
committerMichael Morris <michael.morris@est.tech>2022-06-20 22:02:54 +0000
commit664450db1c0aa36262557eced817862d77f758ee (patch)
tree432b0ccdc6c5278476595d942c022a7351aa6339 /catalog-be/src
parent7081d625ddd0aadcb64f5ba882339fabb612233d (diff)
Service Import - Node Template Node Filter
Issue-ID: SDC-4049 Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech> Change-Id: If0de045f88db44d14936e6fcc55ad623fb235174
Diffstat (limited to 'catalog-be/src')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogic.java11
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogicTest.java2
2 files changed, 11 insertions, 2 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogic.java
index e60ced5cc7..65b5794687 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogic.java
@@ -358,9 +358,17 @@ public class ComponentNodeFilterBusinessLogic extends BaseBusinessLogic {
List<RequirementNodeFilterPropertyDataDefinition> properties = ciNodeFilterDataDefinition.getProperties()
.getListToscaDataDefinition();
if (!properties.isEmpty()) {
+ final Component component;
+ try {
+ component = getComponent(componentId);
+ } catch (BusinessLogicException e) {
+ throw new ComponentException(e.getResponseFormat());
+ }
properties.forEach(property -> {
+ String propertyType = getComponentInstancePropertyType(component, componentInstanceId, property.getName());
RequirementNodeFilterPropertyDataDefinition requirementNodeFilterPropertyDataDefinition =
getRequirementNodeFilterPropertyDataDefinition(property);
+ requirementNodeFilterPropertyDataDefinition.setType(propertyType);
Either<CINodeFilterDataDefinition, StorageOperationStatus> nodeFilterProperty = nodeFilterOperation
.addNewProperty(componentId, componentInstanceId, nodeFilter.left().value(), requirementNodeFilterPropertyDataDefinition);
if (nodeFilterProperty.isRight()) {
@@ -396,8 +404,7 @@ public class ComponentNodeFilterBusinessLogic extends BaseBusinessLogic {
private List<String> getNodeFilterConstraints(String name, List<String> value) {
List<String> constraints = new ArrayList<>();
- String values = value.get(0).split("\n")[0];
- constraints.add(name + ": {" + values + "}");
+ constraints.add(name + ":\n " + value.get(0));
return constraints;
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogicTest.java
index 3b717fb51d..aae88ab153 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentNodeFilterBusinessLogicTest.java
@@ -570,6 +570,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock
nodeFilterMap.put(componentInstanceId, filter);
when(nodeFilterOperation.createNodeFilter(componentId, componentInstanceId)).thenReturn(Either.left(ciNodeFilterDataDefinition));
+ when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(resource));
when(nodeFilterOperation.addNewProperty(anyString(), anyString(), any(CINodeFilterDataDefinition.class),
any(RequirementNodeFilterPropertyDataDefinition.class))).thenReturn(Either.left(ciNodeFilterDataDefinition));
@@ -593,6 +594,7 @@ public class ComponentNodeFilterBusinessLogicTest extends BaseBusinessLogicMock
nodeFilterMap.put(componentInstanceId, filter);
when(nodeFilterOperation.createNodeFilter(componentId, componentInstanceId)).thenReturn(Either.left(ciNodeFilterDataDefinition));
+ when(toscaOperationFacade.getToscaElement(componentId)).thenReturn(Either.left(resource));
when(nodeFilterOperation.addNewProperty(anyString(), anyString(), any(CINodeFilterDataDefinition.class),
any(RequirementNodeFilterPropertyDataDefinition.class))).thenReturn(Either.right(StorageOperationStatus.GENERAL_ERROR));
33' href='#n333'>333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369