From 457c9b19c058877ca59c9b0826d22f3f97392daf Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Fri, 5 Apr 2019 09:03:15 -0400 Subject: Fixes per latest models updates Changes made per the scrum call on 4/4 moved things around. In addition, filter classes were added to the tosca provider. Both of these necessitated changes to policy/pap so that things compile. Change-Id: Iba4c52b650dab0f8d242b06be3fede42dd5b7264 Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn --- .../policy/pap/main/comm/PdpModifyRequestMapTest.java | 5 ++--- .../onap/policy/pap/main/comm/msgdata/UpdateDataTest.java | 15 ++++++--------- .../pap/main/rest/TestPdpGroupDeployControllerV1.java | 4 +--- 3 files changed, 9 insertions(+), 15 deletions(-) (limited to 'main/src/test/java') diff --git a/main/src/test/java/org/onap/policy/pap/main/comm/PdpModifyRequestMapTest.java b/main/src/test/java/org/onap/policy/pap/main/comm/PdpModifyRequestMapTest.java index 91d7d435..8f064035 100644 --- a/main/src/test/java/org/onap/policy/pap/main/comm/PdpModifyRequestMapTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/comm/PdpModifyRequestMapTest.java @@ -42,7 +42,6 @@ import java.util.List; import java.util.Map; import java.util.Queue; import java.util.function.Consumer; - import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; @@ -55,9 +54,9 @@ import org.onap.policy.models.pdp.concepts.PdpMessage; import org.onap.policy.models.pdp.concepts.PdpStateChange; import org.onap.policy.models.pdp.concepts.PdpStatus; import org.onap.policy.models.pdp.concepts.PdpUpdate; -import org.onap.policy.models.pdp.concepts.ToscaPolicyIdentifier; import org.onap.policy.models.pdp.enums.PdpState; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; +import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; import org.onap.policy.pap.main.PapConstants; import org.onap.policy.pap.main.comm.PdpModifyRequestMap.ModifyReqData; import org.onap.policy.pap.main.parameters.PdpModifyRequestMapParams; @@ -585,7 +584,7 @@ public class PdpModifyRequestMapTest { return cng; } - + /** * Converts a ToscaPolicy list to ToscaPolicyIdentifier list. * diff --git a/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/UpdateDataTest.java b/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/UpdateDataTest.java index 127843a0..352b92df 100644 --- a/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/UpdateDataTest.java +++ b/main/src/test/java/org/onap/policy/pap/main/comm/msgdata/UpdateDataTest.java @@ -29,13 +29,13 @@ import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.Arrays; import java.util.List; - +import java.util.stream.Collectors; import org.junit.Before; import org.junit.Test; import org.onap.policy.models.pdp.concepts.PdpStatus; import org.onap.policy.models.pdp.concepts.PdpUpdate; -import org.onap.policy.models.pdp.concepts.ToscaPolicyIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; +import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; import org.onap.policy.pap.main.comm.TimerManager; import org.onap.policy.pap.main.parameters.PdpModifyRequestMapParams; import org.onap.policy.pap.main.parameters.PdpParameters; @@ -123,7 +123,7 @@ public class UpdateDataTest { @Test public void testUpdateDataCheckResponse_MismatchedPolicies() { ArrayList policies = - new ArrayList<>(convertToscaPolicyToToscaPolicyIndentifier(update.getPolicies())); + new ArrayList<>(convertToscaPolicyToToscaPolicyIndentifier(update.getPolicies())); policies.set(0, new ToscaPolicyIdentifier(DIFFERENT, "10.0.0")); response.setPolicies(policies); @@ -184,7 +184,7 @@ public class UpdateDataTest { // do nothing } } - + /** * Converts a ToscaPolicy list to ToscaPolicyIdentifier list. * @@ -192,10 +192,7 @@ public class UpdateDataTest { * @return the ToscaPolicyIdentifier list */ private List convertToscaPolicyToToscaPolicyIndentifier(List toscaPolicies) { - final List toscaPolicyIdentifiers = new ArrayList<>(); - for (final ToscaPolicy toscaPolicy : toscaPolicies) { - toscaPolicyIdentifiers.add(new ToscaPolicyIdentifier(toscaPolicy.getName(), toscaPolicy.getVersion())); - } - return toscaPolicyIdentifiers; + return toscaPolicies.stream().map(policy -> new ToscaPolicyIdentifier(policy.getName(), policy.getVersion())) + .collect(Collectors.toList()); } } diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeployControllerV1.java b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeployControllerV1.java index 18e17b09..09e91a99 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeployControllerV1.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/TestPdpGroupDeployControllerV1.java @@ -25,18 +25,16 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import java.util.Arrays; - import javax.ws.rs.client.Entity; import javax.ws.rs.client.Invocation; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; - import org.junit.Test; import org.onap.policy.models.pap.concepts.PdpDeployPolicies; import org.onap.policy.models.pap.concepts.PdpGroupDeployResponse; import org.onap.policy.models.pdp.concepts.PdpGroup; import org.onap.policy.models.pdp.concepts.PdpSubGroup; -import org.onap.policy.models.pdp.concepts.ToscaPolicyIdentifierOptVersion; +import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifierOptVersion; public class TestPdpGroupDeployControllerV1 extends CommonPapRestServer { -- cgit 1.2.3-korg