summaryrefslogtreecommitdiffstats
path: root/models-provider
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
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')
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java25
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java31
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java52
-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
6 files changed, 101 insertions, 229 deletions
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java
index b186e2b36..a7d414533 100644
--- a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java
+++ b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java
@@ -278,11 +278,10 @@ public interface PolicyModelsProvider extends AutoCloseable {
* Get PDP groups.
*
* @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 groups found
* @throws PfModelException on errors getting PDP groups
*/
- public List<PdpGroup> getPdpGroups(final String name, final String version) throws PfModelException;
+ public List<PdpGroup> getPdpGroups(final String name) throws PfModelException;
/**
* Get filtered PDP groups.
@@ -315,56 +314,50 @@ public interface PolicyModelsProvider extends AutoCloseable {
* Update a PDP subgroup.
*
* @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 String pdpGroupName, @NonNull final String pdpGroupVersion,
- @NonNull final PdpSubGroup pdpSubGroup) throws PfModelException;
+ public void updatePdpSubGroup(@NonNull final String pdpGroupName, @NonNull final PdpSubGroup pdpSubGroup)
+ throws PfModelException;
/**
* Update a PDP.
*
* @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 String pdpGroupName, @NonNull final String pdpGroupVersion,
- @NonNull final String pdpSubGroup, @NonNull final Pdp pdp) throws PfModelException;
+ public void updatePdp(@NonNull final String pdpGroupName, @NonNull final String pdpSubGroup, @NonNull final Pdp pdp)
+ throws PfModelException;
/**
* Delete a PDP group.
*
* @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 String name, @NonNull final String version) throws PfModelException;
+ public PdpGroup deletePdpGroup(@NonNull final String name) throws PfModelException;
/**
* Get PDP statistics.
*
* @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(final String name, final String version) throws PfModelException;
+ public List<PdpStatistics> getPdpStatistics(final String name) throws PfModelException;
/**
* Update PDP statistics for a PDP.
*
* @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 PDP statistics
* @throws PfModelException on errors updating statistics
*/
- public void updatePdpStatistics(@NonNull final String pdpGroupName, @NonNull final String pdpGroupVersion,
- @NonNull final String pdpType, @NonNull final String pdpInstanceId,
- @NonNull final PdpStatistics pdpStatistics) throws PfModelException;
+ public void updatePdpStatistics(@NonNull final String pdpGroupName, @NonNull final String pdpType,
+ @NonNull final String pdpInstanceId, @NonNull final PdpStatistics pdpStatistics) throws PfModelException;
}
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java
index cd7b7f38e..a6e8f325b 100644
--- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java
+++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java
@@ -284,9 +284,9 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public List<PdpGroup> getPdpGroups(final String name, final String version) throws PfModelException {
+ public List<PdpGroup> getPdpGroups(final String name) throws PfModelException {
assertInitilized();
- return new PdpProvider().getPdpGroups(pfDao, name, version);
+ return new PdpProvider().getPdpGroups(pfDao, name);
}
@Override
@@ -308,36 +308,35 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public void updatePdpSubGroup(@NonNull final String pdpGroupName, @NonNull final String pdpGroupVersion,
- @NonNull final PdpSubGroup pdpSubGroup) throws PfModelException {
+ public void updatePdpSubGroup(@NonNull final String pdpGroupName, @NonNull final PdpSubGroup pdpSubGroup)
+ throws PfModelException {
assertInitilized();
- new PdpProvider().updatePdpSubGroup(pfDao, pdpGroupName, pdpGroupVersion, pdpSubGroup);
+ new PdpProvider().updatePdpSubGroup(pfDao, pdpGroupName, pdpSubGroup);
}
@Override
- public void updatePdp(@NonNull String pdpGroupName, @NonNull String pdpGroupVersion, @NonNull String pdpSubGroup,
- @NonNull Pdp pdp) throws PfModelException {
- new PdpProvider().updatePdp(pfDao, pdpGroupName, pdpGroupVersion, pdpSubGroup, pdp);
+ public void updatePdp(@NonNull String pdpGroupName, @NonNull String pdpSubGroup, @NonNull Pdp pdp)
+ throws PfModelException {
+ new PdpProvider().updatePdp(pfDao, pdpGroupName, pdpSubGroup, pdp);
}
@Override
- public PdpGroup deletePdpGroup(@NonNull final String name, @NonNull final String version) throws PfModelException {
+ public PdpGroup deletePdpGroup(@NonNull final String name) throws PfModelException {
assertInitilized();
- return new PdpProvider().deletePdpGroup(pfDao, name, version);
+ return new PdpProvider().deletePdpGroup(pfDao, name);
}
@Override
- public List<PdpStatistics> getPdpStatistics(final String name, final String version) throws PfModelException {
+ public List<PdpStatistics> getPdpStatistics(final String name) throws PfModelException {
assertInitilized();
- return new PdpProvider().getPdpStatistics(pfDao, name, version);
+ return new PdpProvider().getPdpStatistics(pfDao, name);
}
@Override
- public void updatePdpStatistics(@NonNull final String pdpGroupName, @NonNull final String pdpGroupVersion,
- @NonNull final String pdpType, @NonNull final String pdpInstanceId,
- @NonNull final PdpStatistics pdpStatistics) throws PfModelException {
+ public void updatePdpStatistics(@NonNull final String pdpGroupName, @NonNull final String pdpType,
+ @NonNull final String pdpInstanceId, @NonNull final PdpStatistics pdpStatistics) throws PfModelException {
assertInitilized();
- new PdpProvider().updatePdpStatistics(pfDao, pdpGroupName, pdpGroupVersion, pdpType, pdpInstanceId,
+ new PdpProvider().updatePdpStatistics(pfDao, pdpGroupName, pdpType, pdpInstanceId,
pdpStatistics);
}
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java
index 90545f389..9b1ca7669 100644
--- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java
+++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java
@@ -93,20 +93,17 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public ToscaServiceTemplate createPolicyTypes(final ToscaServiceTemplate serviceTemplate)
- throws PfModelException {
+ public ToscaServiceTemplate createPolicyTypes(final ToscaServiceTemplate serviceTemplate) throws PfModelException {
return serviceTemplate;
}
@Override
- public ToscaServiceTemplate updatePolicyTypes(final ToscaServiceTemplate serviceTemplate)
- throws PfModelException {
+ public ToscaServiceTemplate updatePolicyTypes(final ToscaServiceTemplate serviceTemplate) throws PfModelException {
return serviceTemplate;
}
@Override
- public ToscaServiceTemplate deletePolicyType(final String name, final String version)
- throws PfModelException {
+ public ToscaServiceTemplate deletePolicyType(final String name, final String version) throws PfModelException {
return getDummyResponse("dummyimpl/DummyToscaPolicyTypeDeleteResponse.json");
}
@@ -131,20 +128,17 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public ToscaServiceTemplate createPolicies(final ToscaServiceTemplate serviceTemplate)
- throws PfModelException {
+ public ToscaServiceTemplate createPolicies(final ToscaServiceTemplate serviceTemplate) throws PfModelException {
return serviceTemplate;
}
@Override
- public ToscaServiceTemplate updatePolicies(final ToscaServiceTemplate serviceTemplate)
- throws PfModelException {
+ public ToscaServiceTemplate updatePolicies(final ToscaServiceTemplate serviceTemplate) throws PfModelException {
return serviceTemplate;
}
@Override
- public ToscaServiceTemplate deletePolicy(final String name, final String version)
- throws PfModelException {
+ public ToscaServiceTemplate deletePolicy(final String name, final String version) throws PfModelException {
return getDummyResponse("dummyimpl/DummyToscaPolicyDeleteResponse.json");
}
@@ -155,14 +149,14 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public LegacyOperationalPolicy createOperationalPolicy(
- final LegacyOperationalPolicy legacyOperationalPolicy) throws PfModelException {
+ public LegacyOperationalPolicy createOperationalPolicy(final LegacyOperationalPolicy legacyOperationalPolicy)
+ throws PfModelException {
return legacyOperationalPolicy;
}
@Override
- public LegacyOperationalPolicy updateOperationalPolicy(
- final LegacyOperationalPolicy legacyOperationalPolicy) throws PfModelException {
+ public LegacyOperationalPolicy updateOperationalPolicy(final LegacyOperationalPolicy legacyOperationalPolicy)
+ throws PfModelException {
return legacyOperationalPolicy;
}
@@ -177,25 +171,24 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public Map<String, LegacyGuardPolicyOutput> createGuardPolicy(
- final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException {
+ public Map<String, LegacyGuardPolicyOutput> createGuardPolicy(final LegacyGuardPolicyInput legacyGuardPolicy)
+ throws PfModelException {
return new HashMap<>();
}
@Override
- public Map<String, LegacyGuardPolicyOutput> updateGuardPolicy(
- final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException {
+ public Map<String, LegacyGuardPolicyOutput> updateGuardPolicy(final LegacyGuardPolicyInput legacyGuardPolicy)
+ throws PfModelException {
return new HashMap<>();
}
@Override
- public Map<String, LegacyGuardPolicyOutput> deleteGuardPolicy(final String policyId)
- throws PfModelException {
+ public Map<String, LegacyGuardPolicyOutput> deleteGuardPolicy(final String policyId) throws PfModelException {
return new HashMap<>();
}
@Override
- public List<PdpGroup> getPdpGroups(final String name, final String version) throws PfModelException {
+ public List<PdpGroup> getPdpGroups(final String name) throws PfModelException {
return new ArrayList<>();
}
@@ -215,30 +208,27 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public void updatePdpSubGroup(final String pdpGroupName, final String pdpGroupVersion,
- final PdpSubGroup pdpSubGroup) throws PfModelException {
+ public void updatePdpSubGroup(final String pdpGroupName, final PdpSubGroup pdpSubGroup) throws PfModelException {
// Not implemented
}
@Override
- public void updatePdp(String pdpGroupName, String pdpGroupVersion,
- String pdpSubGroup, Pdp pdp) throws PfModelException {
+ public void updatePdp(String pdpGroupName, String pdpSubGroup, Pdp pdp) throws PfModelException {
// Not implemented
}
@Override
- public PdpGroup deletePdpGroup(final String name, final String version) throws PfModelException {
+ public PdpGroup deletePdpGroup(final String name) throws PfModelException {
return null;
}
@Override
- public List<PdpStatistics> getPdpStatistics(final String name, final String version) throws PfModelException {
+ public List<PdpStatistics> getPdpStatistics(final String name) throws PfModelException {
return new ArrayList<>();
}
@Override
- public void updatePdpStatistics(final String pdpGroupName, final String pdpGroupVersion,
- final String pdpType, final String pdpInstanceId,
+ public void updatePdpStatistics(final String pdpGroupName, final String pdpType, final String pdpInstanceId,
final PdpStatistics pdppStatistics) throws PfModelException {
// Not implemented
}
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();
}