aboutsummaryrefslogtreecommitdiffstats
path: root/models-provider/src/test/java
diff options
context:
space:
mode:
authorLiam Fallon <liam.fallon@est.tech>2019-03-31 23:17:59 +0000
committerGerrit Code Review <gerrit@onap.org>2019-03-31 23:17:59 +0000
commitfbed360c0acdc127fdf56a99401c1aea691ce57e (patch)
tree1b61422a0c4984365ef506ce5661f9e475a2bb8a /models-provider/src/test/java
parent96585ff6166369ae6c3f5326e56d55114ae6a3e0 (diff)
parentcc5b96bfd33cd7d91fe6994d348e8d6a0ebb54fa (diff)
Merge "Restructure for authorative models"
Diffstat (limited to 'models-provider/src/test/java')
-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
6 files changed, 35 insertions, 33 deletions
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);
}