diff options
author | Jim Hahn <jrh3@att.com> | 2020-02-20 19:08:55 -0500 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2020-02-21 20:33:06 -0500 |
commit | 7f69c5ca0a6f6018166f8fee3e811edf4dee1eb8 (patch) | |
tree | e57ab3105adbe0752b30e0e0a60ea43588cfb384 /models-interactions/model-actors/actor.appc/src/main | |
parent | 3c8c5b2994e3f132385f0341283bc271e13cdb25 (diff) |
Change payload to Map<String,Object> so it's more versatile
This was supposed to be two separate commits, but I goofed something.
Added guard query to Operation superclass. Modified VfModuleCreate
to store the VF count, pass it to the guard, and bump it once the
create completes successfully.
Added code to check Actors for proper plug-in to ActorService.
Renamed "operation" property to "operations", to be more consistent
with other parameters (e.g., TopicParameterGroup).
The META-INF/services files for the actors had mixed case, which
did not match the package name of the Actor class, preventing the
ServiceLoader from recognizing them. Also modified the ActorService
to skip any that cannot actually be loaded, for whatever reason
(e.g., not in the classpath).
Issue-ID: POLICY-1625
Signed-off-by: Jim Hahn <jrh3@att.com>
Change-Id: Ifa97744543f2866cc553138ec5ec644b033de780
Diffstat (limited to 'models-interactions/model-actors/actor.appc/src/main')
-rw-r--r-- | models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcActorServiceProvider.java | 2 | ||||
-rw-r--r-- | models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java | 21 | ||||
-rw-r--r-- | models-interactions/model-actors/actor.appc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorserviceprovider.spi.Actor (renamed from models-interactions/model-actors/actor.appc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor) | 0 |
3 files changed, 19 insertions, 4 deletions
diff --git a/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcActorServiceProvider.java b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcActorServiceProvider.java index f6a204540..76aa828c1 100644 --- a/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcActorServiceProvider.java +++ b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcActorServiceProvider.java @@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory; public class AppcActorServiceProvider extends BidirectionalTopicActor<BidirectionalTopicActorParams> { - private static final String NAME = "APPC"; + public static final String NAME = "APPC"; private static final Logger logger = LoggerFactory.getLogger(AppcActorServiceProvider.class); diff --git a/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java index 7d4af80ad..dc46f1253 100644 --- a/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java +++ b/models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.UUID; +import java.util.concurrent.CompletableFuture; import org.onap.policy.appc.CommonHeader; import org.onap.policy.appc.Request; import org.onap.policy.appc.Response; @@ -67,6 +68,14 @@ public abstract class AppcOperation extends BidirectionalTopicOperation<Request, } /** + * Starts the GUARD. + */ + @Override + protected CompletableFuture<OperationOutcome> startPreprocessorAsync() { + return startGuardAsync(); + } + + /** * Makes a request, given the target VNF. This is a support function for * {@link #makeRequest(int)}. * @@ -104,10 +113,16 @@ public abstract class AppcOperation extends BidirectionalTopicOperation<Request, * @param source source from which to get the values * @param target where to place the decoded values */ - private static void convertPayload(Map<String, String> source, Map<String, Object> target) { - for (Entry<String, String> ent : source.entrySet()) { + private static void convertPayload(Map<String, Object> source, Map<String, Object> target) { + for (Entry<String, Object> ent : source.entrySet()) { + Object value = ent.getValue(); + if (value == null) { + target.put(ent.getKey(), null); + continue; + } + try { - target.put(ent.getKey(), coder.decode(ent.getValue(), Object.class)); + target.put(ent.getKey(), coder.decode(value.toString(), Object.class)); } catch (CoderException e) { logger.warn("cannot decode JSON value {}: {}", ent.getKey(), ent.getValue(), e); diff --git a/models-interactions/model-actors/actor.appc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor b/models-interactions/model-actors/actor.appc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorserviceprovider.spi.Actor index f1002a301..f1002a301 100644 --- a/models-interactions/model-actors/actor.appc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorServiceProvider.spi.Actor +++ b/models-interactions/model-actors/actor.appc/src/main/resources/META-INF/services/org.onap.policy.controlloop.actorserviceprovider.spi.Actor |