summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-03-03 16:54:52 -0500
committerJim Hahn <jrh3@att.com>2020-03-03 16:54:52 -0500
commit958fc6626f14e4101f0101d7c3bc75793aefa754 (patch)
tree5a43f571c41c8ff3e01db633f7f1d1fe6b86e0ab /models-interactions/model-actors
parent3f06effedc552c31e2608f5b8871301ba5b23033 (diff)
Translate APPC Instant to Long
APPC uses encode Instant fields as milliseconds instead of as ISO date strings. Issue-ID: POLICY-2363 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: Id9bedb11c43264f882b6fd044155621c8ccc79f6
Diffstat (limited to 'models-interactions/model-actors')
-rw-r--r--models-interactions/model-actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/AppcOperation.java9
-rw-r--r--models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java6
-rw-r--r--models-interactions/model-actors/actor.appc/src/test/resources/modifyConfig.json5
-rw-r--r--models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java2
4 files changed, 14 insertions, 8 deletions
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 dc46f1253..43bb81de0 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
@@ -29,8 +29,10 @@ import org.onap.policy.appc.CommonHeader;
import org.onap.policy.appc.Request;
import org.onap.policy.appc.Response;
import org.onap.policy.appc.ResponseCode;
+import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.common.utils.coder.StandardCoderInstantAsMillis;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
import org.onap.policy.controlloop.actorserviceprovider.impl.BidirectionalTopicOperation;
import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicConfig;
@@ -45,7 +47,7 @@ import org.slf4j.LoggerFactory;
*/
public abstract class AppcOperation extends BidirectionalTopicOperation<Request, Response> {
private static final Logger logger = LoggerFactory.getLogger(AppcOperation.class);
- private static final StandardCoder coder = new StandardCoder();
+ private static final StandardCoder coder = new StandardCoderInstantAsMillis();
public static final String VNF_ID_KEY = "generic-vnf.vnf-id";
/**
@@ -178,4 +180,9 @@ public abstract class AppcOperation extends BidirectionalTopicOperation<Request,
outcome.setMessage(response.getStatus().getDescription());
return outcome;
}
+
+ @Override
+ protected Coder makeCoder() {
+ return coder;
+ }
}
diff --git a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java
index ecba91996..06ad1661d 100644
--- a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java
+++ b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java
@@ -35,6 +35,7 @@ import java.util.function.BiConsumer;
import org.onap.policy.appc.Response;
import org.onap.policy.appc.ResponseCode;
import org.onap.policy.appc.ResponseStatus;
+import org.onap.policy.common.utils.coder.StandardCoderInstantAsMillis;
import org.onap.policy.common.utils.coder.StandardCoderObject;
import org.onap.policy.controlloop.actor.test.BasicBidirectionalTopicOperation;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
@@ -49,7 +50,7 @@ import org.powermock.reflect.Whitebox;
* Superclass for various operator tests.
*/
public abstract class BasicAppcOperation extends BasicBidirectionalTopicOperation {
- protected static final String[] IGNORE_FIELDS = {"RequestID", "subRequestID", "seconds", "nanos"};
+ protected static final String[] IGNORE_FIELDS = {"RequestID", "subRequestID", "TimeStamp"};
protected static final String MY_DESCRIPTION = "my-description";
protected static final String MY_VNF = "my-vnf";
protected static final String KEY1 = "my-key-A";
@@ -65,7 +66,7 @@ public abstract class BasicAppcOperation extends BasicBidirectionalTopicOperatio
* Constructs the object using a default actor and operation name.
*/
public BasicAppcOperation() {
- super();
+ this.coder = new StandardCoderInstantAsMillis();
}
/**
@@ -76,6 +77,7 @@ public abstract class BasicAppcOperation extends BasicBidirectionalTopicOperatio
*/
public BasicAppcOperation(String actor, String operation) {
super(actor, operation);
+ this.coder = new StandardCoderInstantAsMillis();
}
/**
diff --git a/models-interactions/model-actors/actor.appc/src/test/resources/modifyConfig.json b/models-interactions/model-actors/actor.appc/src/test/resources/modifyConfig.json
index eae6223f1..582e63b7f 100644
--- a/models-interactions/model-actors/actor.appc/src/test/resources/modifyConfig.json
+++ b/models-interactions/model-actors/actor.appc/src/test/resources/modifyConfig.json
@@ -1,9 +1,6 @@
{
"CommonHeader": {
- "TimeStamp": {
- "seconds": 1582057368,
- "nanos": 981593700
- },
+ "TimeStamp": 981593700981,
"APIver": "1.01",
"RequestID": "9a06c485-ebf1-4780-a183-6a1d862eebeb",
"SubRequestID": "2d011587-a311-45e6-a75d-67fcd3dfae1a",
diff --git a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java
index 989f6a7c3..dd6852d29 100644
--- a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java
+++ b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicOperation.java
@@ -53,7 +53,6 @@ import org.onap.policy.controlloop.policy.PolicyResult;
* Superclass for various Operation tests.
*/
public class BasicOperation {
- protected static final Coder coder = new StandardCoder();
protected static final UUID REQ_ID = UUID.randomUUID();
protected static final String DEFAULT_ACTOR = "default-actor";
protected static final String DEFAULT_OPERATION = "default-operation";
@@ -61,6 +60,7 @@ public class BasicOperation {
protected final String actorName;
protected final String operationName;
+ protected Coder coder = new StandardCoder();
@Mock
protected ActorService service;