diff options
author | liamfallon <liam.fallon@est.tech> | 2023-01-31 10:42:20 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2023-01-31 12:25:52 +0000 |
commit | 6763c4b787593fa0a11668971ba2cb5cc87ad4c5 (patch) | |
tree | d146a1268f7168ed37e69de71f0b433f7a924031 /main/src/test/java/org/onap/policy/pap/main/rest/CommonPapRestServer.java | |
parent | 1b5c2ceafbe9b62e6c697db63f36d2b965402067 (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: Ifcabd73e4130810ba2a99b842ffa4203836c0682
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'main/src/test/java/org/onap/policy/pap/main/rest/CommonPapRestServer.java')
-rw-r--r-- | main/src/test/java/org/onap/policy/pap/main/rest/CommonPapRestServer.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/main/src/test/java/org/onap/policy/pap/main/rest/CommonPapRestServer.java b/main/src/test/java/org/onap/policy/pap/main/rest/CommonPapRestServer.java index 96e36df1..ca81ab7d 100644 --- a/main/src/test/java/org/onap/policy/pap/main/rest/CommonPapRestServer.java +++ b/main/src/test/java/org/onap/policy/pap/main/rest/CommonPapRestServer.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019,2023 Nordix Foundation. * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. * Modifications Copyright (C) 2021-2022 Bell Canada. All rights reserved. * ================================================================================ @@ -55,14 +55,14 @@ import org.onap.policy.pap.main.PapConstants; import org.onap.policy.pap.main.PolicyPapApplication; import org.onap.policy.pap.main.parameters.CommonTestData; import org.onap.policy.pap.main.startstop.PapActivator; -import org.powermock.reflect.Whitebox; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext.ClassMode; import org.springframework.test.context.DynamicPropertyRegistry; import org.springframework.test.context.DynamicPropertySource; import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.util.ReflectionTestUtils; /** * Class to perform unit test of {@link PapRestControllerV1}. @@ -174,8 +174,8 @@ public abstract class CommonPapRestServer { } private void markActivator(boolean wasAlive) { - Object manager = Whitebox.getInternalState(papActivator, "serviceManager"); - AtomicBoolean running = Whitebox.getInternalState(manager, "running"); + Object manager = ReflectionTestUtils.getField(papActivator, "serviceManager"); + AtomicBoolean running = (AtomicBoolean) ReflectionTestUtils.getField(manager, "running"); running.set(wasAlive); } |