Merge "upgrade eelf-core dependency: 1.0.0 -> 2.0.0-oss"
diff --git a/gson/src/test/java/org/onap/policy/common/gson/internal/FieldSerializerTest.java b/gson/src/test/java/org/onap/policy/common/gson/internal/FieldSerializerTest.java
index cc5ef92..156e4ef 100644
--- a/gson/src/test/java/org/onap/policy/common/gson/internal/FieldSerializerTest.java
+++ b/gson/src/test/java/org/onap/policy/common/gson/internal/FieldSerializerTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -89,7 +89,9 @@
text = "world";
- assertThatThrownBy(() -> ser.addToTree(this, new JsonObject())).isInstanceOf(JsonParseException.class)
+ JsonObject obj = new JsonObject();
+
+ assertThatThrownBy(() -> ser.addToTree(this, obj)).isInstanceOf(JsonParseException.class)
.hasMessage(FieldSerializer.GET_ERR + FieldSerializerTest.class.getName() + ".text");
}
}
diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/AllSeemsWellTest.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/AllSeemsWellTest.java
index 79cfe54..a46be4f 100644
--- a/integrity-monitor/src/test/java/org/onap/policy/common/im/AllSeemsWellTest.java
+++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/AllSeemsWellTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@
package org.onap.policy.common.im;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -177,16 +177,19 @@
}
// Check for null parameters
- assertThatThrownBy(() -> im.allSeemsWell(null, IntegrityMonitorProperties.ALLSEEMSWELL, ALL_SEEMS_WELL_MSG));
+ assertThatIllegalArgumentException().isThrownBy(
+ () -> im.allSeemsWell(null, IntegrityMonitorProperties.ALLSEEMSWELL, ALL_SEEMS_WELL_MSG));
- assertThatThrownBy(() -> im.allSeemsWell("", IntegrityMonitorProperties.ALLSEEMSWELL, ALL_SEEMS_WELL_MSG));
+ assertThatIllegalArgumentException().isThrownBy(
+ () -> im.allSeemsWell("", IntegrityMonitorProperties.ALLSEEMSWELL, ALL_SEEMS_WELL_MSG));
- assertThatThrownBy(() -> im.allSeemsWell(this.getClass().getName(), null, ALL_SEEMS_WELL_MSG));
+ assertThatIllegalArgumentException().isThrownBy(
+ () -> im.allSeemsWell(this.getClass().getName(), null, ALL_SEEMS_WELL_MSG));
- assertThatThrownBy(() -> im.allSeemsWell(this.getClass().getName(), IntegrityMonitorProperties.ALLSEEMSWELL,
- null));
+ assertThatIllegalArgumentException().isThrownBy(
+ () -> im.allSeemsWell(this.getClass().getName(), IntegrityMonitorProperties.ALLSEEMSWELL, null));
- assertThatThrownBy(
+ assertThatIllegalArgumentException().isThrownBy(
() -> im.allSeemsWell(this.getClass().getName(), IntegrityMonitorProperties.ALLSEEMSWELL, ""));
logger.debug("\n\ntestAllSeemsWell: Exit\n\n");
diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTest.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTest.java
index 1e194c3..0def27e 100644
--- a/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTest.java
+++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/IntegrityMonitorTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -192,7 +192,7 @@
waitCycles(DEPENDENCY_CHECK_CYCLES);
final IntegrityMonitor im2 = im;
- assertThatThrownBy(im2::evaluateSanity);
+ assertThatThrownBy(im2::evaluateSanity).isInstanceOf(IntegrityMonitorException.class);
// undo dependency groups and jmx test properties settings
myProp.put(IntegrityMonitorProperties.DEPENDENCY_GROUPS, "");
@@ -313,7 +313,7 @@
assertEquals(StateManagement.LOCKED, sm.getAdminState());
// test startTransaction. It should fail since it is locked
- assertThatThrownBy(im::startTransaction);
+ assertThatThrownBy(im::startTransaction).isInstanceOf(IntegrityMonitorException.class);
sm.unlock();
logger.debug("\n\nsm.unlock()\nAdminState = {}\nOpState() = {}\nAvailStatus = {}\nStandbyStatus = {}\n",
@@ -374,7 +374,7 @@
assertEquals(StateManagement.HOT_STANDBY, sm.getStandbyStatus());
// test startTransaction. It should fail since it is standby
- assertThatThrownBy(im::startTransaction);
+ assertThatThrownBy(im::startTransaction).isInstanceOf(IntegrityMonitorException.class);
sm.promote();
@@ -400,7 +400,7 @@
// Test startTransaction. Should fail since standby status is cold
// standby
- assertThatThrownBy(im::startTransaction);
+ assertThatThrownBy(im::startTransaction).isInstanceOf(IntegrityMonitorException.class);
sm.enableNoDependency();
@@ -410,7 +410,7 @@
assertEquals(StateManagement.FAILED, sm.getAvailStatus());
// Test startTransaction. Should fail since standby status is cold
// standby
- assertThatThrownBy(im::startTransaction);
+ assertThatThrownBy(im::startTransaction).isInstanceOf(IntegrityMonitorException.class);
sm.disableDependency();
sm.enableNotFailed();
@@ -423,7 +423,7 @@
assertEquals(StateManagement.DEPENDENCY, sm.getAvailStatus());
// Test startTransaction. Should fail since standby status is cold
// standby
- assertThatThrownBy(im::startTransaction);
+ assertThatThrownBy(im::startTransaction).isInstanceOf(IntegrityMonitorException.class);
sm.enableNoDependency();
logger.debug(
@@ -432,7 +432,7 @@
assertEquals(StateManagement.ENABLED, sm.getOpState());
// test startTransaction. It should fail since standby status is hot
// standby
- assertThatThrownBy(im::startTransaction);
+ assertThatThrownBy(im::startTransaction).isInstanceOf(IntegrityMonitorException.class);
logger.debug("\n\ntestIM: Exit\n\n");
}
@@ -490,7 +490,7 @@
// to do it.
logger.debug("\n\nIntegrityMonitor.testSanityState: calling im.dependencyCheck()\n\n");
im.dependencyCheck();
- assertThatThrownBy(im::evaluateSanity);
+ assertThatThrownBy(im::evaluateSanity).isInstanceOf(IntegrityMonitorException.class);
logger.debug("\n\ntestSanityState: Exit\n\n");
}
@@ -648,7 +648,7 @@
*/
waitCycles(DEPENDENCY_CHECK_CYCLES);
- assertThatThrownBy(im::evaluateSanity);
+ assertThatThrownBy(im::evaluateSanity).isInstanceOf(IntegrityMonitorException.class);
logger.debug("\n\ntestStateCheck: Exit\n\n");
}
diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java
index 680a73e..12671ec 100644
--- a/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java
+++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java
@@ -113,19 +113,17 @@
// the standbystatus shall transition to coldstandby and a
// StandbyStatusException shall be thrown
logger.info("\n??? promote() test case P4");
- assertThatThrownBy(() -> {
- sm.disableFailed();
- sm.lock();
+ sm.disableFailed();
+ sm.lock();
+ assertThatThrownBy(sm::promote).isInstanceOf(IntegrityMonitorException.class);
- sm.promote();
- });
assertEquals(LOCKED_DISABLED_FAILED_COLDSTANDBY, makeString(sm));
// P3 If promote() is called while standbyStatus is coldstandby, the
// state shall not transition
// and a StandbyStatusException shall be thrown
logger.info("\n??? promote() test case P3");
- assertThatThrownBy(sm::promote);
+ assertThatThrownBy(sm::promote).isInstanceOf(IntegrityMonitorException.class);
assertEquals(LOCKED_DISABLED_FAILED_COLDSTANDBY, makeString(sm));
// P2 If promote() is called while the standbyStatus is null and the
@@ -217,7 +215,7 @@
assertEquals(UNLOCKED_DISABLED_FAILED_COLDSTANDBY, makeString(stateChangeNotifier.getStateManagement()));
logger.info("\n??? State change notification test case 6 - promote()");
- assertThatThrownBy(sm::promote);
+ assertThatThrownBy(sm::promote).isInstanceOf(IntegrityMonitorException.class);
assertEquals(UNLOCKED_DISABLED_FAILED_COLDSTANDBY, makeString(sm));
} catch (final Exception ex) {
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicFactoryTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicFactoryTest.java
index 5cb9bcb..af7a4b2 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicFactoryTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicFactoryTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@
package org.onap.policy.common.endpoints.event.comm.bus;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
@@ -136,7 +136,7 @@
initFactory();
assertEquals(1, buildTopics(makePropBuilder().makeTopic(MY_TOPIC)
.setTopicProperty(PROPERTY_MANAGED_SUFFIX, "false").build()).size());
- assertThatThrownBy(() -> factory.get(MY_TOPIC));
+ assertThatIllegalStateException().isThrownBy(() -> factory.get(MY_TOPIC));
// managed undefined - default to true
initFactory();
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/YamlMessageBodyHandlerTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/YamlMessageBodyHandlerTest.java
index 70b620c..4f2eb31 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/YamlMessageBodyHandlerTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/YamlMessageBodyHandlerTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -115,8 +115,7 @@
};
MyObject obj1 = new MyObject(10);
-
- assertThatThrownBy(() -> hdlr.writeTo(obj1, obj1.getClass(), CLASS_OBJ, null, null, null, outstr))
+ assertThatThrownBy(() -> hdlr.writeTo(obj1, MyObject.class, CLASS_OBJ, null, null, null, outstr))
.isInstanceOf(YAMLException.class);
outstr.close();
diff --git a/policy-endpoints/src/test/resources/webapps/alt-root/index.html b/policy-endpoints/src/test/resources/webapps/alt-root/index.html
index 0948ceb..8ef757e 100644
--- a/policy-endpoints/src/test/resources/webapps/alt-root/index.html
+++ b/policy-endpoints/src/test/resources/webapps/alt-root/index.html
@@ -1,6 +1,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2020 Nordix Foundation.
+ Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
============LICENSE_END=========================================================
-->
+<?xml !DOCTYPE html>
<html>
<head>
<title>Hello World</title>
@@ -25,4 +27,4 @@
<body>
<h4>Test Jetty Static Resources Alt-Root</h4>
</body>
-</html>
\ No newline at end of file
+</html>
diff --git a/policy-endpoints/src/test/resources/webapps/root/index.html b/policy-endpoints/src/test/resources/webapps/root/index.html
index a7cc120..35f6101 100644
--- a/policy-endpoints/src/test/resources/webapps/root/index.html
+++ b/policy-endpoints/src/test/resources/webapps/root/index.html
@@ -1,6 +1,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2020 Nordix Foundation.
+ Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -18,6 +19,7 @@
============LICENSE_END=========================================================
-->
+<?xml !DOCTYPE html>
<html>
<head>
<title>Hello World</title>
@@ -25,4 +27,4 @@
<body>
<h4>Test Jetty Static Resources Root</h4>
</body>
-</html>
\ No newline at end of file
+</html>
diff --git a/utils-test/src/test/java/org/onap/policy/common/utils/gson/GsonTestUtilsTest.java b/utils-test/src/test/java/org/onap/policy/common/utils/gson/GsonTestUtilsTest.java
index 11ee63c..f16764c 100644
--- a/utils-test/src/test/java/org/onap/policy/common/utils/gson/GsonTestUtilsTest.java
+++ b/utils-test/src/test/java/org/onap/policy/common/utils/gson/GsonTestUtilsTest.java
@@ -76,10 +76,11 @@
utils.compareGson(data, GsonTestUtilsTest.class);
// file not found
- assertThatThrownBy(() -> utils.compareGson(data,
- new File(GsonTestUtilsTest.class.getSimpleName() + "-NotFound.json")))
- .isInstanceOf(JsonParseException.class)
- .hasCauseInstanceOf(FileNotFoundException.class);
+ File file = new File(GsonTestUtilsTest.class.getSimpleName() + "-NotFound.json");
+
+ assertThatThrownBy(() -> utils.compareGson(data, file))
+ .isInstanceOf(JsonParseException.class)
+ .hasCauseInstanceOf(FileNotFoundException.class);
// force I/O error while reading file
GsonTestUtils utils2 = new GsonTestUtils() {
diff --git a/utils-test/src/test/java/org/onap/policy/common/utils/time/PseudoScheduledExecutorServiceTest.java b/utils-test/src/test/java/org/onap/policy/common/utils/time/PseudoScheduledExecutorServiceTest.java
index 70820c4..745e989 100644
--- a/utils-test/src/test/java/org/onap/policy/common/utils/time/PseudoScheduledExecutorServiceTest.java
+++ b/utils-test/src/test/java/org/onap/policy/common/utils/time/PseudoScheduledExecutorServiceTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@
import static org.junit.Assert.assertTrue;
import java.util.Collections;
+import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledFuture;
@@ -37,6 +38,7 @@
public class PseudoScheduledExecutorServiceTest {
private static final long DELAY_MS = 100L;
private static final long PERIOD_MS = 200L;
+ private static final List<Callable<Object>> EMPTY_CALLABLES = Collections.emptyList();
private int ran;
private int called;
@@ -135,25 +137,25 @@
@Test
public void testInvokeAllCollectionOfQextendsCallableOfT() {
- assertThatThrownBy(() -> svc.invokeAll(Collections.emptyList()))
+ assertThatThrownBy(() -> svc.invokeAll(EMPTY_CALLABLES))
.isInstanceOf(UnsupportedOperationException.class);
}
@Test
public void testInvokeAllCollectionOfQextendsCallableOfTLongTimeUnit() {
- assertThatThrownBy(() -> svc.invokeAll(Collections.emptyList(), 1, TimeUnit.MILLISECONDS))
+ assertThatThrownBy(() -> svc.invokeAll(EMPTY_CALLABLES, 1, TimeUnit.MILLISECONDS))
.isInstanceOf(UnsupportedOperationException.class);
}
@Test
public void testInvokeAnyCollectionOfQextendsCallableOfT() {
- assertThatThrownBy(() -> svc.invokeAny(Collections.emptyList()))
+ assertThatThrownBy(() -> svc.invokeAny(EMPTY_CALLABLES))
.isInstanceOf(UnsupportedOperationException.class);
}
@Test
public void testInvokeAnyCollectionOfQextendsCallableOfTLongTimeUnit() {
- assertThatThrownBy(() -> svc.invokeAny(Collections.emptyList(), 1, TimeUnit.MILLISECONDS))
+ assertThatThrownBy(() -> svc.invokeAny(EMPTY_CALLABLES, 1, TimeUnit.MILLISECONDS))
.isInstanceOf(UnsupportedOperationException.class);
}
diff --git a/utils-test/src/test/java/org/onap/policy/common/utils/time/PseudoTimerTest.java b/utils-test/src/test/java/org/onap/policy/common/utils/time/PseudoTimerTest.java
index 4971053..d7316c1 100644
--- a/utils-test/src/test/java/org/onap/policy/common/utils/time/PseudoTimerTest.java
+++ b/utils-test/src/test/java/org/onap/policy/common/utils/time/PseudoTimerTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -83,8 +83,9 @@
@Test
public void testScheduleTimerTaskDate() {
- assertThatThrownBy(() -> timer.schedule(new MyTask(), new Date()))
- .isInstanceOf(UnsupportedOperationException.class);
+ MyTask task = new MyTask();
+ Date curdate = new Date();
+ assertThatThrownBy(() -> timer.schedule(task, curdate)).isInstanceOf(UnsupportedOperationException.class);
}
@Test
@@ -105,8 +106,9 @@
@Test
public void testScheduleTimerTaskDateLong() {
- assertThatThrownBy(() -> timer.schedule(new MyTask(), new Date(), 1L))
- .isInstanceOf(UnsupportedOperationException.class);
+ MyTask task = new MyTask();
+ Date curdate = new Date();
+ assertThatThrownBy(() -> timer.schedule(task, curdate, 1L)).isInstanceOf(UnsupportedOperationException.class);
}
@Test
@@ -127,7 +129,9 @@
@Test
public void testScheduleAtFixedRateTimerTaskDateLong() {
- assertThatThrownBy(() -> timer.scheduleAtFixedRate(new MyTask(), new Date(), 1L))
+ MyTask task = new MyTask();
+ Date curdate = new Date();
+ assertThatThrownBy(() -> timer.scheduleAtFixedRate(task, curdate, 1L))
.isInstanceOf(UnsupportedOperationException.class);
}
diff --git a/utils/src/test/java/org/onap/policy/common/utils/coder/StandardCoderTest.java b/utils/src/test/java/org/onap/policy/common/utils/coder/StandardCoderTest.java
index ad4382c..a468f0b 100644
--- a/utils/src/test/java/org/onap/policy/common/utils/coder/StandardCoderTest.java
+++ b/utils/src/test/java/org/onap/policy/common/utils/coder/StandardCoderTest.java
@@ -31,6 +31,7 @@
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
+import com.google.gson.JsonSyntaxException;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -319,7 +320,9 @@
assertEquals(json, coder.toJson(sco));
// invalid json -> exception
- assertThatThrownBy(() -> coder.fromJson(new StringReader("["), StandardCoderObject.class));
+ StringReader rdr = new StringReader("[");
+ assertThatThrownBy(() -> coder.fromJson(rdr, StandardCoderObject.class))
+ .isInstanceOf(JsonSyntaxException.class);
}
@Test