aboutsummaryrefslogtreecommitdiffstats
path: root/models-interactions/model-actors/actor.so/src/test
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-05-15 09:52:35 -0400
committerJim Hahn <jrh3@att.com>2020-05-15 11:53:17 -0400
commitafe5abed95c6cbfe239066e267d9c10a71f20623 (patch)
tree89325042e014a2685d54d7cce13f26bb4bfde6b1 /models-interactions/model-actors/actor.so/src/test
parent4e50a58565461839df6a1fe65f571a04b2404616 (diff)
Cannot parse finishTime in SO responses
The timestamp in SO responses appears to follow RFC-1123/RFC-822 format instead of ISO format. Added a type adapter for SO. In Guilin, we may want to consider combining the two type adapters for LocalDateTime so that either format is accepted. Also modified the SO simulator to return responses that are actual samples from SO. As part of that work, discovered that the legacy SO actor is not able to parse these timestamps either. However, as that code is now deprecated, left it as is. Issue-ID: POLICY-2570 Change-Id: I322318d1007e36eef47bb8867fd8ed01cb60223a Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-interactions/model-actors/actor.so/src/test')
-rw-r--r--models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/BasicSoOperation.java4
-rw-r--r--models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java17
2 files changed, 19 insertions, 2 deletions
diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/BasicSoOperation.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/BasicSoOperation.java
index 0232226e0..aaecb46a8 100644
--- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/BasicSoOperation.java
+++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/BasicSoOperation.java
@@ -96,11 +96,11 @@ public abstract class BasicSoOperation extends BasicHttpOperation<SoRequest> {
.serializationProvider(GsonMessageBodyHandler.class.getName()).build();
HttpClientFactoryInstance.getClientFactory().build(clientParams);
- SoSimulatorJaxRs.setYieldIncomplete(true);
+ SoSimulatorJaxRs.setRequirePolling(true);
}
protected static void destroyAfterClass() {
- SoSimulatorJaxRs.setYieldIncomplete(false);
+ SoSimulatorJaxRs.setRequirePolling(false);
HttpClientFactoryInstance.getClientFactory().destroy();
HttpServletServerFactoryInstance.getServerFactory().destroy();
}
diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java
index 70093967c..644521869 100644
--- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java
+++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/SoOperationTest.java
@@ -32,6 +32,8 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+import java.time.LocalDateTime;
+import java.time.Month;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@@ -46,6 +48,7 @@ import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.ServiceInstance;
import org.onap.aai.domain.yang.Tenant;
import org.onap.policy.aai.AaiCqResponse;
+import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.controlloop.ControlLoopOperation;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
@@ -422,4 +425,18 @@ public class SoOperationTest extends BasicSoOperation {
when(cq.getDefaultCloudRegion()).thenReturn(region);
assertSame(region, oper.getDefaultCloudRegion(cq));
}
+
+ @Test
+ public void testMakeCoder() throws CoderException {
+ Coder opcoder = oper.makeCoder();
+
+ // ensure we can decode an SO timestamp
+ String json = "{'request':{'finishTime':'Fri, 15 May 2020 12:14:21 GMT'}}";
+ SoResponse resp = opcoder.decode(json.replace('\'', '"'), SoResponse.class);
+
+ LocalDateTime tfinish = resp.getRequest().getFinishTime();
+ assertNotNull(tfinish);
+ assertEquals(2020, tfinish.getYear());
+ assertEquals(Month.MAY, tfinish.getMonth());
+ }
}