summaryrefslogtreecommitdiffstats
path: root/catalog-model
diff options
context:
space:
mode:
authorandre.schmid <andre.schmid@est.tech>2022-07-07 17:17:52 +0100
committerMichael Morris <michael.morris@est.tech>2022-07-18 14:22:12 +0000
commit68733163804ed2efed8223a04ab0a7a0714a8b33 (patch)
tree013f4d25042aa776120971a612a52d64db52f7a7 /catalog-model
parent4e4ec8e9c21acf7f9210aaebf8f13a60542737fc (diff)
Support for concat TOSCA function
Adds support for the concat TOSCA function in an instance property. Refactors the TOSCA function structure so it can be more generic to support other functions in the future. Change-Id: I338e4138d26afe21779da57c4eeb3f2d486c20a9 Issue-ID: SDC-4095 Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'catalog-model')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperation.java3
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperationTest.java29
2 files changed, 28 insertions, 4 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperation.java
index d20d2afea0..d346d9364a 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperation.java
@@ -313,8 +313,7 @@ public class GroupsOperation extends BaseOperation {
Optional<PropertyDataDefinition> currentProp = properties.stream().filter(p -> p.getName().equals(np.getName())).findAny();
if (currentProp.isPresent()) {
currentProp.get().setValue(np.getValue());
- currentProp.get().setToscaGetFunction(np.getToscaGetFunction());
- currentProp.get().setToscaGetFunctionType(np.getToscaGetFunctionType());
+ currentProp.get().setToscaFunction(np.getToscaFunction());
}
});
updateVersion(promoteMinorVersion, group);
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperationTest.java
index ab4e991b7f..bb45b9b7e1 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperationTest.java
@@ -22,6 +22,8 @@ package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import fj.data.Either;
import java.util.List;
@@ -33,9 +35,11 @@ import org.openecomp.sdc.be.dao.config.JanusGraphSpringConfig;
import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphDao;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
+import org.openecomp.sdc.be.datatypes.enums.PromoteVersionEnum;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.GroupDefinition;
+import org.openecomp.sdc.be.model.GroupProperty;
import org.openecomp.sdc.be.model.ModelTestBase;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.config.ModelOperationsSpringConfig;
@@ -75,7 +79,7 @@ public class GroupsOperationTest extends ModelTestBase {
}
@Test
- public void addGroups_whenContainerHasNoGroups_associateContainerWithGroup() {
+ void addGroups_whenContainerHasNoGroups_associateContainerWithGroup() {
GroupDefinition g1 = createGroupDefinition("g1");
GroupDefinition g2 = createGroupDefinition("g2");
Either<List<GroupDefinition>, StorageOperationStatus> createGroups = groupsOperation.addGroups(container, asList(g1, g2));
@@ -90,7 +94,7 @@ public class GroupsOperationTest extends ModelTestBase {
}
@Test
- public void addGroups_whenContainerHasGroups_addTheGivenGroupsToTheGroupsList() {
+ void addGroups_whenContainerHasGroups_addTheGivenGroupsToTheGroupsList() {
GroupDefinition g1 = createGroupDefinition("g1");
GroupDefinition g2 = createGroupDefinition("g2");
groupsOperation.addGroups(container, asList(g1, g2)).left().value();
@@ -109,6 +113,27 @@ public class GroupsOperationTest extends ModelTestBase {
}
+ @Test
+ void updateGroupPropertiesOnComponent() {
+ final GroupDefinition group = createGroupDefinition("groupId");
+ final GroupProperty groupProperty1 = new GroupProperty();
+ groupProperty1.setName("property1");
+
+ final GroupProperty groupProperty2 = new GroupProperty();
+ groupProperty1.setName("property2");
+ group.setProperties(List.of(groupProperty1, groupProperty2));
+
+ final GroupProperty newProperty1 = new GroupProperty();
+ newProperty1.setName("property2");
+ final List<GroupProperty> newGroupProperties = List.of(newProperty1);
+
+ final Either<List<GroupProperty>, StorageOperationStatus> resultEither =
+ groupsOperation.updateGroupPropertiesOnComponent(CONTAINER_ID, group, newGroupProperties, PromoteVersionEnum.MINOR);
+
+ assertTrue(resultEither.isLeft());
+ assertEquals(newGroupProperties, resultEither.left().value());
+ }
+
private GroupDefinition createGroupDefinition(String id) {
GroupDefinition groupDefinition = new GroupDefinition();
groupDefinition.setUniqueId(id);