diff options
author | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-07-12 10:52:39 +0200 |
---|---|---|
committer | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-08-06 08:35:34 +0200 |
commit | 3cd31c39b0ea2a4db9c03534761519f94101f6c8 (patch) | |
tree | 3364ccd530791e6efcfdaf8bd29e3000ab5736b9 | |
parent | 6fb0e1ab36f343c97d88666262e270db91f72505 (diff) |
Update Janusgraph to 0.6.0 in graphadmin
- update Janusgraph (0.5.3 -> 0.6.0)
- update Tinkerpop (3.4.13 -> 3.5.1)
- bump version to 1.14.5-SNAPSHOT
Issue-ID: AAI-3929
Change-Id: I75bccadca63eb7cd67bd8f9ebbb8d79978138bcc
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
16 files changed, 256 insertions, 104 deletions
@@ -26,7 +26,7 @@ <parent> <groupId>org.onap.aai.aai-common</groupId> <artifactId>aai-parent</artifactId> - <version>1.14.4</version> + <version>1.14.5</version> </parent> <groupId>org.onap.aai.graphadmin</groupId> <artifactId>aai-graphadmin</artifactId> @@ -55,15 +55,10 @@ <docker.push.registry>localhost:5000</docker.push.registry> <aai.docker.version>1.0.0</aai.docker.version> <aai.schema.service.version>1.12.5</aai.schema.service.version> - <aai.common.version>1.14.4</aai.common.version> + <aai.common.version>1.14.5</aai.common.version> <aai.build.directory>${project.build.directory}/${project.artifactId}-${project.version}-build/ </aai.build.directory> <aai.docker.namespace>onap</aai.docker.namespace> - <!-- base image for aai-common --> - <aai.base.image>alpine</aai.base.image> - <!-- aai-common image version --> - <aai.base.image.version>1.13.4</aai.base.image.version> - <!-- End of Docker Related Properties --> <license.goal.type>check</license.goal.type> @@ -102,8 +97,6 @@ <schema.uri.base.path>/aai</schema.uri.base.path> <!-- End of Default ONAP Schema Properties --> - <janusgraph.version>0.5.3</janusgraph.version> - <gremlin.version>3.4.13</gremlin.version> <micrometer.version>1.8.1</micrometer.version> <activemq.version>5.16.7</activemq.version> <antlr.version>4.9.3</antlr.version> @@ -246,37 +239,6 @@ <build> <plugins> <plugin> - <groupId>org.codehaus.groovy.maven</groupId> - <artifactId>gmaven-plugin</artifactId> - <version>1.0</version> - <executions> - <execution> - <phase>pre-clean</phase> - </execution> - <execution> - <id>parse-base</id> - <phase>prepare-package</phase> - <goals> - <goal>execute</goal> - </goals> - <configuration> - <source> - 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']; - </source> - </configuration> - </execution> - </executions> - </plugin> - <plugin> <groupId>io.fabric8</groupId> <artifactId>docker-maven-plugin</artifactId> <version>${docker.fabric.version}</version> @@ -477,6 +439,10 @@ <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> </exclusion> + <exclusion> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-validator</artifactId> + </exclusion> </exclusions> </dependency> <dependency> diff --git a/src/main/java/org/onap/aai/GraphAdminApp.java b/src/main/java/org/onap/aai/GraphAdminApp.java index ebb4634..74328ac 100644 --- a/src/main/java/org/onap/aai/GraphAdminApp.java +++ b/src/main/java/org/onap/aai/GraphAdminApp.java @@ -33,6 +33,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 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.orm.jpa.HibernateJpaAutoConfiguration; import org.springframework.context.annotation.ComponentScan; @@ -63,17 +65,24 @@ import javax.annotation.PreDestroy; "org.onap.aai.datacleanup", "org.onap.aai.aailog", "org.onap.aai.failover", - "org.onap.aai.audit" + "org.onap.aai.audit", + "org.onap.aai.introspection", + "org.onap.aai.rest.notification" }) @EnableAsync @EnableScheduling @EnableAspectJAutoProxy -@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class}) +@EnableAutoConfiguration(exclude = { + DataSourceAutoConfiguration.class, + HibernateJpaAutoConfiguration.class, + CassandraDataAutoConfiguration.class, + CassandraAutoConfiguration.class +}) public class GraphAdminApp { public static final String APP_NAME = "GraphAdmin"; private static final Logger LOGGER = LoggerFactory.getLogger(GraphAdminApp.class); - + private static AaiDebugLog debugLog = new AaiDebugLog(); static { debugLog.setupMDC(); @@ -128,7 +137,7 @@ public class GraphAdminApp { AAIGraph.getInstance(); - System.setProperty("org.onap.aai.graphadmin.started", "true"); + System.setProperty("org.onap.aai.graphadmin.started", "true"); LOGGER.info("GraphAdmin MicroService Started"); LOGGER.debug("GraphAdmin MicroService Started"); System.out.println("GraphAdmin Microservice Started"); diff --git a/src/main/java/org/onap/aai/datasnapshot/DataSnapshot.java b/src/main/java/org/onap/aai/datasnapshot/DataSnapshot.java index 5015213..9feb6d7 100644 --- a/src/main/java/org/onap/aai/datasnapshot/DataSnapshot.java +++ b/src/main/java/org/onap/aai/datasnapshot/DataSnapshot.java @@ -40,14 +40,13 @@ import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; -import org.apache.commons.configuration.PropertiesConfiguration; +import org.apache.commons.configuration2.PropertiesConfiguration; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.io.IoCore; import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONIo; import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONVersion; import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphFactory; -import org.janusgraph.core.util.JanusGraphCleanup; import org.onap.aai.dbmap.AAIGraph; import org.onap.aai.dbmap.AAIGraphConfig; import org.onap.aai.exceptions.AAIException; @@ -701,7 +700,7 @@ public class DataSnapshot { verifyGraph(janusGraph); GraphAdminDBUtils.logConfigs(janusGraph.configuration()); janusGraph.close(); - JanusGraphCleanup.clear(janusGraph); + JanusGraphFactory.drop(janusGraph); LOGGER.debug(" Done clearing data. "); LOGGER.debug(">>> IMPORTANT - NOTE >>> you need to run the SchemaGenerator (use GenTester) before "); LOGGER.debug(" reloading data or the data will be put in without indexes. "); diff --git a/src/main/java/org/onap/aai/datasnapshot/DataSnapshot4HistInit.java b/src/main/java/org/onap/aai/datasnapshot/DataSnapshot4HistInit.java index 43c31e1..85bf142 100644 --- a/src/main/java/org/onap/aai/datasnapshot/DataSnapshot4HistInit.java +++ b/src/main/java/org/onap/aai/datasnapshot/DataSnapshot4HistInit.java @@ -42,13 +42,12 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import org.onap.aai.restclient.PropertyPasswordConfiguration; import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.commons.configuration.PropertiesConfiguration; +import org.apache.commons.configuration2.PropertiesConfiguration; import org.apache.tinkerpop.gremlin.structure.io.IoCore; import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONIo; import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONVersion; import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphFactory; -import org.janusgraph.core.util.JanusGraphCleanup; import org.onap.aai.dbmap.AAIGraph; import org.onap.aai.dbmap.AAIGraphConfig; import org.onap.aai.exceptions.AAIException; @@ -803,7 +802,7 @@ public class DataSnapshot4HistInit { verifyGraph(janusGraph); GraphAdminDBUtils.logConfigs(janusGraph.configuration()); janusGraph.close(); - JanusGraphCleanup.clear(janusGraph); + JanusGraphFactory.drop(janusGraph); LOGGER.debug(" Done clearing data. "); LOGGER.debug(">>> IMPORTANT - NOTE >>> you need to run the SchemaGenerator (use GenTester) before "); LOGGER.debug(" reloading data or the data will be put in without indexes. "); diff --git a/src/main/java/org/onap/aai/db/schema/ScriptDriver.java b/src/main/java/org/onap/aai/db/schema/ScriptDriver.java index 3d9ec69..a70239f 100644 --- a/src/main/java/org/onap/aai/db/schema/ScriptDriver.java +++ b/src/main/java/org/onap/aai/db/schema/ScriptDriver.java @@ -22,8 +22,7 @@ package org.onap.aai.db.schema; import com.beust.jcommander.JCommander; import com.beust.jcommander.Parameter; import com.fasterxml.jackson.databind.ObjectMapper; -import org.apache.commons.configuration.ConfigurationException; -import org.apache.commons.configuration.PropertiesConfiguration; +import org.apache.commons.configuration2.PropertiesConfiguration; import org.codehaus.jackson.JsonGenerationException; import org.janusgraph.core.JanusGraph; import org.janusgraph.core.JanusGraphFactory; @@ -50,13 +49,14 @@ public class ScriptDriver { * @throws AAIException the AAI exception * @throws JsonGenerationException the json generation exception * @throws IOException Signals that an I/O exception has occurred. + * @throws org.apache.commons.configuration2.ex.ConfigurationException */ - public static void main (String[] args) throws AAIException, IOException, ConfigurationException, ErrorObjectFormatException { + public static void main (String[] args) throws AAIException, IOException, ErrorObjectFormatException, org.apache.commons.configuration2.ex.ConfigurationException { CommandLineArgs cArgs = new CommandLineArgs(); - + ErrorLogHelper.loadProperties(); new JCommander(cArgs, args); - + if (cArgs.help) { System.out.println("-c [path to graph configuration] -type [what you want to audit - oxm or graph]"); } @@ -67,7 +67,7 @@ public class ScriptDriver { try { ctx.scan( "org.onap.aai.config", - "org.onap.aai.setup" + "org.onap.aai" ); ctx.refresh(); @@ -108,19 +108,19 @@ public class ScriptDriver { System.out.println(json); } } - + } class CommandLineArgs { - + @Parameter(names = "--help", description = "Help") public boolean help = false; - + @Parameter(names = "-c", description = "Configuration", required=true) public String config; - + @Parameter(names = "-type", description = "Type", required=true) public String type = "graph"; - -}
\ No newline at end of file + +} diff --git a/src/main/java/org/onap/aai/dbgen/ForceDeleteTool.java b/src/main/java/org/onap/aai/dbgen/ForceDeleteTool.java index 1228649..451e344 100644 --- a/src/main/java/org/onap/aai/dbgen/ForceDeleteTool.java +++ b/src/main/java/org/onap/aai/dbgen/ForceDeleteTool.java @@ -28,7 +28,6 @@ import java.util.Properties; import java.util.Scanner; import java.util.UUID; -import org.apache.commons.configuration.ConfigurationException; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; import org.apache.tinkerpop.gremlin.structure.Direction; diff --git a/src/main/java/org/onap/aai/dbgen/UpdatePropertyToolInternal.java b/src/main/java/org/onap/aai/dbgen/UpdatePropertyToolInternal.java index 1e41a91..3b7c4b8 100644 --- a/src/main/java/org/onap/aai/dbgen/UpdatePropertyToolInternal.java +++ b/src/main/java/org/onap/aai/dbgen/UpdatePropertyToolInternal.java @@ -25,7 +25,7 @@ import org.slf4j.LoggerFactory; import com.beust.jcommander.JCommander; import com.beust.jcommander.Parameter; -import org.apache.commons.configuration.PropertiesConfiguration; +import org.apache.commons.configuration2.PropertiesConfiguration; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Vertex; diff --git a/src/main/java/org/onap/aai/migration/MigrationControllerInternal.java b/src/main/java/org/onap/aai/migration/MigrationControllerInternal.java index f2b727f..7a170c3 100644 --- a/src/main/java/org/onap/aai/migration/MigrationControllerInternal.java +++ b/src/main/java/org/onap/aai/migration/MigrationControllerInternal.java @@ -23,8 +23,10 @@ package org.onap.aai.migration; import com.att.eelf.configuration.Configuration; import com.beust.jcommander.JCommander; import com.beust.jcommander.Parameter; -import org.apache.commons.configuration.ConfigurationException; -import org.apache.commons.configuration.PropertiesConfiguration; +import org.apache.commons.configuration2.ex.ConfigurationException; +import org.apache.commons.configuration2.PropertiesConfiguration; +import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder; +import org.apache.commons.configuration2.builder.fluent.Parameters; import org.apache.commons.lang.exception.ExceptionUtils; import org.onap.aai.datasnapshot.DataSnapshot; import org.onap.aai.db.props.AAIProperties; @@ -111,7 +113,12 @@ public class MigrationControllerInternal { // graph storage backend of inmemory if (cArgs.dataSnapshot != null && !cArgs.dataSnapshot.isEmpty()) { try { - PropertiesConfiguration config = new PropertiesConfiguration(cArgs.config); + FileBasedConfigurationBuilder<PropertiesConfiguration> builder = + new FileBasedConfigurationBuilder<PropertiesConfiguration>(PropertiesConfiguration.class) + .configure(new Parameters().properties() + .setFileName(cArgs.config)); + PropertiesConfiguration config = builder.getConfiguration(); + // PropertiesConfiguration config = new PropertiesConfiguration(cArgs.config); if (config.getString("storage.backend").equals("inmemory")) { System.setProperty("snapshot.location", cArgs.dataSnapshot); String snapshotLocation =cArgs.dataSnapshot; diff --git a/src/main/java/org/onap/aai/migration/NotificationHelper.java b/src/main/java/org/onap/aai/migration/NotificationHelper.java index f08c56d..817e5df 100644 --- a/src/main/java/org/onap/aai/migration/NotificationHelper.java +++ b/src/main/java/org/onap/aai/migration/NotificationHelper.java @@ -32,7 +32,7 @@ import org.onap.aai.introspection.Introspector; import org.onap.aai.introspection.Loader; import org.onap.aai.introspection.LoaderFactory; import org.onap.aai.introspection.exceptions.AAIUnknownObjectException; -import org.onap.aai.rest.ueb.UEBNotification; +import org.onap.aai.rest.notification.UEBNotification; import org.onap.aai.serialization.db.DBSerializer; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import org.onap.aai.serialization.engines.query.QueryEngine; @@ -64,9 +64,9 @@ public class NotificationHelper { this.notification = new UEBNotification(loader, loaderFactory, schemaVersions); MDC.put("logFilenameAppender", this.getClass().getSimpleName()); LOGGER = LoggerFactory.getLogger(this.getClass().getSimpleName()); - + } - + public void addEvent(Vertex v, Introspector obj, EventAction action, URI uri, String basePath) throws UnsupportedEncodingException, AAIException { HashMap<String, Introspector> relatedObjects = new HashMap<>(); Status status = mapAction(action); @@ -75,15 +75,15 @@ public class NotificationHelper { relatedObjects = this.getRelatedObjects(serializer, engine.getQueryEngine(), v); } notification.createNotificationEvent(transactionId, sourceOfTruth, status, uri, obj, relatedObjects, basePath); - + } - + public void addDeleteEvent(String transactionId, String sourceOfTruth, EventAction action, URI uri, Introspector obj, HashMap relatedObjects,String basePath) throws UnsupportedEncodingException, AAIException { Status status = mapAction(action); notification.createNotificationEvent(transactionId, sourceOfTruth, status, uri, obj, relatedObjects, basePath); - + } - + private HashMap<String, Introspector> getRelatedObjects(DBSerializer serializer, QueryEngine queryEngine, Vertex v) throws AAIException { HashMap<String, Introspector> relatedVertices = new HashMap<>(); List<Vertex> vertexChain = queryEngine.findParents(v); @@ -94,12 +94,12 @@ public class NotificationHelper { } catch (AAIUnknownObjectException | UnsupportedEncodingException e) { LOGGER.warn("Unable to get vertex properties, partial list of related vertices returned"); } - + } - + return relatedVertices; } - + private Status mapAction(EventAction action) { if (EventAction.CREATE.equals(action)) { return Status.CREATED; @@ -111,7 +111,7 @@ public class NotificationHelper { return Status.OK; } } - + public void triggerEvents() throws AAIException { notification.triggerEvents(); } diff --git a/src/main/java/org/onap/aai/rest/QueryConsumer.java b/src/main/java/org/onap/aai/rest/QueryConsumer.java index b709cfa..a0ba61a 100644 --- a/src/main/java/org/onap/aai/rest/QueryConsumer.java +++ b/src/main/java/org/onap/aai/rest/QueryConsumer.java @@ -44,6 +44,7 @@ import org.onap.aai.util.AAIConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @@ -56,10 +57,10 @@ import java.util.List; @Component @Path("{version: v[1-9][0-9]*|latest}/dbquery") public class QueryConsumer extends RESTAPI { - + /** The introspector factory type. */ private ModelType introspectorFactoryType = ModelType.MOXY; - + private QueryProcessorType processorType = QueryProcessorType.LOCAL_GROOVY; private static final String TARGET_ENTITY = "DB"; @@ -75,7 +76,7 @@ public class QueryConsumer extends RESTAPI { @Autowired public QueryConsumer( - HttpEntry traversalUriHttpEntry, + @Qualifier("traversalUriHttpEntry") HttpEntry traversalUriHttpEntry, DslQueryProcessor dslQueryProcessor, SchemaVersions schemaVersions, @Value("${schema.uri.base.path}") String basePath @@ -121,14 +122,14 @@ public class QueryConsumer extends RESTAPI { } SubGraphStyle subGraphStyle = SubGraphStyle.valueOf(subgraph); JsonParser parser = new JsonParser(); - + JsonObject input = parser.parse(content).getAsJsonObject(); - + JsonElement gremlinElement = input.get("gremlin"); JsonElement dslElement = input.get("dsl"); String gremlin = ""; String dsl = ""; - + SchemaVersion version = new SchemaVersion(versionParam); traversalUriHttpEntry.setHttpEntryProperties(version); dbEngine = traversalUriHttpEntry.getDbEngine(); @@ -140,9 +141,9 @@ public class QueryConsumer extends RESTAPI { dsl = dslElement.getAsString(); } GenericQueryProcessor processor; - + StopWatch.conditionalStart(); - + if(!dsl.equals("")){ processor = new GenericQueryProcessor.Builder(dbEngine) .queryFrom(dsl, "dsl") @@ -156,20 +157,20 @@ public class QueryConsumer extends RESTAPI { String result = ""; List<Object> vertices = processor.execute(subGraphStyle); - + DBSerializer serializer = new DBSerializer(version, dbEngine, introspectorFactoryType, sourceOfTruth); FormatFactory ff = new FormatFactory(traversalUriHttpEntry.getLoader(), serializer, schemaVersions, basePath); - + Formatter formater = ff.get(format, info.getQueryParameters()); - + result = formater.output(vertices).toString(); LOGGER.info ("Completed"); - + response = Response.status(Status.OK) .type(MediaType.APPLICATION_JSON) .entity(result).build(); - + } catch (AAIException e) { response = consumerExceptionResponseGenerator(headers, info, HttpMethod.GET, e); } catch (Exception e ) { @@ -179,14 +180,14 @@ public class QueryConsumer extends RESTAPI { if (dbEngine != null) { dbEngine.rollback(); } - + } - + return response; } - + public void checkQueryParams(MultivaluedMap<String, String> params) throws AAIException { - + if (params.containsKey("depth") && params.getFirst("depth").matches("\\d+")) { String depth = params.getFirst("depth"); int i = Integer.parseInt(depth); @@ -194,8 +195,8 @@ public class QueryConsumer extends RESTAPI { throw new AAIException("AAI_3303"); } } - - + + } } diff --git a/src/main/java/org/onap/aai/schema/GenTester.java b/src/main/java/org/onap/aai/schema/GenTester.java index 2993d90..6674610 100644 --- a/src/main/java/org/onap/aai/schema/GenTester.java +++ b/src/main/java/org/onap/aai/schema/GenTester.java @@ -70,7 +70,8 @@ public class GenTester { try { ctx.scan( "org.onap.aai.config", - "org.onap.aai.setup"); + "org.onap.aai.setup", + "org.onap.aai.introspection"); ctx.refresh(); } catch (Exception e) { AAIException aai = ExceptionTranslator.schemaServiceExceptionTranslator(e); @@ -175,7 +176,7 @@ public class GenTester { * or JanusGraph instances. * This is because a state change needs to be acknowledged by all instances * before transitioning. - * + * * @param graph * @return */ @@ -202,4 +203,4 @@ public class GenTester { graphMgtForClosing.commit(); } -}
\ No newline at end of file +} diff --git a/src/main/java/org/onap/aai/util/GraphAdminDBUtils.java b/src/main/java/org/onap/aai/util/GraphAdminDBUtils.java index bc2810b..6351465 100644 --- a/src/main/java/org/onap/aai/util/GraphAdminDBUtils.java +++ b/src/main/java/org/onap/aai/util/GraphAdminDBUtils.java @@ -32,7 +32,7 @@ public class GraphAdminDBUtils { } - public static void logConfigs(org.apache.commons.configuration.Configuration configuration) { + public static void logConfigs(org.apache.commons.configuration2.Configuration configuration) { if (configuration != null && configuration.getKeys() != null) { Iterator<String> keys = configuration.getKeys(); diff --git a/src/test/java/org/onap/aai/AAIGremlinQueryTest.java b/src/test/java/org/onap/aai/AAIGremlinQueryTest.java index 55506a9..96d05db 100644 --- a/src/test/java/org/onap/aai/AAIGremlinQueryTest.java +++ b/src/test/java/org/onap/aai/AAIGremlinQueryTest.java @@ -29,6 +29,9 @@ import org.onap.aai.exceptions.AAIException; import org.onap.aai.util.AAIConfig; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.server.LocalServerPort; +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.context.annotation.Import; import org.springframework.http.*; @@ -60,6 +63,7 @@ import static org.junit.Assert.fail; * they will be testing against the same thing except fitnesse uses hbase */ @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = GraphAdminApp.class) +@EnableAutoConfiguration(exclude={CassandraDataAutoConfiguration.class, CassandraAutoConfiguration.class}) // there is no running cassandra instance for the test @ContextConfiguration(initializers = PropertyPasswordConfiguration.class) @Import(GraphAdminTestConfiguration.class) @TestPropertySource( diff --git a/src/test/java/org/onap/aai/AAISetup.java b/src/test/java/org/onap/aai/AAISetup.java index 2f502a8..d742ff1 100644 --- a/src/test/java/org/onap/aai/AAISetup.java +++ b/src/test/java/org/onap/aai/AAISetup.java @@ -34,6 +34,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; @@ -62,7 +63,9 @@ import static org.junit.Assert.assertNotNull; DslConfiguration.class, IntrospectionConfig.class, XmlFormatTransformerConfiguration.class, - RestBeanConfig.class + RestBeanConfig.class, + LoaderFactory.class, + NotificationService.class }) @TestPropertySource(properties = { "schema.uri.base.path = /aai", @@ -137,4 +140,4 @@ public abstract class AAISetup { String resource = IOUtils.toString(inputStream); return resource; } -}
\ No newline at end of file +} diff --git a/src/test/java/org/onap/aai/MetricsConfigurationTest.java b/src/test/java/org/onap/aai/MetricsConfigurationTest.java index 68b2ca8..39a6673 100644 --- a/src/test/java/org/onap/aai/MetricsConfigurationTest.java +++ b/src/test/java/org/onap/aai/MetricsConfigurationTest.java @@ -38,9 +38,11 @@ import org.onap.aai.exceptions.AAIException; import org.onap.aai.restclient.PropertyPasswordConfiguration; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.actuate.autoconfigure.web.server.LocalManagementPort; +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.autoconfigure.actuate.metrics.AutoConfigureMetrics; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.context.annotation.Import; import org.springframework.http.*; @@ -57,6 +59,7 @@ import org.springframework.web.client.RestTemplate; @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {SpringContextAware.class, GraphAdminApp.class}) @ContextConfiguration(initializers = PropertyPasswordConfiguration.class, classes = {SpringContextAware.class}) +@EnableAutoConfiguration(exclude={CassandraDataAutoConfiguration.class, CassandraAutoConfiguration.class}) // there is no running cassandra instance for the test @Import(GraphAdminTestConfiguration.class) @TestPropertySource(locations = "classpath:application-test.properties") public class MetricsConfigurationTest { diff --git a/src/test/resources/etc/appprops/aaiconfig.properties b/src/test/resources/etc/appprops/aaiconfig.properties new file mode 100644 index 0000000..b2dd2ed --- /dev/null +++ b/src/test/resources/etc/appprops/aaiconfig.properties @@ -0,0 +1,161 @@ +# +# ============LICENSE_START======================================================= +# org.onap.aai +# ================================================================================ +# Copyright © 2017-18 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= + +#################################################################### +# REMEMBER TO THINK ABOUT ENVIRONMENTAL DIFFERENCES AND CHANGE THE +# TEMPLATE AND *ALL* DATAFILES +#################################################################### + +aai.config.checktime=1000 + +# this could come from siteconfig.pl? +aai.config.nodename=AutomaticallyOverwritten + +aai.transaction.logging=true +aai.transaction.logging.get=true +aai.transaction.logging.post=true + +aai.server.url.base=https://localhost:8443/aai/ +aai.server.url=https://localhost:8443/aai/v14/ +aai.oldserver.url.base=https://localhost:8443/aai/servers/ +aai.oldserver.url=https://localhost:8443/aai/servers/v2/ +aai.global.callback.url=https://localhost:8443/aai/ + +# Start of INTERNAL Specific Properties + +aai.truststore.filename=aai_keystore +aai.truststore.passwd.x=OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0 +aai.keystore.filename=aai-client-cert.p12 +aai.keystore.passwd.x=OBF:1vn21ugu1saj1v9i1v941sar1ugw1vo0 + +aai.realtime.clients=RO,SDNC,MSO,SO + +# End of INTERNAL Specific Properties + +aai.notification.current.version=v14 +aai.notificationEvent.default.status=UNPROCESSED +aai.notificationEvent.default.eventType=AAI-EVENT +aai.notificationEvent.default.domain=devINT1 +aai.notificationEvent.default.sourceName=aai +aai.notificationEvent.default.sequenceNumber=0 +aai.notificationEvent.default.severity=NORMAL +aai.notificationEvent.default.version=v14 +# This one lets us enable/disable resource-version checking on updates/deletes +aai.resourceversion.enableflag=true +aai.logging.maxStackTraceEntries=10 +aai.default.api.version=v14 + +# Used by Model-processing code +aai.model.delete.sleep.per.vtx.msec=500 +aai.model.query.resultset.maxcount=50 +aai.model.query.timeout.sec=90 + +# Used by Data Grooming +aai.grooming.default.max.fix=150 +aai.grooming.default.sleep.minutes=7 + +# Used by Data Snapshot +aai.datasnapshot.default.threads.for.create=16 +aai.datasnapshot.max.nodes.per.file.for.create=120000 + +# Used by DupeTool +aai.dupeTool.default.max.fix=25 +aai.dupeTool.default.sleep.minutes=7 + +aai.model.proc.max.levels=50 +aai.edgeTag.proc.max.levels=50 + +# Used by the ForceDelete tool +aai.forceDel.protected.nt.list=cloud-region +aai.forceDel.protected.edge.count=10 +aai.forceDel.protected.descendant.count=10 + +# Used for CTAG-Pool generation +aai.ctagPool.rangeString.vplsPe1=2001-2500 +aai.ctagPool.rangeString.vplsPe2=2501-3000 + +aai.jms.enable=false + +#used by the dataGrooming and dataSnapshot cleanup tasks +aai.cron.enable.datagroomingcleanup=true +aai.cron.enable.datasnapshotcleanup=true +aai.datagrooming.agezip=5 +aai.datagrooming.agedelete=30 +aai.datasnapshot.agezip=5 +aai.datasnapshot.agedelete=30 +aai.datamigration.agedelete=30 + +#used by the dataSnapshot and dataGrooming tasks +aai.cron.enable.dataSnapshot=true +aai.cron.enable.dataGrooming=true + +#used by the dataGrooming tasks +aai.datagrooming.enableautofix=true +aai.datagrooming.enabledupefixon=true +aai.datagrooming.enabledontfixorphans=true +aai.datagrooming.enabletimewindowminutes=true +aai.datagrooming.enableskiphostcheck=false +aai.datagrooming.enablesleepminutes=false +aai.datagrooming.enableedgesonly=false +aai.datagrooming.enableskipedgechecks=false +aai.datagrooming.enablemaxfix=false +aai.datagrooming.enablesinglecommits=false +aai.datagrooming.enabledupecheckoff=false +aai.datagrooming.enableghost2checkoff=false +aai.datagrooming.enableghost2fixon=false +aai.datagrooming.enablef=false +aai.datagrooming.enableskipindexupdatefix=true + +# used by the dataGrooming to set values +aai.datagrooming.timewindowminutesvalue=10500 +aai.datagrooming.sleepminutesvalue=100 +aai.datagrooming.maxfixvalue=10 +aai.datagrooming.fvalue=10 + +#timeout for traversal enabled flag +aai.graphadmin.timeoutenabled=true + +#timeout app specific -1 to bypass for that app id, a whole number to override the timeout with that value (in ms) +aai.graphadmin.timeout.appspecific=JUNITTESTAPP1,1|JUNITTESTAPP2,-1 + +#default timeout limit added for graphadmin if not overridden (in ms) +aai.graphadmin.timeoutlimit=180000 + +# Disable the process check which are oriented towards linux OS +# These props should only be true for local on windows +aai.disable.check.snapshot.running=true +aai.disable.check.grooming.running=true + +# Specify the params listed right here that you would have send to the dataSnapshot shell script +# JUST_TAKE_SNAPSHOT +# THREADED_SNAPSHOT 2 DEBUG +# THREADED_SNAPSHOT 2 +aai.datasnapshot.params=JUST_TAKE_SNAPSHOT + +#Data export task properties +aai.dataexport.enable=false +aai.dataexport.enable.schema.validation=false +aai.dataexport.output.location=/etc/scriptdata/addmanualdata/tenant_isolation/payload +aai.dataexport.enable.multiple.snapshots=false +aai.dataexport.node.config.location=/etc/scriptdata/tenant_isolation/nodes.json +aai.dataexport.input.filter.config.location=/etc/scriptdata/tenant_isolation/inputFilters.json +aai.dataexport.enable.partial.graph=false + +# Threshold for margin of error (in ms) for resources_with_sot format to derive the most recent http method performed +aai.resource.formatter.threshold=10 |