diff options
Diffstat (limited to 'aai-traversal/src')
-rw-r--r-- | aai-traversal/src/main/java/org/onap/aai/interceptors/pre/RequestTransactionLogging.java | 11 | ||||
-rw-r--r-- | aai-traversal/src/main/java/org/onap/aai/rest/search/CustomQueryConfigDTO.java | 5 | ||||
-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 |
10 files changed, 18 insertions, 23 deletions
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()); |