summaryrefslogtreecommitdiffstats
path: root/models-provider/src/test/java/org
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2019-04-12 18:59:25 +0000
committerliamfallon <liam.fallon@est.tech>2019-04-12 18:59:25 +0000
commitb2ae3e6a44a3aa70ac1cd1d2ef78316bfc6e9d04 (patch)
tree195068aabadcb2853119945c22f84679de53e097 /models-provider/src/test/java/org
parent92d9b661cc32b8dcc90e813aa220e26ef6f83b17 (diff)
Remove version from PdpGroup
Issue-ID: POLICY-1095 Change-Id: I91f495947fe77222804e7ab31c4dd7d7aee66b44 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'models-provider/src/test/java/org')
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java198
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java12
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java12
3 files changed, 56 insertions, 166 deletions
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java
index ff8dfe322..ccdf45af4 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java
@@ -234,229 +234,119 @@ public class DatabasePolicyModelsProviderTest {
}).hasMessage("pdpGroups is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdpSubGroup(null, null, null);
+ databaseProvider.updatePdpSubGroup(null, null);
}).hasMessage("pdpGroupName is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdpSubGroup(null, null, new PdpSubGroup());
+ databaseProvider.updatePdpSubGroup(null, new PdpSubGroup());
}).hasMessage("pdpGroupName is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdpSubGroup(null, "version", null);
- }).hasMessage("pdpGroupName is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdpSubGroup(null, "version", new PdpSubGroup());
- }).hasMessage("pdpGroupName is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdpSubGroup("name", null, null);
- }).hasMessage("pdpGroupVersion is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdpSubGroup("name", null, new PdpSubGroup());
- }).hasMessage("pdpGroupVersion is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdpSubGroup("name", "version", null);
+ databaseProvider.updatePdpSubGroup("name", null);
}).hasMessage("pdpSubGroup is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdp(null, null, null, null);
- }).hasMessage("pdpGroupName is marked @NonNull but is null");
+ databaseProvider.updatePdpSubGroup("name", new PdpSubGroup());
+ }).hasMessage("parameter \"localName\" is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdp(null, null, null, new Pdp());
+ databaseProvider.updatePdp(null, null, null);
}).hasMessage("pdpGroupName is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdp(null, null, "sub", null);
+ databaseProvider.updatePdp(null, null, new Pdp());
}).hasMessage("pdpGroupName is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdp(null, null, "sub", new Pdp());
+ databaseProvider.updatePdp(null, "sub", null);
}).hasMessage("pdpGroupName is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdp(null, "version", null, null);
+ databaseProvider.updatePdp(null, "sub", new Pdp());
}).hasMessage("pdpGroupName is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdp(null, "version", null, new Pdp());
- }).hasMessage("pdpGroupName is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdp(null, "version", "sub", null);
- }).hasMessage("pdpGroupName is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdp(null, "version", "sub", new Pdp());
- }).hasMessage("pdpGroupName is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdp("name", null, null, null);
- }).hasMessage("pdpGroupVersion is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdp("name", null, null, new Pdp());
- }).hasMessage("pdpGroupVersion is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdp("name", null, "sub", null);
- }).hasMessage("pdpGroupVersion is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdp("name", null, "sub", new Pdp());
- }).hasMessage("pdpGroupVersion is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdp("name", "version", null, null);
+ databaseProvider.updatePdp("name", null, null);
}).hasMessage("pdpSubGroup is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdp("name", "version", null, new Pdp());
+ databaseProvider.updatePdp("name", null, new Pdp());
}).hasMessage("pdpSubGroup is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdp("name", "version", "sub", null);
+ databaseProvider.updatePdp("name", "sub", null);
}).hasMessage("pdp is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.deletePdpGroup(null, null);
- }).hasMessage("name is marked @NonNull but is null");
+ databaseProvider.updatePdp("name", "sub", new Pdp());
+ }).hasMessage("parameter \"localName\" is null");
assertThatThrownBy(() -> {
- databaseProvider.deletePdpGroup(null, "version");
+ databaseProvider.deletePdpGroup(null);
}).hasMessage("name is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.deletePdpGroup("name", null);
- }).hasMessage("version is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics(null, null, null, null, null);
+ databaseProvider.updatePdpStatistics(null, null, null, null);
}).hasMessage("pdpGroupName is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics(null, null, null, null, new PdpStatistics());
+ databaseProvider.updatePdpStatistics(null, null, null, new PdpStatistics());
}).hasMessage("pdpGroupName is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics(null, null, null, "Instance", null);
+ databaseProvider.updatePdpStatistics(null, null, "Instance", null);
}).hasMessage("pdpGroupName is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics(null, null, null, "Instance", new PdpStatistics());
+ databaseProvider.updatePdpStatistics(null, null, "Instance", new PdpStatistics());
}).hasMessage("pdpGroupName is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics(null, null, "type", null, null);
+ databaseProvider.updatePdpStatistics(null, "type", null, null);
}).hasMessage("pdpGroupName is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics(null, null, "type", null, new PdpStatistics());
+ databaseProvider.updatePdpStatistics(null, "type", null, new PdpStatistics());
}).hasMessage("pdpGroupName is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics(null, null, "type", "Instance", null);
+ databaseProvider.updatePdpStatistics(null, "type", "Instance", null);
}).hasMessage("pdpGroupName is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics(null, null, "type", "Instance", new PdpStatistics());
+ databaseProvider.updatePdpStatistics(null, "type", "Instance", new PdpStatistics());
}).hasMessage("pdpGroupName is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics(null, "ver", null, null, null);
- }).hasMessage("pdpGroupName is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics(null, "ver", null, null, new PdpStatistics());
- }).hasMessage("pdpGroupName is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics(null, "ver", null, "Instance", null);
- }).hasMessage("pdpGroupName is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics(null, "ver", null, "Instance", new PdpStatistics());
- }).hasMessage("pdpGroupName is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics(null, "ver", "type", null, null);
- }).hasMessage("pdpGroupName is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics(null, "ver", "type", null, new PdpStatistics());
- }).hasMessage("pdpGroupName is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics(null, "ver", "type", "Instance", null);
- }).hasMessage("pdpGroupName is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics(null, "ver", "type", "Instance", new PdpStatistics());
- }).hasMessage("pdpGroupName is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics("name", null, null, null, null);
- }).hasMessage("pdpGroupVersion is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics("name", null, null, null, new PdpStatistics());
- }).hasMessage("pdpGroupVersion is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics("name", null, null, "Instance", null);
- }).hasMessage("pdpGroupVersion is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics("name", null, null, "Instance", new PdpStatistics());
- }).hasMessage("pdpGroupVersion is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics("name", null, "type", null, null);
- }).hasMessage("pdpGroupVersion is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics("name", null, "type", null, new PdpStatistics());
- }).hasMessage("pdpGroupVersion is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics("name", null, "type", "Instance", null);
- }).hasMessage("pdpGroupVersion is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics("name", null, "type", "Instance", new PdpStatistics());
- }).hasMessage("pdpGroupVersion is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics("name", "ver", null, null, null);
+ databaseProvider.updatePdpStatistics("name", null, null, null);
}).hasMessage("pdpType is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics("name", "ver", null, null, new PdpStatistics());
+ databaseProvider.updatePdpStatistics("name", null, null, new PdpStatistics());
}).hasMessage("pdpType is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics("name", "ver", null, "Instance", null);
+ databaseProvider.updatePdpStatistics("name", null, "Instance", null);
}).hasMessage("pdpType is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics("name", "ver", null, "Instance", new PdpStatistics());
+ databaseProvider.updatePdpStatistics("name", null, "Instance", new PdpStatistics());
}).hasMessage("pdpType is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics("name", "ver", "type", null, null);
+ databaseProvider.updatePdpStatistics("name", "type", null, null);
}).hasMessage("pdpInstanceId is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics("name", "ver", "type", null, new PdpStatistics());
+ databaseProvider.updatePdpStatistics("name", "type", null, new PdpStatistics());
}).hasMessage("pdpInstanceId is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.updatePdpStatistics("name", "ver", "type", "Instance", null);
+ databaseProvider.updatePdpStatistics("name", "type", "Instance", null);
}).hasMessage("pdpStatistics is marked @NonNull but is null");
+ databaseProvider.updatePdpStatistics("name", "type", "Instance", new PdpStatistics());
+
databaseProvider.close();
}
@@ -545,7 +435,7 @@ public class DatabasePolicyModelsProviderTest {
databaseProvider.deleteGuardPolicy("policy_id");
}).hasMessage("no policy found for policy ID: policy_id");
- assertEquals(0, databaseProvider.getPdpGroups("name", "version").size());
+ assertEquals(0, databaseProvider.getPdpGroups("name").size());
assertEquals(0, databaseProvider.getFilteredPdpGroups(PdpGroupFilter.builder().build()).size());
assertNotNull(databaseProvider.createPdpGroups(new ArrayList<>()));
@@ -576,29 +466,29 @@ public class DatabasePolicyModelsProviderTest {
assertEquals(123, databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0)
.getDesiredInstanceCount());
- assertEquals(1, databaseProvider.getPdpGroups("group", "1.2.3").size());
+ assertEquals(1, databaseProvider.getPdpGroups("group").size());
pdpSubGroup.setDesiredInstanceCount(234);
- databaseProvider.updatePdpSubGroup("group", "1.2.3", pdpSubGroup);
- assertEquals(234, databaseProvider.getPdpGroups("group", "1.2.3").get(0).getPdpSubgroups()
+ databaseProvider.updatePdpSubGroup("group", pdpSubGroup);
+ assertEquals(234, databaseProvider.getPdpGroups("group").get(0).getPdpSubgroups()
.get(0).getDesiredInstanceCount());
- assertEquals("Hello", databaseProvider.getPdpGroups("group", "1.2.3").get(0).getPdpSubgroups()
+ assertEquals("Hello", databaseProvider.getPdpGroups("group").get(0).getPdpSubgroups()
.get(0).getPdpInstances().get(0).getMessage());
pdp.setMessage("Howdy");
- databaseProvider.updatePdp("group", "1.2.3", "type", pdp);
- assertEquals("Howdy", databaseProvider.getPdpGroups("group", "1.2.3").get(0).getPdpSubgroups()
+ databaseProvider.updatePdp("group", "type", pdp);
+ assertEquals("Howdy", databaseProvider.getPdpGroups("group").get(0).getPdpSubgroups()
.get(0).getPdpInstances().get(0).getMessage());
assertThatThrownBy(() -> {
- databaseProvider.deletePdpGroup("name", "version");
- }).hasMessage("delete of PDP group \"name:version\" failed, PDP group does not exist");
+ databaseProvider.deletePdpGroup("name");
+ }).hasMessage("delete of PDP group \"name:0.0.0\" failed, PDP group does not exist");
- assertEquals(pdpGroup.getName(), databaseProvider.deletePdpGroup("group", "1.2.3").getName());
+ assertEquals(pdpGroup.getName(), databaseProvider.deletePdpGroup("group").getName());
- assertEquals(0, databaseProvider.getPdpStatistics(null, null).size());
+ assertEquals(0, databaseProvider.getPdpStatistics(null).size());
- databaseProvider.updatePdpStatistics("group", "1.2.3", "type", "type-0", new PdpStatistics());
+ databaseProvider.updatePdpStatistics("group", "type", "type-0", new PdpStatistics());
} catch (Exception exc) {
LOGGER.warn("test should not throw an exception", exc);
fail("test should not throw an exception");
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java
index 61f88741c..3e182c02d 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java
@@ -147,7 +147,7 @@ public class DummyBadProviderImpl implements PolicyModelsProvider {
}
@Override
- public List<PdpGroup> getPdpGroups(String name, String version) throws PfModelException {
+ public List<PdpGroup> getPdpGroups(String name) throws PfModelException {
return null;
}
@@ -162,11 +162,11 @@ public class DummyBadProviderImpl implements PolicyModelsProvider {
}
@Override
- public void updatePdp(@NonNull String pdpGroupName, @NonNull String pdpGroupVersion, @NonNull String pdpSubGroup,
+ public void updatePdp(@NonNull String pdpGroupName, @NonNull String pdpSubGroup,
@NonNull Pdp pdp) throws PfModelException {}
@Override
- public PdpGroup deletePdpGroup(@NonNull String name, @NonNull String verison) throws PfModelException {
+ public PdpGroup deletePdpGroup(@NonNull String name) throws PfModelException {
return null;
}
@@ -207,15 +207,15 @@ public class DummyBadProviderImpl implements PolicyModelsProvider {
}
@Override
- public void updatePdpSubGroup(@NonNull String pdpGroupName, @NonNull String pdpGroupVersion,
+ public void updatePdpSubGroup(@NonNull String pdpGroupName,
@NonNull PdpSubGroup pdpSubGroup) throws PfModelException {}
@Override
- public List<PdpStatistics> getPdpStatistics(String name, String version) throws PfModelException {
+ public List<PdpStatistics> getPdpStatistics(String name) throws PfModelException {
return null;
}
@Override
- public void updatePdpStatistics(@NonNull String pdpGroupName, @NonNull String pdpGroupVersion,
+ public void updatePdpStatistics(@NonNull String pdpGroupName,
@NonNull String pdpType, @NonNull String pdpInstanceId, @NonNull PdpStatistics pdppStatistics) {}
}
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java
index 5a0cddb03..9f02fd7a4 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java
@@ -104,16 +104,16 @@ public class DummyPolicyModelsProviderTest {
assertNotNull(dummyProvider.updateGuardPolicy(new LegacyGuardPolicyInput()));
assertNotNull(dummyProvider.deleteGuardPolicy("policy_id"));
- assertTrue(dummyProvider.getPdpGroups("name", "version").isEmpty());
+ assertTrue(dummyProvider.getPdpGroups("name").isEmpty());
assertTrue(dummyProvider.getFilteredPdpGroups(PdpGroupFilter.builder().build()).isEmpty());
assertTrue(dummyProvider.createPdpGroups(new ArrayList<>()).isEmpty());
assertTrue(dummyProvider.updatePdpGroups(new ArrayList<>()).isEmpty());
- assertNull(dummyProvider.deletePdpGroup("name", "version"));
+ assertNull(dummyProvider.deletePdpGroup("name"));
- dummyProvider.updatePdpSubGroup("name", "version", new PdpSubGroup());
- dummyProvider.updatePdp("name", "version", "type", new Pdp());
- dummyProvider.updatePdpStatistics("name", "version", "type", "type-0", new PdpStatistics());
- assertTrue(dummyProvider.getPdpStatistics("name", "version").isEmpty());
+ dummyProvider.updatePdpSubGroup("name", new PdpSubGroup());
+ dummyProvider.updatePdp("name", "type", new Pdp());
+ dummyProvider.updatePdpStatistics("name", "type", "type-0", new PdpStatistics());
+ assertTrue(dummyProvider.getPdpStatistics("name").isEmpty());
dummyProvider.close();
}