diff options
Diffstat (limited to 'aai-resources')
22 files changed, 88 insertions, 57 deletions
diff --git a/aai-resources/pom.xml b/aai-resources/pom.xml index fda6f5b..f5884da 100644 --- a/aai-resources/pom.xml +++ b/aai-resources/pom.xml @@ -92,6 +92,10 @@ <!-- Integration tests will be skipped by default. Could be enabled here or by -DskipITs=false--> <skipITs>true</skipITs> + + <!-- <swagger.version>1.5.24</swagger.version> --> + <!-- https://mvnrepository.com/artifact/io.swagger/swagger-core --> + <swagger.version>1.6.8</swagger.version> </properties> <profiles> <!-- Docker profile to be used for building docker image and pushing to nexus --> @@ -352,6 +356,7 @@ <dependency> <groupId>io.swagger</groupId> <artifactId>swagger-core</artifactId> + <version>${swagger.version}</version> <exclusions> <exclusion> <groupId>javax.ws.rs</groupId> @@ -362,6 +367,7 @@ <dependency> <groupId>io.swagger</groupId> <artifactId>swagger-annotations</artifactId> + <version>${swagger.version}</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> @@ -371,6 +377,7 @@ <dependency> <groupId>io.swagger</groupId> <artifactId>swagger-jersey-jaxrs</artifactId> + <version>${swagger.version}</version> <exclusions> <exclusion> <groupId>org.glassfish.jersey.media</groupId> diff --git a/aai-resources/src/main/java/org/onap/aai/IncreaseNodesTool.java b/aai-resources/src/main/java/org/onap/aai/IncreaseNodesTool.java index a473c2a..9331f2f 100644 --- a/aai-resources/src/main/java/org/onap/aai/IncreaseNodesTool.java +++ b/aai-resources/src/main/java/org/onap/aai/IncreaseNodesTool.java @@ -110,7 +110,8 @@ public class IncreaseNodesTool { public void run(JanusGraph janusGraph, String[] args) throws AAIUnknownObjectException, UnsupportedEncodingException { CommandLineArgs cArgs = new CommandLineArgs(); - JCommander jCommander = new JCommander(cArgs, args); + JCommander jCommander = new JCommander(cArgs); + jCommander.parse(args); jCommander.setProgramName(IncreaseNodesTool.class.getSimpleName()); Loader loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, schemaVersions.getDefaultVersion()); diff --git a/aai-resources/src/main/java/org/onap/aai/TenantIsolation/DataImportTasks.java b/aai-resources/src/main/java/org/onap/aai/TenantIsolation/DataImportTasks.java index 3aeac7e..e32d404 100644 --- a/aai-resources/src/main/java/org/onap/aai/TenantIsolation/DataImportTasks.java +++ b/aai-resources/src/main/java/org/onap/aai/TenantIsolation/DataImportTasks.java @@ -29,23 +29,15 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; -import java.util.Map; -import java.util.NavigableMap; import java.util.Properties; -import java.util.TreeMap; -import java.util.UUID; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import org.apache.commons.io.FileUtils; import org.apache.commons.io.comparator.LastModifiedFileComparator; import org.apache.commons.io.filefilter.DirectoryFileFilter; import org.apache.commons.io.filefilter.FileFileFilter; -import org.apache.commons.io.filefilter.RegexFileFilter; import org.onap.aai.exceptions.AAIException; import org.onap.aai.logging.ErrorLogHelper; import org.onap.aai.util.AAIConfig; diff --git a/aai-resources/src/main/java/org/onap/aai/config/PropertyPasswordConfiguration.java b/aai-resources/src/main/java/org/onap/aai/config/PropertyPasswordConfiguration.java index 4c92eb2..bc87bfa 100644 --- a/aai-resources/src/main/java/org/onap/aai/config/PropertyPasswordConfiguration.java +++ b/aai-resources/src/main/java/org/onap/aai/config/PropertyPasswordConfiguration.java @@ -27,6 +27,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import java.nio.charset.Charset; import java.util.LinkedHashMap; import java.util.Map; import java.util.Properties; @@ -66,7 +67,7 @@ public class PropertyPasswordConfiguration implements ApplicationContextInitiali if (passwordStream != null) { String keystorePassword = null; - keystorePassword = IOUtils.toString(passwordStream); + keystorePassword = IOUtils.toString(passwordStream, Charset.defaultCharset()); if (keystorePassword != null) { keystorePassword = keystorePassword.trim(); } diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/pre/HeaderValidation.java b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/HeaderValidation.java index f0eaac9..294cb0a 100644 --- a/aai-resources/src/main/java/org/onap/aai/interceptors/pre/HeaderValidation.java +++ b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/HeaderValidation.java @@ -24,7 +24,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Optional; -import java.util.UUID; import javax.annotation.Priority; import javax.ws.rs.container.ContainerRequestContext; @@ -39,7 +38,6 @@ import org.onap.aai.interceptors.AAIHeaderProperties; import org.onap.aai.logging.ErrorLogHelper; import org.onap.logging.filter.base.Constants; import org.onap.logging.filter.base.ONAPComponents; -import org.onap.logging.filter.base.SimpleMap; import org.onap.logging.ref.slf4j.ONAPLogConstants; @PreMatching diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestHeaderManipulation.java b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestHeaderManipulation.java index b70ff06..3fb6c81 100644 --- a/aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestHeaderManipulation.java +++ b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/RequestHeaderManipulation.java @@ -20,13 +20,10 @@ package org.onap.aai.interceptors.pre; -import java.io.IOException; import java.util.Collections; import java.util.regex.Matcher; -import java.util.regex.Pattern; import javax.annotation.Priority; -import javax.servlet.http.HttpServletRequest; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerRequestFilter; import javax.ws.rs.container.PreMatching; @@ -34,7 +31,6 @@ import javax.ws.rs.core.MultivaluedMap; import org.onap.aai.interceptors.AAIContainerFilter; import org.onap.aai.interceptors.AAIHeaderProperties; -import org.springframework.beans.factory.annotation.Autowired; @PreMatching @Priority(AAIRequestFilterPriority.HEADER_MANIPULATION) diff --git a/aai-resources/src/main/java/org/onap/aai/interceptors/pre/VersionInterceptor.java b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/VersionInterceptor.java index 5d21141..01cd013 100644 --- a/aai-resources/src/main/java/org/onap/aai/interceptors/pre/VersionInterceptor.java +++ b/aai-resources/src/main/java/org/onap/aai/interceptors/pre/VersionInterceptor.java @@ -20,7 +20,6 @@ package org.onap.aai.interceptors.pre; -import java.net.URI; import java.util.ArrayList; import java.util.Set; import java.util.regex.Matcher; diff --git a/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java index 9d90a46..c7f0911 100644 --- a/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java +++ b/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java @@ -20,12 +20,22 @@ package org.onap.aai.rest; -import com.google.gson.*; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import com.google.gson.JsonSyntaxException; import java.io.UnsupportedEncodingException; import java.net.URI; -import java.util.*; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Set; import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; @@ -33,8 +43,13 @@ import javax.ws.rs.Consumes; import javax.ws.rs.PUT; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; -import javax.ws.rs.core.*; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; +import javax.ws.rs.core.UriBuilder; +import javax.ws.rs.core.UriInfo; import org.javatuples.Pair; import org.onap.aai.config.SpringContextAware; @@ -237,9 +252,8 @@ public abstract class BulkConsumer extends RESTAPI { * bodies to be processed. */ private JsonArray getTransactions(String content, HttpHeaders headers) throws AAIException, JsonSyntaxException { - JsonParser parser = new JsonParser(); - JsonObject input = parser.parse(content).getAsJsonObject(); + JsonObject input = JsonParser.parseString(content).getAsJsonObject(); String module = getModule(); if (!(input.has("transactions"))) { diff --git a/aai-resources/src/main/java/org/onap/aai/rest/URLFromVertexIdConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/URLFromVertexIdConsumer.java index b57181e..bf29fd0 100644 --- a/aai-resources/src/main/java/org/onap/aai/rest/URLFromVertexIdConsumer.java +++ b/aai-resources/src/main/java/org/onap/aai/rest/URLFromVertexIdConsumer.java @@ -43,7 +43,6 @@ import org.onap.aai.restcore.RESTAPI; import org.onap.aai.serialization.db.DBSerializer; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import org.onap.aai.setup.SchemaVersion; -import org.onap.aai.util.AAIConfig; /** * The Class URLFromVertexIdConsumer. diff --git a/aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumer.java index cc1e912..1b274b9 100644 --- a/aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumer.java +++ b/aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumer.java @@ -29,11 +29,24 @@ import io.micrometer.core.annotation.Timed; import java.io.UnsupportedEncodingException; import java.net.URI; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.*; -import javax.ws.rs.core.*; +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; +import javax.ws.rs.core.UriInfo; import org.javatuples.Pair; import org.onap.aai.config.SpringContextAware; @@ -65,7 +78,6 @@ public class BulkSingleTransactionConsumer extends RESTAPI { private static final Set<String> validOperations = Collections.unmodifiableSet(new HashSet<>(Arrays.asList("put", "patch", "delete"))); - private static final JsonParser parser = new JsonParser(); private int allowedOperationCount = 30; private static final Logger LOGGER = LoggerFactory.getLogger(BulkSingleTransactionConsumer.class); @@ -172,8 +184,8 @@ public class BulkSingleTransactionConsumer extends RESTAPI { for (int i = 0; i < transaction.getOperations().size(); i++) { if (!Response.Status.Family.familyOf(results.get(i).getValue1().getStatus()) .equals(Response.Status.Family.SUCCESSFUL)) { - final JsonArray vars = parser.parse(results.get(i).getValue1().getEntity().toString()).getAsJsonObject() - .getAsJsonObject("requestError").getAsJsonObject("serviceException") + final JsonArray vars = JsonParser.parseString(results.get(i).getValue1().getEntity().toString()) + .getAsJsonObject().getAsJsonObject("requestError").getAsJsonObject("serviceException") .getAsJsonArray("variables"); StringBuilder sb = new StringBuilder(); for (int j = 2; j < vars.size() - 1; j++) { diff --git a/aai-resources/src/main/java/org/onap/aai/rest/bulk/pojos/OperationResponse.java b/aai-resources/src/main/java/org/onap/aai/rest/bulk/pojos/OperationResponse.java index 95a6f2b..bcd6e7c 100644 --- a/aai-resources/src/main/java/org/onap/aai/rest/bulk/pojos/OperationResponse.java +++ b/aai-resources/src/main/java/org/onap/aai/rest/bulk/pojos/OperationResponse.java @@ -71,7 +71,7 @@ public class OperationResponse { if (s == null) { this.body = null; } else { - this.body = new JsonParser().parse(s.toString()).getAsJsonObject(); + this.body = JsonParser.parseString(s.toString()).getAsJsonObject(); } } } diff --git a/aai-resources/src/test/java/org/onap/aai/AAISetup.java b/aai-resources/src/test/java/org/onap/aai/AAISetup.java index 8227d37..dc1e6c8 100644 --- a/aai-resources/src/test/java/org/onap/aai/AAISetup.java +++ b/aai-resources/src/test/java/org/onap/aai/AAISetup.java @@ -24,13 +24,18 @@ import static org.junit.Assert.assertNotNull; import java.io.IOException; import java.io.InputStream; +import java.nio.charset.Charset; import java.util.Map; import org.apache.commons.io.IOUtils; import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Rule; -import org.onap.aai.config.*; +import org.onap.aai.config.ConfigConfiguration; +import org.onap.aai.config.IntrospectionConfig; +import org.onap.aai.config.RestBeanConfig; +import org.onap.aai.config.SpringContextAware; +import org.onap.aai.config.XmlFormatTransformerConfiguration; import org.onap.aai.edges.EdgeIngestor; import org.onap.aai.introspection.LoaderFactory; import org.onap.aai.introspection.MoxyLoader; @@ -92,7 +97,7 @@ public abstract class AAISetup { String message = String.format("Unable to find the %s in src/test/resources", filename); assertNotNull(message, inputStream); - String resource = IOUtils.toString(inputStream); + String resource = IOUtils.toString(inputStream, Charset.defaultCharset()); return resource; } } 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 9235109..676da71 100644 --- a/aai-resources/src/test/java/org/onap/aai/HttpTestUtil.java +++ b/aai-resources/src/test/java/org/onap/aai/HttpTestUtil.java @@ -20,7 +20,7 @@ package org.onap.aai; -import static org.mockito.ArgumentMatchers.anyObject; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.when; @@ -102,7 +102,7 @@ public class HttpTestUtil extends RESTAPI { when(uriInfo.getQueryParameters()).thenReturn(queryParameters); when(uriInfo.getQueryParameters(false)).thenReturn(queryParameters); - doReturn(null).when(queryParameters).remove(anyObject()); + doReturn(null).when(queryParameters).remove(any()); when(httpHeaders.getMediaType()).thenReturn(APPLICATION_JSON); schemaVersions = SpringContextAware.getBean(SchemaVersions.class); } diff --git a/aai-resources/src/test/java/org/onap/aai/PayloadUtil.java b/aai-resources/src/test/java/org/onap/aai/PayloadUtil.java index 3197c69..eb1c52c 100644 --- a/aai-resources/src/test/java/org/onap/aai/PayloadUtil.java +++ b/aai-resources/src/test/java/org/onap/aai/PayloadUtil.java @@ -24,6 +24,7 @@ import static org.junit.Assert.assertNotNull; import java.io.IOException; import java.io.InputStream; +import java.nio.charset.Charset; import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; @@ -44,7 +45,7 @@ public class PayloadUtil { String message = String.format("Unable to find the %s in src/test/resources", fileName); assertNotNull(message, inputStream); - String resource = IOUtils.toString(inputStream); + String resource = IOUtils.toString(inputStream, Charset.defaultCharset()); inputStream.close(); return resource; @@ -63,7 +64,7 @@ public class PayloadUtil { if (cache.containsKey(fileName)) { resource = cache.get(fileName); } else { - resource = IOUtils.toString(inputStream); + resource = IOUtils.toString(inputStream, Charset.defaultCharset()); cache.put(fileName, resource); } @@ -95,7 +96,7 @@ public class PayloadUtil { String message = String.format("Unable to find the %s in src/test/resources/payloads/", fileName); assertNotNull(message, inputStream); - String resource = IOUtils.toString(inputStream); + String resource = IOUtils.toString(inputStream, Charset.defaultCharset()); inputStream.close(); return resource; 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 56ab500..e4a9d71 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 @@ -20,7 +20,7 @@ package org.onap.aai.rest; -import static org.mockito.ArgumentMatchers.anyObject; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; import java.io.IOException; @@ -119,7 +119,7 @@ public abstract class BulkProcessorTestAbstraction extends AAISetup { when(uriInfo.getQueryParameters(false)).thenReturn(queryParameters); // TODO - Check if this is valid since RemoveDME2QueryParameters seems to be very unreasonable - Mockito.doReturn(null).when(queryParameters).remove(anyObject()); + Mockito.doReturn(null).when(queryParameters).remove(any()); when(httpHeaders.getMediaType()).thenReturn(APPLICATION_JSON); } 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 1b2e98d..0039303 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 @@ -22,7 +22,7 @@ package org.onap.aai.rest; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.mockito.ArgumentMatchers.anyObject; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; import java.util.ArrayList; @@ -112,7 +112,7 @@ public class ExampleConsumerTest extends AAISetup { when(uriInfo.getQueryParameters(false)).thenReturn(queryParameters); // TODO - Check if this is valid since RemoveDME2QueryParameters seems to be very unreasonable - Mockito.doReturn(null).when(queryParameters).remove(anyObject()); + Mockito.doReturn(null).when(queryParameters).remove(any()); when(httpHeaders.getMediaType()).thenReturn(APPLICATION_JSON); } diff --git a/aai-resources/src/test/java/org/onap/aai/rest/ExceptionHandlerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/ExceptionHandlerTest.java index 68c051d..a804ee5 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/ExceptionHandlerTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/ExceptionHandlerTest.java @@ -26,9 +26,10 @@ import static org.junit.Assert.assertNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonLocation; import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.core.JsonParser; import com.sun.istack.SAXParseException2; import java.util.ArrayList; @@ -106,8 +107,8 @@ public class ExceptionHandlerTest extends AAISetup { @Test public void testConversionWhenJsonParseExceptionResultBadRequest() throws Exception { - JsonLocation jsonLocation = mock(JsonLocation.class); - Exception exception = new JsonParseException("", jsonLocation); + JsonParser parser = new JsonFactory().createParser(""); + Exception exception = new JsonParseException(parser, ""); Response response = handler.toResponse(exception); assertNotNull(response); @@ -119,7 +120,9 @@ public class ExceptionHandlerTest extends AAISetup { public void testConversionWhenJsonMappingExceptionResultBadRequest() throws Exception { JsonLocation jsonLocation = mock(JsonLocation.class); - Exception exception = new JsonMappingException("", jsonLocation); + // Exception exception = new JsonMappingException("", jsonLocation); + JsonParser parser = new JsonFactory().createParser(""); + Exception exception = new JsonParseException(parser, ""); Response response = handler.toResponse(exception); assertNotNull(response); 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 4285af8..7c0161f 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 @@ -24,7 +24,7 @@ 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.ArgumentMatchers.any; import static org.mockito.Mockito.when; import java.io.IOException; @@ -131,7 +131,7 @@ public class LegacyMoxyConsumerTest extends AAISetup { when(uriInfo.getQueryParameters(false)).thenReturn(queryParameters); // TODO - Check if this is valid since RemoveDME2QueryParameters seems to be very unreasonable - Mockito.doReturn(null).when(queryParameters).remove(anyObject()); + Mockito.doReturn(null).when(queryParameters).remove(any()); when(httpHeaders.getMediaType()).thenReturn(APPLICATION_JSON); 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 5abe263..2f8c1b1 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 @@ -23,7 +23,7 @@ package org.onap.aai.rest; 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.ArgumentMatchers.any; import static org.mockito.Mockito.when; import java.io.IOException; @@ -124,7 +124,7 @@ public class URLFromVertexIdConsumerTest extends AAISetup { when(uriInfo.getQueryParameters(false)).thenReturn(queryParameters); // TODO - Check if this is valid since RemoveDME2QueryParameters seems to be very unreasonable - Mockito.doReturn(null).when(queryParameters).remove(anyObject()); + Mockito.doReturn(null).when(queryParameters).remove(any()); when(httpHeaders.getMediaType()).thenReturn(APPLICATION_JSON); } 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 52a5701..a6219e7 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 @@ -23,7 +23,7 @@ package org.onap.aai.rest; 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.ArgumentMatchers.any; import static org.mockito.Mockito.when; import java.io.IOException; @@ -124,7 +124,7 @@ public class VertexIdConsumerTest extends AAISetup { when(uriInfo.getQueryParameters(false)).thenReturn(queryParameters); // TODO - Check if this is valid since RemoveDME2QueryParameters seems to be very unreasonable - Mockito.doReturn(null).when(queryParameters).remove(anyObject()); + Mockito.doReturn(null).when(queryParameters).remove(any()); when(httpHeaders.getMediaType()).thenReturn(APPLICATION_JSON); } diff --git a/aai-resources/src/test/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumerTest.java b/aai-resources/src/test/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumerTest.java index eaa71a9..7629178 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumerTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumerTest.java @@ -321,8 +321,8 @@ public class BulkSingleTransactionConsumerTest extends BulkProcessorTestAbstract @Test public void deleteChildRecreateChildTest() throws IOException { JsonArray requests = - new JsonParser() - .parse(getBulkPayload("single-transaction/delete-child-recreate-child") + JsonParser + .parseString(getBulkPayload("single-transaction/delete-child-recreate-child") .replaceAll("<methodName>", name.getMethodName())) .getAsJsonObject().getAsJsonArray("array"); String payload = requests.get(0).toString(); @@ -338,8 +338,11 @@ public class BulkSingleTransactionConsumerTest extends BulkProcessorTestAbstract @Test public void deleteNodeRecreateNodeTest() throws IOException { - JsonArray requests = new JsonParser().parse(getBulkPayload("single-transaction/delete-node-recreate-node") - .replaceAll("<methodName>", name.getMethodName())).getAsJsonObject().getAsJsonArray("array"); + JsonArray requests = + JsonParser + .parseString(getBulkPayload("single-transaction/delete-node-recreate-node") + .replaceAll("<methodName>", name.getMethodName())) + .getAsJsonObject().getAsJsonArray("array"); String payload = requests.get(0).toString(); Response response = executeRequest(payload); System.out.println(response.getEntity().toString()); 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 21324e9..3662ebe 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.ArgumentMatchers.anyObject; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; @@ -100,7 +100,7 @@ public class EchoResponseTest extends AAISetup { when(uriInfo.getQueryParameters(false)).thenReturn(queryParameters); // TODO - Check if this is valid since RemoveDME2QueryParameters seems to be very unreasonable - Mockito.doReturn(null).when(queryParameters).remove(anyObject()); + Mockito.doReturn(null).when(queryParameters).remove(any()); } |