summaryrefslogtreecommitdiffstats
path: root/catalog-model/src
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-model/src')
-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);