From 72b4a13723049c5d4a066879aa67d08ec5e86180 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Wed, 26 Feb 2020 11:07:35 -0500 Subject: Custom Query should always use vserver Modified the Custom Query Operation to ignore the target entity passed via the "params" and always use the vserver name found in the enrichment data. Issue-ID: POLICY-2349 Signed-off-by: Jim Hahn Change-Id: If2c45df2d0377ca08059bdbfa0bcc3d3f043c5b9 --- .../actor/aai/AaiCustomQueryOperationTest.java | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'models-interactions/model-actors/actor.aai/src/test') diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java index 1ec7bea4e..78ffc50e0 100644 --- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java +++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperationTest.java @@ -20,6 +20,8 @@ package org.onap.policy.controlloop.actor.aai; +import static org.assertj.core.api.Assertions.assertThatCode; +import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertSame; @@ -59,6 +61,7 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperation>> entityCaptor; @@ -79,6 +82,8 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperation new AaiCustomQueryOperation(params, config)).doesNotThrowAnyException(); + + // try without enrichment data + params.getContext().getEnrichment().remove(AaiCustomQueryOperation.VSERVER_VSERVER_NAME); + assertThatIllegalArgumentException().isThrownBy(() -> new AaiCustomQueryOperation(params, config)) + .withMessage("missing " + AaiCustomQueryOperation.VSERVER_VSERVER_NAME + " in enrichment data"); } @Test @@ -105,7 +120,7 @@ public class AaiCustomQueryOperationTest extends BasicAaiOperation future2) -- cgit