aboutsummaryrefslogtreecommitdiffstats
path: root/testsuites/integration
diff options
context:
space:
mode:
authorJorge Hernandez <jorge.hernandez-herrero@att.com>2020-07-22 14:26:19 +0000
committerGerrit Code Review <gerrit@onap.org>2020-07-22 14:26:19 +0000
commit67ee67bd0da0d2d16abb982e26a3d48ba031a7e8 (patch)
tree8ab86bc510a96ae4219581e5a7213defecbe1266 /testsuites/integration
parentd19067ce13765b7f98bcefb26b1bb469282c6624 (diff)
parent53b9324d6ec14ef75dc1f943c19b3ea1a46bc8ab (diff)
Merge "Fix assertTrue in apex-pdp/model apex-pdp/plugins, apex-pdp/services and apex-pdp/testsuites"
Diffstat (limited to 'testsuites/integration')
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java7
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexModelExport.java10
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java5
-rw-r--r--testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateDifferentModels.java19
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java6
-rw-r--r--testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java6
6 files changed, 26 insertions, 27 deletions
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java
index bf883d761..ba4b225d2 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/event/TestEventInstantiation.java
@@ -25,7 +25,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.Date;
@@ -194,11 +193,11 @@ public class TestEventInstantiation {
final double temp2 = (double) event.get("TestTemperature");
assertNotNull(temp2);
- assertTrue(temp2 == 123.456789);
+ assertEquals(123.456789, temp2, 0);
final Double temp3 = (Double) event.get("TestTemperature");
assertNotNull(temp3);
- assertTrue(temp3 == 123.456789);
+ assertEquals(123.456789, temp3, 0);
final Date aDate = new Date(1433453067123L);
final Map<String, Object> eventDataList = new HashMap<String, Object>();
@@ -223,7 +222,7 @@ public class TestEventInstantiation {
final double temp4 = (double) event.get("TestTemperature");
assertNotNull(temp4);
- assertTrue(temp4 == 34.5445667);
+ assertEquals(34.5445667, temp4, 0);
logger.debug(event.toString());
}
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexModelExport.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexModelExport.java
index aaf640bb4..dc5c06f85 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexModelExport.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexModelExport.java
@@ -21,9 +21,9 @@
package org.onap.policy.apex.testsuites.integration.executor.handling;
-import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
@@ -89,13 +89,13 @@ public class TestApexModelExport {
model.getKeyInformation().getKeyInfoMap().remove(new AxArtifactKey("TestContextItem00B", "0.0.1"));
model.getKeyInformation().getKeyInfoMap().remove(new AxArtifactKey("TestContextItem00C", "0.0.1"));
- assertTrue(model.equals(exportedModel0));
+ assertEquals(model, exportedModel0);
exportPolicyList.remove(0);
final AxPolicyModel exportedModel1 = PolicyModelSplitter.getSubPolicyModel(model, exportPolicyList);
- assertFalse(model.equals(exportedModel1));
- assertTrue(model.getPolicies().get("Policy1").equals(exportedModel1.getPolicies().get("Policy1")));
+ assertNotEquals(model, exportedModel1);
+ assertEquals(model.getPolicies().get("Policy1"), exportedModel1.getPolicies().get("Policy1"));
exportPolicyList.clear();
exportPolicyList.add(new AxArtifactKey("NonExistentPolicy", "0.0.1"));
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java
index 3f38a10dd..0561162c8 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +21,7 @@
package org.onap.policy.apex.testsuites.integration.executor.handling;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
import java.sql.Connection;
import java.sql.DriverManager;
@@ -58,7 +59,7 @@ public class TestApexSamplePolicyModel {
@Test
public void testModelValid() throws Exception {
final AxValidationResult result = testApexModel.testApexModelValid();
- assertTrue(result.toString().equals(VALID_MODEL_STRING));
+ assertEquals(VALID_MODEL_STRING, result.toString());
}
/**
diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateDifferentModels.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateDifferentModels.java
index d2e35ecb2..0a4b9a7d5 100644
--- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateDifferentModels.java
+++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestContextUpdateDifferentModels.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,6 @@ package org.onap.policy.apex.testsuites.integration.executor.handling;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import java.io.IOException;
import org.junit.After;
@@ -67,12 +66,12 @@ public class TestContextUpdateDifferentModels {
@Before
public void beforeTest() {
schemaParameters = new SchemaParameters();
-
+
schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME);
schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters());
ParameterService.register(schemaParameters);
-
+
contextParameters = new ContextParameters();
contextParameters.setName(ContextParameterConstants.MAIN_GROUP_NAME);
@@ -84,7 +83,7 @@ public class TestContextUpdateDifferentModels {
ParameterService.register(contextParameters.getDistributorParameters());
ParameterService.register(contextParameters.getLockManagerParameters());
ParameterService.register(contextParameters.getPersistorParameters());
-
+
engineParameters = new EngineParameters();
engineParameters.getExecutorParameterMap().put("MVEL", new MvelExecutorParameters());
ParameterService.register(engineParameters);
@@ -96,7 +95,7 @@ public class TestContextUpdateDifferentModels {
@After
public void afterTest() {
ParameterService.deregister(engineParameters);
-
+
ParameterService.deregister(contextParameters.getDistributorParameters());
ParameterService.deregister(contextParameters.getLockManagerParameters());
ParameterService.deregister(contextParameters.getPersistorParameters());
@@ -136,16 +135,16 @@ public class TestContextUpdateDifferentModels {
assertEquals(apexEngine.getInternalContext().getContextAlbums().size(),
apexModelSample.getAlbums().getAlbumsMap().size());
for (final ContextAlbum contextAlbum : apexEngine.getInternalContext().getContextAlbums().values()) {
- assertTrue(
- contextAlbum.getAlbumDefinition().equals(apexModelSample.getAlbums().get(contextAlbum.getKey())));
+ assertEquals(
+ contextAlbum.getAlbumDefinition(), apexModelSample.getAlbums().get(contextAlbum.getKey()));
}
apexEngine.updateModel(someSpuriousModel, false);
assertEquals(apexEngine.getInternalContext().getContextAlbums().size(),
someSpuriousModel.getAlbums().getAlbumsMap().size());
for (final ContextAlbum contextAlbum : apexEngine.getInternalContext().getContextAlbums().values()) {
- assertTrue(
- contextAlbum.getAlbumDefinition().equals(someSpuriousModel.getAlbums().get(contextAlbum.getKey())));
+ assertEquals(
+ contextAlbum.getAlbumDefinition(), someSpuriousModel.getAlbums().get(contextAlbum.getKey()));
}
apexEngine.clear();
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java
index fdc60d765..22303a69a 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceModelUpdateTest.java
@@ -369,9 +369,9 @@ public class ApexServiceModelUpdateTest {
private void checkResult(final ApexEvent result) {
assertTrue(result.getName().startsWith("Event0004") || result.getName().startsWith("Event0104"));
- assertTrue(result.get("TestSlogan").equals("This is a test slogan"));
- assertTrue(result.get("TestMatchCase").equals((byte) 123));
- assertTrue(result.get("TestTemperature").equals(34.5445667));
+ assertEquals("This is a test slogan", result.get("TestSlogan"));
+ assertEquals((byte) 123, result.get("TestMatchCase"));
+ assertEquals(34.5445667, result.get("TestTemperature"));
assertTrue(((byte) result.get("TestMatchCaseSelected")) >= 0
&& ((byte) result.get("TestMatchCaseSelected") <= 3));
assertTrue(((byte) result.get("TestEstablishCaseSelected")) >= 0
diff --git a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java
index 72444cc7c..445c2df1f 100644
--- a/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java
+++ b/testsuites/integration/integration-uservice-test/src/test/java/org/onap/policy/apex/testsuites/integration/uservice/engine/ApexServiceTest.java
@@ -499,9 +499,9 @@ public class ApexServiceTest {
private void checkResult(final ApexEvent result) {
assertTrue(result.getName().startsWith("Event0004") || result.getName().startsWith("Event0104"));
- assertTrue(result.get("TestSlogan").equals("This is a test slogan"));
- assertTrue(result.get("TestMatchCase").equals((byte) 123));
- assertTrue(result.get("TestTemperature").equals(34.5445667));
+ assertEquals("This is a test slogan", result.get("TestSlogan"));
+ assertEquals((byte) 123, result.get("TestMatchCase"));
+ assertEquals(34.5445667, result.get("TestTemperature"));
assertTrue(((byte) result.get("TestMatchCaseSelected")) >= 0
&& ((byte) result.get("TestMatchCaseSelected") <= 3));
assertTrue(((byte) result.get("TestEstablishCaseSelected")) >= 0