aboutsummaryrefslogtreecommitdiffstats
path: root/models-sim
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2023-01-31 10:41:01 +0000
committerliamfallon <liam.fallon@est.tech>2023-01-31 12:12:05 +0000
commite3938e43b8a1f02f74368ecb75c38530285feac0 (patch)
tree02a042ca672a935fce40fe81120bfffd13cec10f /models-sim
parent8cf623781404f98aeacfc44e1bc8a7f1bf8446ad (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: Ie8d6ee1e8bcdad282bcef3cad409c5c109e907f1 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'models-sim')
-rw-r--r--models-sim/models-sim-dmaap/pom.xml11
-rw-r--r--models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/provider/TopicDataTest.java5
-rw-r--r--models-sim/policy-models-sim-pdp/pom.xml4
-rw-r--r--models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/TestPdpSimulatorConstants.java11
-rw-r--r--models-sim/policy-models-simulators/pom.xml5
5 files changed, 24 insertions, 12 deletions
diff --git a/models-sim/models-sim-dmaap/pom.xml b/models-sim/models-sim-dmaap/pom.xml
index 5c322c31f..36ea7752f 100644
--- a/models-sim/models-sim-dmaap/pom.xml
+++ b/models-sim/models-sim-dmaap/pom.xml
@@ -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. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
@@ -64,8 +64,13 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/provider/TopicDataTest.java b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/provider/TopicDataTest.java
index b731a6fce..f37255acf 100644
--- a/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/provider/TopicDataTest.java
+++ b/models-sim/models-sim-dmaap/src/test/java/org/onap/policy/models/sim/dmaap/provider/TopicDataTest.java
@@ -3,6 +3,7 @@
* ONAP Policy Models
* ================================================================================
* 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.
@@ -45,7 +46,7 @@ import org.junit.Test;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
-import org.powermock.reflect.Whitebox;
+import org.springframework.test.util.ReflectionTestUtils;
public class TopicDataTest {
private static final String EXPECTED_EXCEPTION = "expected exception";
@@ -208,6 +209,6 @@ public class TopicDataTest {
*/
@SuppressWarnings("unchecked")
private Map<String, ConsumerGroupData> getGroups() {
- return (Map<String, ConsumerGroupData>) Whitebox.getInternalState(data, "group2data");
+ return (Map<String, ConsumerGroupData>) ReflectionTestUtils.getField(data, "group2data");
}
}
diff --git a/models-sim/policy-models-sim-pdp/pom.xml b/models-sim/policy-models-sim-pdp/pom.xml
index a18f6f8ef..6f507170b 100644
--- a/models-sim/policy-models-sim-pdp/pom.xml
+++ b/models-sim/policy-models-sim-pdp/pom.xml
@@ -45,8 +45,8 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/TestPdpSimulatorConstants.java b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/TestPdpSimulatorConstants.java
index 491664498..10d7d9f68 100644
--- a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/TestPdpSimulatorConstants.java
+++ b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/TestPdpSimulatorConstants.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019,2023 Nordix Foundation.
* Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,8 +23,8 @@ package org.onap.policy.models.sim.pdp;
import static org.assertj.core.api.Assertions.assertThatCode;
+import java.lang.reflect.Constructor;
import org.junit.Test;
-import org.powermock.reflect.Whitebox;
/**
* Class to perform unit test of {@link PdpSimulatorConstants}}.
@@ -35,6 +35,11 @@ public class TestPdpSimulatorConstants {
@Test
public void test() throws Exception {
// verify that constructor does not throw an exception
- assertThatCode(() -> Whitebox.invokeConstructor(PdpSimulatorConstants.class)).doesNotThrowAnyException();
+ assertThatCode(() -> {
+ Constructor<PdpSimulatorConstants> c = PdpSimulatorConstants.class.getDeclaredConstructor();
+ c.setAccessible(true);
+ c.newInstance();
+ }
+ ).doesNotThrowAnyException();
}
}
diff --git a/models-sim/policy-models-simulators/pom.xml b/models-sim/policy-models-simulators/pom.xml
index 24b907071..609aae2a8 100644
--- a/models-sim/policy-models-simulators/pom.xml
+++ b/models-sim/policy-models-simulators/pom.xml
@@ -3,6 +3,7 @@
ONAP
================================================================================
Copyright (C) 2020-2021 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.
@@ -47,8 +48,8 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>