diff options
author | andre.schmid <andre.schmid@est.tech> | 2022-07-07 17:17:52 +0100 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2022-07-18 14:22:12 +0000 |
commit | 68733163804ed2efed8223a04ab0a7a0714a8b33 (patch) | |
tree | 013f4d25042aa776120971a612a52d64db52f7a7 /catalog-model/src/test/java | |
parent | 4e4ec8e9c21acf7f9210aaebf8f13a60542737fc (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/src/test/java')
-rw-r--r-- | catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/GroupsOperationTest.java | 29 |
1 files changed, 27 insertions, 2 deletions
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); |