summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--README.md (renamed from readme.md)39
-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
-rw-r--r--pom.xml4
11 files changed, 187 insertions, 102 deletions
diff --git a/readme.md b/README.md
index eefc3f1..941a734 100644
--- a/readme.md
+++ b/README.md
@@ -1,59 +1,50 @@
# OpenECOMP AAI Resources
----
----
-
-# Introduction
-
+## Introduction
OpenECOMP AAI Resources is delivered with multiple docker containers with minimum of hbase docker container preinstalled and also have a aai-haproxy container installed for routing
For demo app use case you can install all three of the containers in one machine. Configuration and deployment of hbase for any other use cases should be evaluated and updated accordingly.
-# Compiling AAI Resources
-
+## Compiling AAI Resources
AAI can be compiled easily with a `mvn clean install -DskipTests`. Integration tests are started by omitting the skipTests flag `mvn clean install`
-# Starting AAI
-
-In a developer local environment using the following: mvn -N -P runAjsc
-
-# Accessing AAI APIs
+## Starting AAI
+In a local development environment run:
+``` bash
+mvn -N -P runAjsc
+```
+You have to be in the `aai-resources` folder for that to work!
+## Accessing AAI APIs
Most of the AAI features within OpenECOMP are triggered by using **RESTful interfaces**. AAI is configured on this release with HTTPS only using Basic Authentication. Two way SSL using client certificates should be considered and used for non demo use case deployments.
The MSO APIs are configured to accept requests having a **basic auth. header** set with various **username and password** depending on which client is triggering the request. The realm.properties contains the credentials for the OpenECOMP components and these should be changed as appropriate.
All API endpoints are exposed on port **8443**.
-##### Example API endpoints in the first open source release
-
+### Example API endpoints in the first open source release
http://aai.api.simpledemo.openecomp.org:8443/aai/v10/cloud-infrastructure/pservers/pserver/<pserver-id>
The easy way to trigger these endpoints is to use a RESTful client or automation framework. HTTP GET/PUT/DELETE are supported for most resource endpoints. More information on the REST interface can be found in the AAI Service REST API specification.
-# Configuring AAI
-
+## Configuring AAI
The Docker containers use a Chef based configuration file (JSON) in order to provision AAI basic configuration for the demo app use case set up.
-# Logging
-
+## Logging
EELF framework is used for **specific logs** (audit, metric and error logs). They are tracking inter component logs (request and response) and allow to follow a complete flow through the AAI subsystem
EELF logs are located at the following location on the AAI Service container:
-- /opt/app/aai/logs (each module has its own folder)
+- `/opt/app/aai/logs` (each module has its own folder)
AJSC Jetty logs can be found under /opt/app/aai-resources/logs/ajsc-jetty.
The REST interface logs can be found under /opt/app/aai-resources/logs/rest.
-# Testing AAI Functionalities
+## Testing AAI Functionalities
Any RESTful client such as SoapUI may be configured and setup to use for testing AAI requests.
-# Integration Tests
+## Integration Tests
Integration tests are located in `it` directory, and disabled by default in the pom file:
`<skipITs>true</skipITs>`
As a naming convention, All integration test classes should end with `IT`, and will be executed by changing the `skipITs` value in pom file, or through the command line `-DskipITs=false`
-
-
-
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;
diff --git a/pom.xml b/pom.xml
index 496332b..2b51d77 100644
--- a/pom.xml
+++ b/pom.xml
@@ -155,12 +155,12 @@
<pluginRepositories>
<pluginRepository>
<id>central</id>
- <url>http://repo1.maven.org/maven2</url>
+ <url>https://repo1.maven.org/maven2</url>
</pluginRepository>
<pluginRepository>
<id>EvoSuite</id>
<name>EvoSuite Repository</name>
- <url>http://www.evosuite.org/m2</url>
+ <url>https://www.evosuite.org/m2</url>
</pluginRepository>
</pluginRepositories>
<distributionManagement>