summaryrefslogtreecommitdiffstats
path: root/models-provider
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2019-04-10 11:34:06 +0000
committerliamfallon <liam.fallon@est.tech>2019-04-10 11:34:06 +0000
commit24400f789d2a20da08793fa8d5ac046caf46c267 (patch)
tree92320a6dd5a0ab3ae79c5d15d470372b23075660 /models-provider
parent942cd0a012a2a4e9fd44e680dc6c4c7f4bcf8c62 (diff)
Finish unit test on policy-models
Unit test coverage well over 90% in policy-models-base policy-models-dao policy-models-pdp policy-models-tosca policy-models-provider Issue-ID: POLICY-1095 Change-Id: I7703e2ae8a93575ca478c3d809ff8c1fb9f0f334 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'models-provider')
-rw-r--r--models-provider/pom.xml6
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java3
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java4
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java67
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java351
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java56
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyLegacyGuardPersistenceTest.java10
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyLegacyOperationalPersistenceTest.java6
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyPersistenceTest.java1
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyTypePersistenceTest.java5
10 files changed, 394 insertions, 115 deletions
diff --git a/models-provider/pom.xml b/models-provider/pom.xml
index fb0e302dd..41a5a2cfe 100644
--- a/models-provider/pom.xml
+++ b/models-provider/pom.xml
@@ -69,12 +69,6 @@
</dependency>
<dependency>
- <groupId>org.mariadb.jdbc</groupId>
- <artifactId>mariadb-java-client</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
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 cf40a57f9..b186e2b36 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
@@ -361,9 +361,10 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @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 pdppStatistics) throws PfModelException;
+ @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 2fe52e935..cc70df903 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
@@ -348,10 +348,10 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider {
@Override
public void updatePdpStatistics(@NonNull final String pdpGroupName, @NonNull final String pdpGroupVersion,
@NonNull final String pdpType, @NonNull final String pdpInstanceId,
- @NonNull final PdpStatistics pdppStatistics) throws PfModelException {
+ @NonNull final PdpStatistics pdpStatistics) throws PfModelException {
assertInitilized();
new PdpProvider().updatePdpStatistics(pfDao, pdpGroupName, pdpGroupVersion, pdpType, pdpInstanceId,
- pdppStatistics);
+ 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 0bf529730..90545f389 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
@@ -27,7 +27,6 @@ import java.util.List;
import java.util.Map;
import javax.ws.rs.core.Response;
-import lombok.NonNull;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.resources.ResourceUtils;
@@ -61,7 +60,7 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
*
* @param parameters the parameters for the provider
*/
- public DummyPolicyModelsProviderImpl(@NonNull final PolicyModelsProviderParameters parameters) {}
+ public DummyPolicyModelsProviderImpl(final PolicyModelsProviderParameters parameters) {}
@Override
public void init() throws PfModelException {
@@ -84,29 +83,29 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public ToscaServiceTemplate getFilteredPolicyTypes(@NonNull ToscaPolicyTypeFilter filter) throws PfModelException {
- return null;
+ public ToscaServiceTemplate getFilteredPolicyTypes(ToscaPolicyTypeFilter filter) throws PfModelException {
+ return getDummyResponse("dummyimpl/DummyToscaPolicyTypeGetResponse.json");
}
@Override
- public List<ToscaPolicyType> getFilteredPolicyTypeList(@NonNull ToscaPolicyTypeFilter filter) {
+ public List<ToscaPolicyType> getFilteredPolicyTypeList(ToscaPolicyTypeFilter filter) {
return new ArrayList<>();
}
@Override
- public ToscaServiceTemplate createPolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public ToscaServiceTemplate createPolicyTypes(final ToscaServiceTemplate serviceTemplate)
throws PfModelException {
return serviceTemplate;
}
@Override
- public ToscaServiceTemplate updatePolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public ToscaServiceTemplate updatePolicyTypes(final ToscaServiceTemplate serviceTemplate)
throws PfModelException {
return serviceTemplate;
}
@Override
- public ToscaServiceTemplate deletePolicyType(@NonNull final String name, @NonNull final String version)
+ public ToscaServiceTemplate deletePolicyType(final String name, final String version)
throws PfModelException {
return getDummyResponse("dummyimpl/DummyToscaPolicyTypeDeleteResponse.json");
}
@@ -122,75 +121,75 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public ToscaServiceTemplate getFilteredPolicies(@NonNull ToscaPolicyFilter filter) throws PfModelException {
- return null;
+ public ToscaServiceTemplate getFilteredPolicies(ToscaPolicyFilter filter) throws PfModelException {
+ return getDummyResponse("dummyimpl/DummyToscaPolicyGetResponse.json");
}
@Override
- public List<ToscaPolicy> getFilteredPolicyList(@NonNull ToscaPolicyFilter filter) throws PfModelException {
+ public List<ToscaPolicy> getFilteredPolicyList(ToscaPolicyFilter filter) throws PfModelException {
return new ArrayList<>();
}
@Override
- public ToscaServiceTemplate createPolicies(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public ToscaServiceTemplate createPolicies(final ToscaServiceTemplate serviceTemplate)
throws PfModelException {
return serviceTemplate;
}
@Override
- public ToscaServiceTemplate updatePolicies(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public ToscaServiceTemplate updatePolicies(final ToscaServiceTemplate serviceTemplate)
throws PfModelException {
return serviceTemplate;
}
@Override
- public ToscaServiceTemplate deletePolicy(@NonNull final String name, @NonNull final String version)
+ public ToscaServiceTemplate deletePolicy(final String name, final String version)
throws PfModelException {
return getDummyResponse("dummyimpl/DummyToscaPolicyDeleteResponse.json");
}
@Override
- public LegacyOperationalPolicy getOperationalPolicy(@NonNull final String policyId) throws PfModelException {
+ public LegacyOperationalPolicy getOperationalPolicy(final String policyId) throws PfModelException {
return new LegacyOperationalPolicy();
}
@Override
public LegacyOperationalPolicy createOperationalPolicy(
- @NonNull final LegacyOperationalPolicy legacyOperationalPolicy) throws PfModelException {
+ final LegacyOperationalPolicy legacyOperationalPolicy) throws PfModelException {
return legacyOperationalPolicy;
}
@Override
public LegacyOperationalPolicy updateOperationalPolicy(
- @NonNull final LegacyOperationalPolicy legacyOperationalPolicy) throws PfModelException {
+ final LegacyOperationalPolicy legacyOperationalPolicy) throws PfModelException {
return legacyOperationalPolicy;
}
@Override
- public LegacyOperationalPolicy deleteOperationalPolicy(@NonNull final String policyId) throws PfModelException {
+ public LegacyOperationalPolicy deleteOperationalPolicy(final String policyId) throws PfModelException {
return new LegacyOperationalPolicy();
}
@Override
- public Map<String, LegacyGuardPolicyOutput> getGuardPolicy(@NonNull final String policyId) throws PfModelException {
+ public Map<String, LegacyGuardPolicyOutput> getGuardPolicy(final String policyId) throws PfModelException {
return new HashMap<>();
}
@Override
public Map<String, LegacyGuardPolicyOutput> createGuardPolicy(
- @NonNull final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException {
+ final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException {
return new HashMap<>();
}
@Override
public Map<String, LegacyGuardPolicyOutput> updateGuardPolicy(
- @NonNull final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException {
+ final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException {
return new HashMap<>();
}
@Override
- public Map<String, LegacyGuardPolicyOutput> deleteGuardPolicy(@NonNull final String policyId)
+ public Map<String, LegacyGuardPolicyOutput> deleteGuardPolicy(final String policyId)
throws PfModelException {
return new HashMap<>();
}
@@ -201,34 +200,34 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public List<PdpGroup> getFilteredPdpGroups(@NonNull PdpGroupFilter filter) throws PfModelException {
+ public List<PdpGroup> getFilteredPdpGroups(PdpGroupFilter filter) throws PfModelException {
return new ArrayList<>();
}
@Override
- public List<PdpGroup> createPdpGroups(@NonNull final List<PdpGroup> pdpGroups) throws PfModelException {
+ public List<PdpGroup> createPdpGroups(final List<PdpGroup> pdpGroups) throws PfModelException {
return new ArrayList<>();
}
@Override
- public List<PdpGroup> updatePdpGroups(@NonNull final List<PdpGroup> pdpGroups) throws PfModelException {
+ public List<PdpGroup> updatePdpGroups(final List<PdpGroup> pdpGroups) throws PfModelException {
return new ArrayList<>();
}
@Override
- public void updatePdpSubGroup(@NonNull final String pdpGroupName, @NonNull final String pdpGroupVersion,
- @NonNull final PdpSubGroup pdpSubGroup) throws PfModelException {
+ public void updatePdpSubGroup(final String pdpGroupName, final String pdpGroupVersion,
+ final PdpSubGroup pdpSubGroup) throws PfModelException {
// Not implemented
}
@Override
- public void updatePdp(@NonNull String pdpGroupName, @NonNull String pdpGroupVersion,
- @NonNull String pdpSubGroup, @NonNull Pdp pdp) throws PfModelException {
+ public void updatePdp(String pdpGroupName, String pdpGroupVersion,
+ String pdpSubGroup, Pdp pdp) throws PfModelException {
// Not implemented
}
@Override
- public PdpGroup deletePdpGroup(@NonNull final String name, @NonNull final String version) throws PfModelException {
+ public PdpGroup deletePdpGroup(final String name, final String version) throws PfModelException {
return null;
}
@@ -238,9 +237,9 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public void updatePdpStatistics(@NonNull final String pdpGroupName, @NonNull final String pdpGroupVersion,
- @NonNull final String pdpType, @NonNull final String pdpInstanceId,
- @NonNull final PdpStatistics pdppStatistics) throws PfModelException {
+ public void updatePdpStatistics(final String pdpGroupName, final String pdpGroupVersion,
+ final String pdpType, final String pdpInstanceId,
+ final PdpStatistics pdppStatistics) throws PfModelException {
// Not implemented
}
@@ -250,7 +249,7 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
* @param fileName the file name containing the dummy response
* @return the ToscaServiceTemplate with the dummy response
*/
- protected ToscaServiceTemplate getDummyResponse(@NonNull final String fileName) {
+ protected ToscaServiceTemplate getDummyResponse(final String fileName) {
StandardCoder standardCoder = new StandardCoder();
ToscaServiceTemplate serviceTemplate;
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 38a5ae114..99358c4c6 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
@@ -27,13 +27,23 @@ import static org.junit.Assert.fail;
import java.util.ArrayList;
import java.util.Base64;
+import java.util.List;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
+import org.onap.policy.models.pdp.concepts.Pdp;
+import org.onap.policy.models.pdp.concepts.PdpGroup;
+import org.onap.policy.models.pdp.concepts.PdpGroupFilter;
+import org.onap.policy.models.pdp.concepts.PdpStatistics;
+import org.onap.policy.models.pdp.concepts.PdpSubGroup;
+import org.onap.policy.models.pdp.enums.PdpHealthStatus;
+import org.onap.policy.models.pdp.enums.PdpState;
import org.onap.policy.models.provider.PolicyModelsProvider;
import org.onap.policy.models.provider.PolicyModelsProviderFactory;
import org.onap.policy.models.provider.PolicyModelsProviderParameters;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyFilter;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeFilter;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
@@ -65,6 +75,10 @@ public class DatabasePolicyModelsProviderTest {
@Test
public void testInitAndClose() throws Exception {
+ assertThatThrownBy(() -> {
+ new DatabasePolicyModelsProviderImpl(null);
+ }).hasMessage("parameters is marked @NonNull but is null");
+
PolicyModelsProvider databaseProvider =
new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
@@ -101,6 +115,17 @@ public class DatabasePolicyModelsProviderTest {
fail("test shold not throw an exception here");
}
+ assertThatThrownBy(() -> {
+ databaseProvider.init();
+ databaseProvider.init();
+ }).hasMessage("provider is already initialized");
+
+ try {
+ databaseProvider.close();
+ } catch (Exception pfme) {
+ fail("test shold not throw an exception here");
+ }
+
try {
databaseProvider.close();
} catch (Exception pfme) {
@@ -115,23 +140,18 @@ public class DatabasePolicyModelsProviderTest {
}).hasMessage("could not close connection to database with URL \"jdbc:h2:mem:testdb\"");
}
- @Ignore
@Test
public void testProviderMethodsNull() throws Exception {
PolicyModelsProvider databaseProvider =
new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
assertThatThrownBy(() -> {
- databaseProvider.getPolicyTypes(null, null);
- }).hasMessage("name is marked @NonNull but is null");
+ databaseProvider.getFilteredPolicyTypes(null);
+ }).hasMessage("filter is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.getPolicyTypes("aaa", null);
- }).hasMessage("version is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.getPolicyTypes(null, "aaa");
- }).hasMessage("name is marked @NonNull but is null");
+ databaseProvider.getFilteredPolicyTypeList(null);
+ }).hasMessage("filter is marked @NonNull but is null");
assertThatThrownBy(() -> {
databaseProvider.createPolicyTypes(null);
@@ -154,16 +174,12 @@ public class DatabasePolicyModelsProviderTest {
}).hasMessage("name is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.getPolicies(null, null);
- }).hasMessage("name is marked @NonNull but is null");
+ databaseProvider.getFilteredPolicies(null);
+ }).hasMessage("filter is marked @NonNull but is null");
assertThatThrownBy(() -> {
- databaseProvider.getPolicies(null, "aaa");
- }).hasMessage("name is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- databaseProvider.getPolicies("aaa", null);
- }).hasMessage("version is marked @NonNull but is null");
+ databaseProvider.getFilteredPolicyList(null);
+ }).hasMessage("filter is marked @NonNull but is null");
assertThatThrownBy(() -> {
databaseProvider.createPolicies(null);
@@ -218,6 +234,10 @@ public class DatabasePolicyModelsProviderTest {
}).hasMessage("policyId is marked @NonNull but is null");
assertThatThrownBy(() -> {
+ databaseProvider.getFilteredPdpGroups(null);
+ }).hasMessage("filter is marked @NonNull but is null");
+
+ assertThatThrownBy(() -> {
databaseProvider.createPdpGroups(null);
}).hasMessage("pdpGroups is marked @NonNull but is null");
@@ -226,11 +246,230 @@ public class DatabasePolicyModelsProviderTest {
}).hasMessage("pdpGroups is marked @NonNull but is null");
assertThatThrownBy(() -> {
+ databaseProvider.updatePdpSubGroup(null, null, null);
+ }).hasMessage("pdpGroupName is marked @NonNull but is null");
+
+ assertThatThrownBy(() -> {
+ databaseProvider.updatePdpSubGroup(null, 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);
+ }).hasMessage("pdpSubGroup is marked @NonNull but is null");
+
+ assertThatThrownBy(() -> {
+ databaseProvider.updatePdp(null, null, null, null);
+ }).hasMessage("pdpGroupName is marked @NonNull but is null");
+
+ assertThatThrownBy(() -> {
+ databaseProvider.updatePdp(null, null, null, new Pdp());
+ }).hasMessage("pdpGroupName is marked @NonNull but is null");
+
+ assertThatThrownBy(() -> {
+ databaseProvider.updatePdp(null, null, "sub", null);
+ }).hasMessage("pdpGroupName is marked @NonNull but is null");
+
+ assertThatThrownBy(() -> {
+ databaseProvider.updatePdp(null, null, "sub", new Pdp());
+ }).hasMessage("pdpGroupName is marked @NonNull but is null");
+
+ assertThatThrownBy(() -> {
+ databaseProvider.updatePdp(null, "version", null, null);
+ }).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);
+ }).hasMessage("pdpSubGroup is marked @NonNull but is null");
+
+ assertThatThrownBy(() -> {
+ databaseProvider.updatePdp("name", "version", null, new Pdp());
+ }).hasMessage("pdpSubGroup is marked @NonNull but is null");
+
+ assertThatThrownBy(() -> {
+ databaseProvider.updatePdp("name", "version", "sub", null);
+ }).hasMessage("pdp is marked @NonNull but is null");
+
+ assertThatThrownBy(() -> {
databaseProvider.deletePdpGroup(null, null);
}).hasMessage("name is marked @NonNull but is null");
- databaseProvider.close();
+ assertThatThrownBy(() -> {
+ databaseProvider.deletePdpGroup(null, "version");
+ }).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);
+ }).hasMessage("pdpGroupName is marked @NonNull but is null");
+
+ assertThatThrownBy(() -> {
+ databaseProvider.updatePdpStatistics(null, null, null, null, new PdpStatistics());
+ }).hasMessage("pdpGroupName is marked @NonNull but is null");
+
+ assertThatThrownBy(() -> {
+ databaseProvider.updatePdpStatistics(null, null, null, "Instance", null);
+ }).hasMessage("pdpGroupName is marked @NonNull but is null");
+
+ assertThatThrownBy(() -> {
+ databaseProvider.updatePdpStatistics(null, null, null, "Instance", new PdpStatistics());
+ }).hasMessage("pdpGroupName is marked @NonNull but is null");
+
+ assertThatThrownBy(() -> {
+ databaseProvider.updatePdpStatistics(null, null, "type", null, null);
+ }).hasMessage("pdpGroupName is marked @NonNull but is null");
+
+ assertThatThrownBy(() -> {
+ databaseProvider.updatePdpStatistics(null, null, "type", null, new PdpStatistics());
+ }).hasMessage("pdpGroupName is marked @NonNull but is null");
+
+ assertThatThrownBy(() -> {
+ databaseProvider.updatePdpStatistics(null, null, "type", "Instance", null);
+ }).hasMessage("pdpGroupName is marked @NonNull but is null");
+
+ assertThatThrownBy(() -> {
+ databaseProvider.updatePdpStatistics(null, 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);
+ }).hasMessage("pdpType is marked @NonNull but is null");
+
+ assertThatThrownBy(() -> {
+ databaseProvider.updatePdpStatistics("name", "ver", null, null, new PdpStatistics());
+ }).hasMessage("pdpType is marked @NonNull but is null");
+
+ assertThatThrownBy(() -> {
+ databaseProvider.updatePdpStatistics("name", "ver", null, "Instance", null);
+ }).hasMessage("pdpType is marked @NonNull but is null");
+
+ assertThatThrownBy(() -> {
+ databaseProvider.updatePdpStatistics("name", "ver", null, "Instance", new PdpStatistics());
+ }).hasMessage("pdpType is marked @NonNull but is null");
+
+ assertThatThrownBy(() -> {
+ databaseProvider.updatePdpStatistics("name", "ver", "type", null, null);
+ }).hasMessage("pdpInstanceId is marked @NonNull but is null");
+
+ assertThatThrownBy(() -> {
+ databaseProvider.updatePdpStatistics("name", "ver", "type", null, new PdpStatistics());
+ }).hasMessage("pdpInstanceId is marked @NonNull but is null");
+
+ assertThatThrownBy(() -> {
+ databaseProvider.updatePdpStatistics("name", "ver", "type", "Instance", null);
+ }).hasMessage("pdpStatistics is marked @NonNull but is null");
+
+ databaseProvider.close();
}
@Test
@@ -245,15 +484,16 @@ public class DatabasePolicyModelsProviderTest {
}).hasMessage("policy models provider is not initilaized");
}
- @Ignore
@Test
public void testProviderMethods() {
try (PolicyModelsProvider databaseProvider =
new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters)) {
- assertThatThrownBy(() -> {
- databaseProvider.getPolicyTypes("name", "version");
- }).hasMessage("policy type not found: name:version");
+ assertEquals(0, databaseProvider.getPolicyTypes("name", "version").getPolicyTypes().get(0).size());
+ assertEquals(0, databaseProvider.getPolicyTypeList("name", "version").size());
+ assertEquals(0, databaseProvider.getFilteredPolicyTypes(ToscaPolicyTypeFilter.builder().build())
+ .getPolicyTypes().get(0).size());
+ assertEquals(0, databaseProvider.getFilteredPolicyTypeList(ToscaPolicyTypeFilter.builder().build()).size());
assertThatThrownBy(() -> {
databaseProvider.createPolicyTypes(new ToscaServiceTemplate());
@@ -263,13 +503,16 @@ public class DatabasePolicyModelsProviderTest {
databaseProvider.updatePolicyTypes(new ToscaServiceTemplate());
}).hasMessage("no policy types specified on service template");
- assertThatThrownBy(() -> {
- databaseProvider.deletePolicyType("name", "version");
- }).hasMessage("policy type not found: name:version");
+ assertEquals(0, databaseProvider.deletePolicyType("name", "version").getPolicyTypes().get(0).size());
- assertThatThrownBy(() -> {
- databaseProvider.getPolicies("name", "version");
- }).hasMessage("policy not found: name:version");
+ assertEquals(0, databaseProvider.deletePolicyType("name", "version").getPolicyTypes().get(0).size());
+
+ assertEquals(0, databaseProvider.getPolicies("name", "version").getToscaTopologyTemplate().getPolicies()
+ .get(0).size());
+ assertEquals(0, databaseProvider.getPolicyList("name", "version").size());
+ assertEquals(0, databaseProvider.getFilteredPolicies(ToscaPolicyFilter.builder().build())
+ .getToscaTopologyTemplate().getPolicies().get(0).size());
+ assertEquals(0, databaseProvider.getFilteredPolicyList(ToscaPolicyFilter.builder().build()).size());
assertThatThrownBy(() -> {
databaseProvider.createPolicies(new ToscaServiceTemplate());
@@ -279,9 +522,8 @@ public class DatabasePolicyModelsProviderTest {
databaseProvider.updatePolicies(new ToscaServiceTemplate());
}).hasMessage("topology template not specified on service template");
- assertThatThrownBy(() -> {
- databaseProvider.deletePolicy("name", "version");
- }).hasMessage("policy not found: name:version");
+ assertEquals(0, databaseProvider.deletePolicy("Policy", "0.0.0").getToscaTopologyTemplate().getPolicies()
+ .get(0).size());
assertThatThrownBy(() -> {
databaseProvider.getOperationalPolicy("policy_id");
@@ -316,14 +558,59 @@ public class DatabasePolicyModelsProviderTest {
}).hasMessage("no policy found for policy ID: policy_id");
assertEquals(0, databaseProvider.getPdpGroups("name", "version").size());
+ assertEquals(0, databaseProvider.getFilteredPdpGroups(PdpGroupFilter.builder().build()).size());
assertNotNull(databaseProvider.createPdpGroups(new ArrayList<>()));
assertNotNull(databaseProvider.updatePdpGroups(new ArrayList<>()));
+ PdpGroup pdpGroup = new PdpGroup();
+ pdpGroup.setName("group");
+ pdpGroup.setVersion("1.2.3");
+ pdpGroup.setPdpGroupState(PdpState.ACTIVE);
+ pdpGroup.setPdpSubgroups(new ArrayList<>());
+ List<PdpGroup> groupList = new ArrayList<>();
+ groupList.add(pdpGroup);
+
+ PdpSubGroup pdpSubGroup = new PdpSubGroup();
+ pdpSubGroup.setPdpType("type");
+ pdpSubGroup.setDesiredInstanceCount(123);
+ pdpSubGroup.setSupportedPolicyTypes(new ArrayList<>());
+ pdpSubGroup.getSupportedPolicyTypes().add(new ToscaPolicyTypeIdentifier("type", "7.8.9"));
+ pdpGroup.getPdpSubgroups().add(pdpSubGroup);
+
+ Pdp pdp = new Pdp();
+ pdp.setInstanceId("type-0");
+ pdp.setMessage("Hello");
+ pdp.setPdpState(PdpState.ACTIVE);
+ pdp.setHealthy(PdpHealthStatus.UNKNOWN);
+ pdpSubGroup.setPdpInstances(new ArrayList<>());
+ pdpSubGroup.getPdpInstances().add(pdp);
+
+ assertEquals(123, databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0)
+ .getDesiredInstanceCount());
+ assertEquals(1, databaseProvider.getPdpGroups("group", "1.2.3").size());
+
+ pdpSubGroup.setDesiredInstanceCount(234);
+ databaseProvider.updatePdpSubGroup("group", "1.2.3", pdpSubGroup);
+ assertEquals(234, databaseProvider.getPdpGroups("group", "1.2.3").get(0).getPdpSubgroups()
+ .get(0).getDesiredInstanceCount());
+
+ assertEquals("Hello", databaseProvider.getPdpGroups("group", "1.2.3").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()
+ .get(0).getPdpInstances().get(0).getMessage());
+
assertThatThrownBy(() -> {
databaseProvider.deletePdpGroup("name", "version");
}).hasMessage("delete of PDP group \"name:version\" failed, PDP group does not exist");
+ assertEquals(pdpGroup.getName(), databaseProvider.deletePdpGroup("group", "1.2.3").getName());
+
+ assertEquals(0, databaseProvider.getPdpStatistics(null, null).size());
+
+ databaseProvider.updatePdpStatistics("group", "1.2.3", "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/DummyPolicyModelsProviderTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java
index 01da44924..5a0cddb03 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
@@ -20,7 +20,6 @@
package org.onap.policy.models.provider.impl;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -30,9 +29,15 @@ import static org.junit.Assert.fail;
import java.util.ArrayList;
import org.junit.Test;
+import org.onap.policy.models.pdp.concepts.Pdp;
+import org.onap.policy.models.pdp.concepts.PdpGroupFilter;
+import org.onap.policy.models.pdp.concepts.PdpStatistics;
+import org.onap.policy.models.pdp.concepts.PdpSubGroup;
import org.onap.policy.models.provider.PolicyModelsProvider;
import org.onap.policy.models.provider.PolicyModelsProviderFactory;
import org.onap.policy.models.provider.PolicyModelsProviderParameters;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyFilter;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeFilter;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
@@ -74,11 +79,17 @@ public class DummyPolicyModelsProviderTest {
dummyProvider.init();
assertNotNull(dummyProvider.getPolicyTypes("name", "version"));
+ assertNotNull(dummyProvider.getFilteredPolicyTypes(ToscaPolicyTypeFilter.builder().build()));
+ assertNotNull(dummyProvider.getPolicyTypeList("name", "version"));
+ assertNotNull(dummyProvider.getFilteredPolicyTypeList(ToscaPolicyTypeFilter.builder().build()));
assertNotNull(dummyProvider.createPolicyTypes(new ToscaServiceTemplate()));
assertNotNull(dummyProvider.updatePolicyTypes(new ToscaServiceTemplate()));
assertNotNull(dummyProvider.deletePolicyType("name", "version"));
assertNotNull(dummyProvider.getPolicies("name", "version"));
+ assertNotNull(dummyProvider.getFilteredPolicies(ToscaPolicyFilter.builder().build()));
+ assertNotNull(dummyProvider.getPolicyList("name", "version"));
+ assertNotNull(dummyProvider.getFilteredPolicyList(ToscaPolicyFilter.builder().build()));
assertNotNull(dummyProvider.createPolicies(new ToscaServiceTemplate()));
assertNotNull(dummyProvider.updatePolicies(new ToscaServiceTemplate()));
assertNotNull(dummyProvider.deletePolicy("name", "version"));
@@ -94,46 +105,15 @@ public class DummyPolicyModelsProviderTest {
assertNotNull(dummyProvider.deleteGuardPolicy("policy_id"));
assertTrue(dummyProvider.getPdpGroups("name", "version").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"));
-
- assertThatThrownBy(() -> {
- dummyProvider.getOperationalPolicy(null);
- }).hasMessage("policyId is marked @NonNull but is null");
- assertThatThrownBy(() -> {
- dummyProvider.createOperationalPolicy(null);
- }).hasMessage("legacyOperationalPolicy is marked @NonNull but is null");
- assertThatThrownBy(() -> {
- dummyProvider.updateOperationalPolicy(null);
- }).hasMessage("legacyOperationalPolicy is marked @NonNull but is null");
- assertThatThrownBy(() -> {
- dummyProvider.deleteOperationalPolicy(null);
- }).hasMessage("policyId is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- dummyProvider.getGuardPolicy(null);
- }).hasMessage("policyId is marked @NonNull but is null");
- assertThatThrownBy(() -> {
- dummyProvider.createGuardPolicy(null);
- }).hasMessage("legacyGuardPolicy is marked @NonNull but is null");
- assertThatThrownBy(() -> {
- dummyProvider.updateGuardPolicy(null);
- }).hasMessage("legacyGuardPolicy is marked @NonNull but is null");
- assertThatThrownBy(() -> {
- dummyProvider.deleteGuardPolicy(null);
- }).hasMessage("policyId is marked @NonNull but is null");
-
- assertThatThrownBy(() -> {
- dummyProvider.createPdpGroups(null);
- }).hasMessage("pdpGroups is marked @NonNull but is null");
- assertThatThrownBy(() -> {
- dummyProvider.updatePdpGroups(null);
- }).hasMessage("pdpGroups is marked @NonNull but is null");
- assertThatThrownBy(() -> {
- dummyProvider.deletePdpGroup(null, null);
- }).hasMessage("name is marked @NonNull but is null");
+ 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.close();
}
@@ -159,7 +139,7 @@ public class DummyPolicyModelsProviderTest {
resp.getBadDummyResponse2();
fail("test should throw an exception");
} catch (Exception npe) {
- assertEquals("fileName is marked @NonNull but is null", npe.getMessage());
+ assertEquals("error serializing object", npe.getMessage());
} finally {
if (resp != null) {
resp.close();
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyLegacyGuardPersistenceTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyLegacyGuardPersistenceTest.java
index 47f099a73..5ebb44814 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyLegacyGuardPersistenceTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyLegacyGuardPersistenceTest.java
@@ -134,6 +134,16 @@ public class PolicyLegacyGuardPersistenceTest {
assertEquals(gip.getContent(),
gotGopm.get(gip.getPolicyId()).getProperties().values().iterator().next());
+ Map<String, LegacyGuardPolicyOutput> updatedGopm = databaseProvider.updateGuardPolicy(gip);
+ assertEquals(gip.getPolicyId(), updatedGopm.keySet().iterator().next());
+ assertEquals(gip.getContent(),
+ updatedGopm.get(gip.getPolicyId()).getProperties().values().iterator().next());
+
+ Map<String, LegacyGuardPolicyOutput> deletedGopm = databaseProvider.deleteGuardPolicy(gip.getPolicyId());
+ assertEquals(gip.getPolicyId(), deletedGopm.keySet().iterator().next());
+ assertEquals(gip.getContent(),
+ deletedGopm.get(gip.getPolicyId()).getProperties().values().iterator().next());
+
String actualRetrievedJson = standardCoder.encode(gotGopm);
// All of this dash/underscore stuff is to avoid a checkstyle error around escaping unicode characters
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyLegacyOperationalPersistenceTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyLegacyOperationalPersistenceTest.java
index 65e6a2f54..af6c4a4cc 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyLegacyOperationalPersistenceTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyLegacyOperationalPersistenceTest.java
@@ -130,6 +130,12 @@ public class PolicyLegacyOperationalPersistenceTest {
LegacyOperationalPolicy gotLop = databaseProvider.getOperationalPolicy(lop.getPolicyId());
assertEquals(gotLop, lop);
+ LegacyOperationalPolicy updatedLop = databaseProvider.updateOperationalPolicy(lop);
+ assertEquals(gotLop, updatedLop);
+
+ LegacyOperationalPolicy deletedLop = databaseProvider.deleteOperationalPolicy(lop.getPolicyId());
+ assertEquals(gotLop, deletedLop);
+
String actualRetrievedJson = standardCoder.encode(gotLop);
// All of this dash/underscore stuff is to avoid a checkstyle error around escaping unicode characters
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyPersistenceTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyPersistenceTest.java
index e8c344189..81795dbda 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyPersistenceTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyPersistenceTest.java
@@ -143,6 +143,7 @@ public class PolicyPersistenceTest {
assertNotNull(serviceTemplate);
databaseProvider.createPolicies(serviceTemplate);
+ databaseProvider.updatePolicies(serviceTemplate);
for (Map<String, ToscaPolicy> policyMap : serviceTemplate.getToscaTopologyTemplate().getPolicies()) {
for (ToscaPolicy policy : policyMap.values()) {
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyTypePersistenceTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyTypePersistenceTest.java
index 96360ec93..528395efc 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyTypePersistenceTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyTypePersistenceTest.java
@@ -106,7 +106,7 @@ public class PolicyTypePersistenceTest {
}
@Test
- public void testPolicyPersistence() {
+ public void testPolicyTypePersistence() {
try {
for (String policyTypeResourceName : policyTypeResourceNames) {
String policyTypeString = ResourceUtils.getResourceAsString(policyTypeResourceName);
@@ -118,7 +118,7 @@ public class PolicyTypePersistenceTest {
}
}
} catch (Exception exc) {
- LOGGER.warn("error processing policies", exc);
+ LOGGER.warn("error processing policy types", exc);
fail("test should not throw an exception");
}
}
@@ -143,6 +143,7 @@ public class PolicyTypePersistenceTest {
ToscaPolicyType inPolicyType = serviceTemplate.getPolicyTypes().get(0).values().iterator().next();
databaseProvider.createPolicyTypes(serviceTemplate);
+ databaseProvider.updatePolicyTypes(serviceTemplate);
List<ToscaPolicyType> policyTypeList =
databaseProvider.getPolicyTypeList(inPolicyType.getName(), inPolicyType.getVersion());