diff options
author | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-01-03 14:49:42 +0100 |
---|---|---|
committer | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-01-03 14:49:42 +0100 |
commit | 109f5f03539b10121ead67320c333e06eda126f6 (patch) | |
tree | f3f094c30e808243ed8aaa7589ffe4bdbf73a00d | |
parent | 87cbabb974af4fa9b4777cd54b5cadfc7b9ee3fd (diff) |
Update spring-boot to 2.4
- update spring-boot to 2.4
- add junit vintage engine dependency to keep supporting junit 4 tests
- update mockito to version 3.4.0
Issue-ID: AAI-3681
Change-Id: I8b40529418f9d03179970edf1ab12992db1cb5e8
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
11 files changed, 74 insertions, 74 deletions
diff --git a/aai-traversal/pom.xml b/aai-traversal/pom.xml index a09d14f..125edea 100644 --- a/aai-traversal/pom.xml +++ b/aai-traversal/pom.xml @@ -32,8 +32,6 @@ <artifactId>aai-traversal</artifactId> <properties> - <mockito.core.version>2.4.0</mockito.core.version> - <powermock.version>1.7.0RC2</powermock.version> <java.version>1.8</java.version> <start-class>org.onap.aai.TraversalApp</start-class> @@ -96,15 +94,17 @@ <schema.uri.base.path>/aai</schema.uri.base.path> <!-- versions --> - <spring.boot.version>2.3.12.RELEASE</spring.boot.version> - <spring.version>5.2.15.RELEASE</spring.version> + <spring.boot.version>2.4.13</spring.boot.version> + <spring.version>5.3.13</spring.version> <spring.test.version>${spring.version}</spring.test.version> <spring.jms.version>${spring.version}</spring.jms.version> + <javax.servlet.version>4.0.1</javax.servlet.version> <keycloak.version>11.0.2</keycloak.version> <micrometer-spring-legacy.version>1.3.19</micrometer-spring-legacy.version> <micrometer-core.version>1.6.6</micrometer-core.version> - <micrometer-registry-prometheus.version>1.6.6</micrometer-registry-prometheus.version> <micrometer-jersey2>1.6.6</micrometer-jersey2> + <mockito.core.version>3.4.0</mockito.core.version> + <powermock.version>2.0.9</powermock.version> <testcontainers.version>1.6.1</testcontainers.version> <netty.handler.version>4.1.63.Final</netty.handler.version> <netty.version>4.1.63.Final</netty.version> @@ -312,9 +312,6 @@ </profile> </profiles> - <!-- <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-parent</artifactId> <type>pom</type> <scope>import</scope> - </dependency> </dependencies> </dependencyManagement> --> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> @@ -337,7 +334,7 @@ <dependency> <groupId>io.micrometer</groupId> <artifactId>micrometer-registry-prometheus</artifactId> - <version>${micrometer-registry-prometheus.version}</version> + <!-- <version>${micrometer-registry-prometheus.version}</version> --> </dependency> <dependency> <groupId>io.micrometer</groupId> @@ -460,15 +457,6 @@ <artifactId>janino</artifactId> </dependency> <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>hamcrest-junit</artifactId> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> </dependency> @@ -541,10 +529,6 @@ <artifactId>freemarker</artifactId> </dependency> <dependency> - <groupId>javax.xml.bind</groupId> - <artifactId>jaxb-api</artifactId> - </dependency> - <dependency> <groupId>org.eclipse.persistence</groupId> <artifactId>eclipselink</artifactId> </dependency> @@ -588,35 +572,39 @@ <dependency> <groupId>org.onap.aai.aai-common</groupId> <artifactId>aai-core</artifactId> - <exclusions> - <exclusion> - <groupId>org.onap.aai.aai-common</groupId> - <artifactId>aai-aaf-auth</artifactId> - </exclusion> - <exclusion> - <groupId>com.sun.jersey</groupId> - <artifactId>jersey-core</artifactId> - </exclusion> - <exclusion> - <groupId>org.codehaus.jackson</groupId> - <artifactId>jackson-mapper-asl</artifactId> - </exclusion> - <exclusion> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-http</artifactId> - </exclusion> - <exclusion> - <groupId>org.eclipse.jetty</groupId> - <artifactId>jetty-server</artifactId> - </exclusion> - <exclusion> - <groupId>org.springframework</groupId> - <artifactId>spring-web</artifactId> - </exclusion> - <exclusion> - <groupId>org.onap.aai</groupId> - <artifactId>aai-logging</artifactId> - </exclusion> + <exclusions> + <exclusion> + <groupId>org.onap.aai.aai-common</groupId> + <artifactId>aai-aaf-auth</artifactId> + </exclusion> + <exclusion> + <groupId>com.sun.jersey</groupId> + <artifactId>jersey-core</artifactId> + </exclusion> + <exclusion> + <groupId>org.codehaus.jackson</groupId> + <artifactId>jackson-mapper-asl</artifactId> + </exclusion> + <exclusion> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-http</artifactId> + </exclusion> + <exclusion> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-server</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + </exclusion> + <exclusion> + <groupId>org.onap.aai</groupId> + <artifactId>aai-logging</artifactId> + </exclusion> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> </exclusions> </dependency> <dependency> @@ -696,6 +684,23 @@ <artifactId>spring-boot-starter-jetty</artifactId> </dependency> <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + <!-- TODO: Migrate tests to junit 5 and remove this dependency --> + <dependency> + <groupId>org.junit.vintage</groupId> + <artifactId>junit-vintage-engine</artifactId> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>org.hamcrest</groupId> + <artifactId>hamcrest-core</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> <groupId>org.onap.aaf.authz</groupId> <artifactId>aaf-cadi-aaf</artifactId> </dependency> diff --git a/aai-traversal/src/main/java/org/onap/aai/interceptors/pre/RequestTransactionLogging.java b/aai-traversal/src/main/java/org/onap/aai/interceptors/pre/RequestTransactionLogging.java index 8c73033..6bae614 100644 --- a/aai-traversal/src/main/java/org/onap/aai/interceptors/pre/RequestTransactionLogging.java +++ b/aai-traversal/src/main/java/org/onap/aai/interceptors/pre/RequestTransactionLogging.java @@ -31,27 +31,20 @@ import java.util.Random; import java.util.UUID; 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; import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.UriInfo; -import org.apache.commons.io.Charsets; -import org.apache.commons.io.IOUtils; -import org.glassfish.jersey.message.internal.ReaderWriter; -import org.glassfish.jersey.server.ContainerException; import org.onap.aai.exceptions.AAIException; import org.onap.aai.interceptors.AAIContainerFilter; import org.onap.aai.interceptors.AAIHeaderProperties; import org.onap.aai.util.AAIConfig; import org.onap.aai.util.AAIConstants; import org.onap.aai.util.HbaseSaltPrefixer; -import org.springframework.util.StringUtils; +import org.springframework.util.ObjectUtils; -// Here @PreMatching @Priority(AAIRequestFilterPriority.REQUEST_TRANS_LOGGING) public class RequestTransactionLogging extends AAIContainerFilter @@ -85,7 +78,7 @@ public class RequestTransactionLogging extends AAIContainerFilter requestContext.getHeaders().putSingle(CONTENT_TYPE, DEFAULT_CONTENT_TYPE); } - if (WILDCARD.equals(acceptType) || StringUtils.isEmpty(acceptType) + if (WILDCARD.equals(acceptType) || ObjectUtils.isEmpty(acceptType) || acceptType.contains(TEXT_PLAIN)) { UriInfo uriInfo = requestContext.getUriInfo(); if (uriInfo != null) { diff --git a/aai-traversal/src/main/java/org/onap/aai/rest/search/CustomQueryConfigDTO.java b/aai-traversal/src/main/java/org/onap/aai/rest/search/CustomQueryConfigDTO.java index 7f90566..38b9b88 100644 --- a/aai-traversal/src/main/java/org/onap/aai/rest/search/CustomQueryConfigDTO.java +++ b/aai-traversal/src/main/java/org/onap/aai/rest/search/CustomQueryConfigDTO.java @@ -40,8 +40,7 @@ package org.onap.aai.rest.search; */ import com.fasterxml.jackson.annotation.JsonProperty; - -import org.springframework.util.StringUtils; +import org.springframework.util.ObjectUtils; public class CustomQueryConfigDTO { @@ -53,7 +52,7 @@ public class CustomQueryConfigDTO { public CustomQueryDTO getQueryDTO() { if (queryDTO == null) queryDTO = new CustomQueryDTO(); - if (!StringUtils.isEmpty(storedQuery)) { + if (!ObjectUtils.isEmpty(storedQuery)) { queryDTO.setQuery(storedQuery); } return queryDTO; diff --git a/aai-traversal/src/test/java/org/onap/aai/dbgraphgen/ModelBasedProcessingInvalidDataTest.java b/aai-traversal/src/test/java/org/onap/aai/dbgraphgen/ModelBasedProcessingInvalidDataTest.java index d6b43aa..c228d03 100644 --- a/aai-traversal/src/test/java/org/onap/aai/dbgraphgen/ModelBasedProcessingInvalidDataTest.java +++ b/aai-traversal/src/test/java/org/onap/aai/dbgraphgen/ModelBasedProcessingInvalidDataTest.java @@ -82,7 +82,7 @@ public class ModelBasedProcessingInvalidDataTest extends AAISetup { @Before public void init() { - MockitoAnnotations.initMocks(this); + MockitoAnnotations.openMocks(this); loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, schemaVersions.getDefaultVersion()); processor = new ModelBasedProcessing(loader, dbEngine, serializer); diff --git a/aai-traversal/src/test/java/org/onap/aai/dbgraphgen/ModelBasedProcessingTest.java b/aai-traversal/src/test/java/org/onap/aai/dbgraphgen/ModelBasedProcessingTest.java index ab1ea0a..fad6587 100644 --- a/aai-traversal/src/test/java/org/onap/aai/dbgraphgen/ModelBasedProcessingTest.java +++ b/aai-traversal/src/test/java/org/onap/aai/dbgraphgen/ModelBasedProcessingTest.java @@ -98,7 +98,7 @@ public class ModelBasedProcessingTest extends AAISetup { @Before public void init() throws AAIException { - MockitoAnnotations.initMocks(this); + MockitoAnnotations.openMocks(this); version = schemaVersions.getDefaultVersion(); loader = loaderFactory.createLoaderForVersion(introspectorFactoryType, version); TransactionalGraphEngine newDbEngine = new JanusGraphDBEngine(queryStyle, loader); diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/BadQueryFormatTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/BadQueryFormatTest.java index eb8902e..1efbce7 100644 --- a/aai-traversal/src/test/java/org/onap/aai/rest/BadQueryFormatTest.java +++ b/aai-traversal/src/test/java/org/onap/aai/rest/BadQueryFormatTest.java @@ -19,9 +19,9 @@ */ package org.onap.aai.rest; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; -import static org.hamcrest.junit.MatcherAssert.assertThat; import java.util.Base64; import java.util.Collections; diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/ConfigurationTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/ConfigurationTest.java index b0f9869..0992519 100644 --- a/aai-traversal/src/test/java/org/onap/aai/rest/ConfigurationTest.java +++ b/aai-traversal/src/test/java/org/onap/aai/rest/ConfigurationTest.java @@ -35,6 +35,7 @@ import org.onap.aai.config.SpringContextAware; import org.onap.aai.restclient.PropertyPasswordConfiguration; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.test.autoconfigure.actuate.metrics.AutoConfigureMetrics; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Import; import org.springframework.http.*; @@ -42,9 +43,12 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; import org.springframework.web.client.RestTemplate; +import io.prometheus.client.exporter.common.TextFormat; + /** * Test REST requests against configuration resource */ +@AutoConfigureMetrics @TestPropertySource(locations = "classpath:application-test.properties") @ContextConfiguration( initializers = PropertyPasswordConfiguration.class, @@ -69,7 +73,6 @@ public class ConfigurationTest extends AbstractSpringRestTest { headers = new HttpHeaders(); - headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON)); headers.set("Accept", "text/plain"); headers.add("Real-Time", "true"); headers.add("X-FromAppId", "JUNIT"); @@ -85,13 +88,13 @@ public class ConfigurationTest extends AbstractSpringRestTest { @Test public void TestManagementEndpointConfiguration() { - ResponseEntity responseEntity = null; + ResponseEntity<String> responseEntity = null; String responseBody = null; // set Accept as text/plain in order to get access of endpoint "/actuator/prometheus" responseEntity = restTemplate.exchange(actuatorurl + "/actuator/prometheus", HttpMethod.GET, httpEntity, String.class); - responseBody = (String) responseEntity.getBody(); + responseBody = responseEntity.getBody(); assertEquals(HttpStatus.OK, responseEntity.getStatusCode()); System.out.println("responseBody---------" + responseBody); assertFalse(responseBody.contains("aai_uri")); diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/SpringExceptionHandlerTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/GlobalExceptionHandlerTest.java index b3d1ac9..75cc1a8 100644 --- a/aai-traversal/src/test/java/org/onap/aai/rest/SpringExceptionHandlerTest.java +++ b/aai-traversal/src/test/java/org/onap/aai/rest/GlobalExceptionHandlerTest.java @@ -47,7 +47,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; -public class SpringExceptionHandlerTest { +public class GlobalExceptionHandlerTest { private static final ObjectMapper objectMapper = new ObjectMapper(); @@ -61,7 +61,7 @@ public class SpringExceptionHandlerTest { @Before public void setup() { - MockitoAnnotations.initMocks(this); + MockitoAnnotations.openMocks(this); HttpServletRequest request = mock(HttpServletRequest.class); when(request.getMethod()).thenReturn("PUT"); when(request.getRequestURI()).thenReturn("/aai/v14/dsl"); diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/search/OnapQueryTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/search/OnapQueryTest.java index 6d12842..44264c1 100644 --- a/aai-traversal/src/test/java/org/onap/aai/rest/search/OnapQueryTest.java +++ b/aai-traversal/src/test/java/org/onap/aai/rest/search/OnapQueryTest.java @@ -142,7 +142,7 @@ public abstract class OnapQueryTest { System.setProperty("AJSC_HOME", "."); System.setProperty("BUNDLECONFIG_DIR", "src/main/resources"); logger = LoggerFactory.getLogger(getClass()); - MockitoAnnotations.initMocks(this); + MockitoAnnotations.openMocks(this); graph = TinkerGraph.open(); gts = graph.traversal(); createGraph(); diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/search/QueryTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/search/QueryTest.java index bdd52ee..4574ca1 100644 --- a/aai-traversal/src/test/java/org/onap/aai/rest/search/QueryTest.java +++ b/aai-traversal/src/test/java/org/onap/aai/rest/search/QueryTest.java @@ -142,7 +142,7 @@ public abstract class QueryTest { System.setProperty("AJSC_HOME", "."); System.setProperty("BUNDLECONFIG_DIR", "src/main/resources"); logger = LoggerFactory.getLogger(getClass()); - MockitoAnnotations.initMocks(this); + MockitoAnnotations.openMocks(this); graph = TinkerGraph.open(); gts = graph.traversal(); createGraph(); diff --git a/aai-traversal/src/test/java/org/onap/aai/rest/search/SimpleFormatTest.java b/aai-traversal/src/test/java/org/onap/aai/rest/search/SimpleFormatTest.java index 0b53b72..dc33e07 100644 --- a/aai-traversal/src/test/java/org/onap/aai/rest/search/SimpleFormatTest.java +++ b/aai-traversal/src/test/java/org/onap/aai/rest/search/SimpleFormatTest.java @@ -70,7 +70,7 @@ public class SimpleFormatTest extends AAISetup { @Before public void setUp() throws AAIException, NoEdgeRuleFoundException { - MockitoAnnotations.initMocks(this); + MockitoAnnotations.openMocks(this); graph = TinkerGraph.open(); loader = loaderFactory.createLoaderForVersion(ModelType.MOXY, schemaVersions.getRelatedLinkVersion()); |