diff options
author | liamfallon <liam.fallon@est.tech> | 2019-04-12 18:59:25 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2019-04-12 18:59:25 +0000 |
commit | b2ae3e6a44a3aa70ac1cd1d2ef78316bfc6e9d04 (patch) | |
tree | 195068aabadcb2853119945c22f84679de53e097 /models-pdp/src | |
parent | 92d9b661cc32b8dcc90e813aa220e26ef6f83b17 (diff) |
Remove version from PdpGroup
Issue-ID: POLICY-1095
Change-Id: I91f495947fe77222804e7ab31c4dd7d7aee66b44
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'models-pdp/src')
10 files changed, 134 insertions, 423 deletions
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java index 53bf3c1c6..3c1aec258 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroup.java @@ -1,7 +1,7 @@ -/* +/*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation. - * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 AT&T Intellectual Property. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,36 +32,28 @@ import org.onap.policy.common.parameters.BeanValidationResult; import org.onap.policy.common.parameters.ObjectValidationResult; import org.onap.policy.common.parameters.ValidationResult; import org.onap.policy.common.parameters.ValidationStatus; +import org.onap.policy.models.base.PfKey; import org.onap.policy.models.base.PfNameVersion; import org.onap.policy.models.base.PfUtils; import org.onap.policy.models.pdp.enums.PdpState; /** - * Class to represent a PDPGroup, which groups multiple PDPSubGroup entities together for - * a particular domain. + * Class to represent a PDPGroup, which groups multiple PDPSubGroup entities together for a particular domain. * * @author Ram Krishna Verma (ram.krishna.verma@est.tech) */ @Data @NoArgsConstructor public class PdpGroup implements PfNameVersion, Comparable<PdpGroup> { - /** - * In the future, we'll eliminate the "version" field. Until then, the version of - * every group should always be this fixed value. - */ - public static final String VERSION = "1.0.0"; - private String name; - private String version; private String description; private PdpState pdpGroupState; private Map<String, String> properties; private List<PdpSubGroup> pdpSubgroups; /* - * Note: removed "@NotNull" annotation from the constructor argument, because it - * cannot be covered by a junit test, as the superclass does the check and throws an - * exception first. + * Note: removed "@NotNull" annotation from the constructor argument, because it cannot be covered by a junit test, + * as the superclass does the check and throws an exception first. */ /** @@ -71,7 +63,6 @@ public class PdpGroup implements PfNameVersion, Comparable<PdpGroup> { */ public PdpGroup(PdpGroup source) { this.name = source.name; - this.version = source.version; this.description = source.description; this.pdpGroupState = source.pdpGroupState; this.properties = (source.properties == null ? null : new LinkedHashMap<>(source.properties)); @@ -84,8 +75,7 @@ public class PdpGroup implements PfNameVersion, Comparable<PdpGroup> { } /** - * Validates that appropriate fields are populated for an incoming call to the PAP - * REST API. + * Validates that appropriate fields are populated for an incoming call to the PAP REST API. * * @return the validation result */ @@ -93,8 +83,7 @@ public class PdpGroup implements PfNameVersion, Comparable<PdpGroup> { BeanValidationResult result = new BeanValidationResult("group", this); /* - * Don't care about version or state, because we override them. Ok if description - * is null. + * Don't care about version or state, because we override them. Ok if description is null. */ result.validateNotNull("name", name); @@ -118,19 +107,27 @@ public class PdpGroup implements PfNameVersion, Comparable<PdpGroup> { Set<String> set = new HashSet<>(); for (PdpSubGroup subgrp : pdpSubgroups) { - if (subgrp == null) { - continue; - } + String pdpType = (subgrp == null ? null : subgrp.getPdpType()); - String pdpType = subgrp.getPdpType(); if (pdpType == null) { continue; } if (!set.add(pdpType)) { result.addResult(new ObjectValidationResult("subgroups", pdpType, ValidationStatus.INVALID, - "duplicate subgroup")); + "duplicate subgroup")); } } } + + @Override + public String getVersion() { + // We need to pass a version for keying in the database + return PfKey.NULL_KEY_VERSION; + } + + @Override + public void setVersion(String version) { + // Just ignore any version that is set + } } diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroupFilter.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroupFilter.java index 0f86c6890..d67f2d4cb 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroupFilter.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroupFilter.java @@ -41,14 +41,9 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifi @Builder @Data public class PdpGroupFilter implements PfObjectFilter<PdpGroup> { - public static final String LATEST_VERSION = "LATEST"; - // Name to find private String name; - // Version to find, set to LATEST_VERSION to get the latest version - private String version; - // State to find private PdpState groupState; @@ -76,10 +71,8 @@ public class PdpGroupFilter implements PfObjectFilter<PdpGroup> { public List<PdpGroup> filter(@NonNull final List<PdpGroup> originalList) { // @formatter:off - List<PdpGroup> returnList = originalList.stream() + return originalList.stream() .filter(p -> filterString(p.getName(), name)) - .filter(p -> LATEST_VERSION.equals(version) - || filterString(p.getVersion(), version)) .filter(p -> groupState == null || ObjectUtils.compare(p.getPdpGroupState(), groupState) == 0) .filter(p -> filterOnPdpType(p, pdpType)) .filter(p -> filterOnPolicyTypeList(p, policyTypeList, matchPolicyTypesExactly)) @@ -87,12 +80,6 @@ public class PdpGroupFilter implements PfObjectFilter<PdpGroup> { .filter(p -> filterOnPdpState(p, pdpState)) .collect(Collectors.toList()); // @formatter:on - - if (LATEST_VERSION.equals(version)) { - returnList = this.latestVersionFilter(returnList); - } - - return returnList; } /** diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java index bfdeda984..0a0f5f7ef 100644 --- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java +++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/provider/PdpProvider.java @@ -28,6 +28,7 @@ import javax.ws.rs.core.Response; import lombok.NonNull; import org.onap.policy.models.base.PfConceptKey; +import org.onap.policy.models.base.PfKey; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.base.PfModelRuntimeException; import org.onap.policy.models.base.PfReferenceKey; @@ -60,14 +61,12 @@ public class PdpProvider { * * @param dao the DAO to use to access the database * @param name the name of the PDP group to get, null to get all PDP groups - * @param version the version of the policy to get, null to get all versions of a PDP group * @return the PDP groups found * @throws PfModelException on errors getting PDP groups */ - public List<PdpGroup> getPdpGroups(@NonNull final PfDao dao, final String name, final String version) - throws PfModelException { + public List<PdpGroup> getPdpGroups(@NonNull final PfDao dao, final String name) throws PfModelException { - return asPdpGroupList(dao.getFiltered(JpaPdpGroup.class, name, version)); + return asPdpGroupList(dao.getFiltered(JpaPdpGroup.class, name, PfKey.NULL_KEY_VERSION)); } /** @@ -115,7 +114,7 @@ public class PdpProvider { for (PdpGroup pdpGroup : pdpGroups) { JpaPdpGroup jpaPdpGroup = - dao.get(JpaPdpGroup.class, new PfConceptKey(pdpGroup.getName(), pdpGroup.getVersion())); + dao.get(JpaPdpGroup.class, new PfConceptKey(pdpGroup.getName(), PfKey.NULL_KEY_VERSION)); returnPdpGroups.add(jpaPdpGroup.toAuthorative()); } @@ -152,7 +151,7 @@ public class PdpProvider { for (PdpGroup pdpGroup : pdpGroups) { JpaPdpGroup jpaPdpGroup = - dao.get(JpaPdpGroup.class, new PfConceptKey(pdpGroup.getName(), pdpGroup.getVersion())); + dao.get(JpaPdpGroup.class, new PfConceptKey(pdpGroup.getName(), PfKey.NULL_KEY_VERSION)); returnPdpGroups.add(jpaPdpGroup.toAuthorative()); } @@ -164,14 +163,14 @@ public class PdpProvider { * * @param dao the DAO to use to access the database * @param pdpGroupName the name of the PDP group of the PDP subgroup - * @param pdpGroupVersion the version of the PDP group of the PDP subgroup * @param pdpSubGroup the PDP subgroup to be updated * @throws PfModelException on errors updating PDP subgroups */ public void updatePdpSubGroup(@NonNull final PfDao dao, @NonNull final String pdpGroupName, - @NonNull final String pdpGroupVersion, @NonNull final PdpSubGroup pdpSubGroup) throws PfModelException { + @NonNull final PdpSubGroup pdpSubGroup) throws PfModelException { - final PfReferenceKey subGroupKey = new PfReferenceKey(pdpGroupName, pdpGroupVersion, pdpSubGroup.getPdpType()); + final PfReferenceKey subGroupKey = + new PfReferenceKey(pdpGroupName, PfKey.NULL_KEY_VERSION, pdpSubGroup.getPdpType()); final JpaPdpSubGroup jpaPdpSubgroup = new JpaPdpSubGroup(subGroupKey); jpaPdpSubgroup.fromAuthorative(pdpSubGroup); @@ -190,16 +189,15 @@ public class PdpProvider { * * @param dao the DAO to use to access the database * @param pdpGroupName the name of the PDP group of the PDP subgroup - * @param pdpGroupVersion the version of the PDP group of the PDP subgroup * @param pdpSubGroup the PDP subgroup to be updated * @param pdp the PDP to be updated * @throws PfModelException on errors updating PDP subgroups */ public void updatePdp(@NonNull final PfDao dao, @NonNull final String pdpGroupName, - @NonNull final String pdpGroupVersion, @NonNull final String pdpSubGroup, @NonNull final Pdp pdp) { + @NonNull final String pdpSubGroup, @NonNull final Pdp pdp) { final PfReferenceKey pdpKey = - new PfReferenceKey(pdpGroupName, pdpGroupVersion, pdpSubGroup, pdp.getInstanceId()); + new PfReferenceKey(pdpGroupName, PfKey.NULL_KEY_VERSION, pdpSubGroup, pdp.getInstanceId()); final JpaPdp jpaPdp = new JpaPdp(pdpKey); jpaPdp.fromAuthorative(pdp); @@ -218,14 +216,12 @@ public class PdpProvider { * * @param dao the DAO to use to access the database * @param name the name of the policy to get, null to get all PDP groups - * @param version the version of the policy to get, null to get all versions of a PDP group * @return the PDP group deleted * @throws PfModelException on errors deleting PDP groups */ - public PdpGroup deletePdpGroup(@NonNull final PfDao dao, @NonNull final String name, - @NonNull final String version) { + public PdpGroup deletePdpGroup(@NonNull final PfDao dao, @NonNull final String name) { - PfConceptKey pdpGroupKey = new PfConceptKey(name, version); + PfConceptKey pdpGroupKey = new PfConceptKey(name, PfKey.NULL_KEY_VERSION); JpaPdpGroup jpaDeletePdpGroup = dao.get(JpaPdpGroup.class, pdpGroupKey); @@ -245,12 +241,10 @@ public class PdpProvider { * * @param dao the DAO to use to access the database * @param name the name of the PDP group to get statistics for, null to get all PDP groups - * @param version the version of the PDP group to get statistics for, null to get all versions of a PDP group * @return the statistics found * @throws PfModelException on errors getting statistics */ - public List<PdpStatistics> getPdpStatistics(@NonNull final PfDao dao, final String name, final String version) - throws PfModelException { + public List<PdpStatistics> getPdpStatistics(@NonNull final PfDao dao, final String name) throws PfModelException { return new ArrayList<>(); } @@ -259,14 +253,13 @@ public class PdpProvider { * * @param dao the DAO to use to access the database * @param pdpGroupName the name of the PDP group containing the PDP that the statistics are for - * @param pdpGroupVersion the version of the PDP group containing the PDP that the statistics are for * @param pdpType the PDP type of the subgroup containing the PDP that the statistics are for * @param pdpInstanceId the instance ID of the PDP to update statistics for * @param pdpStatistics the statistics to update * @throws PfModelException on errors updating statistics */ public void updatePdpStatistics(@NonNull final PfDao dao, @NonNull final String pdpGroupName, - @NonNull final String pdpGroupVersion, @NonNull final String pdpType, @NonNull final String pdpInstanceId, + @NonNull final String pdpType, @NonNull final String pdpInstanceId, @NonNull final PdpStatistics pdpStatistics) throws PfModelException { // Not implemented yet } diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupFilterTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupFilterTest.java index 75ec4d169..89ee5b90d 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupFilterTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupFilterTest.java @@ -74,38 +74,28 @@ public class PdpGroupFilterTest { } @Test - public void testFilterLatestVersion() { - PdpGroupFilter filter = PdpGroupFilter.builder().version(PdpGroupFilter.LATEST_VERSION).build(); - - List<PdpGroup> filteredList = filter.filter(pdpGroupList); - assertEquals(2, filteredList.size()); - assertEquals("1.2.4", filteredList.get(0).getVersion()); - assertEquals("1.2.3", filteredList.get(1).getVersion()); - } - - @Test - public void testFilterNameVersion() { + public void testFilterName() { PdpGroupFilter filter = PdpGroupFilter.builder().name("PdpGroup0").build(); List<PdpGroup> filteredList = filter.filter(pdpGroupList); - assertEquals(3, filteredList.size()); + assertEquals(1, filteredList.size()); filter = PdpGroupFilter.builder().name("PdpGroup1").build(); filteredList = filter.filter(pdpGroupList); - assertEquals(2, filteredList.size()); + assertEquals(1, filteredList.size()); - filter = PdpGroupFilter.builder().name("PdpGroup2").build(); + filter = PdpGroupFilter.builder().name("PdpGroup20").build(); filteredList = filter.filter(pdpGroupList); - assertEquals(0, filteredList.size()); + assertEquals(1, filteredList.size()); - filter = PdpGroupFilter.builder().version("1.2.3").build(); + filter = PdpGroupFilter.builder().build(); filteredList = filter.filter(pdpGroupList); - assertEquals(2, filteredList.size()); + assertEquals(5, filteredList.size()); - filter = PdpGroupFilter.builder().name("PdpGroup0").version("1.2.3").build(); + filter = PdpGroupFilter.builder().name("PdpGroup0").build(); filteredList = filter.filter(pdpGroupList); assertEquals(1, filteredList.size()); - filter = PdpGroupFilter.builder().name("PdpGroup1").version("1.2.9").build(); + filter = PdpGroupFilter.builder().name("PdpGroup19").build(); filteredList = filter.filter(pdpGroupList); assertEquals(0, filteredList.size()); } diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupTest.java index 3082bb228..0df2d34d9 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupTest.java @@ -55,8 +55,8 @@ public class PdpGroupTest { PdpGroup orig = new PdpGroup(); // verify with null values - assertEquals("PdpGroup(name=null, version=null, description=null, pdpGroupState=null, " - + "properties=null, pdpSubgroups=[])", new PdpGroup(orig).toString()); + assertEquals("PdpGroup(name=null, description=null, pdpGroupState=null, " + "properties=null, pdpSubgroups=[])", + new PdpGroup(orig).toString()); // verify with all values orig.setDescription("my-descript"); @@ -76,7 +76,7 @@ public class PdpGroupTest { props.put("key-B", "value-B"); orig.setProperties(props); - assertEquals("PdpGroup(name=my-name, version=1.2.3, description=my-description, " + assertEquals("PdpGroup(name=my-name, description=my-description, " + "pdpGroupState=SAFE, properties={key-A=value-A, key-B=value-B}, " + "pdpSubgroups=[PdpSubGroup(pdpType=null, supportedPolicyTypes=[], policies=[], " + "currentInstanceCount=10, desiredInstanceCount=0, properties=null, pdpInstances=[]), " diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java index e75743e40..c0545fa36 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpGroupTest.java @@ -98,16 +98,8 @@ public class JpaPdpGroupTest { JpaPdpGroup testJpaPdpGroup = new JpaPdpGroup(); testJpaPdpGroup.setKey(null); - assertThatThrownBy(() -> { - testJpaPdpGroup.fromAuthorative(testPdpGroup); - }).hasMessage("version is marked @NonNull but is null"); - testJpaPdpGroup.setKey(new PfConceptKey()); - assertThatThrownBy(() -> { - testJpaPdpGroup.fromAuthorative(testPdpGroup); - }).hasMessage("version is marked @NonNull but is null"); - testPdpGroup.setVersion("1.0.0"); testJpaPdpGroup.fromAuthorative(testPdpGroup); diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java index ee9c76b98..f0af69ea4 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java @@ -106,15 +106,11 @@ public class PdpProviderTest { @Test public void testGroupsGet() throws Exception { assertThatThrownBy(() -> { - new PdpProvider().getPdpGroups(null, null, null); + new PdpProvider().getPdpGroups(null, null); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().getPdpGroups(null, null, "version"); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().getPdpGroups(null, "name", "version"); + new PdpProvider().getPdpGroups(null, "name"); }).hasMessage("dao is marked @NonNull but is null"); String originalJson = ResourceUtils.getResourceAsString("testdata/PdpGroups0.json"); @@ -126,7 +122,7 @@ public class PdpProviderTest { assertEquals(originalJson.replaceAll("\\s+", ""), createdJson.replaceAll("\\s+", "")); PdpGroups gotPdpGroups0 = new PdpGroups(); - gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, "PdpGroup0", "1.2.3")); + gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, "PdpGroup0")); String gotJson = standardCoder.encode(gotPdpGroups0); @@ -162,7 +158,6 @@ public class PdpProviderTest { final PdpGroupFilter filter = PdpGroupFilter.builder() .groupState(PdpState.PASSIVE) .name("PdpGroup0") - .version("1.2.3") .matchPoliciesExactly(false) .matchPolicyTypesExactly(false) .pdpState(PdpState.PASSIVE) @@ -197,7 +192,7 @@ public class PdpProviderTest { assertEquals(originalJson.replaceAll("\\s+", ""), createdJson.replaceAll("\\s+", "")); PdpGroups gotPdpGroups0 = new PdpGroups(); - gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, "PdpGroup0", "1.2.3")); + gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, "PdpGroup0")); String gotJson = standardCoder.encode(gotPdpGroups0); assertEquals(originalJson.replaceAll("\\s+", ""), gotJson.replaceAll("\\s+", "")); @@ -223,7 +218,7 @@ public class PdpProviderTest { assertEquals(originalTweakedJson.replaceAll("\\s+", ""), createdJson.replaceAll("\\s+", "")); PdpGroups gotPdpGroups0 = new PdpGroups(); - gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, "TestPdpGroup", "1.2.3")); + gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, "TestPdpGroup")); String gotJson = standardCoder.encode(gotPdpGroups0); assertEquals(originalTweakedJson.replaceAll("\\s+", ""), gotJson.replaceAll("\\s+", "")); @@ -252,7 +247,7 @@ public class PdpProviderTest { assertEquals(originalJson.replaceAll("\\s+", ""), createdJson.replaceAll("\\s+", "")); PdpGroups gotPdpGroups0 = new PdpGroups(); - gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, "PdpGroup0", "1.2.3")); + gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, "PdpGroup0")); String gotJson = standardCoder.encode(gotPdpGroups0); assertEquals(originalJson.replaceAll("\\s+", ""), gotJson.replaceAll("\\s+", "")); @@ -276,32 +271,20 @@ public class PdpProviderTest { @Test public void testPoliciesDelete() throws Exception { assertThatThrownBy(() -> { - new PdpProvider().deletePdpGroup(null, null, null); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().deletePdpGroup(null, null, "version"); + new PdpProvider().deletePdpGroup(null, null); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().deletePdpGroup(null, "name", null); + new PdpProvider().deletePdpGroup(null, "name"); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().deletePdpGroup(null, "name", "version"); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().deletePdpGroup(pfDao, null, "version"); + new PdpProvider().deletePdpGroup(pfDao, null); }).hasMessage("name is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().deletePdpGroup(pfDao, "name", null); - }).hasMessage("version is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().deletePdpGroup(pfDao, "name", "version"); - }).hasMessage("delete of PDP group \"name:version\" failed, PDP group does not exist"); + new PdpProvider().deletePdpGroup(pfDao, "name"); + }).hasMessage("delete of PDP group \"name:0.0.0\" failed, PDP group does not exist"); String originalJson = ResourceUtils.getResourceAsString("testdata/PdpGroups0.json"); PdpGroups pdpGroups0 = standardCoder.decode(originalJson, PdpGroups.class); @@ -312,82 +295,54 @@ public class PdpProviderTest { assertEquals(originalJson.replaceAll("\\s+", ""), createdJson.replaceAll("\\s+", "")); PdpGroups gotPdpGroups0 = new PdpGroups(); - gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, "PdpGroup0", "1.2.3")); + gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, "PdpGroup0")); String gotJson = standardCoder.encode(gotPdpGroups0); assertEquals(originalJson.replaceAll("\\s+", ""), gotJson.replaceAll("\\s+", "")); - PdpGroup deletedPdpGroup = new PdpProvider().deletePdpGroup(pfDao, "PdpGroup0", "1.2.3"); + PdpGroup deletedPdpGroup = new PdpProvider().deletePdpGroup(pfDao, "PdpGroup0"); assertEquals(createdPdpGroups0.getGroups().get(0), deletedPdpGroup); - assertEquals(0, new PdpProvider().getPdpGroups(pfDao, "PdpGroup0", "1.2.3").size()); + assertEquals(0, new PdpProvider().getPdpGroups(pfDao, "PdpGroup0").size()); assertThatThrownBy(() -> { - new PdpProvider().deletePdpGroup(pfDao, "PdpGroup0", "1.2.3"); - }).hasMessage("delete of PDP group \"PdpGroup0:1.2.3\" failed, PDP group does not exist"); + new PdpProvider().deletePdpGroup(pfDao, "PdpGroup0"); + }).hasMessage("delete of PDP group \"PdpGroup0:0.0.0\" failed, PDP group does not exist"); } @Test public void testPdpSubgroupUpdate() throws Exception { assertThatThrownBy(() -> { - new PdpProvider().updatePdpSubGroup(null, null, null, null); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpSubGroup(null, null, null, new PdpSubGroup()); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpSubGroup(null, null, "version", null); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpSubGroup(null, null, "version", new PdpSubGroup()); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpSubGroup(null, "name", null, null); + new PdpProvider().updatePdpSubGroup(null, null, null); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpSubGroup(null, "name", null, new PdpSubGroup()); + new PdpProvider().updatePdpSubGroup(null, null, new PdpSubGroup()); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpSubGroup(null, "name", "version", null); + new PdpProvider().updatePdpSubGroup(null, "name", null); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpSubGroup(null, "name", "version", new PdpSubGroup()); + new PdpProvider().updatePdpSubGroup(null, "name", new PdpSubGroup()); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpSubGroup(pfDao, null, null, new PdpSubGroup()); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpSubGroup(pfDao, null, "version", null); + new PdpProvider().updatePdpSubGroup(pfDao, null, null); }).hasMessage("pdpGroupName is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpSubGroup(pfDao, null, "version", new PdpSubGroup()); + new PdpProvider().updatePdpSubGroup(pfDao, null, new PdpSubGroup()); }).hasMessage("pdpGroupName is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpSubGroup(pfDao, "name", null, null); - }).hasMessage("pdpGroupVersion is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpSubGroup(pfDao, "name", null, new PdpSubGroup()); - }).hasMessage("pdpGroupVersion is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpSubGroup(pfDao, "name", "version", null); + new PdpProvider().updatePdpSubGroup(pfDao, "name", null); }).hasMessage("pdpSubGroup is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpSubGroup(pfDao, "name", "version", new PdpSubGroup()); + new PdpProvider().updatePdpSubGroup(pfDao, "name", new PdpSubGroup()); }).hasMessage("parameter \"localName\" is null"); String originalJson = ResourceUtils.getResourceAsString("testdata/PdpGroups0.json"); @@ -399,7 +354,7 @@ public class PdpProviderTest { assertEquals(originalJson.replaceAll("\\s+", ""), createdJson.replaceAll("\\s+", "")); PdpGroups gotPdpGroups0 = new PdpGroups(); - gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, "PdpGroup0", "1.2.3")); + gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, "PdpGroup0")); String gotJson = standardCoder.encode(gotPdpGroups0); assertEquals(originalJson.replaceAll("\\s+", ""), gotJson.replaceAll("\\s+", "")); @@ -407,15 +362,15 @@ public class PdpProviderTest { PdpSubGroup existingSubGroup = gotPdpGroups0.getGroups().get(0).getPdpSubgroups().get(0); existingSubGroup.setCurrentInstanceCount(10); existingSubGroup.setDesiredInstanceCount(10); - new PdpProvider().updatePdpSubGroup(pfDao, "PdpGroup0", "1.2.3", existingSubGroup); + new PdpProvider().updatePdpSubGroup(pfDao, "PdpGroup0", existingSubGroup); - List<PdpGroup> afterUpdatePdpGroups = new PdpProvider().getPdpGroups(pfDao, "PdpGroup0", "1.2.3"); + List<PdpGroup> afterUpdatePdpGroups = new PdpProvider().getPdpGroups(pfDao, "PdpGroup0"); assertEquals(10, afterUpdatePdpGroups.get(0).getPdpSubgroups().get(0).getCurrentInstanceCount()); assertEquals(10, afterUpdatePdpGroups.get(0).getPdpSubgroups().get(0).getDesiredInstanceCount()); existingSubGroup.setDesiredInstanceCount(-1); assertThatThrownBy(() -> { - new PdpProvider().updatePdpSubGroup(pfDao, "PdpGroup0", "1.2.3", existingSubGroup); + new PdpProvider().updatePdpSubGroup(pfDao, "PdpGroup0", existingSubGroup); }).hasMessageContaining("INVALID:the desired instance count of a PDP sub group may not be negative"); existingSubGroup.setDesiredInstanceCount(10); } @@ -423,131 +378,67 @@ public class PdpProviderTest { @Test public void testPdpUpdate() throws Exception { assertThatThrownBy(() -> { - new PdpProvider().updatePdp(null, null, null, null, null); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdp(null, null, null, null, new Pdp()); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdp(null, null, null, "TYPE", null); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdp(null, null, null, "TYPE", new Pdp()); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdp(null, null, "version", null, null); + new PdpProvider().updatePdp(null, null, null, null); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdp(null, null, "version", null, new Pdp()); + new PdpProvider().updatePdp(null, null, null, new Pdp()); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdp(null, null, "version", "TYPE", null); + new PdpProvider().updatePdp(null, null, "TYPE", null); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdp(null, null, "version", "TYPE", new Pdp()); + new PdpProvider().updatePdp(null, null, "TYPE", new Pdp()); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdp(null, "name", null, null, null); + new PdpProvider().updatePdp(null, "name", null, null); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdp(null, "name", null, null, new Pdp()); + new PdpProvider().updatePdp(null, "name", null, new Pdp()); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdp(null, "name", null, "TYPE", null); + new PdpProvider().updatePdp(null, "name", "TYPE", null); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdp(null, "name", null, "TYPE", new Pdp()); + new PdpProvider().updatePdp(null, "name", "TYPE", new Pdp()); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdp(null, "name", "version", null, null); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdp(null, "name", "version", null, new Pdp()); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdp(null, "name", "version", "TYPE", null); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdp(null, "name", "version", "TYPE", new Pdp()); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdp(pfDao, null, null, null, null); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdp(pfDao, null, null, null, new Pdp()); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdp(pfDao, null, null, "TYPE", null); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdp(pfDao, null, null, "TYPE", new Pdp()); + new PdpProvider().updatePdp(pfDao, null, null, null); }).hasMessage("pdpGroupName is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdp(pfDao, null, "version", null, null); + new PdpProvider().updatePdp(pfDao, null, null, new Pdp()); }).hasMessage("pdpGroupName is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdp(pfDao, null, "version", null, new Pdp()); + new PdpProvider().updatePdp(pfDao, null, "TYPE", null); }).hasMessage("pdpGroupName is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdp(pfDao, null, "version", "TYPE", null); + new PdpProvider().updatePdp(pfDao, null, "TYPE", new Pdp()); }).hasMessage("pdpGroupName is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdp(pfDao, null, "version", "TYPE", new Pdp()); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdp(pfDao, "name", null, null, null); - }).hasMessage("pdpGroupVersion is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdp(pfDao, "name", null, null, new Pdp()); - }).hasMessage("pdpGroupVersion is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdp(pfDao, "name", null, "TYPE", null); - }).hasMessage("pdpGroupVersion is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdp(pfDao, "name", null, "TYPE", new Pdp()); - }).hasMessage("pdpGroupVersion is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdp(pfDao, "name", "version", null, null); + new PdpProvider().updatePdp(pfDao, "name", null, null); }).hasMessage("pdpSubGroup is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdp(pfDao, "name", "version", null, new Pdp()); + new PdpProvider().updatePdp(pfDao, "name", null, new Pdp()); }).hasMessage("pdpSubGroup is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdp(pfDao, "name", "version", "TYPE", null); + new PdpProvider().updatePdp(pfDao, "name", "TYPE", null); }).hasMessage("pdp is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdp(pfDao, "name", "version", "TYPE", new Pdp()); + new PdpProvider().updatePdp(pfDao, "name", "TYPE", new Pdp()); }).hasMessage("parameter \"localName\" is null"); String originalJson = ResourceUtils.getResourceAsString("testdata/PdpGroups0.json"); @@ -559,7 +450,7 @@ public class PdpProviderTest { assertEquals(originalJson.replaceAll("\\s+", ""), createdJson.replaceAll("\\s+", "")); PdpGroups gotPdpGroups0 = new PdpGroups(); - gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, "PdpGroup0", "1.2.3")); + gotPdpGroups0.setGroups(new PdpProvider().getPdpGroups(pfDao, "PdpGroup0")); String gotJson = standardCoder.encode(gotPdpGroups0); assertEquals(originalJson.replaceAll("\\s+", ""), gotJson.replaceAll("\\s+", "")); @@ -567,9 +458,9 @@ public class PdpProviderTest { Pdp existingPdp = gotPdpGroups0.getGroups().get(0).getPdpSubgroups().get(0).getPdpInstances().get(0); existingPdp.setPdpState(PdpState.TEST); existingPdp.setHealthy(PdpHealthStatus.TEST_IN_PROGRESS); - new PdpProvider().updatePdp(pfDao, "PdpGroup0", "1.2.3", "APEX", existingPdp); + new PdpProvider().updatePdp(pfDao, "PdpGroup0", "APEX", existingPdp); - List<PdpGroup> afterUpdatePdpGroups = new PdpProvider().getPdpGroups(pfDao, "PdpGroup0", "1.2.3"); + List<PdpGroup> afterUpdatePdpGroups = new PdpProvider().getPdpGroups(pfDao, "PdpGroup0"); assertEquals(PdpState.TEST, afterUpdatePdpGroups.get(0).getPdpSubgroups().get(0).getPdpInstances().get(0).getPdpState()); assertEquals(PdpHealthStatus.TEST_IN_PROGRESS, @@ -577,7 +468,7 @@ public class PdpProviderTest { existingPdp.setMessage(""); assertThatThrownBy(() -> { - new PdpProvider().updatePdp(pfDao, "PdpGroup0", "1.2.3", "APEX", existingPdp); + new PdpProvider().updatePdp(pfDao, "PdpGroup0", "APEX", existingPdp); }).hasMessageContaining("INVALID:message may not be blank"); existingPdp.setMessage("A Message"); } @@ -585,274 +476,142 @@ public class PdpProviderTest { @Test public void testGetPdpStatistics() throws PfModelException { assertThatThrownBy(() -> { - new PdpProvider().getPdpStatistics(null, null, null); + new PdpProvider().getPdpStatistics(null, null); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().getPdpStatistics(null, null, "version"); + new PdpProvider().getPdpStatistics(null, "name"); }).hasMessage("dao is marked @NonNull but is null"); - assertThatThrownBy(() -> { - new PdpProvider().getPdpStatistics(null, "name", null); - }).hasMessage("dao is marked @NonNull but is null"); - - assertEquals(0, new PdpProvider().getPdpStatistics(pfDao, "name", "version").size()); + assertEquals(0, new PdpProvider().getPdpStatistics(pfDao, "name").size()); } @Test public void testUpdatePdpStatistics() throws PfModelException { assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, null, null, null, null, null); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, null, null, null, null, new PdpStatistics()); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, null, null, null, "inst", null); + new PdpProvider().updatePdpStatistics(null, null, null, null, null); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, null, null, null, "inst", new PdpStatistics()); + new PdpProvider().updatePdpStatistics(null, null, null, null, new PdpStatistics()); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, null, null, "TYPE", null, null); + new PdpProvider().updatePdpStatistics(null, null, null, "inst", null); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, null, null, "TYPE", null, new PdpStatistics()); + new PdpProvider().updatePdpStatistics(null, null, null, "inst", new PdpStatistics()); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, null, null, "TYPE", "inst", null); + new PdpProvider().updatePdpStatistics(null, null, "TYPE", null, null); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, null, null, "TYPE", "inst", new PdpStatistics()); + new PdpProvider().updatePdpStatistics(null, null, "TYPE", null, new PdpStatistics()); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, null, "version", null, null, null); + new PdpProvider().updatePdpStatistics(null, null, "TYPE", "inst", null); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, null, "version", null, null, new PdpStatistics()); + new PdpProvider().updatePdpStatistics(null, null, "TYPE", "inst", new PdpStatistics()); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, null, "version", null, "inst", null); + new PdpProvider().updatePdpStatistics(null, "name", null, null, null); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, null, "version", null, "inst", new PdpStatistics()); + new PdpProvider().updatePdpStatistics(null, "name", null, null, new PdpStatistics()); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, null, "version", "TYPE", null, null); + new PdpProvider().updatePdpStatistics(null, "name", null, "inst", null); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, null, "version", "TYPE", null, new PdpStatistics()); + new PdpProvider().updatePdpStatistics(null, "name", null, "inst", new PdpStatistics()); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, null, "version", "TYPE", "inst", null); + new PdpProvider().updatePdpStatistics(null, "name", "TYPE", null, null); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, null, "version", "TYPE", "inst", new PdpStatistics()); + new PdpProvider().updatePdpStatistics(null, "name", "TYPE", null, new PdpStatistics()); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, "name", null, null, null, null); + new PdpProvider().updatePdpStatistics(null, "name", "TYPE", "inst", null); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, "name", null, null, null, new PdpStatistics()); + new PdpProvider().updatePdpStatistics(null, "name", "TYPE", "inst", new PdpStatistics()); }).hasMessage("dao is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, "name", null, null, "inst", null); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, "name", null, null, "inst", new PdpStatistics()); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, "name", null, "TYPE", null, null); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, "name", null, "TYPE", null, new PdpStatistics()); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, "name", null, "TYPE", "inst", null); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, "name", null, "TYPE", "inst", new PdpStatistics()); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, "name", "version", null, null, null); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, "name", "version", null, null, new PdpStatistics()); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, "name", "version", null, "inst", null); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, "name", "version", null, "inst", new PdpStatistics()); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, "name", "version", "TYPE", null, null); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, "name", "version", "TYPE", null, new PdpStatistics()); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, "name", "version", "TYPE", "inst", null); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(null, "name", "version", "TYPE", "inst", new PdpStatistics()); - }).hasMessage("dao is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, null, null, null, null, null); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, null, null, null, null, new PdpStatistics()); + new PdpProvider().updatePdpStatistics(pfDao, null, null, null, null); }).hasMessage("pdpGroupName is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, null, null, null, "inst", null); + new PdpProvider().updatePdpStatistics(pfDao, null, null, null, new PdpStatistics()); }).hasMessage("pdpGroupName is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, null, null, null, "inst", new PdpStatistics()); + new PdpProvider().updatePdpStatistics(pfDao, null, null, "inst", null); }).hasMessage("pdpGroupName is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, null, null, "TYPE", null, null); + new PdpProvider().updatePdpStatistics(pfDao, null, null, "inst", new PdpStatistics()); }).hasMessage("pdpGroupName is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, null, null, "TYPE", null, new PdpStatistics()); + new PdpProvider().updatePdpStatistics(pfDao, null, "TYPE", null, null); }).hasMessage("pdpGroupName is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, null, null, "TYPE", "inst", null); + new PdpProvider().updatePdpStatistics(pfDao, null, "TYPE", null, new PdpStatistics()); }).hasMessage("pdpGroupName is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, null, null, "TYPE", "inst", new PdpStatistics()); + new PdpProvider().updatePdpStatistics(pfDao, null, "TYPE", "inst", null); }).hasMessage("pdpGroupName is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, null, "version", null, null, null); + new PdpProvider().updatePdpStatistics(pfDao, null, "TYPE", "inst", new PdpStatistics()); }).hasMessage("pdpGroupName is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, null, "version", null, null, new PdpStatistics()); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, null, "version", null, "inst", null); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, null, "version", null, "inst", new PdpStatistics()); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, null, "version", "TYPE", null, null); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, null, "version", "TYPE", null, new PdpStatistics()); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, null, "version", "TYPE", "inst", null); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, null, "version", "TYPE", "inst", new PdpStatistics()); - }).hasMessage("pdpGroupName is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, "name", null, null, null, null); - }).hasMessage("pdpGroupVersion is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, "name", null, null, null, new PdpStatistics()); - }).hasMessage("pdpGroupVersion is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, "name", null, null, "inst", null); - }).hasMessage("pdpGroupVersion is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, "name", null, null, "inst", new PdpStatistics()); - }).hasMessage("pdpGroupVersion is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, "name", null, "TYPE", null, null); - }).hasMessage("pdpGroupVersion is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, "name", null, "TYPE", null, new PdpStatistics()); - }).hasMessage("pdpGroupVersion is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, "name", null, "TYPE", "inst", null); - }).hasMessage("pdpGroupVersion is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, "name", null, "TYPE", "inst", new PdpStatistics()); - }).hasMessage("pdpGroupVersion is marked @NonNull but is null"); - - assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, "name", "version", null, null, null); + new PdpProvider().updatePdpStatistics(pfDao, "name", null, null, null); }).hasMessage("pdpType is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, "name", "version", null, null, new PdpStatistics()); + new PdpProvider().updatePdpStatistics(pfDao, "name", null, null, new PdpStatistics()); }).hasMessage("pdpType is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, "name", "version", null, "inst", null); + new PdpProvider().updatePdpStatistics(pfDao, "name", null, "inst", null); }).hasMessage("pdpType is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, "name", "version", null, "inst", new PdpStatistics()); + new PdpProvider().updatePdpStatistics(pfDao, "name", null, "inst", new PdpStatistics()); }).hasMessage("pdpType is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, "name", "version", "TYPE", null, null); + new PdpProvider().updatePdpStatistics(pfDao, "name", "TYPE", null, null); }).hasMessage("pdpInstanceId is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, "name", "version", "TYPE", null, new PdpStatistics()); + new PdpProvider().updatePdpStatistics(pfDao, "name", "TYPE", null, new PdpStatistics()); }).hasMessage("pdpInstanceId is marked @NonNull but is null"); assertThatThrownBy(() -> { - new PdpProvider().updatePdpStatistics(pfDao, "name", "version", "TYPE", "inst", null); + new PdpProvider().updatePdpStatistics(pfDao, "name", "TYPE", "inst", null); }).hasMessage("pdpStatistics is marked @NonNull but is null"); - new PdpProvider().updatePdpStatistics(pfDao, "name", "version", "TYPE", "inst", new PdpStatistics()); + new PdpProvider().updatePdpStatistics(pfDao, "name", "TYPE", "inst", new PdpStatistics()); } } diff --git a/models-pdp/src/test/resources/testdata/PdpGroups0.json b/models-pdp/src/test/resources/testdata/PdpGroups0.json index 6ebdd6c7a..01e140cd8 100644 --- a/models-pdp/src/test/resources/testdata/PdpGroups0.json +++ b/models-pdp/src/test/resources/testdata/PdpGroups0.json @@ -2,7 +2,6 @@ "groups": [ { "name": "PdpGroup0", - "version": "1.2.3", "description": "group description", "pdpGroupState": "PASSIVE", "properties": { diff --git a/models-pdp/src/test/resources/testdata/PdpGroups0Update.json b/models-pdp/src/test/resources/testdata/PdpGroups0Update.json index a54ec53ea..05594fa47 100644 --- a/models-pdp/src/test/resources/testdata/PdpGroups0Update.json +++ b/models-pdp/src/test/resources/testdata/PdpGroups0Update.json @@ -2,7 +2,6 @@ "groups": [ { "name": "PdpGroup0", - "version": "1.2.3", "description": "group description", "pdpGroupState": "PASSIVE", "properties": { diff --git a/models-pdp/src/test/resources/testdata/PdpGroupsForFiltering.json b/models-pdp/src/test/resources/testdata/PdpGroupsForFiltering.json index f9c822b06..f1d4378fd 100644 --- a/models-pdp/src/test/resources/testdata/PdpGroupsForFiltering.json +++ b/models-pdp/src/test/resources/testdata/PdpGroupsForFiltering.json @@ -2,7 +2,6 @@ "groups": [ { "name": "PdpGroup0", - "version": "1.2.3", "description": "group description", "pdpGroupState": "PASSIVE", "properties": { @@ -70,8 +69,7 @@ ] }, { - "name": "PdpGroup0", - "version": "1.2.4", + "name": "PdpGroup10", "description": "group description", "pdpGroupState": "ACTIVE", "properties": { @@ -117,8 +115,7 @@ ] }, { - "name": "PdpGroup0", - "version": "1.2.1", + "name": "PdpGroup20", "description": "group description", "pdpGroupState": "SAFE", "properties": { @@ -193,7 +190,6 @@ }, { "name": "PdpGroup1", - "version": "1.2.1", "description": "group description", "pdpGroupState": "PASSIVE", "properties": { @@ -235,8 +231,7 @@ ] }, { - "name": "PdpGroup1", - "version": "1.2.3", + "name": "PdpGroup11", "description": "group description", "pdpGroupState": "TEST", "properties": { |