summaryrefslogtreecommitdiffstats
path: root/services/services-engine/src/test/java
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2022-02-07 17:56:44 +0000
committerliamfallon <liam.fallon@est.tech>2022-02-08 18:39:03 +0000
commit59b90519eda3b95b0cfc49b6349a591c7d0c78e2 (patch)
tree810e07f7d5cf270582264c40245372f597c713a2 /services/services-engine/src/test/java
parentdef44b294fa00bb5470e977eef9a05e5087035f0 (diff)
Remove JAXB and XML, use GSON for JSON
This review converst apex-pdp to use GSON for JSON handling. In order to preserve backward compatibility with the JAXB format of JSON, custom handling of maps was required. Therefore, the policy-common StandardCoder could not be used. There are a lot of small changes, removing annotations from concepts and tweaking of test data. However, this cleans up the code base so it is worth doing. Issue-ID: POLICY-1820 Change-Id: I213fa64f6d7f3f1df8d10f111d9fbedbe80f9fe0 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'services/services-engine/src/test/java')
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JsonEventHandlerForPojoTest.java4
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImplTest.java8
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorkerTest.java8
3 files changed, 10 insertions, 10 deletions
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JsonEventHandlerForPojoTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JsonEventHandlerForPojoTest.java
index c58cb085d..e2149efa5 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JsonEventHandlerForPojoTest.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/event/JsonEventHandlerForPojoTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020,2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,7 +66,7 @@ public class JsonEventHandlerForPojoTest {
final String policyModelString =
TextFileUtils.getTextFileAsString("src/test/resources/policymodels/PojoEventModel.json");
final ApexModelReader<AxPolicyModel> modelReader = new ApexModelReader<AxPolicyModel>(AxPolicyModel.class);
- modelReader.setValidateFlag(false);
+ modelReader.setValidate(false);
final AxPolicyModel apexPolicyModel = modelReader.read(new ByteArrayInputStream(policyModelString.getBytes()));
// Set up the models in the model service
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImplTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImplTest.java
index 0095c9630..a903a885e 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImplTest.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImplTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2020-2022 Nordix Foundation.
* Modifications Copyright (C) 2020-2022 Bell Canada. All rights reserved.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -199,7 +199,7 @@ public class EngineServiceImplTest {
.isInstanceOf(ApexException.class).hasMessage("engine with key DummyKey:0.0.1 not found in engine service");
String status = esImpl.getStatus(esImpl.getEngineKeys().iterator().next());
- assertTrue(status.contains("\n \"apexEngineModel\" :"));
+ assertTrue(status.contains("\"timestamp\":"));
assertFalse(esImpl.isStarted());
assertFalse(esImpl.isStarted(null));
@@ -334,7 +334,7 @@ public class EngineServiceImplTest {
assertEquals(AxEngineState.EXECUTING, esImpl.getState());
String status = esImpl.getStatus(esImpl.getEngineKeys().iterator().next());
- assertTrue(status.contains("\n \"apexEngineModel\" :"));
+ assertTrue(status.contains("\"timestamp\":"));
assertTrue(esImpl.isStarted());
assertTrue(esImpl.isStarted(esImpl.getEngineKeys().iterator().next()));
assertFalse(esImpl.isStopped());
@@ -421,4 +421,4 @@ public class EngineServiceImplTest {
fail("test should not throw an exception");
}
}
-} \ No newline at end of file
+}
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorkerTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorkerTest.java
index c95b465cf..b904fb1d4 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorkerTest.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineWorkerTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020,2022 Nordix Foundation.
* Modifications Copyright (C) 2021-2022 Bell Canada Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -219,7 +219,7 @@ public class EngineWorkerTest {
assertEquals(AxEngineState.STOPPED, worker.getState());
String status = worker.getStatus(worker.getEngineKeys().iterator().next());
- assertEquals("{\"apexEngineModel\":{\"key\":", status.replaceAll("\\s+", "").substring(0, 26));
+ assertEquals("{\"TimeStamp\":", runtimeInfo.replaceAll("\\s+", "").substring(0, 13));
assertFalse(worker.isStarted());
assertFalse(worker.isStarted(null));
@@ -380,7 +380,7 @@ public class EngineWorkerTest {
assertEquals(AxEngineState.READY, worker.getState());
String status = worker.getStatus(worker.getEngineKeys().iterator().next());
- assertEquals("{\"apexEngineModel\":{\"key\":", status.replaceAll("\\s+", "").substring(0, 26));
+ assertEquals("{\"timestamp\":", status.replaceAll("\\s+", "").substring(0, 13));
assertTrue(worker.isStarted());
assertTrue(worker.isStarted(worker.getEngineKeys().iterator().next()));
@@ -457,4 +457,4 @@ public class EngineWorkerTest {
assertEquals(policyCounter.getPolicyExecutedCount(),
policyCounter.getPolicyExecutedFailCount() + policyCounter.getPolicyExecutedSuccessCount());
}
-} \ No newline at end of file
+}