diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2019-04-08 17:11:37 -0400 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2019-04-08 17:11:43 -0400 |
commit | f95ba842b148c6f31ca528a2e22498ee2885ad47 (patch) | |
tree | 761822bd79c002c31b566cad623e1ae3caec9f00 /models-interactions/model-actors/actor.sdnr/src/test | |
parent | a32b49c3ec54e5f3bf23634a5fb538909905f8e6 (diff) |
Code changes for OOF SON Use Case
Companian review to https://gerrit.onap.org/r/#/c/84361/
Issue-ID: POLICY-1463
Change-Id: I2640f01c07890a4b1e8938175b637b84dcc19f3c
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'models-interactions/model-actors/actor.sdnr/src/test')
-rw-r--r-- | models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java index 226c3da47..265aea341 100644 --- a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java +++ b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/SdnrActorServiceProviderTest.java @@ -2,7 +2,7 @@ * SdnrActorServiceProviderTest * ================================================================================ * Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ import java.util.UUID; import org.junit.Test; import org.onap.policy.controlloop.ControlLoopEventStatus; import org.onap.policy.controlloop.ControlLoopOperation; +import org.onap.policy.controlloop.ControlLoopResponse; import org.onap.policy.controlloop.ControlLoopTargetType; import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.policy.Policy; @@ -38,6 +39,7 @@ import org.onap.policy.controlloop.policy.Target; import org.onap.policy.controlloop.policy.TargetType; import org.onap.policy.sdnr.PciRequest; import org.onap.policy.sdnr.PciResponse; +import org.onap.policy.sdnr.PciResponseWrapper; import org.onap.policy.sdnr.util.Serialization; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -87,6 +89,32 @@ public class SdnrActorServiceProviderTest { policy.setPayload(null); policy.setRetry(2); policy.setTimeout(300); + + } + + @Test + public void getControlLoopResponseTest() { + PciRequest sdnrRequest; + sdnrRequest = SdnrActorServiceProvider.constructRequest(onsetEvent, operation, policy).getBody(); + PciResponse sdnrResponse = new PciResponse(sdnrRequest); + sdnrResponse.getStatus().setCode(200); + sdnrResponse.getStatus().setValue("SDNR success"); + sdnrResponse.setPayload("sdnr payload "); + /* Print out request as json to make sure serialization works */ + String jsonResponse = Serialization.gsonPretty.toJson(sdnrResponse); + logger.info(jsonResponse); + PciResponseWrapper pciResponseWrapper = new PciResponseWrapper(); + pciResponseWrapper.setBody(sdnrResponse); + + ControlLoopResponse clRsp = SdnrActorServiceProvider.getControlLoopResponse(pciResponseWrapper, onsetEvent); + assertEquals(clRsp.getClosedLoopControlName(), onsetEvent.getClosedLoopControlName()); + assertEquals(clRsp.getRequestId(), onsetEvent.getRequestId()); + assertEquals(clRsp.getPolicyName(), onsetEvent.getPolicyName()); + assertEquals(clRsp.getPolicyVersion(), onsetEvent.getPolicyVersion()); + assertEquals(clRsp.getVersion(), onsetEvent.getVersion()); + assertEquals(clRsp.getFrom(), "SDNR"); + assertEquals(clRsp.getTarget(), "DCAE"); + assertEquals(clRsp.getPayload(), sdnrResponse.getPayload()); } @Test |