From 0a763735660f607980ae6fb729890b8433713dcd Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Tue, 9 Jul 2024 14:01:25 +0200 Subject: Update Janusgraph to 0.6.0 in resources - update Janusgraph (0.5.3 -> 0.6.0) - remove all unused imports - use full context scanning with @SpringBootApplication Issue-ID: AAI-3927 Change-Id: I26af1f780c8463efbc0eb25255ecbf61261ab77d Signed-off-by: Fiete Ostkamp --- aai-resources/pom.xml | 39 ++-------------------- .../src/main/java/org/onap/aai/ResourcesApp.java | 13 ++------ .../java/org/onap/aai/rest/ExceptionHandler.java | 1 - .../java/org/onap/aai/rest/LegacyMoxyConsumer.java | 1 - .../org/onap/aai/rest/bulk/pojos/Operation.java | 2 +- .../java/org/onap/aai/rest/util/EchoResponse.java | 1 - .../java/org/onap/aai/web/JerseyConfiguration.java | 1 - .../src/test/java/org/onap/aai/AAISetup.java | 4 +-- .../onap/aai/it/performance/K6PerformanceTest.java | 4 +++ .../org/onap/aai/rest/AbstractSpringRestTest.java | 8 +++-- .../java/org/onap/aai/rest/ConfigurationTest.java | 4 +++ .../org/onap/aai/rest/ExceptionHandlerTest.java | 2 -- .../org/onap/aai/rest/ModelDistributionTest.java | 2 -- 13 files changed, 23 insertions(+), 59 deletions(-) (limited to 'aai-resources') diff --git a/aai-resources/pom.xml b/aai-resources/pom.xml index d580966..2ad5cb6 100644 --- a/aai-resources/pom.xml +++ b/aai-resources/pom.xml @@ -28,7 +28,7 @@ org.onap.aai.resources resources - 1.14.4-SNAPSHOT + 1.14.5-SNAPSHOT 1.8 @@ -40,8 +40,6 @@ localhost:5000 1.0.0 - alpine - 1.13.4 4.1.63.Final 4.1.63.Final @@ -83,8 +81,8 @@ 2.4.13 - 0.5.3 - 3.4.13 + 0.6.0 + 3.5.1 4.0.1 11.0.2 @@ -106,37 +104,6 @@ docker - - org.codehaus.groovy.maven - gmaven-plugin - 1.0 - - - pre-clean - - - parse-base - prepare-package - - execute - - - - def userAaiBaseImage = session.userProperties['aai.base.image'] - def userAaiCommonVersion = session.userProperties['aai.base.image.version'] - if (userAaiCommonVersion != null) { - project.properties['aai.base.image.version'] = userAaiCommonVersion - } - if (userAaiBaseImage != null) { - project.properties['aai.base.image'] = userAaiBaseImage - } - log.info 'Base image flavour: ' + project.properties['aai.base.image'] - log.info 'Base image version: ' + project.properties['aai.base.image.version'] - - - - - io.fabric8 docker-maven-plugin diff --git a/aai-resources/src/main/java/org/onap/aai/ResourcesApp.java b/aai-resources/src/main/java/org/onap/aai/ResourcesApp.java index 007b0d1..51f5609 100644 --- a/aai-resources/src/main/java/org/onap/aai/ResourcesApp.java +++ b/aai-resources/src/main/java/org/onap/aai/ResourcesApp.java @@ -37,24 +37,17 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration; +import org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; -import org.springframework.context.annotation.ComponentScan; import org.springframework.core.env.Environment; import org.springframework.core.env.Profiles; @SpringBootApplication( exclude = {DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class, - HibernateJpaAutoConfiguration.class}) -// Component Scan provides a way to look for spring beans -// It only searches beans in the following packages -// Any method annotated with @Bean annotation or any class -// with @Component, @Configuration, @Service will be picked up -@ComponentScan( - basePackages = {"org.onap.aai.config", "org.onap.aai.web", "org.onap.aai.setup", "org.onap.aai.tasks", - "org.onap.aai.service", "org.onap.aai.rest", "org.onap.aai.aaf", "org.onap.aai.TenantIsolation", - "org.onap.aai.aailog", "org.onap.aai.prevalidation"}) + HibernateJpaAutoConfiguration.class, CassandraDataAutoConfiguration.class, CassandraAutoConfiguration.class}) public class ResourcesApp { private static final Logger logger = LoggerFactory.getLogger(ResourcesApp.class.getName()); diff --git a/aai-resources/src/main/java/org/onap/aai/rest/ExceptionHandler.java b/aai-resources/src/main/java/org/onap/aai/rest/ExceptionHandler.java index 81c49b9..7af598b 100644 --- a/aai-resources/src/main/java/org/onap/aai/rest/ExceptionHandler.java +++ b/aai-resources/src/main/java/org/onap/aai/rest/ExceptionHandler.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.JsonMappingException; import com.sun.istack.SAXParseException2; import java.util.ArrayList; -import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.WebApplicationException; diff --git a/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java index c518258..689e0b4 100644 --- a/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java +++ b/aai-resources/src/main/java/org/onap/aai/rest/LegacyMoxyConsumer.java @@ -47,7 +47,6 @@ import org.onap.aai.introspection.sideeffect.OwnerCheck; import org.onap.aai.query.builder.Pageable; import org.onap.aai.parsers.query.QueryParser; import org.onap.aai.query.builder.QueryOptions; -import org.onap.aai.query.builder.Sort; import org.onap.aai.rest.db.DBRequest; import org.onap.aai.rest.db.HttpEntry; import org.onap.aai.rest.exceptions.AAIInvalidXMLNamespace; diff --git a/aai-resources/src/main/java/org/onap/aai/rest/bulk/pojos/Operation.java b/aai-resources/src/main/java/org/onap/aai/rest/bulk/pojos/Operation.java index 814cea0..1920b37 100644 --- a/aai-resources/src/main/java/org/onap/aai/rest/bulk/pojos/Operation.java +++ b/aai-resources/src/main/java/org/onap/aai/rest/bulk/pojos/Operation.java @@ -20,7 +20,7 @@ package org.onap.aai.rest.bulk.pojos; -import com.google.gson.*; +import com.google.gson.JsonObject; import com.google.gson.annotations.SerializedName; public class Operation { diff --git a/aai-resources/src/main/java/org/onap/aai/rest/util/EchoResponse.java b/aai-resources/src/main/java/org/onap/aai/rest/util/EchoResponse.java index d4d8d32..0e44a63 100644 --- a/aai-resources/src/main/java/org/onap/aai/rest/util/EchoResponse.java +++ b/aai-resources/src/main/java/org/onap/aai/rest/util/EchoResponse.java @@ -21,7 +21,6 @@ package org.onap.aai.rest.util; import java.util.ArrayList; -import java.util.HashMap; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.GET; diff --git a/aai-resources/src/main/java/org/onap/aai/web/JerseyConfiguration.java b/aai-resources/src/main/java/org/onap/aai/web/JerseyConfiguration.java index 24004d1..41ec8e1 100644 --- a/aai-resources/src/main/java/org/onap/aai/web/JerseyConfiguration.java +++ b/aai-resources/src/main/java/org/onap/aai/web/JerseyConfiguration.java @@ -47,7 +47,6 @@ import org.onap.aai.rest.bulk.BulkSingleTransactionConsumer; import org.onap.aai.rest.util.EchoResponse; import org.onap.logging.filter.base.AuditLogContainerFilter; import org.reflections.Reflections; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; 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 b510c00..81ed8c3 100644 --- a/aai-resources/src/test/java/org/onap/aai/AAISetup.java +++ b/aai-resources/src/test/java/org/onap/aai/AAISetup.java @@ -32,7 +32,6 @@ import org.junit.ClassRule; import org.junit.Rule; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.extension.ExtendWith; -import org.junit.runner.RunWith; import org.onap.aai.config.ConfigConfiguration; import org.onap.aai.config.IntrospectionConfig; import org.onap.aai.config.RestBeanConfig; @@ -43,6 +42,7 @@ import org.onap.aai.introspection.LoaderFactory; import org.onap.aai.introspection.MoxyLoader; import org.onap.aai.nodes.NodeIngestor; import org.onap.aai.rest.db.HttpEntry; +import org.onap.aai.rest.notification.NotificationService; import org.onap.aai.serialization.db.EdgeSerializer; import org.onap.aai.setup.AAIConfigTranslator; import org.onap.aai.setup.SchemaVersion; @@ -58,7 +58,7 @@ import org.springframework.test.context.junit4.rules.SpringMethodRule; @ContextConfiguration( classes = {ConfigConfiguration.class, AAIConfigTranslator.class, NodeIngestor.class, EdgeIngestor.class, EdgeSerializer.class, SpringContextAware.class, IntrospectionConfig.class, - XmlFormatTransformerConfiguration.class, RestBeanConfig.class}) + XmlFormatTransformerConfiguration.class, RestBeanConfig.class, LoaderFactory.class, NotificationService.class}) @TestPropertySource( properties = {"schema.uri.base.path = /aai", "schema.ingest.file = src/test/resources/application-test.properties"}) diff --git a/aai-resources/src/test/java/org/onap/aai/it/performance/K6PerformanceTest.java b/aai-resources/src/test/java/org/onap/aai/it/performance/K6PerformanceTest.java index 64b4f3c..00179fe 100644 --- a/aai-resources/src/test/java/org/onap/aai/it/performance/K6PerformanceTest.java +++ b/aai-resources/src/test/java/org/onap/aai/it/performance/K6PerformanceTest.java @@ -36,6 +36,9 @@ import org.onap.aai.db.props.AAIProperties; import org.onap.aai.dbmap.AAIGraph; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration; +import org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.web.server.LocalServerPort; @@ -48,6 +51,7 @@ import lombok.SneakyThrows; @Testcontainers @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@EnableAutoConfiguration(exclude={CassandraDataAutoConfiguration.class, CassandraAutoConfiguration.class}) // there is no running cassandra instance for the test public class K6PerformanceTest { private static final Logger logger = LoggerFactory.getLogger(ResourcesApp.class.getName()); diff --git a/aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java b/aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java index 9e901ad..82d726e 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/AbstractSpringRestTest.java @@ -41,6 +41,9 @@ import org.onap.aai.nodes.NodeIngestor; import org.onap.aai.restclient.PropertyPasswordConfiguration; import org.onap.aai.util.AAIConfig; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration; +import org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.context.annotation.Import; @@ -53,10 +56,11 @@ import org.springframework.test.context.junit4.rules.SpringClassRule; import org.springframework.test.context.junit4.rules.SpringMethodRule; import org.springframework.web.client.RestTemplate; -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = ResourcesApp.class) +@Import(ResourcesTestConfiguration.class) @TestPropertySource(locations = "classpath:application-test.properties") @ContextConfiguration(initializers = PropertyPasswordConfiguration.class) -@Import(ResourcesTestConfiguration.class) +@EnableAutoConfiguration(exclude={CassandraDataAutoConfiguration.class, CassandraAutoConfiguration.class}) // there is no running cassandra instance for the test +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = ResourcesApp.class) public abstract class AbstractSpringRestTest { @ClassRule diff --git a/aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java b/aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java index 5e1142d..21f2fb4 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/ConfigurationTest.java @@ -38,6 +38,9 @@ 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.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration; +import org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.context.annotation.Import; @@ -57,6 +60,7 @@ import org.springframework.web.client.RestTemplate; @TestPropertySource(locations = "classpath:application-test.properties") @ContextConfiguration(initializers = PropertyPasswordConfiguration.class, classes = {SpringContextAware.class}) +@EnableAutoConfiguration(exclude={CassandraDataAutoConfiguration.class, CassandraAutoConfiguration.class}) // there is no running cassandra instance for the test @Import(ResourcesTestConfiguration.class) @SpringBootTest( webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, 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 0780649..21baedc 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 @@ -27,8 +27,6 @@ import static org.junit.jupiter.api.Assertions.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.core.JsonParser; import com.fasterxml.jackson.databind.JsonMappingException; diff --git a/aai-resources/src/test/java/org/onap/aai/rest/ModelDistributionTest.java b/aai-resources/src/test/java/org/onap/aai/rest/ModelDistributionTest.java index 374519e..6679c0b 100644 --- a/aai-resources/src/test/java/org/onap/aai/rest/ModelDistributionTest.java +++ b/aai-resources/src/test/java/org/onap/aai/rest/ModelDistributionTest.java @@ -26,9 +26,7 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.Collections; -import org.json.JSONObject; import org.junit.jupiter.api.Test; -import org.onap.aai.rest.AbstractSpringRestTest; import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; -- cgit 1.2.3-korg