From 25628c56e5fc6b1d6e2e3b761f435fc9596ce1b3 Mon Sep 17 00:00:00 2001 From: Daniel Cruz Date: Wed, 23 Oct 2019 18:18:07 -0500 Subject: Update APPC LCM Model references Updates to all references of APPC LCM model code based on changes in policy models for APPC LCM. Issue-ID: POLICY-2043 Change-Id: I0102eb27f449578636cfc0bf22124fa863f05724 Signed-off-by: Daniel Cruz --- .../onap/policy/template/demo/ControlLoopBase.java | 4 ++-- .../template/demo/ControlLoopFailureTest.java | 23 +++++++++++---------- .../policy/template/demo/VcpeControlLoopTest.java | 24 ++++++++++++---------- 3 files changed, 27 insertions(+), 24 deletions(-) (limited to 'controlloop/templates/template.demo') diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopBase.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopBase.java index 716452f73..a311ba0b0 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopBase.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopBase.java @@ -96,7 +96,7 @@ public class ControlLoopBase { Properties noopSinkProperties = new Properties(); noopSinkProperties.put(PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS, "APPC-LCM-READ,APPC-CL,SDNR-CL,POLICY-CL-MGT"); - noopSinkProperties.put("noop.sink.topics.APPC-LCM-READ.events", "org.onap.policy.appclcm.LcmRequestWrapper"); + noopSinkProperties.put("noop.sink.topics.APPC-LCM-READ.events", "org.onap.policy.appclcm.AppcLcmDmaapWrapper"); noopSinkProperties.put("noop.sink.topics.APPC-LCM-READ.events.custom.gson", "org.onap.policy.appclcm.util.Serialization,gson"); noopSinkProperties.put("noop.sink.topics.APPC-CL.events", "org.onap.policy.appc.Response"); @@ -119,7 +119,7 @@ public class ControlLoopBase { .groupId(JUNIT_GROUP_ID) .artifactId(JUNIT_ARTIFACT_ID) .topic("APPC-LCM-READ") - .eventClass("org.onap.policy.appclcm.LcmRequestWrapper") + .eventClass("org.onap.policy.appclcm.AppcLcmDmaapWrapper") .protocolFilter(new JsonProtocolFilter()) .modelClassLoaderHash(1111)); EventProtocolCoderConstants.getManager().addEncoder(EventProtocolParams.builder() diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopFailureTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopFailureTest.java index db5da1e4a..1647fa0e1 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopFailureTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/ControlLoopFailureTest.java @@ -30,10 +30,10 @@ import java.util.HashMap; import java.util.UUID; import org.junit.BeforeClass; import org.junit.Test; -import org.onap.policy.appclcm.LcmRequest; -import org.onap.policy.appclcm.LcmRequestWrapper; -import org.onap.policy.appclcm.LcmResponse; -import org.onap.policy.appclcm.LcmResponseWrapper; +import org.onap.policy.appclcm.AppcLcmBody; +import org.onap.policy.appclcm.AppcLcmDmaapWrapper; +import org.onap.policy.appclcm.AppcLcmInput; +import org.onap.policy.appclcm.AppcLcmOutput; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.event.comm.TopicListener; import org.onap.policy.common.endpoints.event.comm.TopicSink; @@ -155,7 +155,7 @@ public class ControlLoopFailureTest extends ControlLoopBase implements TopicList org.onap.policy.controlloop.VirtualControlLoopNotification.class); } else if ("APPC-LCM-READ".equals(topic)) { obj = org.onap.policy.appclcm.util.Serialization.gsonJunit.fromJson(event, - org.onap.policy.appclcm.LcmRequestWrapper.class); + org.onap.policy.appclcm.AppcLcmDmaapWrapper.class); } assertNotNull(obj); if (obj instanceof VirtualControlLoopNotification) { @@ -222,12 +222,12 @@ public class ControlLoopFailureTest extends ControlLoopBase implements TopicList logger.debug("The control loop timed out"); fail("Control Loop Timed Out"); } - } else if (obj instanceof LcmRequestWrapper) { + } else if (obj instanceof AppcLcmDmaapWrapper) { /* * The request should be of type LCMRequestWrapper and the subrequestid should be 1 */ - LcmRequestWrapper dmaapRequest = (LcmRequestWrapper) obj; - LcmRequest appcRequest = dmaapRequest.getBody(); + AppcLcmDmaapWrapper dmaapRequest = (AppcLcmDmaapWrapper) obj; + AppcLcmInput appcRequest = dmaapRequest.getBody().getInput(); assertTrue(appcRequest.getCommonHeader().getSubRequestId().equals("1")); logger.debug("\n============ APPC received the request!!! ===========\n"); @@ -235,11 +235,12 @@ public class ControlLoopFailureTest extends ControlLoopBase implements TopicList /* * Simulate a success response from APPC and insert the response into the working memory */ - LcmResponseWrapper dmaapResponse = new LcmResponseWrapper(); - LcmResponse appcResponse = new LcmResponse(appcRequest); + AppcLcmDmaapWrapper dmaapResponse = new AppcLcmDmaapWrapper(); + AppcLcmOutput appcResponse = new AppcLcmOutput(appcRequest); appcResponse.getStatus().setCode(400); appcResponse.getStatus().setMessage("AppC success"); - dmaapResponse.setBody(appcResponse); + dmaapResponse.setBody(new AppcLcmBody()); + dmaapResponse.getBody().setOutput(appcResponse); /* * Interrupting with a different request for the same target entity to check if lock diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VcpeControlLoopTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VcpeControlLoopTest.java index 7d5a4f3a8..57085f614 100644 --- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VcpeControlLoopTest.java +++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/VcpeControlLoopTest.java @@ -30,10 +30,10 @@ import java.util.HashMap; import java.util.UUID; import org.junit.BeforeClass; import org.junit.Test; -import org.onap.policy.appclcm.LcmRequest; -import org.onap.policy.appclcm.LcmRequestWrapper; -import org.onap.policy.appclcm.LcmResponse; -import org.onap.policy.appclcm.LcmResponseWrapper; +import org.onap.policy.appclcm.AppcLcmBody; +import org.onap.policy.appclcm.AppcLcmDmaapWrapper; +import org.onap.policy.appclcm.AppcLcmInput; +import org.onap.policy.appclcm.AppcLcmOutput; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.event.comm.TopicListener; import org.onap.policy.common.endpoints.event.comm.TopicSink; @@ -155,7 +155,7 @@ public class VcpeControlLoopTest extends ControlLoopBase implements TopicListene org.onap.policy.controlloop.VirtualControlLoopNotification.class); } else if ("APPC-LCM-READ".equals(topic)) { obj = org.onap.policy.appclcm.util.Serialization.gsonJunit.fromJson(event, - org.onap.policy.appclcm.LcmRequestWrapper.class); + org.onap.policy.appclcm.AppcLcmDmaapWrapper.class); } assertNotNull(obj); if (obj instanceof VirtualControlLoopNotification) { @@ -205,12 +205,12 @@ public class VcpeControlLoopTest extends ControlLoopBase implements TopicListene logger.debug("The control loop timed out"); fail("Control Loop Timed Out"); } - } else if (obj instanceof LcmRequestWrapper) { + } else if (obj instanceof AppcLcmDmaapWrapper) { /* * The request should be of type LcmRequestWrapper and the subrequestid should be 1 */ - LcmRequestWrapper dmaapRequest = (LcmRequestWrapper) obj; - LcmRequest appcRequest = dmaapRequest.getBody(); + AppcLcmDmaapWrapper dmaapRequest = (AppcLcmDmaapWrapper) obj; + AppcLcmInput appcRequest = dmaapRequest.getBody().getInput(); assertTrue(appcRequest.getCommonHeader().getSubRequestId().equals("1")); assertNotNull(appcRequest.getActionIdentifiers().get("vnf-id")); @@ -219,11 +219,13 @@ public class VcpeControlLoopTest extends ControlLoopBase implements TopicListene /* * Simulate a success response from APPC and insert the response into the working memory */ - LcmResponseWrapper dmaapResponse = new LcmResponseWrapper(); - LcmResponse appcResponse = new LcmResponse(appcRequest); + AppcLcmDmaapWrapper dmaapResponse = new AppcLcmDmaapWrapper(); + AppcLcmOutput appcResponse = new AppcLcmOutput(appcRequest); appcResponse.getStatus().setCode(400); appcResponse.getStatus().setMessage("AppC success"); - dmaapResponse.setBody(appcResponse); + dmaapResponse.setBody(new AppcLcmBody()); + dmaapResponse.getBody().setOutput(appcResponse); + kieSession.insert(dmaapResponse); } } -- cgit 1.2.3-korg