From e034d785a227815f66138d1f83f49624c402aa97 Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Mon, 8 Apr 2019 08:47:38 -0400 Subject: Test decision from main entry Tests a decision upon startup. This also updates the use of ToscaPolicyTypeIdentifier for all the applications. Very basic packaging for applications and their properties. Added cleaning of unused imports to remove sonar issues. Added production persistence.xml file to guard application. Not sure if we need a copy in the application/common resource directory. Issue-ID: POLICY-1440 Change-Id: If96eef5a9e0a7c6cc5461c0bdb6f0cd708cc41bb Signed-off-by: Pamela Dragosh --- .../optimization/OptimizationPdpApplicationTest.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'applications/optimization/src/test/java/org') 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 efbf730c..e593d5fe 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 @@ -47,6 +47,8 @@ import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.resources.TextFileUtils; import org.onap.policy.models.decisions.concepts.DecisionRequest; import org.onap.policy.models.decisions.concepts.DecisionResponse; +import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier; +import org.onap.policy.pdp.xacml.application.common.XacmlApplicationException; import org.onap.policy.pdp.xacml.application.common.XacmlApplicationServiceProvider; import org.onap.policy.pdp.xacml.application.common.XacmlPolicyUtils; import org.slf4j.Logger; @@ -139,8 +141,10 @@ public class OptimizationPdpApplicationTest { // Ensure it has the supported policy types and // can support the correct policy types. // - assertThat(service.canSupportPolicyType("onap.policies.optimization.AffinityPolicy", "1.0.0")).isTrue(); - assertThat(service.canSupportPolicyType("onap.foobar", "1.0.0")).isFalse(); + assertThat(service.canSupportPolicyType(new ToscaPolicyTypeIdentifier( + "onap.policies.optimization.AffinityPolicy", "1.0.0"))).isTrue(); + assertThat(service.canSupportPolicyType(new ToscaPolicyTypeIdentifier( + "onap.foobar", "1.0.0"))).isFalse(); } @Test @@ -157,7 +161,8 @@ public class OptimizationPdpApplicationTest { @SuppressWarnings("unchecked") @Test - public void test3AddOptimizationPolicies() throws CoderException, FileNotFoundException, IOException { + public void test3AddOptimizationPolicies() throws CoderException, FileNotFoundException, IOException, + XacmlApplicationException { // // Now load the optimization policies // @@ -184,8 +189,9 @@ public class OptimizationPdpApplicationTest { // assertThat(policyDefinition.containsKey("type")).isTrue(); assertThat(service.canSupportPolicyType( + new ToscaPolicyTypeIdentifier( policyDefinition.get("type").toString(), - policyDefinition.get("version").toString())) + policyDefinition.get("version").toString()))) .isTrue(); } } -- cgit 1.2.3-korg