From fe3a8ec467beae89bca9d10b8b5b39f98c81ca01 Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Mon, 4 Nov 2019 16:18:08 -0500 Subject: Implement closest match algorithm Needed to add more obligations, which make it easier to scan through obligations and be able to pull information about the policy. Adding weight as an obligation for Optimization policies in order to implement "closest match" algorithm. Moved Obligation to a support class. Added JUnit code coverage on the translator classes. Split some methods up to reduce complexity via sonar. Issue-ID: POLICY-2066 Change-Id: Ibb13d2dc0a63ab2a6d585b0697a0c1d129fa8f7b Signed-off-by: Pamela Dragosh --- .../optimization/OptimizationPdpApplicationTest.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'applications/optimization/src/test') 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 1bcb5222..b77f301f 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 @@ -255,7 +255,7 @@ public class OptimizationPdpApplicationTest { // DecisionResponse response = makeDecision(); assertThat(response).isNotNull(); - assertThat(response.getPolicies().size()).isEqualTo(3); // Should be 1 + assertThat(response.getPolicies().size()).isEqualTo(2); // // Validate it // @@ -275,7 +275,7 @@ public class OptimizationPdpApplicationTest { DecisionResponse response = makeDecision(); assertThat(response).isNotNull(); - assertThat(response.getPolicies().size()).isEqualTo(6); // should be 1 + assertThat(response.getPolicies().size()).isEqualTo(4); // // Validate it // @@ -286,7 +286,7 @@ public class OptimizationPdpApplicationTest { @Test public void test07OptimizationDefaultGeographyAndServiceAndResource() throws CoderException { // - // Add vCPE to the service list + // Add vG to the resource list // ((List)baseRequest.getResource().get("resources")).add("vG"); // @@ -295,7 +295,7 @@ public class OptimizationPdpApplicationTest { DecisionResponse response = makeDecision(); assertThat(response).isNotNull(); - assertThat(response.getPolicies().size()).isEqualTo(11); // should be 4 + assertThat(response.getPolicies().size()).isEqualTo(8); // // Validate it // @@ -315,7 +315,7 @@ public class OptimizationPdpApplicationTest { DecisionResponse response = makeDecision(); assertThat(response).isNotNull(); - assertThat(response.getPolicies().size()).isEqualTo(12); // should be 1 + assertThat(response.getPolicies().size()).isEqualTo(8); // // Validate it // @@ -335,7 +335,7 @@ public class OptimizationPdpApplicationTest { DecisionResponse response = makeDecision(); assertThat(response).isNotNull(); - assertThat(response.getPolicies().size()).isEqualTo(14); // should be 3 + assertThat(response.getPolicies().size()).isEqualTo(10); // // Validate it // @@ -355,7 +355,7 @@ public class OptimizationPdpApplicationTest { DecisionResponse response = makeDecision(); assertThat(response).isNotNull(); - assertThat(response.getPolicies().size()).isEqualTo(13); // should be 2 + assertThat(response.getPolicies().size()).isEqualTo(9); // // Validate it // @@ -375,7 +375,7 @@ public class OptimizationPdpApplicationTest { DecisionResponse response = makeDecision(); assertThat(response).isNotNull(); - assertThat(response.getPolicies().size()).isEqualTo(4); // should be 1 + assertThat(response.getPolicies().size()).isEqualTo(1); // // Validate it // @@ -395,7 +395,7 @@ public class OptimizationPdpApplicationTest { DecisionResponse response = makeDecision(); assertThat(response).isNotNull(); - assertThat(response.getPolicies().size()).isEqualTo(6); // should be 2 + assertThat(response.getPolicies().size()).isEqualTo(2); // // Validate it // -- cgit 1.2.3-korg