summaryrefslogtreecommitdiffstats
path: root/aai-resources
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2022-10-10 14:30:01 +0000
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2022-10-10 14:30:01 +0000
commitaa4d8afd0d10c79a0605bc9402da2dc7f838f8ee (patch)
tree1778a57bda3d8bac57cb19edeaca30fb68389d58 /aai-resources
parentf80844c59b994da133af38b66b3403d3231553e3 (diff)
Migrate Mockito 1 to version 2 in the resources service
- update mockito to version 2.4.0 - update eelf-core since it has a compile time dependency to mockito 1.10.19 in version 1 Issue-ID: AAI-3546 Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de> Change-Id: I6ba724fe26b57e9a468bdeb89cadaa6f51e68634
Diffstat (limited to 'aai-resources')
-rw-r--r--aai-resources/.classpath52
-rw-r--r--aai-resources/pom.xml10
-rw-r--r--aai-resources/src/test/java/org/onap/aai/HttpTestUtil.java29
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/BulkProcessorTestAbstraction.java6
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/ExampleConsumerTest.java31
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java43
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java32
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java32
-rw-r--r--aai-resources/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java11
9 files changed, 170 insertions, 76 deletions
diff --git a/aai-resources/.classpath b/aai-resources/.classpath
index 9dedccc..e89215e 100644
--- a/aai-resources/.classpath
+++ b/aai-resources/.classpath
@@ -1,12 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="src/main/resources"/>
- <classpathentry kind="src" path="src/test/resources"/>
- <classpathentry kind="src" path="src/test/java"/>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ <attribute name="test" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ <attribute name="test" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
- <attribute name="owner.project.facets" value="java"/>
+ <attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
@@ -14,5 +34,27 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
+ <classpathentry kind="src" path="target/generated-sources/annotations">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ <attribute name="ignore_optional_problems" value="true"/>
+ <attribute name="m2e-apt" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/docker">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ <attribute name="ignore_optional_problems" value="true"/>
+ <attribute name="m2e-apt" value="true"/>
+ <attribute name="test" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
diff --git a/aai-resources/pom.xml b/aai-resources/pom.xml
index 3b29f25..0e3a979 100644
--- a/aai-resources/pom.xml
+++ b/aai-resources/pom.xml
@@ -87,6 +87,7 @@
<micrometer-registry-prometheus.version>1.6.6</micrometer-registry-prometheus.version>
<micrometer-jersey2>1.6.6</micrometer-jersey2>
<testcontainers.version>1.6.1</testcontainers.version>
+ <mockito.core.version>2.4.0</mockito.core.version>
<!-- Setting some default value to not complain by editor but it will be overridden by gmaven plugin -->
<!-- Integration tests will be skipped by default. Could be enabled here or by -DskipITs=false-->
@@ -414,6 +415,7 @@
<dependency>
<groupId>com.att.eelf</groupId>
<artifactId>eelf-core</artifactId>
+ <version>2.0.0-oss</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
@@ -459,14 +461,10 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
+ <version>${mockito.core.version}</version>
<scope>test</scope>
- </dependency>
+ </dependency>
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
diff --git a/aai-resources/src/test/java/org/onap/aai/HttpTestUtil.java b/aai-resources/src/test/java/org/onap/aai/HttpTestUtil.java
index bd93f73..cc021bc 100644
--- a/aai-resources/src/test/java/org/onap/aai/HttpTestUtil.java
+++ b/aai-resources/src/test/java/org/onap/aai/HttpTestUtil.java
@@ -19,6 +19,24 @@
*/
package org.onap.aai;
+import static org.mockito.ArgumentMatchers.anyObject;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.when;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.core.UriInfo;
+
import org.javatuples.Pair;
import org.mockito.Mockito;
import org.onap.aai.config.SpringContextAware;
@@ -37,17 +55,6 @@ import org.onap.aai.setup.SchemaVersions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.ws.rs.core.*;
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-import static org.mockito.Matchers.anyObject;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.when;
-
public class HttpTestUtil extends RESTAPI {
private static final Logger logger = LoggerFactory.getLogger(HttpTestUtil.class);
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessorTestAbstraction.java b/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessorTestAbstraction.java
index d5c112b..4fd789f 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessorTestAbstraction.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/BulkProcessorTestAbstraction.java
@@ -19,9 +19,9 @@
*/
package org.onap.aai.rest;
-import static org.mockito.Matchers.anyObject;
+import static org.mockito.ArgumentMatchers.anyObject;
import static org.mockito.Mockito.when;
-import org.springframework.mock.web.MockHttpServletRequest;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
@@ -41,9 +41,9 @@ import org.junit.BeforeClass;
import org.mockito.Mockito;
import org.onap.aai.AAISetup;
import org.onap.aai.dbmap.AAIGraph;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.mock.web.MockHttpServletRequest;
public abstract class BulkProcessorTestAbstraction extends AAISetup {
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/ExampleConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/ExampleConsumerTest.java
index 9d2a519..c9941dc 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/ExampleConsumerTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/ExampleConsumerTest.java
@@ -19,23 +19,32 @@
*/
package org.onap.aai.rest;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.ArgumentMatchers.anyObject;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mockito;
import org.onap.aai.AAISetup;
import org.onap.aai.dbmap.AAIGraph;
-
-import javax.ws.rs.core.*;
-
-import java.util.*;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.anyObject;
-import static org.mockito.Mockito.when;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ExampleConsumerTest extends AAISetup {
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java
index 84ac1a8..863b084 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/LegacyMoxyConsumerTest.java
@@ -19,15 +19,32 @@
*/
package org.onap.aai.rest;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+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 static org.mockito.ArgumentMatchers.anyObject;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
import org.json.JSONArray;
-import org.json.simple.parser.JSONParser;
-import org.json.simple.parser.ParseException;
import org.json.JSONException;
import org.json.JSONObject;
+import org.json.simple.parser.ParseException;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
@@ -36,22 +53,12 @@ import org.mockito.Mockito;
import org.onap.aai.AAISetup;
import org.onap.aai.dbmap.AAIGraph;
import org.onap.aai.exceptions.AAIException;
-
import org.onap.aai.util.AAIConfig;
import org.onap.aai.util.AAIConstants;
import org.skyscreamer.jsonassert.JSONAssert;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.mock.web.MockHttpServletRequest;
-import org.springframework.test.annotation.DirtiesContext;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.core.*;
-import java.io.IOException;
-import java.util.*;
-
-import static org.junit.Assert.*;
-import static org.mockito.Matchers.anyObject;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
// TODO: Change the following test to use spring boot
public class LegacyMoxyConsumerTest extends AAISetup {
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java
index c6885c7..f726e2c 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/URLFromVertexIdConsumerTest.java
@@ -19,8 +19,26 @@
*/
package org.onap.aai.rest;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.anyObject;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
import org.json.JSONException;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -29,14 +47,8 @@ import org.mockito.Mockito;
import org.onap.aai.AAISetup;
import org.onap.aai.dbmap.AAIGraph;
import org.onap.aai.exceptions.AAIException;
-
-import javax.ws.rs.core.*;
-import java.io.IOException;
-import java.util.*;
-
-import static org.junit.Assert.*;
-import static org.mockito.Matchers.anyObject;
-import static org.mockito.Mockito.when;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.mock.web.MockHttpServletRequest;
public class URLFromVertexIdConsumerTest extends AAISetup {
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java
index e4e7340..daa87d4 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/VertexIdConsumerTest.java
@@ -19,8 +19,26 @@
*/
package org.onap.aai.rest;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.anyObject;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
import org.json.JSONException;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -29,14 +47,8 @@ import org.mockito.Mockito;
import org.onap.aai.AAISetup;
import org.onap.aai.dbmap.AAIGraph;
import org.onap.aai.exceptions.AAIException;
-
-import javax.ws.rs.core.*;
-import java.io.IOException;
-import java.util.*;
-
-import static org.junit.Assert.*;
-import static org.mockito.Matchers.anyObject;
-import static org.mockito.Mockito.when;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.mock.web.MockHttpServletRequest;
public class VertexIdConsumerTest extends AAISetup {
diff --git a/aai-resources/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java b/aai-resources/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java
index a8e5583..21324e9 100644
--- a/aai-resources/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java
+++ b/aai-resources/src/test/java/org/onap/aai/rest/util/EchoResponseTest.java
@@ -22,7 +22,7 @@ package org.onap.aai.rest.util;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.anyObject;
+import static org.mockito.ArgumentMatchers.anyObject;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
@@ -32,7 +32,14 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
-import javax.ws.rs.core.*;
+
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;