From bed21af59885a954e3facf7226c4678f4b69b153 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Thu, 16 Apr 2020 18:51:40 -0400 Subject: CDS Operator should be generic Like the SDNR Operator, the CDS Operator should work regardless of the operation name. Issue-ID: POLICY-2504 Signed-off-by: Jim Hahn Change-Id: I9a77838462bc5b91e2d95e7dcf1f8822bd45f04c --- .../controlloop/actor/cds/CdsActorServiceProviderTest.java | 12 ++++++++++++ .../model-actors/actor.cds/src/test/resources/service.yaml | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'models-interactions/model-actors/actor.cds/src/test') 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 9c59e5648..73787da3f 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 @@ -23,6 +23,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.assertSame; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyLong; @@ -57,6 +58,7 @@ import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.actor.cds.CdsActorServiceProvider.CdsActorServiceManager; import org.onap.policy.controlloop.actor.cds.constants.CdsActorConstants; import org.onap.policy.controlloop.actor.test.BasicActor; +import org.onap.policy.controlloop.actorserviceprovider.Operator; import org.onap.policy.controlloop.policy.Policy; public class CdsActorServiceProviderTest extends BasicActor { @@ -134,6 +136,16 @@ public class CdsActorServiceProviderTest extends BasicActor { verifyActorService(CdsActorConstants.CDS_ACTOR, "service.yaml"); } + @Test + public void testGetOperator() { + CdsActorServiceProvider sp = new CdsActorServiceProvider(); + + // should always return the same operator regardless of the name + Operator oper = sp.getOperator("unknown"); + assertNotNull(oper); + assertSame(oper, sp.getOperator("another")); + } + @Test public void testConstructRequestWhenMissingCdsParamsInPolicyPayload() { policy.setPayload(new HashMap<>()); diff --git a/models-interactions/model-actors/actor.cds/src/test/resources/service.yaml b/models-interactions/model-actors/actor.cds/src/test/resources/service.yaml index d48b4542f..0d3c76f48 100644 --- a/models-interactions/model-actors/actor.cds/src/test/resources/service.yaml +++ b/models-interactions/model-actors/actor.cds/src/test/resources/service.yaml @@ -19,7 +19,7 @@ # actors: CDS: - gRPC: + any: timeout: 10 port: 6700 host: my-host -- cgit 1.2.3-korg