diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2017-10-18 17:02:33 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-10-18 17:02:33 +0000 |
commit | 0f4579198b531a38cdef06bbeb4f51302730e4ba (patch) | |
tree | aacfee9bfe6dde471f36e813667705d33350ebb3 /controlloop/common/actors | |
parent | f7f46f9c7ddbd7918b428649a766366d6c912b89 (diff) | |
parent | 506267bf7e9d961f1a6b2a989ee8a23ca67b9d61 (diff) |
Merge "Add support for AAI Named Query error handling"
Diffstat (limited to 'controlloop/common/actors')
3 files changed, 22 insertions, 2 deletions
diff --git a/controlloop/common/actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/APPCActorServiceProvider.java b/controlloop/common/actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/APPCActorServiceProvider.java index 75810c01e..6ae62bbcd 100644 --- a/controlloop/common/actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/APPCActorServiceProvider.java +++ b/controlloop/common/actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/APPCActorServiceProvider.java @@ -25,6 +25,7 @@ import java.util.List; import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.actor.appclcm.AppcLcmActorServiceProvider; +import org.onap.policy.aai.util.AAIException; import org.onap.policy.appc.CommonHeader; import org.onap.policy.appc.Request; import org.onap.policy.controlloop.ControlLoopOperation; @@ -33,6 +34,7 @@ import org.onap.policy.vnf.trafficgenerator.PGRequest; import org.onap.policy.vnf.trafficgenerator.PGStream; import org.onap.policy.vnf.trafficgenerator.PGStreams; import org.onap.policy.controlloop.actorServiceProvider.spi.Actor; + import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -85,8 +87,9 @@ public class APPCActorServiceProvider implements Actor { * the policy the was specified from the yaml generated * by CLAMP or through the Policy GUI/API * @return an APPC request conforming to the legacy API + * @throws AAIException */ - public static Request constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation, Policy policy) { + public static Request constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation, Policy policy) throws AAIException { /* * Construct an APPC request */ @@ -111,6 +114,10 @@ public class APPCActorServiceProvider implements Actor { policy.getTarget().getResourceID(), onset.AAI.get("generic-vnf.vnf-id")); } + if (vnfId == null) { + throw new AAIException("No vnf id found"); + } + /* * For now Policy generates the PG Streams as a demo, in the * future the payload can be provided by CLAMP diff --git a/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java b/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java index 9d7e46320..7ab368f6f 100644 --- a/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java +++ b/controlloop/common/actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/AppcServiceProviderTest.java @@ -29,6 +29,7 @@ import java.util.UUID; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import org.onap.policy.aai.util.AAIException; import org.onap.policy.appc.Request; import org.onap.policy.appc.Response; import org.onap.policy.appc.ResponseCode; @@ -115,7 +116,13 @@ public class AppcServiceProviderTest { @Test public void constructModifyConfigRequestTest() { - Request appcRequest = APPCActorServiceProvider.constructRequest(onsetEvent, operation, policy); + Request appcRequest = null; + try { + appcRequest = APPCActorServiceProvider.constructRequest(onsetEvent, operation, policy); + } catch (AAIException e) { + logger.warn(e.toString()); + fail("no vnfid found"); + } /* The service provider must return a non null APPC request */ assertNotNull(appcRequest); diff --git a/controlloop/common/actors/actor.test/pom.xml b/controlloop/common/actors/actor.test/pom.xml index c7e240ceb..79d6b6601 100644 --- a/controlloop/common/actors/actor.test/pom.xml +++ b/controlloop/common/actors/actor.test/pom.xml @@ -31,6 +31,12 @@ <scope>provided</scope> </dependency> <dependency> + <groupId>org.onap.policy.drools-applications</groupId> + <artifactId>aai</artifactId> + <version>1.1.0-SNAPSHOT</version> + <scope>provided</scope> + </dependency> + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> |