summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingContext.java3
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/eelf/PolicyLogger.java2
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/EelfLogger.java2
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/FlexLogger.java8
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger.java1
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/SystemOutLogger.java2
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/SharedContext.java7
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventDataTest.java26
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoHandlerTest.java7
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoTest.java22
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/eelf/PolicyLoggerTest.java3
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/FlexLoggerTest.java16
-rw-r--r--common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/SystemOutLoggerTest.java2
-rw-r--r--common-parameters/src/test/java/org/onap/policy/common/parameters/ExceptionTest.java3
-rw-r--r--gson/src/main/java/org/onap/policy/common/gson/internal/Adapter.java21
-rw-r--r--integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java11
-rw-r--r--integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java7
-rw-r--r--integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditCompareEntriesTest.java5
-rw-r--r--integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditTest.java4
-rw-r--r--integrity-audit/src/test/java/org/onap/policy/common/ia/DbDaoTest.java10
-rw-r--r--integrity-audit/src/test/java/org/onap/policy/common/ia/DefaultLoggingPatternTest.java1
-rw-r--r--integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditTest.java12
-rw-r--r--integrity-audit/src/test/java/org/onap/policy/common/ia/jpa/IaTestEntity.java3
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java106
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdmin.java22
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java17
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java23
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java15
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java3
-rw-r--r--integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementEntityTest.java4
-rw-r--r--integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementTest.java1
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/Topic.java3
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineBusTopicSink.java1
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSink.java3
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSource.java1
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java1
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBase.java15
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/HttpClient.java1
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/parameters/RestServerParameters.java2
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/TopicEndpointProxyTest.java3
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/BusTopicFactoryTestBase.java20
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicEndpointTest.java3
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/TopicFactoryTestBase.java10
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java14
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/MyJacksonProvider.java4
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/RestEndpoints.java4
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/report/TestHealthCheckReport.java2
-rw-r--r--utils-test/src/main/java/org/onap/policy/common/utils/test/ThrowablesTester.java1
-rw-r--r--utils-test/src/main/java/org/onap/policy/common/utils/test/ToStringTester.java3
-rw-r--r--utils-test/src/test/java/org/onap/policy/common/utils/test/log/logback/ExtractAppenderTest.java2
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/resources/ResourceUtils.java1
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/services/OrderedServiceImpl.java17
-rw-r--r--utils/src/test/java/org/onap/policy/common/utils/coder/PropertyCoderTest.java7
-rw-r--r--utils/src/test/java/org/onap/policy/common/utils/jpa/EntityMgrCloserTest.java3
-rw-r--r--utils/src/test/java/org/onap/policy/common/utils/jpa/EntityMgrFactoryCloserTest.java3
-rw-r--r--utils/src/test/java/org/onap/policy/common/utils/jpa/EntityTransCloserTest.java3
-rw-r--r--utils/src/test/java/org/onap/policy/common/utils/network/NetworkUtilTest.java9
-rw-r--r--utils/src/test/java/org/onap/policy/common/utils/resources/ResourceUtilsTest.java5
-rw-r--r--utils/src/test/java/org/onap/policy/common/utils/resources/TextFileUtilsTest.java2
-rw-r--r--utils/src/test/java/org/onap/policy/common/utils/validation/VersionTest.java24
60 files changed, 237 insertions, 299 deletions
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingContext.java b/common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingContext.java
index 0373abfe..47c05041 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingContext.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/OnapLoggingContext.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP-Logging
* ================================================================================
- * 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.
@@ -24,7 +24,6 @@ import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.Instant;
import java.util.Date;
-
import org.onap.policy.common.logging.nsa.LoggingContextFactory;
import org.onap.policy.common.logging.nsa.SharedLoggingContext;
import org.slf4j.MDC;
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/PolicyLogger.java b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/PolicyLogger.java
index 7bc2c1dc..c582ea85 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/PolicyLogger.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/PolicyLogger.java
@@ -54,10 +54,8 @@ import java.net.UnknownHostException;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.Instant;
-import java.util.Arrays;
import java.util.Date;
import java.util.Iterator;
-import java.util.Map;
import java.util.Properties;
import java.util.Timer;
import java.util.UUID;
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/EelfLogger.java b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/EelfLogger.java
index df60fa9c..837a584f 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/EelfLogger.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/EelfLogger.java
@@ -21,10 +21,8 @@
package org.onap.policy.common.logging.flexlogger;
import com.att.eelf.configuration.EELFLogger.Level;
-
import java.io.Serializable;
import java.util.UUID;
-
import org.onap.policy.common.logging.eelf.MessageCodes;
import org.onap.policy.common.logging.eelf.PolicyLogger;
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/FlexLogger.java b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/FlexLogger.java
index 62459bcc..eb6daee9 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/FlexLogger.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/FlexLogger.java
@@ -29,7 +29,6 @@ import java.util.Date;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
-
import org.onap.policy.common.logging.eelf.PolicyLogger;
import org.onap.policy.common.logging.flexlogger.PropertyUtil.Listener;
@@ -73,10 +72,8 @@ public class FlexLogger extends SecurityManager {
/**
* Returns an instance of Logger.
- *
- * @param name the name of the logger
*/
- public static Logger getLogger(String name) {
+ public static Logger getLogger() {
Logger logger = null;
displayMessage(GET_LOGGER_PREFIX + loggerType);
switch (loggerType) {
@@ -121,10 +118,9 @@ public class FlexLogger extends SecurityManager {
/**
* Returns an instance of Logger.
*
- * @param name the name of the logger
* @param isNewTransaction is a new transaction
*/
- public static Logger getLogger(String name, boolean isNewTransaction) {
+ public static Logger getLogger(boolean isNewTransaction) {
Logger logger = null;
displayMessage(GET_LOGGER_PREFIX + loggerType);
switch (loggerType) {
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger.java b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger.java
index 315cd935..ad155a4c 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/Logger.java
@@ -21,7 +21,6 @@
package org.onap.policy.common.logging.flexlogger;
import java.util.UUID;
-
import org.onap.policy.common.logging.eelf.MessageCodes;
/**
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/SystemOutLogger.java b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/SystemOutLogger.java
index bc7633da..a059bd77 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/SystemOutLogger.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/flexlogger/SystemOutLogger.java
@@ -23,11 +23,9 @@ package org.onap.policy.common.logging.flexlogger;
import static org.onap.policy.common.logging.flexlogger.DisplayUtils.displayMessage;
import com.att.eelf.configuration.EELFLogger.Level;
-
import java.io.Serializable;
import java.util.Arrays;
import java.util.UUID;
-
import org.onap.policy.common.logging.OnapLoggingUtils;
import org.onap.policy.common.logging.eelf.MessageCodes;
import org.onap.policy.common.logging.eelf.PolicyLogger;
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/SharedContext.java b/common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/SharedContext.java
index e5f5e65b..13b38fc0 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/SharedContext.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/nsa/impl/SharedContext.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP-Logging
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018, 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,7 +22,6 @@ package org.onap.policy.common.logging.nsa.impl;
import java.util.HashMap;
import java.util.Map.Entry;
-
import org.onap.policy.common.logging.nsa.LoggingContext;
import org.onap.policy.common.logging.nsa.SharedLoggingContext;
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventDataTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventDataTest.java
index 6fe81d27..882cc2cf 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventDataTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventDataTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Engine - Common Modules
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-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.
@@ -21,13 +21,10 @@
package org.onap.policy.common.logging.eelf;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
import java.time.Instant;
-
import org.junit.Test;
public class EventDataTest {
@@ -142,32 +139,33 @@ public class EventDataTest {
final EventData d3 = new EventData("abc", iend, istart);
// same object
- assertTrue(d1.equals(d1));
+ assertEquals(d1, d1);
// compare with null
- assertFalse(d1.equals(null));
+ assertNotEquals(d1, null);
// compare with request id
- assertTrue(d1.equals("abc"));
- assertFalse(d1.equals("abd"));
+ // note: ignoring sonar because we want to test d1.equals(), not "abc".equals()
+ assertEquals(d1, "abc"); // NOSONAR
+ assertNotEquals(d1, "abd");
// compare with int - different class type
- assertFalse(d1.equals(10));
+ assertNotEquals(d1, 10);
// "this" has null request id
- assertFalse(new EventData().equals(d1));
+ assertNotEquals(new EventData(), d1);
// both null
- assertTrue(new EventData().equals(new EventData()));
+ assertEquals(new EventData(), new EventData());
// this request id is not null, other is null
- assertFalse(d1.equals(new EventData()));
+ assertNotEquals(d1, new EventData());
// neither null, same
- assertTrue(d1.equals(d3));
+ assertEquals(d1, d3);
// neither null, diff
- assertFalse(d1.equals(d2));
+ assertNotEquals(d1, d2);
}
}
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoHandlerTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoHandlerTest.java
index d1d5983d..2cc1e59e 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoHandlerTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoHandlerTest.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP Policy Engine - Common Modules
* ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018, 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,7 +24,6 @@ import static org.junit.Assert.assertEquals;
import java.time.Instant;
import java.util.concurrent.ConcurrentMap;
-
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoTest.java
index e6024682..0ca5feb5 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/EventTrackInfoTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy Engine - Common Modules
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-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.
@@ -23,10 +23,10 @@ package org.onap.policy.common.logging.eelf;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import java.time.Instant;
-
import org.junit.Before;
import org.junit.Test;
@@ -62,8 +62,8 @@ public class EventTrackInfoTest {
info.storeEventData(data1);
info.storeEventData(data2);
- assertTrue(data1 == info.getEventDataByRequestId("abc"));
- assertTrue(data2 == info.getEventDataByRequestId("def"));
+ assertSame(data1, info.getEventDataByRequestId("abc"));
+ assertSame(data2, info.getEventDataByRequestId("def"));
assertNull(info.getEventDataByRequestId("hello"));
}
@@ -86,14 +86,14 @@ public class EventTrackInfoTest {
assertEquals(2, info.getEventInfo().size());
// look-up by request id
- assertTrue(data1 == info.getEventDataByRequestId("abc"));
- assertTrue(data2 == info.getEventDataByRequestId("def"));
+ assertSame(data1, info.getEventDataByRequestId("abc"));
+ assertSame(data2, info.getEventDataByRequestId("def"));
// doesn't replace existing value
info.storeEventData(new EventData("abc", iend, istart));
assertEquals(2, info.getEventInfo().size());
- assertTrue(data1 == info.getEventDataByRequestId("abc"));
- assertTrue(data2 == info.getEventDataByRequestId("def"));
+ assertSame(data1, info.getEventDataByRequestId("abc"));
+ assertSame(data2, info.getEventDataByRequestId("def"));
}
/**
@@ -111,7 +111,7 @@ public class EventTrackInfoTest {
// look-up by request id
assertNull(info.getEventDataByRequestId("abc"));
- assertTrue(data2 == info.getEventDataByRequestId("def"));
+ assertSame(data2, info.getEventDataByRequestId("def"));
}
/**
@@ -123,8 +123,8 @@ public class EventTrackInfoTest {
info.storeEventData(data2);
assertEquals(2, info.getEventInfo().size());
- assertTrue(data1 == info.getEventInfo().get("abc"));
- assertTrue(data2 == info.getEventInfo().get("def"));
+ assertSame(data1, info.getEventInfo().get("abc"));
+ assertSame(data2, info.getEventInfo().get("def"));
}
}
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/PolicyLoggerTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/PolicyLoggerTest.java
index adb7d366..8688ea3d 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/eelf/PolicyLoggerTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/eelf/PolicyLoggerTest.java
@@ -37,7 +37,6 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
import static org.onap.policy.common.logging.eelf.OnapConfigProperties.PARTNER_NAME;
import static org.onap.policy.common.logging.eelf.OnapConfigProperties.RESPONSE_CODE;
import static org.onap.policy.common.logging.eelf.OnapConfigProperties.RESPONSE_DESCRIPTION;
@@ -46,11 +45,9 @@ import static org.onap.policy.common.logging.eelf.OnapConfigProperties.STATUS_CO
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFLogger.Level;
-
import java.time.Instant;
import java.util.Properties;
import java.util.UUID;
-
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/FlexLoggerTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/FlexLoggerTest.java
index f43c85df..f5fcefe6 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/FlexLoggerTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/FlexLoggerTest.java
@@ -52,15 +52,15 @@ public class FlexLoggerTest {
@Test
public void testGetLoggerStringEelf() {
Whitebox.setInternalState(FlexLogger.class, "loggerType", LoggerType.EELF);
- Logger logger = FlexLogger.getLogger("str1");
- assertSame(logger, FlexLogger.getLogger("str1"));
+ Logger logger = FlexLogger.getLogger();
+ assertSame(logger, FlexLogger.getLogger());
}
@Test
public void testGetLoggerStringSystemOut() {
Whitebox.setInternalState(FlexLogger.class, "loggerType", LoggerType.SYSTEMOUT);
- Logger logger = FlexLogger.getLogger("str1");
- assertSame(logger, FlexLogger.getLogger("str1"));
+ Logger logger = FlexLogger.getLogger();
+ assertSame(logger, FlexLogger.getLogger());
}
@Test
@@ -80,15 +80,15 @@ public class FlexLoggerTest {
@Test
public void testGetLoggerStringBooleanEelf() {
Whitebox.setInternalState(FlexLogger.class, "loggerType", LoggerType.EELF);
- Logger logger = FlexLogger.getLogger("str1", true);
- assertSame(logger, FlexLogger.getLogger("str1", true));
+ Logger logger = FlexLogger.getLogger(true);
+ assertSame(logger, FlexLogger.getLogger(true));
}
@Test
public void testGetLoggerStringBooleanSystemOut() {
Whitebox.setInternalState(FlexLogger.class, "loggerType", LoggerType.SYSTEMOUT);
- Logger logger = FlexLogger.getLogger("str1", true);
- assertSame(logger, FlexLogger.getLogger("str1", true));
+ Logger logger = FlexLogger.getLogger(true);
+ assertSame(logger, FlexLogger.getLogger(true));
}
@Test
diff --git a/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/SystemOutLoggerTest.java b/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/SystemOutLoggerTest.java
index cde423f5..38c9e0d2 100644
--- a/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/SystemOutLoggerTest.java
+++ b/common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/SystemOutLoggerTest.java
@@ -27,11 +27,9 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import com.att.eelf.configuration.EELFLogger.Level;
-
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.UUID;
-
import org.junit.Test;
import org.onap.policy.common.logging.eelf.MessageCodes;
import org.onap.policy.common.logging.eelf.PolicyLogger;
diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/ExceptionTest.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/ExceptionTest.java
index b874db69..48d2f4b5 100644
--- a/common-parameters/src/test/java/org/onap/policy/common/parameters/ExceptionTest.java
+++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/ExceptionTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications 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.
@@ -24,7 +24,6 @@ package org.onap.policy.common.parameters;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
-
import org.junit.Test;
public class ExceptionTest {
diff --git a/gson/src/main/java/org/onap/policy/common/gson/internal/Adapter.java b/gson/src/main/java/org/onap/policy/common/gson/internal/Adapter.java
index 39ec6bd0..64a51d0b 100644
--- a/gson/src/main/java/org/onap/policy/common/gson/internal/Adapter.java
+++ b/gson/src/main/java/org/onap/policy/common/gson/internal/Adapter.java
@@ -127,8 +127,8 @@ public class Adapter {
ConvInfo wtr = writer;
- @SuppressWarnings("rawtypes")
- TypeAdapter conv = (wtr.clazz == clazz ? wtr.getConverter() : gson.getAdapter(clazz));
+ TypeAdapter<Object> conv =
+ (wtr.clazz == clazz ? wtr.getConverter() : (TypeAdapter<Object>) gson.getAdapter(clazz));
return conv.toJsonTree(object);
}
@@ -316,36 +316,33 @@ public class Adapter {
/**
* Type on which the converter works.
*/
- @SuppressWarnings("rawtypes")
- private TypeToken type;
+ private TypeToken<?> type;
/**
* Class of object on which the converter works.
*/
- @SuppressWarnings("rawtypes")
- private Class clazz;
+ private Class<?> clazz;
/**
* Converter to use, initialized lazily.
*/
- @SuppressWarnings("rawtypes")
- private TypeAdapter conv = null;
+ private TypeAdapter<Object> conv = null;
/**
* Constructs the object.
*
* @param type type of object to be converted
*/
- public ConvInfo(@SuppressWarnings("rawtypes") TypeToken type) {
+ public ConvInfo(TypeToken<?> type) {
this.type = type;
this.clazz = type.getRawType();
}
- @SuppressWarnings({"rawtypes", "unchecked"})
- public final TypeAdapter getConverter() {
+ @SuppressWarnings("unchecked")
+ public final TypeAdapter<Object> getConverter() {
if (conv == null) {
// race condition here, but it's ok to overwrite a previous value
- this.conv = gson.getAdapter(type);
+ this.conv = (TypeAdapter<Object>) gson.getAdapter(type);
}
return conv;
diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java
index 80177b30..28e8e387 100644
--- a/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java
+++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Audit
* ================================================================================
- * 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.
@@ -48,7 +48,7 @@ import org.onap.policy.common.logging.flexlogger.Logger;
*
*/
public class DbDao {
- private static final Logger logger = FlexLogger.getLogger(DbDao.class.getName());
+ private static final Logger logger = FlexLogger.getLogger();
private String resourceName;
private String persistenceUnit;
@@ -505,17 +505,16 @@ public class DbDao {
// if IntegrityAuditEntity entry exists for resourceName and PU, update it. If not
// found, create a new entry
- Query iaequery = em.createQuery(SELECT_STRING);
+ TypedQuery<IntegrityAuditEntity> iaequery = em.createQuery(SELECT_STRING, IntegrityAuditEntity.class);
iaequery.setParameter("rn", resourceName);
iaequery.setParameter("pu", persistenceUnit);
- @SuppressWarnings("rawtypes")
- List iaeList = iaequery.getResultList();
+ List<IntegrityAuditEntity> iaeList = iaequery.getResultList();
IntegrityAuditEntity iae;
if (!iaeList.isEmpty()) {
// ignores multiple results
- iae = (IntegrityAuditEntity) iaeList.get(0);
+ iae = iaeList.get(0);
} else {
// If it does not exist
diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java
index c1046828..a1d2116f 100644
--- a/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java
+++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/jpa/IntegrityAuditEntity.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* Integrity Audit
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018, 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,7 +24,6 @@ import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Date;
-
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditCompareEntriesTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditCompareEntriesTest.java
index 99cf4b2a..ad154d33 100644
--- a/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditCompareEntriesTest.java
+++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditCompareEntriesTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Audit
* ================================================================================
- * 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.
@@ -30,12 +30,10 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
-
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
import org.onap.policy.common.ia.jpa.IaTestEntity;
import org.onap.policy.common.ia.jpa.IntegrityAuditEntity;
@@ -419,7 +417,6 @@ public class DbAuditCompareEntriesTest extends IntegrityAuditTestBase {
/*
* Tests that comparison algorithm works for each entity in the database
*/
- @Ignore
@Test
public void testCompareAllDbEntities() throws Exception {
logger.info("testCompareAllDbEntities: Entering");
diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditTest.java
index 220b0635..4728fe84 100644
--- a/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditTest.java
+++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Audit
* ================================================================================
- * 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.
@@ -26,11 +26,9 @@ import static org.junit.Assert.assertFalse;
import java.util.List;
import java.util.Properties;
-
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
-
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/DbDaoTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/DbDaoTest.java
index ef21e831..79dfeb18 100644
--- a/integrity-audit/src/test/java/org/onap/policy/common/ia/DbDaoTest.java
+++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/DbDaoTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Audit
* ================================================================================
- * 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.
@@ -25,26 +25,18 @@ import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-/*
- * All JUnits are designed to run in the local development environment
- * where they have write privileges and can execute time-sensitive
- * tasks.
- */
-
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
-
import javax.persistence.PersistenceUnitUtil;
import javax.persistence.Query;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
-
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/DefaultLoggingPatternTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/DefaultLoggingPatternTest.java
index fda7e4a2..5944443e 100644
--- a/integrity-audit/src/test/java/org/onap/policy/common/ia/DefaultLoggingPatternTest.java
+++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/DefaultLoggingPatternTest.java
@@ -25,7 +25,6 @@ import static org.assertj.core.api.Assertions.assertThat;
import java.io.File;
import java.io.IOException;
-
import org.junit.AfterClass;
import org.junit.Test;
import org.onap.policy.common.utils.resources.TextFileUtils;
diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditTest.java
index c9ff6854..9550017e 100644
--- a/integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditTest.java
+++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Audit
* ================================================================================
- * 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.
@@ -21,10 +21,10 @@
package org.onap.policy.common.ia;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import java.util.Properties;
-
import org.junit.Test;
public class IntegrityAuditTest {
@@ -41,7 +41,7 @@ public class IntegrityAuditTest {
StringBuilder badParams = new StringBuilder();
IntegrityAudit.parmsAreBad(null, SOMETHING, null, badParams);
- assertFalse("".equals(badParams.toString()));
+ assertNotEquals("", badParams.toString());
assertTrue(badParams.toString().contains(RESOURCE_NAME));
assertTrue(badParams.toString().contains(PROPERTIES));
@@ -51,14 +51,14 @@ public class IntegrityAuditTest {
props.put(IntegrityAuditProperties.DB_DRIVER, "test_db_driver");
IntegrityAudit.parmsAreBad(null, SOMETHING, props, badParams);
- assertFalse("".equals(badParams.toString()));
+ assertNotEquals("", badParams.toString());
assertTrue(badParams.toString().contains(RESOURCE_NAME));
assertFalse(badParams.toString().contains(PROPERTIES));
// Try with 0 null params
badParams = new StringBuilder();
IntegrityAudit.parmsAreBad("someting", SOMETHING, props, badParams);
- assertFalse("".equals(badParams.toString()));
+ assertNotEquals("", badParams.toString());
assertFalse(badParams.toString().contains(RESOURCE_NAME));
assertFalse(badParams.toString().contains(PROPERTIES));
@@ -66,7 +66,7 @@ public class IntegrityAuditTest {
props.put(IntegrityAuditProperties.NODE_TYPE, "bogus");
badParams = new StringBuilder();
IntegrityAudit.parmsAreBad("someting", SOMETHING, props, badParams);
- assertFalse("".equals(badParams.toString()));
+ assertNotEquals("", badParams.toString());
assertTrue(badParams.toString().contains("nodeType"));
}
diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/jpa/IaTestEntity.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/jpa/IaTestEntity.java
index 4a4824c5..2ca83050 100644
--- a/integrity-audit/src/test/java/org/onap/policy/common/ia/jpa/IaTestEntity.java
+++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/jpa/IaTestEntity.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Integrity Audit
* ================================================================================
- * 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.
@@ -22,7 +22,6 @@ package org.onap.policy.common.ia.jpa;
import java.io.Serializable;
import java.util.Date;
-
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java
index d12a9bde..33c51e21 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java
@@ -43,6 +43,7 @@ import javax.persistence.FlushModeType;
import javax.persistence.LockModeType;
import javax.persistence.Persistence;
import javax.persistence.Query;
+import javax.persistence.TypedQuery;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.persistence.config.PersistenceUnitProperties;
import org.onap.policy.common.im.jmx.ComponentAdmin;
@@ -287,15 +288,15 @@ public class IntegrityMonitor {
}
protected void createOrUpdateForwardProgress(String resourceName) {
- Query fquery = em.createQuery(QUERY_STRING);
+ TypedQuery<ForwardProgressEntity> fquery = em.createQuery(QUERY_STRING, ForwardProgressEntity.class);
fquery.setParameter("rn", resourceName);
- @SuppressWarnings("rawtypes")
- List fpList = fquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+ List<ForwardProgressEntity> fpList =
+ fquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
ForwardProgressEntity fpx = null;
if (!fpList.isEmpty()) {
// ignores multiple results
- fpx = (ForwardProgressEntity) fpList.get(0);
+ fpx = fpList.get(0);
// refresh the object from DB in case cached data was returned
em.refresh(fpx);
if (logger.isDebugEnabled()) {
@@ -318,15 +319,17 @@ public class IntegrityMonitor {
}
protected void createOrUpdateResourceReg(String resourceName, String jmxUrl, EntityTransaction et) {
- Query rquery = em.createQuery("Select r from ResourceRegistrationEntity r where r.resourceName=:rn");
+ TypedQuery<ResourceRegistrationEntity> rquery =
+ em.createQuery("Select r from ResourceRegistrationEntity r where r.resourceName=:rn",
+ ResourceRegistrationEntity.class);
rquery.setParameter("rn", resourceName);
- @SuppressWarnings("rawtypes")
- List rrList = rquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+ List<ResourceRegistrationEntity> rrList =
+ rquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
ResourceRegistrationEntity rrx = null;
if (!rrList.isEmpty()) {
// ignores multiple results
- rrx = (ResourceRegistrationEntity) rrList.get(0);
+ rrx = rrList.get(0);
// refresh the object from DB in case cached data was returned
em.refresh(rrx);
if (logger.isDebugEnabled()) {
@@ -555,41 +558,44 @@ public class IntegrityMonitor {
AtomicReference<StateManagementEntity> stateManagementEntity = new AtomicReference<>();
String errorMsg =
- withinTransaction(dep + ": ForwardProgressEntity DB operation failed with exception: ", () -> {
- Query query =
- em.createQuery("Select p from ForwardProgressEntity p where p.resourceName=:resource");
- query.setParameter(LC_RESOURCE_STRING, dep);
+ withinTransaction(dep + ": ForwardProgressEntity DB operation failed with exception: ", () -> {
+ TypedQuery<ForwardProgressEntity> query = em.createQuery(
+ "Select p from ForwardProgressEntity p where p.resourceName=:resource",
+ ForwardProgressEntity.class);
+ query.setParameter(LC_RESOURCE_STRING, dep);
- @SuppressWarnings("rawtypes")
- List fpList =
- query.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+ List<ForwardProgressEntity> fpList = query.setLockMode(LockModeType.NONE)
+ .setFlushMode(FlushModeType.COMMIT).getResultList();
- if (!fpList.isEmpty()) {
- // exists
- forwardProgressEntity.set((ForwardProgressEntity) fpList.get(0));
- // refresh the object from DB in case cached data was
- // returned
- em.refresh(forwardProgressEntity.get());
- logger.debug("Found entry in ForwardProgressEntity table for dependent Resource={}", dep);
- return null;
-
- } else {
- return dep + ": resource not found in ForwardProgressEntity database table";
- }
- });
+ if (!fpList.isEmpty()) {
+ // exists
+ forwardProgressEntity.set(fpList.get(0));
+ // refresh the object from DB in case cached data was
+ // returned
+ em.refresh(forwardProgressEntity.get());
+ logger.debug("Found entry in ForwardProgressEntity table for dependent Resource={}",
+ dep);
+ return null;
+
+ } else {
+ return dep + ": resource not found in ForwardProgressEntity database table";
+ }
+ });
if (errorMsg == null) {
errorMsg = withinTransaction(dep + ": StateManagementEntity DB read failed with exception: ", () -> {
// query if StateManagement entry exists for dependent resource
- Query query = em.createQuery("Select p from StateManagementEntity p where p.resourceName=:resource");
+ TypedQuery<StateManagementEntity> query =
+ em.createQuery("Select p from StateManagementEntity p where p.resourceName=:resource",
+ StateManagementEntity.class);
query.setParameter(LC_RESOURCE_STRING, dep);
- @SuppressWarnings("rawtypes")
- List smList = query.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+ List<StateManagementEntity> smList =
+ query.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
if (!smList.isEmpty()) {
// exist
- stateManagementEntity.set((StateManagementEntity) smList.get(0));
+ stateManagementEntity.set(smList.get(0));
// refresh the object from DB in case cached data was
// returned
em.refresh(stateManagementEntity.get());
@@ -713,15 +719,15 @@ public class IntegrityMonitor {
}
private String fpCheck2(String dep) {
- Query fquery = em.createQuery(QUERY_STRING);
+ TypedQuery<ForwardProgressEntity> fquery = em.createQuery(QUERY_STRING, ForwardProgressEntity.class);
fquery.setParameter("rn", dep);
- @SuppressWarnings("rawtypes")
- List fpList = fquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+ List<ForwardProgressEntity> fpList =
+ fquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
ForwardProgressEntity fpx;
if (!fpList.isEmpty()) {
// ignores multiple results
- fpx = (ForwardProgressEntity) fpList.get(0);
+ fpx = fpList.get(0);
// refresh the object from DB in case cached data was returned
em.refresh(fpx);
if (logger.isDebugEnabled()) {
@@ -794,16 +800,18 @@ public class IntegrityMonitor {
private String getJmxUrlFromDb(String dep, AtomicReference<String> jmxUrl) {
// query if ResourceRegistration entry exists for resourceName
- Query rquery = em.createQuery("Select r from ResourceRegistrationEntity r where r.resourceName=:rn");
+ TypedQuery<ResourceRegistrationEntity> rquery =
+ em.createQuery("Select r from ResourceRegistrationEntity r where r.resourceName=:rn",
+ ResourceRegistrationEntity.class);
rquery.setParameter("rn", dep);
- @SuppressWarnings("rawtypes")
- List rrList = rquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+ List<ResourceRegistrationEntity> rrList =
+ rquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
ResourceRegistrationEntity rrx = null;
if (!rrList.isEmpty()) {
// ignores multiple results
- rrx = (ResourceRegistrationEntity) rrList.get(0);
+ rrx = rrList.get(0);
// refresh the object from DB in case cached data was
// returned
em.refresh(rrx);
@@ -1197,15 +1205,15 @@ public class IntegrityMonitor {
try {
// query if ForwardProgress entry exists for resourceName
- Query fquery = em.createQuery(QUERY_STRING);
+ TypedQuery<ForwardProgressEntity> fquery = em.createQuery(QUERY_STRING, ForwardProgressEntity.class);
fquery.setParameter("rn", resourceName);
- @SuppressWarnings("rawtypes")
- List fpList = fquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+ List<ForwardProgressEntity> fpList =
+ fquery.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
ForwardProgressEntity fpx;
if (!fpList.isEmpty()) {
// ignores multiple results
- fpx = (ForwardProgressEntity) fpList.get(0);
+ fpx = fpList.get(0);
// refresh the object from DB in case cached data was returned
em.refresh(fpx);
if (logger.isDebugEnabled()) {
@@ -1544,14 +1552,16 @@ public class IntegrityMonitor {
try {
// query if StateManagement entry exists for fpe resource
- Query query = em.createQuery("Select p from StateManagementEntity p where p.resourceName=:resource");
+ TypedQuery<StateManagementEntity> query =
+ em.createQuery("Select p from StateManagementEntity p where p.resourceName=:resource",
+ StateManagementEntity.class);
query.setParameter(LC_RESOURCE_STRING, fpe.getResourceName());
- @SuppressWarnings("rawtypes")
- List smList = query.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
+ List<StateManagementEntity> smList =
+ query.setLockMode(LockModeType.NONE).setFlushMode(FlushModeType.COMMIT).getResultList();
if (!smList.isEmpty()) {
// exists
- sme = (StateManagementEntity) smList.get(0);
+ sme = smList.get(0);
// refresh the object from DB in case cached data was
// returned
em.refresh(sme);
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdmin.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdmin.java
index bd7ed7b5..cf7a968f 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdmin.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jmx/ComponentAdmin.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018, 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,7 +22,6 @@ package org.onap.policy.common.im.jmx;
import java.util.ArrayList;
import java.util.Iterator;
-
import javax.management.InstanceAlreadyExistsException;
import javax.management.InstanceNotFoundException;
import javax.management.MBeanRegistrationException;
@@ -31,7 +30,6 @@ import javax.management.MBeanServerFactory;
import javax.management.MalformedObjectNameException;
import javax.management.NotCompliantMBeanException;
import javax.management.ObjectName;
-
import org.onap.policy.common.im.IntegrityMonitor;
import org.onap.policy.common.im.IntegrityMonitorException;
import org.onap.policy.common.im.StateManagement;
@@ -54,7 +52,7 @@ public class ComponentAdmin implements ComponentAdminMBean {
/**
* Constructor.
- *
+ *
* @param name the MBean name
* @param integrityMonitor the integrity monitor
* @param stateManager the state manager
@@ -81,7 +79,7 @@ public class ComponentAdmin implements ComponentAdminMBean {
/**
* Registers with the MBean server.
- *
+ *
* @throws ComponentAdminException a JMX exception
*/
public synchronized void register() throws ComponentAdminException {
@@ -114,7 +112,7 @@ public class ComponentAdmin implements ComponentAdminMBean {
/**
* Checks if this MBean is registered with the MBeanServer.
- *
+ *
* @return true if this MBean is registered with the MBeanServer.
*/
public boolean isRegistered() {
@@ -123,7 +121,7 @@ public class ComponentAdmin implements ComponentAdminMBean {
/**
* Unregisters with the MBean server.
- *
+ *
* @throws ComponentAdminException a JMX exception
*/
public synchronized void unregister() throws ComponentAdminException {
@@ -151,7 +149,7 @@ public class ComponentAdmin implements ComponentAdminMBean {
/**
* Finds the MBeanServer.
- *
+ *
* @return the MBeanServer, or null if it is not found
*/
public static MBeanServer findMBeanServer() {
@@ -172,7 +170,7 @@ public class ComponentAdmin implements ComponentAdminMBean {
/**
* Creates the MBeanServer (intended for unit testing only).
- *
+ *
* @return the MBeanServer
*/
public static MBeanServer createMBeanServer() {
@@ -181,7 +179,7 @@ public class ComponentAdmin implements ComponentAdminMBean {
/**
* Get the MBean object name for the specified feature name.
- *
+ *
* @param componentName component name
* @return the object name
* @throws MalformedObjectNameException a JMX exception
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java
index f0ea2c00..0e0c24c6 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ForwardProgressEntity.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018, 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,7 +22,6 @@ package org.onap.policy.common.im.jpa;
import java.io.Serializable;
import java.util.Date;
-
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
@@ -91,7 +90,7 @@ public class ForwardProgressEntity implements Serializable {
/**
* Get the forward progress Id.
- *
+ *
* @return the Id
*/
public long getForwardProgressId() {
@@ -108,7 +107,7 @@ public class ForwardProgressEntity implements Serializable {
/**
* Get the fpcCount.
- *
+ *
* @return the fpcCount
*/
public long getFpcCount() {
@@ -117,7 +116,7 @@ public class ForwardProgressEntity implements Serializable {
/**
* Set the fpcCount.
- *
+ *
* @param fpcCount the fpcCount to set
*/
public void setFpcCount(long fpcCount) {
@@ -126,7 +125,7 @@ public class ForwardProgressEntity implements Serializable {
/**
* Get the lastUpdated.
- *
+ *
* @return the lastUpdated
*/
public Date getLastUpdated() {
@@ -135,7 +134,7 @@ public class ForwardProgressEntity implements Serializable {
/**
* Set the lastUpdated.
- *
+ *
* @param lastUpdated the lastUpdated to set
*/
public void setLastUpdated(Date lastUpdated) {
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java
index 1822578b..6c710f27 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ImTestEntity.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018, 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,7 +22,6 @@ package org.onap.policy.common.im.jpa;
import java.io.Serializable;
import java.util.Date;
-
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
@@ -87,7 +86,7 @@ public class ImTestEntity implements Serializable {
/**
* Get the Im test Id.
- *
+ *
* @return the Id
*/
public long getImTestId() {
@@ -96,7 +95,7 @@ public class ImTestEntity implements Serializable {
/**
* Get the createdBy.
- *
+ *
* @return the createdBy
*/
public String getCreatedBy() {
@@ -105,7 +104,7 @@ public class ImTestEntity implements Serializable {
/**
* Set the createdBy.
- *
+ *
* @param createdBy the createdBy to set
*/
public void setCreatedBy(String createdBy) {
@@ -114,7 +113,7 @@ public class ImTestEntity implements Serializable {
/**
* Get the modifiedBy.
- *
+ *
* @return the modifiedBy
*/
public String getModifiedBy() {
@@ -123,7 +122,7 @@ public class ImTestEntity implements Serializable {
/**
* Set the ModifiedBy.
- *
+ *
* @param modifiedBy the modifiedBy to set
*/
public void setModifiedBy(String modifiedBy) {
@@ -132,7 +131,7 @@ public class ImTestEntity implements Serializable {
/**
* Get the modifiedDate.
- *
+ *
* @return the modifiedDate
*/
public Date getModifiedDate() {
@@ -141,7 +140,7 @@ public class ImTestEntity implements Serializable {
/**
* Set the modifiedDate.
- *
+ *
* @param modifiedDate the modifiedDate to set
*/
public void setModifiedDate(Date modifiedDate) {
@@ -150,7 +149,7 @@ public class ImTestEntity implements Serializable {
/**
* Get the createdDate.
- *
+ *
* @return the createdDate
*/
public Date getCreatedDate() {
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java
index 42e141aa..e23553fa 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/ResourceRegistrationEntity.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* Integrity Monitor
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018, 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,7 +22,6 @@ package org.onap.policy.common.im.jpa;
import java.io.Serializable;
import java.util.Date;
-
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
@@ -99,7 +98,7 @@ public class ResourceRegistrationEntity implements Serializable {
/**
* Get the resource registration Id.
- *
+ *
* @return the Id
*/
public long getResourceRegistrationId() {
@@ -140,7 +139,7 @@ public class ResourceRegistrationEntity implements Serializable {
/**
* Get the createdDate.
- *
+ *
* @return the createdDate
*/
public Date getCreatedDate() {
@@ -149,7 +148,7 @@ public class ResourceRegistrationEntity implements Serializable {
/**
* Get the lastUpdated.
- *
+ *
* @return the lastUpdated
*/
public Date getLastUpdated() {
@@ -158,7 +157,7 @@ public class ResourceRegistrationEntity implements Serializable {
/**
* Set the lastUpdated.
- *
+ *
* @param lastUpdated the lastUpdated to set
*/
public void setLastUpdated(Date lastUpdated) {
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java
index 494931d2..30677814 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/jpa/StateManagementEntity.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.
@@ -22,7 +22,6 @@ package org.onap.policy.common.im.jpa;
import java.io.Serializable;
import java.util.Date;
-
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementEntityTest.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementEntityTest.java
index 3e482ddf..10ab9f3c 100644
--- a/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementEntityTest.java
+++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/StateManagementEntityTest.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.
@@ -23,9 +23,7 @@ package org.onap.policy.common.im;
import static org.junit.Assert.assertEquals;
import java.util.List;
-
import javax.persistence.Query;
-
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
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 dccef6ae..680a73e6 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
@@ -34,7 +34,6 @@ import javax.persistence.EntityTransaction;
import javax.persistence.PersistenceException;
import javax.persistence.QueryTimeoutException;
import javax.persistence.TypedQuery;
-
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/Topic.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/Topic.java
index 96c00c77..6532a198 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/Topic.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/Topic.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,7 +22,6 @@
package org.onap.policy.common.endpoints.event.comm;
import java.util.List;
-
import org.onap.policy.common.capabilities.Lockable;
import org.onap.policy.common.capabilities.Startable;
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineBusTopicSink.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineBusTopicSink.java
index 16669904..00bd9e3a 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineBusTopicSink.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineBusTopicSink.java
@@ -22,7 +22,6 @@
package org.onap.policy.common.endpoints.event.comm.bus.internal;
import java.util.UUID;
-
import org.onap.policy.common.endpoints.event.comm.bus.BusTopicSink;
import org.onap.policy.common.endpoints.utils.NetLoggerUtil;
import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSink.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSink.java
index ba556bb8..a7a692de 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSink.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSink.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,7 +22,6 @@
package org.onap.policy.common.endpoints.event.comm.bus.internal;
import java.util.Map;
-
import org.onap.policy.common.endpoints.event.comm.Topic;
import org.onap.policy.common.endpoints.event.comm.bus.DmaapTopicSink;
import org.slf4j.Logger;
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSource.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSource.java
index d0d25a26..e52204f6 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSource.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedBusTopicSource.java
@@ -24,7 +24,6 @@ package org.onap.policy.common.endpoints.event.comm.bus.internal;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.UUID;
-
import org.onap.policy.common.endpoints.event.comm.FilterableTopicSource;
import org.onap.policy.common.endpoints.event.comm.TopicListener;
import org.onap.policy.common.endpoints.event.comm.bus.BusTopicSource;
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java
index 6ed2e31e..c5f2b5bc 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java
@@ -23,7 +23,6 @@ package org.onap.policy.common.endpoints.event.comm.bus.internal;
import java.net.MalformedURLException;
import java.util.Map;
-
import org.onap.policy.common.endpoints.event.comm.Topic;
import org.onap.policy.common.endpoints.event.comm.bus.DmaapTopicSource;
import org.slf4j.Logger;
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBase.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBase.java
index 6f07df1b..2e0a9a46 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBase.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/TopicBase.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,7 +22,6 @@ package org.onap.policy.common.endpoints.event.comm.bus.internal;
import java.util.ArrayList;
import java.util.List;
-
import org.apache.commons.collections4.queue.CircularFifoQueue;
import org.onap.policy.common.endpoints.event.comm.Topic;
import org.onap.policy.common.endpoints.event.comm.TopicListener;
@@ -76,10 +75,10 @@ public abstract class TopicBase implements Topic {
/**
* Instantiates a new Topic Base.
- *
+ *
* @param servers list of servers
* @param topic topic name
- *
+ *
* @throws IllegalArgumentException if invalid parameters are present
*/
public TopicBase(List<String> servers, String topic) {
@@ -152,7 +151,7 @@ public abstract class TopicBase implements Topic {
/**
* Broadcast event to all listeners.
- *
+ *
* @param message the event
* @return true if all notifications are performed with no error, false otherwise
*/
@@ -173,7 +172,7 @@ public abstract class TopicBase implements Topic {
/**
* Take a snapshot of current topic listeners.
- *
+ *
* @return the topic listeners
*/
protected synchronized List<TopicListener> snapshotTopicListeners() {
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/HttpClient.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/HttpClient.java
index 49874843..8a133155 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/HttpClient.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/HttpClient.java
@@ -26,7 +26,6 @@ import javax.ws.rs.client.Entity;
import javax.ws.rs.client.InvocationCallback;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Response;
-
import org.onap.policy.common.capabilities.Startable;
/**
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/parameters/RestServerParameters.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/parameters/RestServerParameters.java
index 85f1f455..53154b9e 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/parameters/RestServerParameters.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/parameters/RestServerParameters.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 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.
@@ -21,7 +22,6 @@
package org.onap.policy.common.endpoints.parameters;
import lombok.Getter;
-
import org.onap.policy.common.parameters.ParameterGroupImpl;
import org.onap.policy.common.parameters.annotations.Min;
import org.onap.policy.common.parameters.annotations.NotBlank;
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/TopicEndpointProxyTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/TopicEndpointProxyTest.java
index a661b063..e47b2665 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/TopicEndpointProxyTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/TopicEndpointProxyTest.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.
@@ -31,7 +31,6 @@ import static org.junit.Assert.assertTrue;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
-
import org.junit.After;
import org.junit.Test;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/BusTopicFactoryTestBase.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/BusTopicFactoryTestBase.java
index b5c9e614..7a819e0d 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/BusTopicFactoryTestBase.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/BusTopicFactoryTestBase.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* policy-endpoints
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-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.
@@ -25,6 +25,8 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_ALLOW_SELF_SIGNED_CERTIFICATES_SUFFIX;
import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_HTTP_HTTPS_SUFFIX;
@@ -82,7 +84,7 @@ public abstract class BusTopicFactoryTestBase<T extends Topic> extends TopicFact
assertNotNull(item2);
assertEquals(item.getTopic(), item.getEffectiveTopic());
assertNotEquals(item2.getTopic(), item2.getEffectiveTopic());
- assertTrue(item != item2);
+ assertNotSame(item, item2);
// duplicate topics, but since they aren't managed, they should be different
T item3 = buildTopic(makeBuilder().managed(false).build());
@@ -91,9 +93,9 @@ public abstract class BusTopicFactoryTestBase<T extends Topic> extends TopicFact
assertNotNull(item4);
assertEquals(MY_TOPIC, item4.getTopic());
assertEquals(TOPIC2, item4.getEffectiveTopic());
- assertTrue(item != item3);
- assertTrue(item != item4);
- assertTrue(item3 != item4);
+ assertNotSame(item, item3);
+ assertNotSame(item, item4);
+ assertNotSame(item3, item4);
// two managed topics
T item5 = buildTopic(makeBuilder().build());
@@ -102,8 +104,8 @@ public abstract class BusTopicFactoryTestBase<T extends Topic> extends TopicFact
assertNotNull(item6);
// re-build same managed topics - should get exact same objects
- assertTrue(item5 == buildTopic(makeBuilder().topic(MY_TOPIC).build()));
- assertTrue(item6 == buildTopic(makeBuilder().topic(TOPIC2).build()));
+ assertSame(item5, buildTopic(makeBuilder().topic(MY_TOPIC).build()));
+ assertSame(item6, buildTopic(makeBuilder().topic(TOPIC2).build()));
}
/**
@@ -135,11 +137,11 @@ public abstract class BusTopicFactoryTestBase<T extends Topic> extends TopicFact
T item2 = buildTopic(servers, TOPIC2);
assertNotNull(item2);
- assertTrue(item1 != item2);
+ assertNotSame(item1, item2);
// duplicate - should be the same, as these topics are managed
T item3 = buildTopic(servers, TOPIC2);
- assertTrue(item2 == item3);
+ assertSame(item2, item3);
}
/**
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicEndpointTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicEndpointTest.java
index 0974a041..6cdb628a 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicEndpointTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/NoopTopicEndpointTest.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.
@@ -29,7 +29,6 @@ import static org.mockito.Mockito.verify;
import java.util.Arrays;
import java.util.Collections;
-
import org.junit.Before;
import org.junit.Test;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/TopicFactoryTestBase.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/TopicFactoryTestBase.java
index d8a16428..9795fd30 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/TopicFactoryTestBase.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/event/comm/bus/TopicFactoryTestBase.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* policy-endpoints
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-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.
@@ -24,6 +24,8 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX;
@@ -126,9 +128,9 @@ public abstract class TopicFactoryTestBase<T extends Topic> extends TopicTestBas
int index = 0;
T item = lst.get(index++);
- assertTrue(item != lst.get(index++));
- assertTrue(item == lst.get(index++));
- assertTrue(item == lst.get(index++));
+ assertNotSame(item, lst.get(index++));
+ assertSame(item, lst.get(index++));
+ assertSame(item, lst.get(index++));
}
/**
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java
index cbe5a5a5..2ff1d56b 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java
@@ -27,10 +27,10 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.assertj.core.api.Assertions.catchThrowable;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import com.google.gson.Gson;
-
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
@@ -401,13 +401,13 @@ public class HttpServerTest {
assertTrue(HttpServletServerFactoryInstance.getServerFactory().get(port2).isAlive());
String response = http(portUrl + JUNIT_ECHO_HELLO);
- assertTrue(HELLO.equals(response));
+ assertEquals(HELLO, response);
response = http(portUrl + SWAGGER_JSON);
- assertTrue(response != null);
+ assertNotNull(response);
response = http(LOCALHOST_PREFIX + port2 + JUNIT_ECHO_HELLO);
- assertTrue(HELLO.equals(response));
+ assertEquals(HELLO, response);
assertThatThrownBy(() -> http(LOCALHOST_PREFIX + port2 + SWAGGER_JSON)).isInstanceOf(IOException.class);
@@ -429,7 +429,7 @@ public class HttpServerTest {
assertTrue(HttpServletServerFactoryInstance.getServerFactory().get(port).isAlive());
String response = http(portUrl + JUNIT_ECHO_HELLO);
- assertTrue(HELLO.equals(response));
+ assertEquals(HELLO, response);
response = http(portUrl + "/junit/endpoints/http/servers");
assertTrue(response.contains(randomName));
@@ -451,7 +451,7 @@ public class HttpServerTest {
assertTrue(HttpServletServerFactoryInstance.getServerFactory().get(port).isAlive());
String response = http(portUrl + JUNIT_ECHO_HELLO);
- assertTrue(HELLO.equals(response));
+ assertEquals(HELLO, response);
HttpServletServerFactoryInstance.getServerFactory().destroy();
assertTrue(HttpServletServerFactoryInstance.getServerFactory().inventory().isEmpty());
@@ -472,7 +472,7 @@ public class HttpServerTest {
assertTrue(HttpServletServerFactoryInstance.getServerFactory().get(port).isAlive());
String response = http(portUrl + JUNIT_ECHO_HELLO);
- assertTrue(HELLO.equals(response));
+ assertEquals(HELLO, response);
response = http(portUrl + "/junit/endpoints/http/servers");
assertTrue(response.contains(randomName));
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/MyJacksonProvider.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/MyJacksonProvider.java
index 8c4eea5a..cd922eba 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/MyJacksonProvider.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/MyJacksonProvider.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.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -28,10 +28,8 @@ import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
-
import lombok.AccessLevel;
import lombok.Setter;
-
import org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJsonProvider;
/**
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/RestEndpoints.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/RestEndpoints.java
index 6ada15c5..cafab42f 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/RestEndpoints.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/RestEndpoints.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* policy-endpoints
* ================================================================================
- * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 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.
@@ -21,12 +21,10 @@
package org.onap.policy.common.endpoints.http.server.test;
import java.util.List;
-
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
-
import org.onap.policy.common.endpoints.http.server.HttpServletServer;
import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/report/TestHealthCheckReport.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/report/TestHealthCheckReport.java
index ebab616a..36970d74 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/report/TestHealthCheckReport.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/report/TestHealthCheckReport.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * 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.
@@ -27,7 +28,6 @@ import com.openpojo.validation.rule.impl.GetterMustExistRule;
import com.openpojo.validation.rule.impl.SetterMustExistRule;
import com.openpojo.validation.test.impl.GetterTester;
import com.openpojo.validation.test.impl.SetterTester;
-
import org.junit.Test;
import org.onap.policy.common.utils.test.ToStringTester;
diff --git a/utils-test/src/main/java/org/onap/policy/common/utils/test/ThrowablesTester.java b/utils-test/src/main/java/org/onap/policy/common/utils/test/ThrowablesTester.java
index f051a104..fd819b25 100644
--- a/utils-test/src/main/java/org/onap/policy/common/utils/test/ThrowablesTester.java
+++ b/utils-test/src/main/java/org/onap/policy/common/utils/test/ThrowablesTester.java
@@ -27,7 +27,6 @@ import static org.junit.Assert.assertTrue;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/utils-test/src/main/java/org/onap/policy/common/utils/test/ToStringTester.java b/utils-test/src/main/java/org/onap/policy/common/utils/test/ToStringTester.java
index f9ae39ac..18502a35 100644
--- a/utils-test/src/main/java/org/onap/policy/common/utils/test/ToStringTester.java
+++ b/utils-test/src/main/java/org/onap/policy/common/utils/test/ToStringTester.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,7 +29,6 @@ import com.openpojo.reflection.PojoClass;
import com.openpojo.validation.affirm.Affirm;
import com.openpojo.validation.test.Tester;
import com.openpojo.validation.utils.ValidationHelper;
-
import org.hamcrest.Matcher;
diff --git a/utils-test/src/test/java/org/onap/policy/common/utils/test/log/logback/ExtractAppenderTest.java b/utils-test/src/test/java/org/onap/policy/common/utils/test/log/logback/ExtractAppenderTest.java
index 2eb07366..4c2237fc 100644
--- a/utils-test/src/test/java/org/onap/policy/common/utils/test/log/logback/ExtractAppenderTest.java
+++ b/utils-test/src/test/java/org/onap/policy/common/utils/test/log/logback/ExtractAppenderTest.java
@@ -26,13 +26,11 @@ import static org.junit.Assert.assertFalse;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.spi.ILoggingEvent;
-
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
-
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
diff --git a/utils/src/main/java/org/onap/policy/common/utils/resources/ResourceUtils.java b/utils/src/main/java/org/onap/policy/common/utils/resources/ResourceUtils.java
index 58e2baf5..2acc67ac 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/resources/ResourceUtils.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/resources/ResourceUtils.java
@@ -33,7 +33,6 @@ import java.util.Set;
import java.util.TreeSet;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/utils/src/main/java/org/onap/policy/common/utils/services/OrderedServiceImpl.java b/utils/src/main/java/org/onap/policy/common/utils/services/OrderedServiceImpl.java
index bbd30220..7c5c9cbb 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/services/OrderedServiceImpl.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/services/OrderedServiceImpl.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* utils
* ================================================================================
- * 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,18 +24,18 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import java.util.ServiceLoader;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This class is a template for building a sorted list of service instances,
- * which are discovered and created using 'ServiceLoader'.
+ * which are discovered and created using 'ServiceLoader'.
*/
public class OrderedServiceImpl<T extends OrderedService> {
// logger
- private static Logger logger = LoggerFactory.getLogger(OrderedServiceImpl.class);
+ private static Logger logger = LoggerFactory.getLogger(OrderedServiceImpl.class);
// sorted list of instances implementing the service
private List<T> implementers = null;
@@ -44,8 +44,7 @@ public class OrderedServiceImpl<T extends OrderedService> {
private ServiceLoader<T> serviceLoader = null;
// use this to ensure that we only use one unique instance of each class
- @SuppressWarnings("rawtypes")
- private static HashMap<Class,OrderedService> classToSingleton = new HashMap<>();
+ private static Map<Class<?>,OrderedService> classToSingleton = new HashMap<>();
/**
* Constructor - create the 'ServiceLoader' instance.
@@ -60,7 +59,7 @@ public class OrderedServiceImpl<T extends OrderedService> {
/**
* Get List of implementers.
- *
+ *
* @return the sorted list of services implementing interface 'T' discovered
* by 'ServiceLoader'.
*/
diff --git a/utils/src/test/java/org/onap/policy/common/utils/coder/PropertyCoderTest.java b/utils/src/test/java/org/onap/policy/common/utils/coder/PropertyCoderTest.java
index 83017e70..47453dfc 100644
--- a/utils/src/test/java/org/onap/policy/common/utils/coder/PropertyCoderTest.java
+++ b/utils/src/test/java/org/onap/policy/common/utils/coder/PropertyCoderTest.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.
@@ -23,13 +23,10 @@ package org.onap.policy.common.utils.coder;
import static org.junit.Assert.assertEquals;
import com.google.gson.annotations.SerializedName;
-
import java.io.Reader;
import java.io.StringReader;
import java.util.List;
-
import lombok.Getter;
-
import org.junit.Before;
import org.junit.Test;
@@ -102,4 +99,4 @@ public class PropertyCoderTest {
private String port;
private String pass;
}
-} \ No newline at end of file
+}
diff --git a/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityMgrCloserTest.java b/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityMgrCloserTest.java
index 589d0924..b8730a65 100644
--- a/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityMgrCloserTest.java
+++ b/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityMgrCloserTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Common Utils
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-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.
@@ -26,7 +26,6 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import javax.persistence.EntityManager;
-
import org.junit.Before;
import org.junit.Test;
diff --git a/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityMgrFactoryCloserTest.java b/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityMgrFactoryCloserTest.java
index ca2b7220..3981e2af 100644
--- a/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityMgrFactoryCloserTest.java
+++ b/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityMgrFactoryCloserTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Common Utils
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-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.
@@ -26,7 +26,6 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import javax.persistence.EntityManagerFactory;
-
import org.junit.Before;
import org.junit.Test;
diff --git a/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityTransCloserTest.java b/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityTransCloserTest.java
index d764e9d0..3b6e4955 100644
--- a/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityTransCloserTest.java
+++ b/utils/src/test/java/org/onap/policy/common/utils/jpa/EntityTransCloserTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* Common Utils
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-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.
@@ -28,7 +28,6 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import javax.persistence.EntityTransaction;
-
import org.junit.Before;
import org.junit.Test;
diff --git a/utils/src/test/java/org/onap/policy/common/utils/network/NetworkUtilTest.java b/utils/src/test/java/org/onap/policy/common/utils/network/NetworkUtilTest.java
index a0b8353d..4ae72842 100644
--- a/utils/src/test/java/org/onap/policy/common/utils/network/NetworkUtilTest.java
+++ b/utils/src/test/java/org/onap/policy/common/utils/network/NetworkUtilTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* policy-utils
* ================================================================================
- * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-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.
@@ -22,6 +22,7 @@ package org.onap.policy.common.utils.network;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -67,7 +68,7 @@ public class NetworkUtilTest {
public void testAllocPort_testAllocPortString__testAllocPortInetSocketAddress() throws Exception {
// allocate wild-card port
int wildCardPort = NetworkUtil.allocPort();
- assertTrue(wildCardPort != 0);
+ assertNotEquals(0, wildCardPort);
// verify that we can listen on the port
try (ServerSocket wildSocket = new ServerSocket(wildCardPort)) {
@@ -78,10 +79,10 @@ public class NetworkUtilTest {
// allocate port using host name
int localPort = NetworkUtil.allocPort(LOCALHOST);
- assertTrue(localPort != 0);
+ assertNotEquals(0, localPort);
// the OS should have allocated a new port, even though the first has been closed
- assertTrue(localPort != wildCardPort);
+ assertNotEquals(wildCardPort, localPort);
try (ServerSocket localSocket = new ServerSocket()) {
localSocket.bind(new InetSocketAddress(LOCALHOST, localPort));
diff --git a/utils/src/test/java/org/onap/policy/common/utils/resources/ResourceUtilsTest.java b/utils/src/test/java/org/onap/policy/common/utils/resources/ResourceUtilsTest.java
index af98e300..2e122187 100644
--- a/utils/src/test/java/org/onap/policy/common/utils/resources/ResourceUtilsTest.java
+++ b/utils/src/test/java/org/onap/policy/common/utils/resources/ResourceUtilsTest.java
@@ -34,7 +34,6 @@ import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Set;
-
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -234,10 +233,10 @@ public class ResourceUtilsTest {
assertNotNull(theString);
theString = ResourceUtils.getResourceAsString(tmpEmptyFile.getAbsolutePath());
- assertTrue(theString.equals(""));
+ assertEquals("", theString);
theString = ResourceUtils.getResourceAsString(tmpUsedFile.getAbsolutePath());
- assertTrue(theString.equals("Bluebirds fly over the rainbow"));
+ assertEquals("Bluebirds fly over the rainbow", theString);
theString = ResourceUtils.getResourceAsString(jarFileResource);
assertNotNull(theString);
diff --git a/utils/src/test/java/org/onap/policy/common/utils/resources/TextFileUtilsTest.java b/utils/src/test/java/org/onap/policy/common/utils/resources/TextFileUtilsTest.java
index 0952b168..67cdab52 100644
--- a/utils/src/test/java/org/onap/policy/common/utils/resources/TextFileUtilsTest.java
+++ b/utils/src/test/java/org/onap/policy/common/utils/resources/TextFileUtilsTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 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.
@@ -25,7 +26,6 @@ import static org.junit.Assert.assertEquals;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
-
import org.junit.Test;
/**
diff --git a/utils/src/test/java/org/onap/policy/common/utils/validation/VersionTest.java b/utils/src/test/java/org/onap/policy/common/utils/validation/VersionTest.java
index 1a45f9e1..4673233e 100644
--- a/utils/src/test/java/org/onap/policy/common/utils/validation/VersionTest.java
+++ b/utils/src/test/java/org/onap/policy/common/utils/validation/VersionTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP PAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,7 +22,7 @@
package org.onap.policy.common.utils.validation;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
@@ -48,7 +48,7 @@ public class VersionTest {
public void testHashCode() {
int hash = vers.hashCode();
int hash2 = new Version(MAJOR, MINOR, PATCH + 1).hashCode();
- assertTrue(hash != hash2);
+ assertNotEquals(hash, hash2);
}
@Test
@@ -72,16 +72,16 @@ public class VersionTest {
@Test
public void testEquals() {
- assertFalse(vers.equals(null));
- assertFalse(vers.equals(new Object()));
+ assertNotEquals(vers, null);
+ assertNotEquals(vers, new Object());
- assertTrue(vers.equals(vers));
+ assertEquals(vers, vers);
- assertTrue(vers.equals(new Version(MAJOR, MINOR, PATCH)));
+ assertEquals(vers, new Version(MAJOR, MINOR, PATCH));
- assertFalse(vers.equals(new Version(MAJOR + 1, MINOR, PATCH)));
- assertFalse(vers.equals(new Version(MAJOR, MINOR + 1, PATCH)));
- assertFalse(vers.equals(new Version(MAJOR, MINOR, PATCH + 1)));
+ assertNotEquals(vers, new Version(MAJOR + 1, MINOR, PATCH));
+ assertNotEquals(vers, new Version(MAJOR, MINOR + 1, PATCH));
+ assertNotEquals(vers, new Version(MAJOR, MINOR, PATCH + 1));
}
@Test
@@ -89,7 +89,7 @@ public class VersionTest {
vers = new Version(101, 201, 301);
// equals case
- assertTrue(new Version(101, 201, 301).compareTo(vers) == 0);
+ assertEquals(0, new Version(101, 201, 301).compareTo(vers));
// major takes precedence
assertTrue(new Version(102, 200, 300).compareTo(vers) > 0);
@@ -139,4 +139,4 @@ public class VersionTest {
public void testVersion() {
assertEquals("0.0.0", new Version().toString());
}
-} \ No newline at end of file
+}