summaryrefslogtreecommitdiffstats
path: root/models-provider
diff options
context:
space:
mode:
Diffstat (limited to 'models-provider')
-rw-r--r--models-provider/pom.xml2
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java18
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java21
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java25
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java10
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyBadProviderImpl.java20
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderSubImpl.java6
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java12
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyPersistenceTest.java10
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyToscaPersistenceTest.java10
-rw-r--r--models-provider/src/test/resources/META-INF/persistence.xml6
11 files changed, 72 insertions, 68 deletions
diff --git a/models-provider/pom.xml b/models-provider/pom.xml
index cbe19389d..fb0e302dd 100644
--- a/models-provider/pom.xml
+++ b/models-provider/pom.xml
@@ -58,7 +58,7 @@
<dependency>
<groupId>org.onap.policy.models</groupId>
- <artifactId>policy-models-pap</artifactId>
+ <artifactId>policy-models-pdp</artifactId>
<version>${project.version}</version>
</dependency>
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 103d761df..e390a04f0 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
@@ -30,7 +30,7 @@ import org.onap.policy.models.pdp.concepts.PdpGroups;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
-import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
/**
* This interface describes the operations that are provided to users and components for reading objects from and
@@ -54,7 +54,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @return the policy types found
* @throws PfModelException on errors getting policy types
*/
- public ToscaServiceTemplate getPolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException;
+ public JpaToscaServiceTemplate getPolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException;
/**
* Create policy types.
@@ -63,7 +63,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @return the TOSCA service template containing the created policy types
* @throws PfModelException on errors creating policy types
*/
- public ToscaServiceTemplate createPolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate createPolicyTypes(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException;
/**
@@ -73,7 +73,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @return the TOSCA service template containing the modified policy types
* @throws PfModelException on errors updating policy types
*/
- public ToscaServiceTemplate updatePolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate updatePolicyTypes(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException;
/**
@@ -84,7 +84,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @return the TOSCA service template containing the policy types that were deleted
* @throws PfModelException on errors deleting policy types
*/
- public ToscaServiceTemplate deletePolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException;
+ public JpaToscaServiceTemplate deletePolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException;
/**
* Get policies.
@@ -94,7 +94,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @return the policies found
* @throws PfModelException on errors getting policies
*/
- public ToscaServiceTemplate getPolicies(@NonNull final PfConceptKey policyKey) throws PfModelException;
+ public JpaToscaServiceTemplate getPolicies(@NonNull final PfConceptKey policyKey) throws PfModelException;
/**
* Create policies.
@@ -103,7 +103,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @return the TOSCA service template containing the policy types that were created
* @throws PfModelException on errors creating policies
*/
- public ToscaServiceTemplate createPolicies(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate createPolicies(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException;
@@ -114,7 +114,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @return the TOSCA service template containing the policies that were updated
* @throws PfModelException on errors updating policies
*/
- public ToscaServiceTemplate updatePolicies(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate updatePolicies(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException;
/**
@@ -124,7 +124,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @return the TOSCA service template containing the policy types that were deleted
* @throws PfModelException on errors deleting policies
*/
- public ToscaServiceTemplate deletePolicies(@NonNull final PfConceptKey policyKey) throws PfModelException;
+ public JpaToscaServiceTemplate deletePolicies(@NonNull final PfConceptKey policyKey) throws PfModelException;
/**
* Get legacy operational policy.
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 078126243..85c4d139c 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
@@ -37,14 +37,14 @@ import org.onap.policy.models.dao.PfDao;
import org.onap.policy.models.dao.PfDaoFactory;
import org.onap.policy.models.dao.impl.DefaultPfDao;
import org.onap.policy.models.pdp.concepts.PdpGroups;
-import org.onap.policy.models.pdp.provider.PdpProvider;
+import org.onap.policy.models.pdp.persistence.provider.PdpProvider;
import org.onap.policy.models.provider.PolicyModelsProvider;
import org.onap.policy.models.provider.PolicyModelsProviderParameters;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
import org.onap.policy.models.tosca.legacy.provider.LegacyProvider;
-import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
import org.onap.policy.models.tosca.simple.provider.SimpleToscaProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -138,53 +138,54 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public ToscaServiceTemplate getPolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException {
+ public JpaToscaServiceTemplate getPolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException {
assertInitilized();
return new SimpleToscaProvider().getPolicyTypes(pfDao, policyTypeKey);
}
@Override
- public ToscaServiceTemplate createPolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate createPolicyTypes(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException {
assertInitilized();
return new SimpleToscaProvider().createPolicyTypes(pfDao, serviceTemplate);
}
@Override
- public ToscaServiceTemplate updatePolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate updatePolicyTypes(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException {
assertInitilized();
return new SimpleToscaProvider().updatePolicyTypes(pfDao, serviceTemplate);
}
@Override
- public ToscaServiceTemplate deletePolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException {
+ public JpaToscaServiceTemplate deletePolicyTypes(@NonNull final PfConceptKey policyTypeKey)
+ throws PfModelException {
assertInitilized();
return new SimpleToscaProvider().deletePolicyTypes(pfDao, policyTypeKey);
}
@Override
- public ToscaServiceTemplate getPolicies(@NonNull final PfConceptKey policyKey) throws PfModelException {
+ public JpaToscaServiceTemplate getPolicies(@NonNull final PfConceptKey policyKey) throws PfModelException {
assertInitilized();
return new SimpleToscaProvider().getPolicies(pfDao, policyKey);
}
@Override
- public ToscaServiceTemplate createPolicies(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate createPolicies(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException {
assertInitilized();
return new SimpleToscaProvider().createPolicies(pfDao, serviceTemplate);
}
@Override
- public ToscaServiceTemplate updatePolicies(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate updatePolicies(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException {
assertInitilized();
return new SimpleToscaProvider().updatePolicies(pfDao, serviceTemplate);
}
@Override
- public ToscaServiceTemplate deletePolicies(@NonNull final PfConceptKey policyKey) throws PfModelException {
+ public JpaToscaServiceTemplate deletePolicies(@NonNull final PfConceptKey policyKey) throws PfModelException {
assertInitilized();
return new SimpleToscaProvider().deletePolicies(pfDao, policyKey);
}
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 36fb01c27..e37b1d632 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
@@ -38,7 +38,7 @@ import org.onap.policy.models.provider.PolicyModelsProviderParameters;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
-import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
import org.onap.policy.models.tosca.simple.serialization.ToscaServiceTemplateMessageBodyHandler;
/**
@@ -66,46 +66,47 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public ToscaServiceTemplate getPolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException {
+ public JpaToscaServiceTemplate getPolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException {
return getDummyResponse("dummyimpl/DummyToscaPolicyTypeGetResponse.json");
}
@Override
- public ToscaServiceTemplate createPolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate createPolicyTypes(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException {
return serviceTemplate;
}
@Override
- public ToscaServiceTemplate updatePolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate updatePolicyTypes(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException {
return serviceTemplate;
}
@Override
- public ToscaServiceTemplate deletePolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException {
+ public JpaToscaServiceTemplate deletePolicyTypes(@NonNull final PfConceptKey policyTypeKey)
+ throws PfModelException {
return getDummyResponse("dummyimpl/DummyToscaPolicyTypeDeleteResponse.json");
}
@Override
- public ToscaServiceTemplate getPolicies(@NonNull final PfConceptKey policyKey) throws PfModelException {
+ public JpaToscaServiceTemplate getPolicies(@NonNull final PfConceptKey policyKey) throws PfModelException {
return getDummyResponse("dummyimpl/DummyToscaPolicyGetResponse.json");
}
@Override
- public ToscaServiceTemplate createPolicies(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate createPolicies(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException {
return serviceTemplate;
}
@Override
- public ToscaServiceTemplate updatePolicies(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate updatePolicies(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException {
return serviceTemplate;
}
@Override
- public ToscaServiceTemplate deletePolicies(@NonNull final PfConceptKey policyKey) throws PfModelException {
+ public JpaToscaServiceTemplate deletePolicies(@NonNull final PfConceptKey policyKey) throws PfModelException {
return getDummyResponse("dummyimpl/DummyToscaPolicyDeleteResponse.json");
}
@@ -181,12 +182,12 @@ 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 JpaToscaServiceTemplate getDummyResponse(@NonNull final String fileName) {
Gson gson = new ToscaServiceTemplateMessageBodyHandler().getGson();
- ToscaServiceTemplate serviceTemplate;
+ JpaToscaServiceTemplate serviceTemplate;
try {
- serviceTemplate = gson.fromJson(ResourceUtils.getResourceAsString(fileName), ToscaServiceTemplate.class);
+ serviceTemplate = gson.fromJson(ResourceUtils.getResourceAsString(fileName), JpaToscaServiceTemplate.class);
if (serviceTemplate == null) {
throw new PfModelException(Response.Status.INTERNAL_SERVER_ERROR, "error reading specified file");
}
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 1631d9bb1..335233476 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
@@ -35,7 +35,7 @@ import org.onap.policy.models.provider.PolicyModelsProviderFactory;
import org.onap.policy.models.provider.PolicyModelsProviderParameters;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
-import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -225,11 +225,11 @@ public class DatabasePolicyModelsProviderTest {
}).hasMessage("policy type not found: NULL:0.0.0");
assertThatThrownBy(() -> {
- databaseProvider.createPolicyTypes(new ToscaServiceTemplate());
+ databaseProvider.createPolicyTypes(new JpaToscaServiceTemplate());
}).hasMessage("no policy types specified on service template");
assertThatThrownBy(() -> {
- databaseProvider.updatePolicyTypes(new ToscaServiceTemplate());
+ databaseProvider.updatePolicyTypes(new JpaToscaServiceTemplate());
}).hasMessage("no policy types specified on service template");
assertThatThrownBy(() -> {
@@ -241,11 +241,11 @@ public class DatabasePolicyModelsProviderTest {
}).hasMessage("policy not found: NULL:0.0.0");
assertThatThrownBy(() -> {
- databaseProvider.createPolicies(new ToscaServiceTemplate());
+ databaseProvider.createPolicies(new JpaToscaServiceTemplate());
}).hasMessage("topology template not specified on service template");
assertThatThrownBy(() -> {
- databaseProvider.updatePolicies(new ToscaServiceTemplate());
+ databaseProvider.updatePolicies(new JpaToscaServiceTemplate());
}).hasMessage("topology template not specified on service template");
assertThatThrownBy(() -> {
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 f8602e65c..2ee210c13 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
@@ -34,7 +34,7 @@ import org.onap.policy.models.provider.PolicyModelsProvider;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
-import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
/**
* Dummy implementation of {@link PolicyModelsProvider} with bad constructor.
@@ -53,44 +53,46 @@ public class DummyBadProviderImpl implements PolicyModelsProvider {
public void init() throws PfModelException {}
@Override
- public ToscaServiceTemplate getPolicyTypes(@NonNull PfConceptKey policyTypeKey) throws PfModelException {
+ public JpaToscaServiceTemplate getPolicyTypes(@NonNull PfConceptKey policyTypeKey) throws PfModelException {
return null;
}
@Override
- public ToscaServiceTemplate createPolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate createPolicyTypes(@NonNull JpaToscaServiceTemplate serviceTemplate)
throws PfModelException {
return null;
}
@Override
- public ToscaServiceTemplate updatePolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate updatePolicyTypes(@NonNull JpaToscaServiceTemplate serviceTemplate)
throws PfModelException {
return null;
}
@Override
- public ToscaServiceTemplate deletePolicyTypes(@NonNull PfConceptKey policyTypeKey) throws PfModelException {
+ public JpaToscaServiceTemplate deletePolicyTypes(@NonNull PfConceptKey policyTypeKey) throws PfModelException {
return null;
}
@Override
- public ToscaServiceTemplate getPolicies(@NonNull PfConceptKey policyKey) throws PfModelException {
+ public JpaToscaServiceTemplate getPolicies(@NonNull PfConceptKey policyKey) throws PfModelException {
return null;
}
@Override
- public ToscaServiceTemplate createPolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
+ public JpaToscaServiceTemplate createPolicies(@NonNull JpaToscaServiceTemplate serviceTemplate)
+ throws PfModelException {
return null;
}
@Override
- public ToscaServiceTemplate updatePolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
+ public JpaToscaServiceTemplate updatePolicies(@NonNull JpaToscaServiceTemplate serviceTemplate)
+ throws PfModelException {
return null;
}
@Override
- public ToscaServiceTemplate deletePolicies(@NonNull PfConceptKey policyKey) throws PfModelException {
+ public JpaToscaServiceTemplate deletePolicies(@NonNull PfConceptKey policyKey) throws PfModelException {
return null;
}
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderSubImpl.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderSubImpl.java
index 9b68dd037..66c7762f8 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderSubImpl.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderSubImpl.java
@@ -23,7 +23,7 @@ package org.onap.policy.models.provider.impl;
import lombok.NonNull;
import org.onap.policy.models.provider.PolicyModelsProviderParameters;
-import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
/**
* Sub class to check getDummyResponse() method in base class.
@@ -40,11 +40,11 @@ public class DummyPolicyModelsProviderSubImpl extends DummyPolicyModelsProviderI
super(parameters);
}
- public ToscaServiceTemplate getBadDummyResponse1() {
+ public JpaToscaServiceTemplate getBadDummyResponse1() {
return super.getDummyResponse("/i/dont/exist");
}
- public ToscaServiceTemplate getBadDummyResponse2() {
+ public JpaToscaServiceTemplate getBadDummyResponse2() {
return super.getDummyResponse(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 de61dc0ab..af76edbcb 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
@@ -33,7 +33,7 @@ import org.onap.policy.models.provider.PolicyModelsProviderFactory;
import org.onap.policy.models.provider.PolicyModelsProviderParameters;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
-import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
/**
* Test the dummy models provider implementation.
@@ -53,7 +53,7 @@ public class DummyPolicyModelsProviderTest {
dummyProvider.init();
- ToscaServiceTemplate serviceTemplate = dummyProvider.getPolicies(new PfConceptKey());
+ JpaToscaServiceTemplate serviceTemplate = dummyProvider.getPolicies(new PfConceptKey());
assertNotNull(serviceTemplate);
assertEquals("onap.vcpe.tca:1.0.0",
serviceTemplate.getTopologyTemplate().getPolicies().get("onap.vcpe.tca").getId());
@@ -72,13 +72,13 @@ public class DummyPolicyModelsProviderTest {
dummyProvider.init();
assertNotNull(dummyProvider.getPolicyTypes(new PfConceptKey()));
- assertNotNull(dummyProvider.createPolicyTypes(new ToscaServiceTemplate()));
- assertNotNull(dummyProvider.updatePolicyTypes(new ToscaServiceTemplate()));
+ assertNotNull(dummyProvider.createPolicyTypes(new JpaToscaServiceTemplate()));
+ assertNotNull(dummyProvider.updatePolicyTypes(new JpaToscaServiceTemplate()));
assertNotNull(dummyProvider.deletePolicyTypes(new PfConceptKey()));
assertNotNull(dummyProvider.getPolicies(new PfConceptKey()));
- assertNotNull(dummyProvider.createPolicies(new ToscaServiceTemplate()));
- assertNotNull(dummyProvider.updatePolicies(new ToscaServiceTemplate()));
+ assertNotNull(dummyProvider.createPolicies(new JpaToscaServiceTemplate()));
+ assertNotNull(dummyProvider.updatePolicies(new JpaToscaServiceTemplate()));
assertNotNull(dummyProvider.deletePolicies(new PfConceptKey()));
assertNotNull(dummyProvider.getOperationalPolicy("policy_id"));
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 de299772f..e0aba8a9e 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
@@ -42,8 +42,8 @@ import org.onap.policy.models.base.PfValidationResult;
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.simple.concepts.ToscaPolicy;
-import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
import org.onap.policy.models.tosca.simple.serialization.ToscaServiceTemplateMessageBodyHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -141,7 +141,7 @@ public class PolicyPersistenceTest {
* @throws Exception any exception thrown
*/
public void testJsonStringPolicyPersistence(@NonNull final String policyString) throws Exception {
- ToscaServiceTemplate serviceTemplate = gson.fromJson(policyString, ToscaServiceTemplate.class);
+ JpaToscaServiceTemplate serviceTemplate = gson.fromJson(policyString, JpaToscaServiceTemplate.class);
assertNotNull(serviceTemplate);
LOGGER.info(serviceTemplate.validate(new PfValidationResult()).toString());
@@ -150,8 +150,8 @@ public class PolicyPersistenceTest {
databaseProvider.createPolicies(serviceTemplate);
for (PfConceptKey policyKey : serviceTemplate.getTopologyTemplate().getPolicies().getConceptMap().keySet()) {
- ToscaPolicy incomingPolicy = serviceTemplate.getTopologyTemplate().getPolicies().get(policyKey);
- ToscaPolicy databasePolicy =
+ JpaToscaPolicy incomingPolicy = serviceTemplate.getTopologyTemplate().getPolicies().get(policyKey);
+ JpaToscaPolicy databasePolicy =
databaseProvider.getPolicies(policyKey).getTopologyTemplate().getPolicies().get(policyKey);
assertEquals(incomingPolicy, databasePolicy);
}
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 a4b1dcd03..bd85358b3 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
@@ -42,8 +42,8 @@ import org.onap.policy.models.base.PfValidationResult;
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.simple.concepts.ToscaPolicy;
-import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
import org.onap.policy.models.tosca.simple.serialization.ToscaServiceTemplateMessageBodyHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -141,7 +141,7 @@ public class PolicyToscaPersistenceTest {
* @throws Exception any exception thrown
*/
public void testJsonStringPolicyPersistence(@NonNull final String policyString) throws Exception {
- ToscaServiceTemplate serviceTemplate = gson.fromJson(policyString, ToscaServiceTemplate.class);
+ JpaToscaServiceTemplate serviceTemplate = gson.fromJson(policyString, JpaToscaServiceTemplate.class);
assertNotNull(serviceTemplate);
LOGGER.info(serviceTemplate.validate(new PfValidationResult()).toString());
@@ -150,8 +150,8 @@ public class PolicyToscaPersistenceTest {
databaseProvider.createPolicies(serviceTemplate);
for (PfConceptKey policyKey : serviceTemplate.getTopologyTemplate().getPolicies().getConceptMap().keySet()) {
- ToscaPolicy incomingPolicy = serviceTemplate.getTopologyTemplate().getPolicies().get(policyKey);
- ToscaPolicy databasePolicy =
+ JpaToscaPolicy incomingPolicy = serviceTemplate.getTopologyTemplate().getPolicies().get(policyKey);
+ JpaToscaPolicy databasePolicy =
databaseProvider.getPolicies(policyKey).getTopologyTemplate().getPolicies().get(policyKey);
assertEquals(incomingPolicy, databasePolicy);
}
diff --git a/models-provider/src/test/resources/META-INF/persistence.xml b/models-provider/src/test/resources/META-INF/persistence.xml
index 68340901b..23e8567f1 100644
--- a/models-provider/src/test/resources/META-INF/persistence.xml
+++ b/models-provider/src/test/resources/META-INF/persistence.xml
@@ -26,8 +26,8 @@
<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.ToscaPolicyType</class>
- <class>org.onap.policy.models.tosca.simple.concepts.ToscaPolicy</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver" />
@@ -46,7 +46,7 @@
<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.ToscaPolicy</class>
+ <class>org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.mariadb.jdbc.Driver" />