aboutsummaryrefslogtreecommitdiffstats
path: root/applications/optimization/src/test/java/org
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2019-10-21 14:21:54 -0400
committerPamela Dragosh <pdragosh@research.att.com>2019-10-21 14:22:03 -0400
commitfc07c32a4c01a2541c8061a37c3c6589c720e2b3 (patch)
tree98c2f46d6cc1d413586df462abd091e828f1de3e /applications/optimization/src/test/java/org
parent3107498c86304ef114e6799ee430013fc26e1750 (diff)
Use yaml policies in models-examples
Now that yaml is supported, use those policies that are stored in the models-examples that are preloaded into the api. Fixed a minor checkstyle issue. Not sure why it was missed. Issue-ID: POLICY-2066 Change-Id: I2f4384a310bfa818555de5dacb477daf82fac6de Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'applications/optimization/src/test/java/org')
-rw-r--r--applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java19
1 files changed, 15 insertions, 4 deletions
diff --git a/applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java b/applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java
index b39f5c7f..11a7a923 100644
--- a/applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java
+++ b/applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java
@@ -45,6 +45,7 @@ import org.junit.runners.MethodSorters;
import org.onap.policy.common.endpoints.parameters.RestServerParameters;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.common.utils.resources.ResourceUtils;
import org.onap.policy.common.utils.resources.TextFileUtils;
import org.onap.policy.models.decisions.concepts.DecisionRequest;
import org.onap.policy.models.decisions.concepts.DecisionResponse;
@@ -66,10 +67,17 @@ public class OptimizationPdpApplicationTest {
private static StandardCoder gson = new StandardCoder();
private static DecisionRequest requestAffinity;
private static RestServerParameters clientParams;
- private static String[] listPolicyTypeFiles = { "onap.policies.Optimization",
+ private static String[] listPolicyTypeFiles = {
+ "onap.policies.Optimization",
"onap.policies.optimization.AffinityPolicy",
"onap.policies.optimization.DistancePolicy",
- "onap.policies.optimization.SubscriberPolicy"};
+ "onap.policies.optimization.HpaPolicy",
+ "onap.policies.optimization.OptimizationPolicy",
+ "onap.policies.optimization.PciPolicy",
+ "onap.policies.optimization.QueryPolicy",
+ "onap.policies.optimization.SubscriberPolicy",
+ "onap.policies.optimization.Vim_fit",
+ "onap.policies.optimization.VnfPolicy"};
@ClassRule
public static final TemporaryFolder policyFolder = new TemporaryFolder();
@@ -102,8 +110,10 @@ public class OptimizationPdpApplicationTest {
// Copy the test policy types into data area
//
for (String policy : listPolicyTypeFiles) {
- Files.copy(Paths.get("src/test/resources", policy + "-1.0.0.json"),
- Paths.get(policyFolder.getRoot().getAbsolutePath(), policy + "-1.0.0.json"));
+ String policyType = ResourceUtils.getResourceAsString("policytypes/" + policy + ".yaml");
+ LOGGER.info("Copying {}", policyType);
+ Files.write(Paths.get(policyFolder.getRoot().getAbsolutePath(), policy + "-1.0.0.yaml"),
+ policyType.getBytes());
}
//
// Load service
@@ -135,6 +145,7 @@ public class OptimizationPdpApplicationTest {
strDump.append(System.lineSeparator());
}
LOGGER.debug("{}", strDump);
+ assertThat(service).isNotNull();
//
// Tell it to initialize based on the properties file
// we just built for it.