diff options
author | Bruno Sakoto <bruno.sakoto@bell.ca> | 2019-09-27 15:51:11 -0400 |
---|---|---|
committer | Bruno Sakoto <bruno.sakoto@bell.ca> | 2019-10-07 08:23:13 -0400 |
commit | 1d0d9ebabda67d6c770b4854a8154763aa6e75d6 (patch) | |
tree | 787dcdccda0080da650aeaecf99ed5ea3f170d41 /models-interactions/model-actors/actor.cds/src/test | |
parent | 5af913104ec412086deab4d599359751246e4ba3 (diff) |
Changes in model to integrate cds actor
* Create class for CDS response
Issue-ID: POLICY-2088
Change-Id: I813a310f7d5123fac4bb1c3880d108391096250f
Signed-off-by: Bruno Sakoto <bruno.sakoto@bell.ca>
Diffstat (limited to 'models-interactions/model-actors/actor.cds/src/test')
-rw-r--r-- | models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProviderTest.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProviderTest.java b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProviderTest.java index 0152521af..28a1676ed 100644 --- a/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProviderTest.java +++ b/models-interactions/model-actors/actor.cds/src/test/java/org/onap/policy/controlloop/actor/cds/CdsActorServiceProviderTest.java @@ -20,6 +20,7 @@ package org.onap.policy.controlloop.actor.cds; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyLong; @@ -49,6 +50,7 @@ import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType; import org.onap.ccsdk.cds.controllerblueprints.common.api.Status; import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput; import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput; +import org.onap.policy.cds.CdsResponse; import org.onap.policy.cds.client.CdsProcessorGrpcClient; import org.onap.policy.cds.properties.CdsServerProperties; import org.onap.policy.controlloop.ControlLoopOperation; @@ -188,18 +190,20 @@ public class CdsActorServiceProviderTest { when(cdsClient.sendRequest(any(ExecutionServiceInput.class))).thenReturn(countDownLatch); CdsActorServiceProvider.CdsActorServiceManager cdsActorSvcMgr = cdsActor.new CdsActorServiceManager(); - String response = cdsActorSvcMgr + CdsResponse response = cdsActorSvcMgr .sendRequestToCds(cdsClient, cdsProps, ExecutionServiceInput.newBuilder().build()); assertTrue(Thread.interrupted()); - assertEquals(response, CdsActorConstants.INTERRUPTED); + assertNotNull(response); + assertEquals(CdsActorConstants.INTERRUPTED, response.getStatus()); } @Test public void testSendRequestToCdsLatchTimedOut() { CdsActorServiceProvider.CdsActorServiceManager cdsActorSvcMgr = cdsActor.new CdsActorServiceManager(); - String response = cdsActorSvcMgr + CdsResponse response = cdsActorSvcMgr .sendRequestToCds(cdsClient, cdsProps, ExecutionServiceInput.newBuilder().build()); - assertEquals(response, CdsActorConstants.TIMED_OUT); + assertNotNull(response); + assertEquals(CdsActorConstants.TIMED_OUT, response.getStatus()); } @Test @@ -216,21 +220,21 @@ public class CdsActorServiceProviderTest { // #1: Failure test cdsActorSvcMgr.onMessage(message); - assertEquals(cdsActorSvcMgr.getCdsResponse(), CdsActorConstants.FAILED); + assertEquals(CdsActorConstants.FAILED, cdsActorSvcMgr.getCdsStatus()); // #2: Success test cdsActorSvcMgr = sendRequestToCds(); message = ExecutionServiceOutput.newBuilder() .setStatus(Status.newBuilder().setEventType(EventType.EVENT_COMPONENT_EXECUTED).build()).build(); cdsActorSvcMgr.onMessage(message); - assertEquals(cdsActorSvcMgr.getCdsResponse(), CdsActorConstants.SUCCESS); + assertEquals(CdsActorConstants.SUCCESS, cdsActorSvcMgr.getCdsStatus()); // #3: Processing test cdsActorSvcMgr = sendRequestToCds(); message = ExecutionServiceOutput.newBuilder() .setStatus(Status.newBuilder().setEventType(EventType.EVENT_COMPONENT_PROCESSING).build()).build(); cdsActorSvcMgr.onMessage(message); - assertEquals(cdsActorSvcMgr.getCdsResponse(), CdsActorConstants.PROCESSING); + assertEquals(CdsActorConstants.PROCESSING, cdsActorSvcMgr.getCdsStatus()); } private CdsActorServiceManager sendRequestToCds() { |