diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/src/main/java/org/onap/policy/pap/main/rest/depundep/PdpGroupDeployProvider.java | 2 | ||||
-rw-r--r-- | main/src/test/java/org/onap/policy/pap/main/rest/depundep/TestPdpGroupDeployProvider.java | 16 |
2 files changed, 18 insertions, 0 deletions
diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/depundep/PdpGroupDeployProvider.java b/main/src/main/java/org/onap/policy/pap/main/rest/depundep/PdpGroupDeployProvider.java index da9e46f4..2f94d39d 100644 --- a/main/src/main/java/org/onap/policy/pap/main/rest/depundep/PdpGroupDeployProvider.java +++ b/main/src/main/java/org/onap/policy/pap/main/rest/depundep/PdpGroupDeployProvider.java @@ -192,6 +192,8 @@ public class PdpGroupDeployProvider extends ProviderBase { } boolean updated = updateField(dbgroup.getDescription(), group.getDescription(), dbgroup::setDescription); + updated = updateField(dbgroup.getPdpGroupState(), group.getPdpGroupState(), dbgroup::setPdpGroupState) + || updated; updated = notifyPdpsDelSubGroups(data, dbgroup, group) || updated; updated = addOrUpdateSubGroups(data, dbgroup, group, result) || updated; diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/depundep/TestPdpGroupDeployProvider.java b/main/src/test/java/org/onap/policy/pap/main/rest/depundep/TestPdpGroupDeployProvider.java index 899b5695..60f9d2e8 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/depundep/TestPdpGroupDeployProvider.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/depundep/TestPdpGroupDeployProvider.java @@ -233,6 +233,22 @@ public class TestPdpGroupDeployProvider extends ProviderSuper { } @Test + public void testUpdateGroup_NewState() throws Exception { + PdpGroups groups = loadPdpGroups("createGroups.json"); + PdpGroup newgrp = groups.getGroups().get(0); + PdpGroup group = new PdpGroup(newgrp); + group.setPdpGroupState(PdpState.TEST); + when(dao.getPdpGroups(group.getName())).thenReturn(Arrays.asList(group)); + + prov.createOrUpdateGroups(groups); + + assertGroupUpdateOnly(group); + + assertEquals(PdpState.ACTIVE, group.getPdpGroupState()); + assertEquals(newgrp.toString(), group.toString()); + } + + @Test public void testUpdateGroup_NewSubGroup() throws Exception { PdpGroups groups = loadPdpGroups("createGroupsNewSub.json"); PdpGroup group = loadPdpGroups("createGroups.json").getGroups().get(0); |