diff options
author | liamfallon <liam.fallon@est.tech> | 2023-01-31 10:39:50 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2023-01-31 11:16:31 +0000 |
commit | 987b9f7a030a2389216c998225abb2602ef2dba3 (patch) | |
tree | c3973249317b67b1a258a765703730d8421a8a62 /common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/FlexLoggerTest.java | |
parent | 6c4fc8693221990eca8000d07c208749c635a769 (diff) |
Upgrade and clean up dependencies
- Upgrade Hibernate
- Upgrade Mockito
- Upgrade Mockserver
- Remove Powermock (no longer supported) and replace with spring-test ReflectionTestUtils
- Upgrade Spring Framework
- Add spring-security to allow authentication on unit tests using MockMVC
Minor clean-up
- Replace deprecated authorization configuraiton on spring boot applications with SecurityFilterChain bean
- Change @LocalPort include on tests to use test include rather than runtime include
- Remove unused imports
- Remove unused constants and variables
- Add deprecation annotations where required
Issue-ID: POLICY-4482
Change-Id: Iec5ba1283acd506c9f3c7fe7b5d7858db6abbaa7
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/FlexLoggerTest.java')
-rw-r--r-- | common-logging/src/test/java/org/onap/policy/common/logging/flexlogger/FlexLoggerTest.java | 19 |
1 files changed, 10 insertions, 9 deletions
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 f5fcefe6..c0194f2b 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 @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2023 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,13 +31,13 @@ import java.util.HashSet; import java.util.Set; import org.junit.Test; import org.onap.policy.common.logging.flexlogger.FlexLogger.PropertiesCallBack; -import org.powermock.reflect.Whitebox; +import org.springframework.test.util.ReflectionTestUtils; public class FlexLoggerTest { @Test public void testGetLoggerClassOfQEelf() { - Whitebox.setInternalState(FlexLogger.class, "loggerType", LoggerType.EELF); + ReflectionTestUtils.setField(FlexLogger.class, "loggerType", LoggerType.EELF); Logger logger = FlexLogger.getLogger((Class<?>) null); assertSame(logger, FlexLogger.getLogger((Class<?>) null)); assertNotEquals(logger, FlexLogger.getLogger(String.class)); @@ -44,49 +45,49 @@ public class FlexLoggerTest { @Test public void testGetLoggerClassOfQSystemOut() { - Whitebox.setInternalState(FlexLogger.class, "loggerType", LoggerType.SYSTEMOUT); + ReflectionTestUtils.setField(FlexLogger.class, "loggerType", LoggerType.SYSTEMOUT); Logger logger = FlexLogger.getLogger(this.getClass()); assertSame(logger, FlexLogger.getLogger(this.getClass())); } @Test public void testGetLoggerStringEelf() { - Whitebox.setInternalState(FlexLogger.class, "loggerType", LoggerType.EELF); + ReflectionTestUtils.setField(FlexLogger.class, "loggerType", LoggerType.EELF); Logger logger = FlexLogger.getLogger(); assertSame(logger, FlexLogger.getLogger()); } @Test public void testGetLoggerStringSystemOut() { - Whitebox.setInternalState(FlexLogger.class, "loggerType", LoggerType.SYSTEMOUT); + ReflectionTestUtils.setField(FlexLogger.class, "loggerType", LoggerType.SYSTEMOUT); Logger logger = FlexLogger.getLogger(); assertSame(logger, FlexLogger.getLogger()); } @Test public void testGetLoggerClassOfQBooleanEelf() { - Whitebox.setInternalState(FlexLogger.class, "loggerType", LoggerType.EELF); + ReflectionTestUtils.setField(FlexLogger.class, "loggerType", LoggerType.EELF); Logger logger = FlexLogger.getLogger(this.getClass(), true); assertSame(logger, FlexLogger.getLogger(this.getClass(), true)); } @Test public void testGetLoggerClassOfQBooleanSystemOut() { - Whitebox.setInternalState(FlexLogger.class, "loggerType", LoggerType.SYSTEMOUT); + ReflectionTestUtils.setField(FlexLogger.class, "loggerType", LoggerType.SYSTEMOUT); Logger logger = FlexLogger.getLogger(this.getClass(), true); assertSame(logger, FlexLogger.getLogger(this.getClass(), true)); } @Test public void testGetLoggerStringBooleanEelf() { - Whitebox.setInternalState(FlexLogger.class, "loggerType", LoggerType.EELF); + ReflectionTestUtils.setField(FlexLogger.class, "loggerType", LoggerType.EELF); Logger logger = FlexLogger.getLogger(true); assertSame(logger, FlexLogger.getLogger(true)); } @Test public void testGetLoggerStringBooleanSystemOut() { - Whitebox.setInternalState(FlexLogger.class, "loggerType", LoggerType.SYSTEMOUT); + ReflectionTestUtils.setField(FlexLogger.class, "loggerType", LoggerType.SYSTEMOUT); Logger logger = FlexLogger.getLogger(true); assertSame(logger, FlexLogger.getLogger(true)); } |