Add persistence for PDP concepts
This review adds the JPA annotations to PDP group/subgroup and PDP for
persisting to the database.
It also updates the Provider API as requested by other team members.
Issue-ID: POLICY-1095
Change-Id: I8188afb763849ede9680f3751b464d9d76c27196
Signed-off-by: liamfallon <liam.fallon@est.tech>
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 b0494ff..af1c88f 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
@@ -28,7 +28,6 @@
import org.apache.commons.lang3.tuple.Pair;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.pdp.concepts.PdpGroup;
-import org.onap.policy.models.pdp.concepts.PdpGroups;
import org.onap.policy.models.pdp.concepts.PdpStatistics;
import org.onap.policy.models.pdp.concepts.PdpSubGroup;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
@@ -52,6 +51,9 @@
*/
public void init() throws PfModelException;
+ @Override
+ public void close() throws PfModelException;
+
/**
* Get policy types.
*
@@ -145,10 +147,13 @@
* Get policies for a policy type name.
*
* @param policyTypeName the name of the policy type for which to get policies
+ * @param policyTypeVersion the version of the policy type, null returns all versions of deployed policies for
+ * policy types
* @return the policies found
* @throws PfModelException on errors getting policies
*/
- public List<ToscaPolicy> getPolicyList4PolicyType(@NonNull final String policyTypeName) throws PfModelException;
+ public List<ToscaPolicy> getPolicyList4PolicyType(@NonNull final String policyTypeName,
+ final String policyTypeVersion) throws PfModelException;
/**
* Get latest policies.
@@ -284,25 +289,25 @@
* @return the PDP groups found
* @throws PfModelException on errors getting PDP groups
*/
- public PdpGroups getPdpGroups(final String name, final String version) throws PfModelException;
+ public List<PdpGroup> getPdpGroups(final String name, final String version) throws PfModelException;
/**
- * Get latest PDP Groups.
+ * Get latest PDP Groups, returns PDP groups in all states.
*
* @param name the name of the PDP group to get, null to get all PDP groups
* @return the PDP groups found
* @throws PfModelException on errors getting policies
*/
- public PdpGroups getLatestPdpGroups(final String name) throws PfModelException;
+ public List<PdpGroup> getLatestPdpGroups(final String name) throws PfModelException;
/**
- * Get a filtered list of PDP groups.
+ * Get a filtered list of PDP groups, returns only active PDP groups.
*
- * @param pdpType The PDP type filter for the returned PDP groups
+ * @param pdpType The PDP type filter for the returned PDP groups, null to get policy types across PDP subgroups
* @param supportedPolicyTypes a list of policy type name/version pairs that the PDP groups must support.
* @return the PDP groups found
*/
- public PdpGroups getFilteredPdpGroups(@NonNull final String pdpType,
+ public List<PdpGroup> getFilteredPdpGroups(final String pdpType,
@NonNull final List<Pair<String, String>> supportedPolicyTypes);
/**
@@ -312,7 +317,7 @@
* @return the PDP groups created
* @throws PfModelException on errors creating PDP groups
*/
- public PdpGroups createPdpGroups(@NonNull final PdpGroups pdpGroups) throws PfModelException;
+ public List<PdpGroup> createPdpGroups(@NonNull final List<PdpGroup> pdpGroups) throws PfModelException;
/**
* Updates PDP groups.
@@ -321,7 +326,7 @@
* @return the PDP groups updated
* @throws PfModelException on errors updating PDP groups
*/
- public PdpGroups updatePdpGroups(@NonNull final PdpGroups pdpGroups) throws PfModelException;
+ public List<PdpGroup> updatePdpGroups(@NonNull final List<PdpGroup> pdpGroups) throws PfModelException;
/**
@@ -372,8 +377,9 @@
* Get deployed policies.
*
* @param name the name of the policy to get, null to get all policies
- * @return the policies deployed as a map of policy lists keyed by PDP group
+ * @return the policies deployed as a map of policy lists keyed by PDP group name and version
* @throws PfModelException on errors getting policies
*/
- public Map<PdpGroup, List<ToscaPolicy>> getDeployedPolicyList(final String name) throws PfModelException;
+ public Map<Pair<String, String>, List<ToscaPolicy>> getDeployedPolicyList(final String name)
+ throws PfModelException;
}
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderFactory.java b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderFactory.java
index 718668b..86551b3 100644
--- a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderFactory.java
+++ b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderFactory.java
@@ -66,8 +66,12 @@
}
try {
- return (PolicyModelsProvider) implementationClass.getConstructor(PolicyModelsProviderParameters.class)
- .newInstance(parameters);
+ PolicyModelsProvider provider = (PolicyModelsProvider) implementationClass
+ .getConstructor(PolicyModelsProviderParameters.class).newInstance(parameters);
+
+ provider.init();
+
+ return provider;
} catch (Exception exc) {
String errorMessage =
"could not create an instance of PolicyModelsProvider \"" + parameters.getImplementation() + "\"";
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 ee8ed73..96185b6 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
@@ -38,7 +38,6 @@
import org.onap.policy.models.dao.PfDaoFactory;
import org.onap.policy.models.dao.impl.DefaultPfDao;
import org.onap.policy.models.pdp.concepts.PdpGroup;
-import org.onap.policy.models.pdp.concepts.PdpGroups;
import org.onap.policy.models.pdp.concepts.PdpStatistics;
import org.onap.policy.models.pdp.concepts.PdpSubGroup;
import org.onap.policy.models.pdp.persistence.provider.PdpProvider;
@@ -84,6 +83,12 @@
LOGGER.debug("opening the database connection to {} using persistence unit {}", parameters.getDatabaseUrl(),
parameters.getPersistenceUnit());
+ if (connection != null || pfDao != null) {
+ String errorMessage = "provider is already initialized";
+ LOGGER.warn(errorMessage);
+ throw new PfModelException(Response.Status.NOT_ACCEPTABLE, errorMessage);
+ }
+
// Decode the password using Base64
String decodedPassword = new String(Base64.getDecoder().decode(parameters.getDatabasePassword()));
@@ -201,9 +206,10 @@
}
@Override
- public List<ToscaPolicy> getPolicyList4PolicyType(@NonNull final String policyTypeName) throws PfModelException {
+ public List<ToscaPolicy> getPolicyList4PolicyType(@NonNull final String policyTypeName,
+ final String policyTypeVersion) throws PfModelException {
assertInitilized();
- return new AuthorativeToscaProvider().getPolicyList4PolicyType(pfDao, policyTypeName);
+ return new AuthorativeToscaProvider().getPolicyList4PolicyType(pfDao, policyTypeName, policyTypeVersion);
}
@Override
@@ -293,32 +299,32 @@
}
@Override
- public PdpGroups getPdpGroups(final String name, final String version) throws PfModelException {
+ public List<PdpGroup> getPdpGroups(final String name, final String version) throws PfModelException {
assertInitilized();
return new PdpProvider().getPdpGroups(pfDao, name, version);
}
@Override
- public PdpGroups getLatestPdpGroups(final String name) throws PfModelException {
+ public List<PdpGroup> getLatestPdpGroups(final String name) throws PfModelException {
assertInitilized();
return new PdpProvider().getLatestPdpGroups(pfDao, name);
}
@Override
- public PdpGroups getFilteredPdpGroups(@NonNull final String pdpType,
+ public List<PdpGroup> getFilteredPdpGroups(final String pdpType,
@NonNull final List<Pair<String, String>> supportedPolicyTypes) {
assertInitilized();
return new PdpProvider().getFilteredPdpGroups(pfDao, pdpType, supportedPolicyTypes);
}
@Override
- public PdpGroups createPdpGroups(@NonNull final PdpGroups pdpGroups) throws PfModelException {
+ public List<PdpGroup> createPdpGroups(@NonNull final List<PdpGroup> pdpGroups) throws PfModelException {
assertInitilized();
return new PdpProvider().createPdpGroups(pfDao, pdpGroups);
}
@Override
- public PdpGroups updatePdpGroups(@NonNull final PdpGroups pdpGroups) throws PfModelException {
+ public List<PdpGroup> updatePdpGroups(@NonNull final List<PdpGroup> pdpGroups) throws PfModelException {
assertInitilized();
return new PdpProvider().updatePdpGroups(pfDao, pdpGroups);
}
@@ -345,14 +351,15 @@
@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 pdppStatistics) throws PfModelException {
assertInitilized();
new PdpProvider().updatePdpStatistics(pfDao, pdpGroupName, pdpGroupVersion, pdpType, pdpInstanceId,
pdppStatistics);
}
@Override
- public Map<PdpGroup, List<ToscaPolicy>> getDeployedPolicyList(final String name) throws PfModelException {
+ public Map<Pair<String, String>, List<ToscaPolicy>> getDeployedPolicyList(final String name)
+ throws PfModelException {
assertInitilized();
return new PdpProvider().getDeployedPolicyList(pfDao, name);
}
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 3db8e5e..bf707ef 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
@@ -35,7 +35,6 @@
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.pdp.concepts.PdpGroup;
-import org.onap.policy.models.pdp.concepts.PdpGroups;
import org.onap.policy.models.pdp.concepts.PdpStatistics;
import org.onap.policy.models.pdp.concepts.PdpSubGroup;
import org.onap.policy.models.provider.PolicyModelsProvider;
@@ -120,7 +119,8 @@
}
@Override
- public List<ToscaPolicy> getPolicyList4PolicyType(@NonNull final String policyTypeName) throws PfModelException {
+ public List<ToscaPolicy> getPolicyList4PolicyType(@NonNull final String policyTypeName,
+ final String policyTypeVersion) throws PfModelException {
return new ArrayList<>();
}
@@ -199,29 +199,29 @@
}
@Override
- public PdpGroups getPdpGroups(final String name, final String version) throws PfModelException {
- return null;
+ public List<PdpGroup> getPdpGroups(final String name, final String version) throws PfModelException {
+ return new ArrayList<>();
}
@Override
- public PdpGroups getLatestPdpGroups(final String name) throws PfModelException {
- return null;
+ public List<PdpGroup> getLatestPdpGroups(final String name) throws PfModelException {
+ return new ArrayList<>();
}
@Override
- public PdpGroups getFilteredPdpGroups(@NonNull final String pdpType,
+ public List<PdpGroup> getFilteredPdpGroups(final String pdpType,
@NonNull final List<Pair<String, String>> supportedPolicyTypes) {
- return null;
+ return new ArrayList<>();
}
@Override
- public PdpGroups createPdpGroups(@NonNull final PdpGroups pdpGroups) throws PfModelException {
- return null;
+ public List<PdpGroup> createPdpGroups(@NonNull final List<PdpGroup> pdpGroups) throws PfModelException {
+ return new ArrayList<>();
}
@Override
- public PdpGroups updatePdpGroups(@NonNull final PdpGroups pdpGroups) throws PfModelException {
- return null;
+ public List<PdpGroup> updatePdpGroups(@NonNull final List<PdpGroup> pdpGroups) throws PfModelException {
+ return new ArrayList<>();
}
@Override
@@ -243,12 +243,13 @@
@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 pdppStatistics) throws PfModelException {
// Not implemented
}
@Override
- public Map<PdpGroup, List<ToscaPolicy>> getDeployedPolicyList(final String name) throws PfModelException {
+ public Map<Pair<String, String>, List<ToscaPolicy>> getDeployedPolicyList(final String name)
+ throws PfModelException {
return null;
}
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 d925333..7ad2217 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
@@ -24,11 +24,11 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
+import java.util.ArrayList;
import java.util.Base64;
import org.junit.Before;
import org.junit.Test;
-import org.onap.policy.models.pdp.concepts.PdpGroups;
import org.onap.policy.models.provider.PolicyModelsProvider;
import org.onap.policy.models.provider.PolicyModelsProviderFactory;
import org.onap.policy.models.provider.PolicyModelsProviderParameters;
@@ -69,6 +69,7 @@
parameters.setDatabaseUrl("jdbc://www.acmecorp.nonexist");
assertThatThrownBy(() -> {
+ databaseProvider.close();
databaseProvider.init();
}).hasMessage("could not connect to database with URL \"jdbc://www.acmecorp.nonexist\"");
@@ -116,7 +117,6 @@
public void testProviderMethodsNull() throws Exception {
PolicyModelsProvider databaseProvider =
new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
- databaseProvider.init();
assertThatThrownBy(() -> {
databaseProvider.getPolicyTypes(null, null);
@@ -235,6 +235,8 @@
PolicyModelsProvider databaseProvider =
new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
+ databaseProvider.close();
+
assertThatThrownBy(() -> {
databaseProvider.getPolicyTypes("name", "version");
}).hasMessage("policy models provider is not initilaized");
@@ -244,7 +246,6 @@
public void testProviderMethods() {
try (PolicyModelsProvider databaseProvider =
new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters)) {
- databaseProvider.init();
assertThatThrownBy(() -> {
databaseProvider.getPolicyTypes("name", "version");
@@ -310,9 +311,12 @@
databaseProvider.deleteGuardPolicy("policy_id");
}).hasMessage("no policy found for policy ID: policy_id");
- assertNotNull(databaseProvider.getPdpGroups("name", "version"));
- assertNotNull(databaseProvider.createPdpGroups(new PdpGroups()));
- assertNotNull(databaseProvider.updatePdpGroups(new PdpGroups()));
+ assertThatThrownBy(() -> {
+ databaseProvider.getPdpGroups("name", "version");
+ }).hasMessage("PDP group not found: name:version");
+
+ assertNotNull(databaseProvider.createPdpGroups(new ArrayList<>()));
+ assertNotNull(databaseProvider.updatePdpGroups(new ArrayList<>()));
assertNotNull(databaseProvider.deletePdpGroup("name", "version"));
} catch (Exception exc) {
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 9320df5..c64603d 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
@@ -31,7 +31,6 @@
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.pdp.concepts.PdpGroup;
-import org.onap.policy.models.pdp.concepts.PdpGroups;
import org.onap.policy.models.pdp.concepts.PdpStatistics;
import org.onap.policy.models.pdp.concepts.PdpSubGroup;
import org.onap.policy.models.provider.PolicyModelsProvider;
@@ -53,7 +52,7 @@
}
@Override
- public void close() throws Exception {}
+ public void close() throws PfModelException {}
@Override
public void init() throws PfModelException {}
@@ -86,14 +85,12 @@
}
@Override
- public ToscaServiceTemplate createPolicies(@NonNull ToscaServiceTemplate serviceTemplate)
- throws PfModelException {
+ public ToscaServiceTemplate createPolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
return null;
}
@Override
- public ToscaServiceTemplate updatePolicies(@NonNull ToscaServiceTemplate serviceTemplate)
- throws PfModelException {
+ public ToscaServiceTemplate updatePolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
return null;
}
@@ -147,17 +144,17 @@
}
@Override
- public PdpGroups getPdpGroups(String name, String version) throws PfModelException {
+ public List<PdpGroup> getPdpGroups(String name, String version) throws PfModelException {
return null;
}
@Override
- public PdpGroups createPdpGroups(@NonNull PdpGroups pdpGroups) throws PfModelException {
+ public List<PdpGroup> createPdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException {
return null;
}
@Override
- public PdpGroups updatePdpGroups(@NonNull PdpGroups pdpGroups) throws PfModelException {
+ public List<PdpGroup> updatePdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException {
return null;
}
@@ -187,7 +184,8 @@
}
@Override
- public List<ToscaPolicy> getPolicyList4PolicyType(@NonNull String policyTypeName) throws PfModelException {
+ public List<ToscaPolicy> getPolicyList4PolicyType(@NonNull String policyTypeName, final String policyTypeVersion)
+ throws PfModelException {
return null;
}
@@ -202,20 +200,19 @@
}
@Override
- public PdpGroups getLatestPdpGroups(String name) throws PfModelException {
+ public List<PdpGroup> getLatestPdpGroups(String name) throws PfModelException {
return null;
}
@Override
- public PdpGroups getFilteredPdpGroups(@NonNull String pdpType,
+ public List<PdpGroup> getFilteredPdpGroups(@NonNull String pdpType,
@NonNull List<Pair<String, String>> supportedPolicyTypes) {
return null;
}
@Override
public void updatePdpSubGroup(@NonNull String pdpGroupName, @NonNull String pdpGroupVersion,
- @NonNull PdpSubGroup pdpSubGroup) throws PfModelException {
- }
+ @NonNull PdpSubGroup pdpSubGroup) throws PfModelException {}
@Override
public List<PdpStatistics> getPdpStatistics(String name, String version) throws PfModelException {
@@ -224,11 +221,10 @@
@Override
public void updatePdpStatistics(@NonNull String pdpGroupName, @NonNull String pdpGroupVersion,
- @NonNull String pdpType, @NonNull String pdpInstanceId, @NonNull PdpStatistics pdppStatistics) {
- }
+ @NonNull String pdpType, @NonNull String pdpInstanceId, @NonNull PdpStatistics pdppStatistics) {}
@Override
- public Map<PdpGroup, List<ToscaPolicy>> getDeployedPolicyList(String name) throws PfModelException {
+ public Map<Pair<String, String>, List<ToscaPolicy>> getDeployedPolicyList(String name) throws PfModelException {
return null;
}
}
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 a0b4857..01da449 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
@@ -24,10 +24,12 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import java.util.ArrayList;
+
import org.junit.Test;
-import org.onap.policy.models.pdp.concepts.PdpGroups;
import org.onap.policy.models.provider.PolicyModelsProvider;
import org.onap.policy.models.provider.PolicyModelsProviderFactory;
import org.onap.policy.models.provider.PolicyModelsProviderParameters;
@@ -91,9 +93,9 @@
assertNotNull(dummyProvider.updateGuardPolicy(new LegacyGuardPolicyInput()));
assertNotNull(dummyProvider.deleteGuardPolicy("policy_id"));
- assertNull(dummyProvider.getPdpGroups("name", "version"));
- assertNull(dummyProvider.createPdpGroups(new PdpGroups()));
- assertNull(dummyProvider.updatePdpGroups(new PdpGroups()));
+ assertTrue(dummyProvider.getPdpGroups("name", "version").isEmpty());
+ assertTrue(dummyProvider.createPdpGroups(new ArrayList<>()).isEmpty());
+ assertTrue(dummyProvider.updatePdpGroups(new ArrayList<>()).isEmpty());
assertNull(dummyProvider.deletePdpGroup("name", "version"));
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 2cb787d..47f099a 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
@@ -82,7 +82,6 @@
parameters.setPersistenceUnit("ToscaConceptTest");
databaseProvider = new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
- databaseProvider.init();
}
/**
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 60d577c..65e6a2f 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
@@ -82,7 +82,6 @@
parameters.setPersistenceUnit("ToscaConceptTest");
databaseProvider = new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
- databaseProvider.init();
}
/**
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 b29e1d6..468d4d7 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
@@ -90,7 +90,6 @@
parameters.setPersistenceUnit("ToscaConceptTest");
databaseProvider = new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
- databaseProvider.init();
}
/**
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyToscaPersistenceTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyToscaPersistenceTest.java
index f2b8676..bf48292 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyToscaPersistenceTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyToscaPersistenceTest.java
@@ -89,7 +89,6 @@
parameters.setPersistenceUnit("ToscaConceptTest");
databaseProvider = new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
- databaseProvider.init();
}
/**
diff --git a/models-provider/src/test/resources/META-INF/persistence.xml b/models-provider/src/test/resources/META-INF/persistence.xml
index 23e8567..c7d6d1e 100644
--- a/models-provider/src/test/resources/META-INF/persistence.xml
+++ b/models-provider/src/test/resources/META-INF/persistence.xml
@@ -28,6 +28,9 @@
<class>org.onap.policy.models.base.PfConceptKey</class>
<class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType</class>
<class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpGroup</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpSubGroup</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdp</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
@@ -46,7 +49,11 @@
<class>org.onap.policy.models.dao.converters.CDataConditioner</class>
<class>org.onap.policy.models.dao.converters.Uuid2String</class>
<class>org.onap.policy.models.base.PfConceptKey</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType</class>
<class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpGroup</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdpSubGroup</class>
+ <class>org.onap.policy.models.pdp.persistence.concepts.JpaPdp</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.mariadb.jdbc.Driver" />