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 /aai-traversal/src/test/java | |
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>
Diffstat (limited to 'aai-traversal/src/test/java')
-rw-r--r-- | aai-traversal/src/test/java/org/onap/aai/dbgraphgen/ModelBasedProcessingInvalidDataTest.java | 2 | ||||
-rw-r--r-- | aai-traversal/src/test/java/org/onap/aai/dbgraphgen/ModelBasedProcessingTest.java | 2 | ||||
-rw-r--r-- | aai-traversal/src/test/java/org/onap/aai/rest/BadQueryFormatTest.java | 2 | ||||
-rw-r--r-- | aai-traversal/src/test/java/org/onap/aai/rest/ConfigurationTest.java | 9 | ||||
-rw-r--r-- | aai-traversal/src/test/java/org/onap/aai/rest/GlobalExceptionHandlerTest.java (renamed from aai-traversal/src/test/java/org/onap/aai/rest/SpringExceptionHandlerTest.java) | 4 | ||||
-rw-r--r-- | aai-traversal/src/test/java/org/onap/aai/rest/search/OnapQueryTest.java | 2 | ||||
-rw-r--r-- | aai-traversal/src/test/java/org/onap/aai/rest/search/QueryTest.java | 2 | ||||
-rw-r--r-- | aai-traversal/src/test/java/org/onap/aai/rest/search/SimpleFormatTest.java | 2 |
8 files changed, 14 insertions, 11 deletions
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()); |