aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/rules-test/src/main
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2023-01-31 10:44:54 +0000
committerliamfallon <liam.fallon@est.tech>2023-01-31 12:56:17 +0000
commit0d52472a24ba317d6c96fcd215c7f2a2b6bd43f8 (patch)
treea4a5f06ba1ab41033f7cca9cc160333d87f20247 /controlloop/common/rules-test/src/main
parent6895f4d2004cf3ccb94d9d7bbb0928db50dae39a (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: I8f3eeba7bd476c2b8e74a6a6a9d1f53b4c5304c3 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'controlloop/common/rules-test/src/main')
-rw-r--r--controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseTest.java8
-rw-r--r--controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/DroolsRuleTest.java3
2 files changed, 7 insertions, 4 deletions
diff --git a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseTest.java b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseTest.java
index 044fa8121..f36a3780b 100644
--- a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseTest.java
+++ b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2020-2022 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.
@@ -50,7 +51,7 @@ import org.onap.policy.drools.system.internal.SimpleLockManager;
import org.onap.policy.drools.system.internal.SimpleLockManager.SimpleLock;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
import org.onap.policy.sdnr.PciMessage;
-import org.powermock.reflect.Whitebox;
+import org.springframework.test.util.ReflectionTestUtils;
/**
* Superclass used for rule tests.
@@ -766,10 +767,11 @@ public abstract class BaseTest {
}
}
+ @SuppressWarnings("unchecked")
private Map<String, SimpleLock> getLockMap() {
- Object lockMgr = Whitebox.getInternalState(PolicyEngineConstants.getManager(), "lockManager");
+ Object lockMgr = ReflectionTestUtils.getField(PolicyEngineConstants.getManager(), "lockManager");
if (lockMgr instanceof SimpleLockManager) {
- return Whitebox.getInternalState(lockMgr, "resource2lock");
+ return (Map<String, SimpleLock>) ReflectionTestUtils.getField(lockMgr, "resource2lock");
}
return Collections.emptyMap();
diff --git a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/DroolsRuleTest.java b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/DroolsRuleTest.java
index 449096223..97bbeeadf 100644
--- a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/DroolsRuleTest.java
+++ b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/DroolsRuleTest.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2020, 2022 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.
@@ -31,7 +32,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
public abstract class DroolsRuleTest extends BaseTest {
// these may be overridden by junit tests
- private static final Function<String, Rules> ruleMaker = Rules::new;
+ private static Function<String, Rules> ruleMaker = Rules::new;
protected static Rules rules;