diff options
Diffstat (limited to 'aai-core/src')
49 files changed, 1408 insertions, 395 deletions
diff --git a/aai-core/src/main/java/org/onap/aai/db/schema/AuditTitan.java b/aai-core/src/main/java/org/onap/aai/db/schema/AuditJanusGraph.java index 03c0f9ae..e8ac6ae0 100644 --- a/aai-core/src/main/java/org/onap/aai/db/schema/AuditTitan.java +++ b/aai-core/src/main/java/org/onap/aai/db/schema/AuditJanusGraph.java @@ -25,22 +25,22 @@ import java.util.LinkedHashSet; import org.apache.tinkerpop.gremlin.structure.Vertex; -import com.thinkaurelius.titan.core.EdgeLabel; -import com.thinkaurelius.titan.core.PropertyKey; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.schema.TitanGraphIndex; -import com.thinkaurelius.titan.core.schema.TitanManagement; +import org.janusgraph.core.EdgeLabel; +import org.janusgraph.core.PropertyKey; +import org.janusgraph.core.JanusGraph; +import org.janusgraph.core.schema.JanusGraphIndex; +import org.janusgraph.core.schema.JanusGraphManagement; -public class AuditTitan extends Auditor { +public class AuditJanusGraph extends Auditor { - private final TitanGraph graph; + private final JanusGraph graph; /** - * Instantiates a new audit titan. + * Instantiates a new audit JanusGraph. * * @param g the g */ - public AuditTitan (TitanGraph g) { + public AuditJanusGraph (JanusGraph g) { this.graph = g; buildSchema(); } @@ -58,12 +58,12 @@ public class AuditTitan extends Auditor { * Populate properties. */ private void populateProperties() { - TitanManagement mgmt = graph.openManagement(); + JanusGraphManagement mgmt = graph.openManagement(); Iterable<PropertyKey> iterable = mgmt.getRelationTypes(PropertyKey.class); - Iterator<PropertyKey> titanProperties = iterable.iterator(); + Iterator<PropertyKey> JanusGraphProperties = iterable.iterator(); PropertyKey propKey; - while (titanProperties.hasNext()) { - propKey = titanProperties.next(); + while (JanusGraphProperties.hasNext()) { + propKey = JanusGraphProperties.next(); DBProperty prop = new DBProperty(); prop.setName(propKey.name()); @@ -78,23 +78,23 @@ public class AuditTitan extends Auditor { * Populate indexes. */ private void populateIndexes() { - TitanManagement mgmt = graph.openManagement(); - Iterable<TitanGraphIndex> iterable = mgmt.getGraphIndexes(Vertex.class); - Iterator<TitanGraphIndex> titanIndexes = iterable.iterator(); - TitanGraphIndex titanIndex; - while (titanIndexes.hasNext()) { - titanIndex = titanIndexes.next(); - if (titanIndex.isCompositeIndex()) { + JanusGraphManagement mgmt = graph.openManagement(); + Iterable<JanusGraphIndex> iterable = mgmt.getGraphIndexes(Vertex.class); + Iterator<JanusGraphIndex> JanusGraphIndexes = iterable.iterator(); + JanusGraphIndex JanusGraphIndex; + while (JanusGraphIndexes.hasNext()) { + JanusGraphIndex = JanusGraphIndexes.next(); + if (JanusGraphIndex.isCompositeIndex()) { DBIndex index = new DBIndex(); LinkedHashSet<DBProperty> dbProperties = new LinkedHashSet<>(); - index.setName(titanIndex.name()); - index.setUnique(titanIndex.isUnique()); - PropertyKey[] keys = titanIndex.getFieldKeys(); + index.setName(JanusGraphIndex.name()); + index.setUnique(JanusGraphIndex.isUnique()); + PropertyKey[] keys = JanusGraphIndex.getFieldKeys(); for (PropertyKey key : keys) { dbProperties.add(this.properties.get(key.name())); } index.setProperties(dbProperties); - index.setStatus(titanIndex.getIndexStatus(keys[0])); + index.setStatus(JanusGraphIndex.getIndexStatus(keys[0])); this.indexes.put(index.getName(), index); } } @@ -104,12 +104,12 @@ public class AuditTitan extends Auditor { * Populate edge labels. */ private void populateEdgeLabels() { - TitanManagement mgmt = graph.openManagement(); + JanusGraphManagement mgmt = graph.openManagement(); Iterable<EdgeLabel> iterable = mgmt.getRelationTypes(EdgeLabel.class); - Iterator<EdgeLabel> titanEdgeLabels = iterable.iterator(); + Iterator<EdgeLabel> JanusGraphEdgeLabels = iterable.iterator(); EdgeLabel edgeLabel; - while (titanEdgeLabels.hasNext()) { - edgeLabel = titanEdgeLabels.next(); + while (JanusGraphEdgeLabels.hasNext()) { + edgeLabel = JanusGraphEdgeLabels.next(); EdgeProperty edgeProperty = new EdgeProperty(); edgeProperty.setName(edgeLabel.name()); diff --git a/aai-core/src/main/java/org/onap/aai/db/schema/AuditOXM.java b/aai-core/src/main/java/org/onap/aai/db/schema/AuditOXM.java index ff7eee25..167b26d0 100644 --- a/aai-core/src/main/java/org/onap/aai/db/schema/AuditOXM.java +++ b/aai-core/src/main/java/org/onap/aai/db/schema/AuditOXM.java @@ -51,9 +51,9 @@ import org.onap.aai.util.AAIConstants; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import com.google.common.collect.Multimap; -import com.thinkaurelius.titan.core.Cardinality; -import com.thinkaurelius.titan.core.Multiplicity; -import com.thinkaurelius.titan.core.schema.SchemaStatus; +import org.janusgraph.core.Cardinality; +import org.janusgraph.core.Multiplicity; +import org.janusgraph.core.schema.SchemaStatus; public class AuditOXM extends Auditor { diff --git a/aai-core/src/main/java/org/onap/aai/db/schema/AuditorFactory.java b/aai-core/src/main/java/org/onap/aai/db/schema/AuditorFactory.java index f47807b2..67bc0398 100644 --- a/aai-core/src/main/java/org/onap/aai/db/schema/AuditorFactory.java +++ b/aai-core/src/main/java/org/onap/aai/db/schema/AuditorFactory.java @@ -20,7 +20,7 @@ package org.onap.aai.db.schema; import org.onap.aai.introspection.Version; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraph; public class AuditorFactory { @@ -40,7 +40,7 @@ public class AuditorFactory { * @param g the g * @return the graph auditor */ - public static Auditor getGraphAuditor (TitanGraph g) { - return new AuditTitan(g); + public static Auditor getGraphAuditor (JanusGraph g) { + return new AuditJanusGraph(g); } } diff --git a/aai-core/src/main/java/org/onap/aai/db/schema/DBIndex.java b/aai-core/src/main/java/org/onap/aai/db/schema/DBIndex.java index f0e3ee6d..9fd0eda0 100644 --- a/aai-core/src/main/java/org/onap/aai/db/schema/DBIndex.java +++ b/aai-core/src/main/java/org/onap/aai/db/schema/DBIndex.java @@ -22,7 +22,7 @@ package org.onap.aai.db.schema; import java.util.LinkedHashSet; import java.util.Set; -import com.thinkaurelius.titan.core.schema.SchemaStatus; +import org.janusgraph.core.schema.SchemaStatus; public class DBIndex implements Named { diff --git a/aai-core/src/main/java/org/onap/aai/db/schema/DBProperty.java b/aai-core/src/main/java/org/onap/aai/db/schema/DBProperty.java index 29aef8e8..fd19f72d 100644 --- a/aai-core/src/main/java/org/onap/aai/db/schema/DBProperty.java +++ b/aai-core/src/main/java/org/onap/aai/db/schema/DBProperty.java @@ -20,7 +20,7 @@ package org.onap.aai.db.schema; import org.onap.aai.introspection.Introspector; -import com.thinkaurelius.titan.core.Cardinality; +import org.janusgraph.core.Cardinality; public class DBProperty implements Named { diff --git a/aai-core/src/main/java/org/onap/aai/db/schema/EdgeProperty.java b/aai-core/src/main/java/org/onap/aai/db/schema/EdgeProperty.java index f0de7656..6d10232d 100644 --- a/aai-core/src/main/java/org/onap/aai/db/schema/EdgeProperty.java +++ b/aai-core/src/main/java/org/onap/aai/db/schema/EdgeProperty.java @@ -19,7 +19,7 @@ */ package org.onap.aai.db.schema; -import com.thinkaurelius.titan.core.Multiplicity; +import org.janusgraph.core.Multiplicity; import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.annotate.JsonPropertyOrder; diff --git a/aai-core/src/main/java/org/onap/aai/db/schema/ManageTitanSchema.java b/aai-core/src/main/java/org/onap/aai/db/schema/ManageJanusGraphSchema.java index c696d88d..bf2d4107 100644 --- a/aai-core/src/main/java/org/onap/aai/db/schema/ManageTitanSchema.java +++ b/aai-core/src/main/java/org/onap/aai/db/schema/ManageJanusGraphSchema.java @@ -28,19 +28,19 @@ import com.att.eelf.configuration.EELFManager; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.onap.aai.introspection.Version; -import com.thinkaurelius.titan.core.PropertyKey; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.schema.SchemaStatus; -import com.thinkaurelius.titan.core.schema.TitanGraphIndex; -import com.thinkaurelius.titan.core.schema.TitanManagement; -import com.thinkaurelius.titan.core.schema.TitanManagement.IndexBuilder; +import org.janusgraph.core.PropertyKey; +import org.janusgraph.core.JanusGraph; +import org.janusgraph.core.schema.SchemaStatus; +import org.janusgraph.core.schema.JanusGraphIndex; +import org.janusgraph.core.schema.JanusGraphManagement; +import org.janusgraph.core.schema.JanusGraphManagement.IndexBuilder; -public class ManageTitanSchema { +public class ManageJanusGraphSchema { - private static final EELFLogger logger = EELFManager.getInstance().getLogger(AuditOXM.class); + private static final EELFLogger logger = EELFManager.getInstance().getLogger(ManageJanusGraphSchema.class); - private TitanManagement graphMgmt; - private TitanGraph graph; + private JanusGraphManagement graphMgmt; + private JanusGraph graph; private List<DBProperty> aaiProperties; private List<DBIndex> aaiIndexes; private List<EdgeProperty> aaiEdgeProperties; @@ -48,11 +48,11 @@ public class ManageTitanSchema { private Auditor graphInfo = null; /** - * Instantiates a new manage titan schema. + * Instantiates a new manage JanusGraph schema. * * @param graph the graph */ - public ManageTitanSchema(final TitanGraph graph) { + public ManageJanusGraphSchema(final JanusGraph graph) { this.graph = graph; oxmInfo = AuditorFactory.getOXMAuditor(Version.v8); graphInfo = AuditorFactory.getGraphAuditor(graph); @@ -126,8 +126,8 @@ public class ManageTitanSchema { keyList.add(graphMgmt.getPropertyKey(prop.getName())); } if (graphMgmt.containsGraphIndex(index.getName())) { - TitanGraphIndex titanIndex = graphMgmt.getGraphIndex(index.getName()); - PropertyKey[] dbKeys = titanIndex.getFieldKeys(); + JanusGraphIndex JanusGraphIndex = graphMgmt.getGraphIndex(index.getName()); + PropertyKey[] dbKeys = JanusGraphIndex.getFieldKeys(); if (dbKeys.length != keyList.size()) { isChanged = true; } else { @@ -178,7 +178,7 @@ public class ManageTitanSchema { * @param mgmt the mgmt * @param prop the prop */ - private void createProperty(TitanManagement mgmt, DBProperty prop) { + private void createProperty(JanusGraphManagement mgmt, DBProperty prop) { if (mgmt.containsPropertyKey(prop.getName())) { PropertyKey key = mgmt.getPropertyKey(prop.getName()); boolean isChanged = false; @@ -209,11 +209,11 @@ public class ManageTitanSchema { * @param isNew the is new * @param isChanged the is changed */ - private void createIndex(TitanManagement mgmt, String indexName, List<PropertyKey> keys, boolean isUnique, boolean isNew, boolean isChanged) { + private void createIndex(JanusGraphManagement mgmt, String indexName, List<PropertyKey> keys, boolean isUnique, boolean isNew, boolean isChanged) { /*if (isChanged) { System.out.println("Changing index: " + indexName); - TitanGraphIndex oldIndex = mgmt.getGraphIndex(indexName); + JanusGraphIndex oldIndex = mgmt.getGraphIndex(indexName); mgmt.updateIndex(oldIndex, SchemaAction.DISABLE_INDEX); mgmt.commit(); //cannot remove indexes @@ -241,7 +241,7 @@ public class ManageTitanSchema { try { //waitForCompletion(indexName); - //TitanIndexRepair.hbaseRepair(AAIConstants.AAI_CONFIG_FILENAME, indexName, ""); + //JanusGraphIndexRepair.hbaseRepair(AAIConstants.AAI_CONFIG_FILENAME, indexName, ""); } catch (Exception e) { graph.tx().rollback(); graph.close(); @@ -270,8 +270,8 @@ public class ManageTitanSchema { long before = System.currentTimeMillis(); while (!registered) { Thread.sleep(500L); - TitanManagement mgmt = graph.openManagement(); - TitanGraphIndex idx = mgmt.getGraphIndex(name); + JanusGraphManagement mgmt = graph.openManagement(); + JanusGraphIndex idx = mgmt.getGraphIndex(name); registered = true; for (PropertyKey k : idx.getFieldKeys()) { SchemaStatus s = idx.getIndexStatus(k); @@ -301,7 +301,7 @@ public class ManageTitanSchema { */ public void updateIndex(DBIndex index) { - TitanManagement mgmt = graph.openManagement(); + JanusGraphManagement mgmt = graph.openManagement(); List<PropertyKey> keys = new ArrayList<>(); boolean isNew = false; boolean isChanged = false; diff --git a/aai-core/src/main/java/org/onap/aai/db/schema/ScriptDriver.java b/aai-core/src/main/java/org/onap/aai/db/schema/ScriptDriver.java index 7385ea5f..d6e32d2d 100644 --- a/aai-core/src/main/java/org/onap/aai/db/schema/ScriptDriver.java +++ b/aai-core/src/main/java/org/onap/aai/db/schema/ScriptDriver.java @@ -34,8 +34,8 @@ import org.onap.aai.logging.LoggingContext.StatusCode; import org.onap.aai.util.AAIConfig; import com.beust.jcommander.JCommander; import com.beust.jcommander.Parameter; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraphFactory; +import org.janusgraph.core.JanusGraph; public class ScriptDriver { @@ -69,7 +69,7 @@ public class ScriptDriver { } String config = cArgs.config; AAIConfig.init(); - try (TitanGraph graph = TitanFactory.open(new AAIGraphConfig.Builder(config).forService(ScriptDriver.class.getSimpleName()).withGraphType("NA").buildConfiguration())) { + try (JanusGraph graph = JanusGraphFactory.open(new AAIGraphConfig.Builder(config).forService(ScriptDriver.class.getSimpleName()).withGraphType("NA").buildConfiguration())) { if (!("oxm".equals(cArgs.type) || "graph".equals(cArgs.type))) { System.out.println("type: " + cArgs.type + " not recognized."); System.exit(1); diff --git a/aai-core/src/main/java/org/onap/aai/dbgen/DataGrooming.java b/aai-core/src/main/java/org/onap/aai/dbgen/DataGrooming.java index f201a57e..c5de1d61 100644 --- a/aai-core/src/main/java/org/onap/aai/dbgen/DataGrooming.java +++ b/aai-core/src/main/java/org/onap/aai/dbgen/DataGrooming.java @@ -66,8 +66,8 @@ import org.onap.aai.logging.LoggingContext.StatusCode; import com.att.eelf.configuration.Configuration; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraphFactory; +import org.janusgraph.core.JanusGraph; public class DataGrooming { @@ -379,8 +379,8 @@ public class DataGrooming { int cleanupCandidateCount = 0; long windowStartTime = 0; // Translation of the window into a starting timestamp BufferedWriter bw = null; - TitanGraph graph = null; - TitanGraph graph2 = null; + JanusGraph graph = null; + JanusGraph graph2 = null; int deleteCount = 0; boolean executeFinalCommit = false; Set<String> deleteCandidateList = new LinkedHashSet<>(); @@ -440,10 +440,10 @@ public class DataGrooming { if( cacheDbOkFlag ){ // Since we're just reading (not deleting/fixing anything), we can use // a cached connection to the DB - graph = TitanFactory.open(new AAIGraphConfig.Builder(AAIConstants.CACHED_DB_CONFIG).forService(DataGrooming.class.getSimpleName()).withGraphType("cached").buildConfiguration()); + graph = JanusGraphFactory.open(new AAIGraphConfig.Builder(AAIConstants.CACHED_DB_CONFIG).forService(DataGrooming.class.getSimpleName()).withGraphType("cached").buildConfiguration()); } else { - graph = TitanFactory.open(new AAIGraphConfig.Builder(AAIConstants.REALTIME_DB_CONFIG).forService(DataGrooming.class.getSimpleName()).withGraphType("realtime1").buildConfiguration()); + graph = JanusGraphFactory.open(new AAIGraphConfig.Builder(AAIConstants.REALTIME_DB_CONFIG).forService(DataGrooming.class.getSimpleName()).withGraphType("realtime1").buildConfiguration()); } if (graph == null) { String emsg = "null graph object in DataGrooming\n"; @@ -771,7 +771,7 @@ public class DataGrooming { logger.debug(" ---- DEBUG --- about to open a SECOND graph (takes a little while)--------\n"); // Note - graph2 just reads - but we want it to use a fresh connection to // the database, so we are NOT using the CACHED DB CONFIG here. - graph2 = TitanFactory.open(new AAIGraphConfig.Builder(AAIConstants.REALTIME_DB_CONFIG).forService(DataGrooming.class.getSimpleName()).withGraphType("realtime2").buildConfiguration()); + graph2 = JanusGraphFactory.open(new AAIGraphConfig.Builder(AAIConstants.REALTIME_DB_CONFIG).forService(DataGrooming.class.getSimpleName()).withGraphType("realtime2").buildConfiguration()); if (graph2 == null) { String emsg = "null graph2 object in DataGrooming\n"; throw new AAIException("AAI_6101", emsg); @@ -1425,7 +1425,7 @@ public class DataGrooming { } g.tx().rollback(); } catch (Exception ex) { - // Don't throw anything because Titan sometimes is just saying that the graph is already closed + // Don't throw anything because JanusGraph sometimes is just saying that the graph is already closed LoggingContext.statusCode(StatusCode.ERROR); LoggingContext.responseCode(LoggingContext.AVAILABILITY_TIMEOUT_ERROR); logger.warn("WARNING from final graphTransaction.rollback()", ex); @@ -1438,7 +1438,7 @@ public class DataGrooming { try { g2.tx().rollback(); } catch (Exception ex) { - // Don't throw anything because Titan sometimes is just saying that the graph is already closed + // Don't throw anything because JanusGraph sometimes is just saying that the graph is already closed LoggingContext.statusCode(StatusCode.ERROR); LoggingContext.responseCode(LoggingContext.AVAILABILITY_TIMEOUT_ERROR); logger.warn("WARNING from final graphTransaction2.rollback()", ex); @@ -1452,7 +1452,7 @@ public class DataGrooming { graph.close(); } } catch (Exception ex) { - // Don't throw anything because Titan sometimes is just saying that the graph is already closed{ + // Don't throw anything because JanusGraph sometimes is just saying that the graph is already closed{ LoggingContext.statusCode(StatusCode.ERROR); LoggingContext.responseCode(LoggingContext.AVAILABILITY_TIMEOUT_ERROR); logger.warn("WARNING from final graph.shutdown()", ex); @@ -1464,7 +1464,7 @@ public class DataGrooming { graph2.close(); } } catch (Exception ex) { - // Don't throw anything because Titan sometimes is just saying that the graph is already closed{ + // Don't throw anything because JanusGraph sometimes is just saying that the graph is already closed{ LoggingContext.statusCode(StatusCode.ERROR); LoggingContext.responseCode(LoggingContext.AVAILABILITY_TIMEOUT_ERROR); logger.warn("WARNING from final graph2.shutdown()", ex); @@ -2085,7 +2085,7 @@ public class DataGrooming { String transId, String fromAppId, GraphTraversalSource g, String version, String nType, ArrayList<Vertex> passedVertList, Loader loader) throws AAIException { - // Given a list of Titan Vertices of one nodeType (see AAI-8956), group + // Given a list of JanusGraph Vertices of one nodeType (see AAI-8956), group // them together by the parent node they depend on. // Ie. if given a list of ip address nodes (assumed to all have the // same key info) they might sit under several different parent vertices. diff --git a/aai-core/src/main/java/org/onap/aai/dbgen/GenTester.java b/aai-core/src/main/java/org/onap/aai/dbgen/GenTester.java index 174b157e..9a726ec5 100644 --- a/aai-core/src/main/java/org/onap/aai/dbgen/GenTester.java +++ b/aai-core/src/main/java/org/onap/aai/dbgen/GenTester.java @@ -22,8 +22,8 @@ package org.onap.aai.dbgen; import com.att.eelf.configuration.Configuration; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.schema.TitanManagement; +import org.janusgraph.core.JanusGraph; +import org.janusgraph.core.schema.JanusGraphManagement; import org.onap.aai.dbmap.AAIGraph; import org.onap.aai.logging.ErrorLogHelper; import org.onap.aai.logging.LoggingContext; @@ -46,7 +46,7 @@ public class GenTester { */ public static void main(String[] args) { - TitanGraph graph = null; + JanusGraph graph = null; System.setProperty("aai.service.name", GenTester.class.getSimpleName()); // Set the logging file properties to be used by EELFManager Properties props = System.getProperties(); @@ -81,11 +81,11 @@ public class GenTester { graph = AAIGraph.getInstance().getGraph(); if( graph == null ){ - ErrorLogHelper.logError("AAI_5102", "Error creating Titan graph."); + ErrorLogHelper.logError("AAI_5102", "Error creating JanusGraph graph."); return; } else { - String amsg = "Successfully loaded a Titan graph without doing any schema work. "; + String amsg = "Successfully loaded a JanusGraph graph without doing any schema work. "; System.out.println(amsg); LOGGER.auditEvent(amsg); return; @@ -118,17 +118,17 @@ public class GenTester { graph = AAIGraph.getInstance().getGraph(); if( graph == null ){ - ErrorLogHelper.logError("AAI_5102", "Error creating Titan graph. "); + ErrorLogHelper.logError("AAI_5102", "Error creating JanusGraph graph. "); return; } // Load the propertyKeys, indexes and edge-Labels into the DB - TitanManagement graphMgt = graph.openManagement(); + JanusGraphManagement graphMgt = graph.openManagement(); - imsg = "-- Loading new schema elements into Titan --"; + imsg = "-- Loading new schema elements into JanusGraph --"; System.out.println(imsg); LOGGER.info(imsg); - SchemaGenerator.loadSchemaIntoTitan( graph, graphMgt, addDefaultCR ); + SchemaGenerator.loadSchemaIntoJanusGraph( graph, graphMgt, addDefaultCR ); } catch(Exception ex) { ErrorLogHelper.logError("AAI_4000", ex.getMessage()); diff --git a/aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java b/aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java index c8b3df50..6336edd3 100644 --- a/aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java +++ b/aai-core/src/main/java/org/onap/aai/dbgen/SchemaGenerator.java @@ -41,11 +41,11 @@ import org.onap.aai.util.AAIConfig; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import com.google.common.collect.Multimap; -import com.thinkaurelius.titan.core.Cardinality; -import com.thinkaurelius.titan.core.Multiplicity; -import com.thinkaurelius.titan.core.PropertyKey; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.schema.TitanManagement; +import org.janusgraph.core.Cardinality; +import org.janusgraph.core.Multiplicity; +import org.janusgraph.core.PropertyKey; +import org.janusgraph.core.JanusGraph; +import org.janusgraph.core.schema.JanusGraphManagement; @@ -56,24 +56,24 @@ public class SchemaGenerator{ /** - * Load schema into titan. + * Load schema into JanusGraph. * * @param graph the graph * @param graphMgmt the graph mgmt * @param addDefaultCloudRegion the add default cloud region */ - public static void loadSchemaIntoTitan(final TitanGraph graph, final TitanManagement graphMgmt, boolean addDefaultCloudRegion) { + public static void loadSchemaIntoJanusGraph(final JanusGraph graph, final JanusGraphManagement graphMgmt, boolean addDefaultCloudRegion) { addDefaultCR = addDefaultCloudRegion; - loadSchemaIntoTitan(graph, graphMgmt); + loadSchemaIntoJanusGraph(graph, graphMgmt); } /** - * Load schema into titan. + * Load schema into JanusGraph. * * @param graph the graph * @param graphMgmt the graph mgmt */ - public static void loadSchemaIntoTitan(final TitanGraph graph, final TitanManagement graphMgmt) { + public static void loadSchemaIntoJanusGraph(final JanusGraph graph, final JanusGraphManagement graphMgmt) { try { AAIConfig.init(); @@ -84,8 +84,8 @@ public class SchemaGenerator{ System.exit(1); } - // NOTE - Titan 0.5.3 doesn't keep a list of legal node Labels. - // They are only used when a vertex is actually being created. Titan 1.1 will keep track (we think). + // NOTE - JanusGraph 0.5.3 doesn't keep a list of legal node Labels. + // They are only used when a vertex is actually being created. JanusGraph 1.1 will keep track (we think). // Use EdgeRules to make sure edgeLabels are defined in the db. NOTE: the multiplicty used here is @@ -186,7 +186,7 @@ public class SchemaGenerator{ LOGGER.info(imsg); graphMgmt.commit(); - }// End of loadSchemaIntoTitan() + }// End of loadSchemaIntoJanusGraph() } diff --git a/aai-core/src/main/java/org/onap/aai/dbmap/AAIGraph.java b/aai-core/src/main/java/org/onap/aai/dbmap/AAIGraph.java index 46fc2c6e..0a287516 100644 --- a/aai-core/src/main/java/org/onap/aai/dbmap/AAIGraph.java +++ b/aai-core/src/main/java/org/onap/aai/dbmap/AAIGraph.java @@ -37,15 +37,15 @@ import org.onap.aai.util.AAIConstants; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.schema.TitanManagement; +import org.janusgraph.core.JanusGraphFactory; +import org.janusgraph.core.JanusGraph; +import org.janusgraph.core.schema.JanusGraphManagement; /** * Database Mapping class which acts as the middle man between the REST - * interface objects and Titan DB objects. This class provides methods to commit - * the objects received on the REST interface into the Titan graph database as - * vertices and edges. Transactions are also managed here by using a TitanGraph + * interface objects and JanusGraph DB objects. This class provides methods to commit + * the objects received on the REST interface into the JanusGraph graph database as + * vertices and edges. Transactions are also managed here by using a JanusGraph * object to load, commit/rollback and shutdown for each request. The data model * rules such as keys/required properties are handled by calling DBMeth methods * which are driven by a specification file in json. @@ -56,7 +56,7 @@ public class AAIGraph { private static final EELFLogger logger = EELFManager.getInstance().getLogger(AAIGraph.class); protected static final String COMPONENT = "aaidbmap"; - protected Map<String, TitanGraph> graphs = new HashMap<>(); + protected Map<String, JanusGraph> graphs = new HashMap<>(); private static final String REALTIME_DB = "realtime"; private static final String CACHED_DB = "cached"; private static boolean isInit = false; @@ -103,11 +103,11 @@ public class AAIGraph { } private void loadGraph(String name, String configPath, String serviceName) throws Exception { - // Graph being opened by TitanFactory is being placed in hashmap to be used later + // Graph being opened by JanusGraphFactory is being placed in hashmap to be used later // These graphs shouldn't be closed until the application shutdown try { PropertiesConfiguration propertiesConfiguration = new AAIGraphConfig.Builder(configPath).forService(serviceName).withGraphType(name).buildConfiguration(); - TitanGraph graph = TitanFactory.open(propertiesConfiguration); + JanusGraph graph = JanusGraphFactory.open(propertiesConfiguration); Properties graphProps = new Properties(); propertiesConfiguration.getKeys().forEachRemaining(k -> graphProps.setProperty(k, propertiesConfiguration.getString(k))); @@ -130,7 +130,7 @@ public class AAIGraph { } } - private void loadSnapShotToInMemoryGraph(TitanGraph graph, Properties graphProps) { + private void loadSnapShotToInMemoryGraph(JanusGraph graph, Properties graphProps) { if (logger.isDebugEnabled()) { logger.debug("Load Snapshot to InMemory Graph"); } @@ -153,19 +153,19 @@ public class AAIGraph { } } - private void loadSchema(TitanGraph graph) { + private void loadSchema(JanusGraph graph) { // Load the propertyKeys, indexes and edge-Labels into the DB - TitanManagement graphMgt = graph.openManagement(); + JanusGraphManagement graphMgt = graph.openManagement(); - System.out.println("-- loading schema into Titan"); - SchemaGenerator.loadSchemaIntoTitan( graph, graphMgt ); + System.out.println("-- loading schema into JanusGraph"); + SchemaGenerator.loadSchemaIntoJanusGraph( graph, graphMgt ); } /** * Close all of the graph connections made in the instance. */ public void graphShutdown() { - graphs.values().stream().filter(TitanGraph::isOpen).forEach(TitanGraph::close); + graphs.values().stream().filter(JanusGraph::isOpen).forEach(JanusGraph::close); } /** @@ -173,7 +173,7 @@ public class AAIGraph { * * @return the graph */ - public TitanGraph getGraph() { + public JanusGraph getGraph() { return graphs.get(REALTIME_DB); } @@ -182,7 +182,7 @@ public class AAIGraph { graphs.get(this.getGraphName(connectionType)).close(); } - public TitanGraph getGraph(DBConnectionType connectionType) { + public JanusGraph getGraph(DBConnectionType connectionType) { return graphs.get(this.getGraphName(connectionType)); } diff --git a/aai-core/src/main/java/org/onap/aai/dbmap/AAIGraphConfig.java b/aai-core/src/main/java/org/onap/aai/dbmap/AAIGraphConfig.java index 59a1453d..eff7f0ec 100644 --- a/aai-core/src/main/java/org/onap/aai/dbmap/AAIGraphConfig.java +++ b/aai-core/src/main/java/org/onap/aai/dbmap/AAIGraphConfig.java @@ -24,8 +24,8 @@ import com.att.eelf.configuration.EELFManager; import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.collect.Iterators; -import com.thinkaurelius.titan.diskstorage.configuration.ConfigElement; -import com.thinkaurelius.titan.diskstorage.configuration.backend.CommonsConfiguration; +import org.janusgraph.diskstorage.configuration.ConfigElement; +import org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration; import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.commons.lang.StringUtils; @@ -37,10 +37,10 @@ import java.util.Iterator; import java.util.Objects; import java.util.regex.Pattern; -import static com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.*; +import static org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration.*; /** - * For building a config that TitanFactory.open can use with an identifiable graph.unique-instance-id + * For building a config that JanusGraphFactory.open can use with an identifiable graph.unique-instance-id */ public class AAIGraphConfig { @@ -50,7 +50,7 @@ public class AAIGraphConfig { public PropertiesConfiguration getCc(String configPath, String graphType, String service) throws ConfigurationException, FileNotFoundException { - PropertiesConfiguration cc = this.loadTitanPropFile(configPath); + PropertiesConfiguration cc = this.loadJanusGraphPropFile(configPath); String uid = ManagementFactory.getRuntimeMXBean().getName() + "_" + service + "_" + graphType + "_" + System.currentTimeMillis(); for (char c : ConfigElement.ILLEGAL_CHARS) { @@ -63,7 +63,7 @@ public class AAIGraphConfig { } - private PropertiesConfiguration loadTitanPropFile(String shortcutOrFile) throws ConfigurationException, FileNotFoundException { + private PropertiesConfiguration loadJanusGraphPropFile(String shortcutOrFile) throws ConfigurationException, FileNotFoundException { File file = new File(shortcutOrFile); if (file.exists()) { PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration(); diff --git a/aai-core/src/main/java/org/onap/aai/dbmap/InMemoryGraph.java b/aai-core/src/main/java/org/onap/aai/dbmap/InMemoryGraph.java index e5d4c2e0..45d0bbe4 100644 --- a/aai-core/src/main/java/org/onap/aai/dbmap/InMemoryGraph.java +++ b/aai-core/src/main/java/org/onap/aai/dbmap/InMemoryGraph.java @@ -30,10 +30,10 @@ import org.apache.tinkerpop.gremlin.structure.io.IoCore; import org.onap.aai.dbgen.SchemaGenerator; import org.onap.aai.logging.LogFormatTools; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.TitanTransaction; -import com.thinkaurelius.titan.core.schema.TitanManagement; +import org.janusgraph.core.JanusGraphFactory; +import org.janusgraph.core.JanusGraph; +import org.janusgraph.core.JanusGraphTransaction; +import org.janusgraph.core.schema.JanusGraphManagement; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; @@ -41,7 +41,7 @@ import com.att.eelf.configuration.EELFManager; public class InMemoryGraph { private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(InMemoryGraph.class); - private TitanGraph graph = null; + private JanusGraph graph = null; public InMemoryGraph(Builder builder) throws IOException { @@ -50,16 +50,16 @@ public class InMemoryGraph { */ InputStream is = new FileInputStream(builder.propertyFile); try { - graph = TitanFactory.open(builder.propertyFile); + graph = JanusGraphFactory.open(builder.propertyFile); Properties graphProps = new Properties(); graphProps.load(is); - TitanManagement graphMgt = graph.openManagement(); + JanusGraphManagement graphMgt = graph.openManagement(); if(builder.isSchemaEnabled){ LOGGER.info("Schema Enabled"); - SchemaGenerator.loadSchemaIntoTitan(graph, graphMgt); + SchemaGenerator.loadSchemaIntoJanusGraph(graph, graphMgt); } - TitanTransaction transaction = graph.newTransaction(); + JanusGraphTransaction transaction = graph.newTransaction(); LOGGER.info("Loading snapshot"); transaction.io(IoCore.graphson()).readGraph(builder.graphsonLocation); transaction.commit(); @@ -97,7 +97,7 @@ public class InMemoryGraph { } } - public TitanGraph getGraph() { + public JanusGraph getGraph() { return graph; } diff --git a/aai-core/src/main/java/org/onap/aai/extensions/AAIExtensionMap.java b/aai-core/src/main/java/org/onap/aai/extensions/AAIExtensionMap.java index eff781c3..7b125496 100644 --- a/aai-core/src/main/java/org/onap/aai/extensions/AAIExtensionMap.java +++ b/aai-core/src/main/java/org/onap/aai/extensions/AAIExtensionMap.java @@ -67,7 +67,7 @@ public class AAIExtensionMap { // ----------------------------------------------------------------------- // postExtSkipErrorCallback | java.lang.Boolean (RW) // ----------------------------------------------------------------------- - // graph | com.thinkaurelius.titan.core.TitanGraph (RW) + // graph | org.janusgraph.core.JanusGraph (RW) // ----------------------------------------------------------------------- // objectFromResponse | Object // ----------------------------------------------------------------------- diff --git a/aai-core/src/main/java/org/onap/aai/rest/db/HttpEntry.java b/aai-core/src/main/java/org/onap/aai/rest/db/HttpEntry.java index 67b46bfb..28af6a55 100644 --- a/aai-core/src/main/java/org/onap/aai/rest/db/HttpEntry.java +++ b/aai-core/src/main/java/org/onap/aai/rest/db/HttpEntry.java @@ -68,7 +68,7 @@ import org.onap.aai.restcore.HttpMethod; import org.onap.aai.schema.enums.ObjectMetadata; import org.onap.aai.serialization.db.DBSerializer; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import org.onap.aai.serialization.engines.query.QueryEngine; @@ -78,7 +78,10 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.fge.jsonpatch.JsonPatchException; import com.github.fge.jsonpatch.mergepatch.JsonMergePatch; -import com.thinkaurelius.titan.core.TitanException; +import org.janusgraph.core.JanusGraphException; +import org.onap.aai.serialization.queryformats.Format; +import org.onap.aai.serialization.queryformats.FormatFactory; +import org.onap.aai.serialization.queryformats.Formatter; /** * The Class HttpEntry. @@ -113,7 +116,7 @@ public class HttpEntry { this.queryStyle = queryStyle; this.version = version; this.loader = LoaderFactory.createLoaderForVersion(introspectorFactoryType, version); - this.dbEngine = new TitanDBEngine( + this.dbEngine = new JanusGraphDBEngine( queryStyle, connectionType, loader); @@ -281,7 +284,7 @@ public class HttpEntry { status = Status.OK; MarshallerProperties properties; if (!request.getMarshallerProperties().isPresent()) { - properties = + properties = new MarshallerProperties.Builder(org.onap.aai.restcore.MediaType.getEnum(outputMediaType)).build(); } else { properties = request.getMarshallerProperties().get(); @@ -450,7 +453,7 @@ public class HttpEntry { responses.add(pairedResp); //break out of retry loop break; - } catch (TitanException e) { + } catch (JanusGraphException e) { this.dbEngine.rollback(); LOGGER.info ("Caught exception: " + e.getMessage()); @@ -586,9 +589,9 @@ public class HttpEntry { depth = AAIProperties.MAXIMUM_DEPTH; } } else { - if (depthParam.length() > 0 && !depthParam.equals("all")){ + if (!depthParam.isEmpty() && !"all".equals(depthParam)){ try { - depth = Integer.valueOf(depthParam); + depth = Integer.parseInt(depthParam); } catch (Exception e) { throw new AAIException("AAI_4016"); } diff --git a/aai-core/src/main/java/org/onap/aai/serialization/db/DBSerializer.java b/aai-core/src/main/java/org/onap/aai/serialization/db/DBSerializer.java index 9b57e48e..67a5edb3 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/db/DBSerializer.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/db/DBSerializer.java @@ -23,7 +23,7 @@ package org.onap.aai.serialization.db; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import com.google.common.base.CaseFormat; -import com.thinkaurelius.titan.core.SchemaViolationException; +import org.janusgraph.core.SchemaViolationException; import org.apache.commons.collections.IteratorUtils; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__; diff --git a/aai-core/src/main/java/org/onap/aai/serialization/db/GraphSingleton.java b/aai-core/src/main/java/org/onap/aai/serialization/db/GraphSingleton.java index c90e1eee..d70a7ee7 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/db/GraphSingleton.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/db/GraphSingleton.java @@ -19,7 +19,7 @@ */ package org.onap.aai.serialization.db; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraph; import org.onap.aai.dbmap.AAIGraph; import org.onap.aai.dbmap.DBConnectionType; @@ -58,11 +58,11 @@ public class GraphSingleton { * * @return the tx graph */ - public TitanGraph getTxGraph() { + public JanusGraph getTxGraph() { return AAIGraph.getInstance().getGraph(); } - public TitanGraph getTxGraph(DBConnectionType connectionType) { + public JanusGraph getTxGraph(DBConnectionType connectionType) { return AAIGraph.getInstance().getGraph(connectionType); } } diff --git a/aai-core/src/main/java/org/onap/aai/serialization/db/InMemoryGraphSingleton.java b/aai-core/src/main/java/org/onap/aai/serialization/db/InMemoryGraphSingleton.java index 369161ac..0f4c3e7d 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/db/InMemoryGraphSingleton.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/db/InMemoryGraphSingleton.java @@ -21,22 +21,22 @@ package org.onap.aai.serialization.db; import org.onap.aai.dbmap.DBConnectionType; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraph; public class InMemoryGraphSingleton extends GraphSingleton { - private static TitanGraph inMemgraph; + private static JanusGraph inMemgraph; private static class Helper { private static final InMemoryGraphSingleton INSTANCE = new InMemoryGraphSingleton(); } /** - * Gets the single instance of TitanGraphSingleton. + * Gets the single instance of JanusGraphSingleton. * - * @return single instance of TitanGraphSingleton + * @return single instance of JanusGraphSingleton */ - public static InMemoryGraphSingleton getInstance(TitanGraph graph) { + public static InMemoryGraphSingleton getInstance(JanusGraph graph) { inMemgraph = graph; return Helper.INSTANCE; } @@ -47,12 +47,12 @@ public class InMemoryGraphSingleton extends GraphSingleton { * @return the tx graph */ @Override - public TitanGraph getTxGraph() { + public JanusGraph getTxGraph() { return inMemgraph; } @Override - public TitanGraph getTxGraph(DBConnectionType connectionType) { + public JanusGraph getTxGraph(DBConnectionType connectionType) { return inMemgraph; } } diff --git a/aai-core/src/main/java/org/onap/aai/serialization/db/TitanGraphSingleton.java b/aai-core/src/main/java/org/onap/aai/serialization/db/JanusGraphSingleton.java index 4c1f3181..4513d107 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/db/TitanGraphSingleton.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/db/JanusGraphSingleton.java @@ -20,18 +20,18 @@ package org.onap.aai.serialization.db; /* This is class is just a wrapper of its parent */ -public class TitanGraphSingleton extends GraphSingleton { +public class JanusGraphSingleton extends GraphSingleton { private static class Helper { - private static final TitanGraphSingleton INSTANCE = new TitanGraphSingleton(); + private static final JanusGraphSingleton INSTANCE = new JanusGraphSingleton(); } /** - * Gets the single instance of TitanGraphSingleton. + * Gets the single instance of JanusGraphSingleton. * - * @return single instance of TitanGraphSingleton + * @return single instance of JanusGraphSingleton */ - public static TitanGraphSingleton getInstance() { + public static JanusGraphSingleton getInstance() { return Helper.INSTANCE; } } diff --git a/aai-core/src/main/java/org/onap/aai/serialization/engines/InMemoryDBEngine.java b/aai-core/src/main/java/org/onap/aai/serialization/engines/InMemoryDBEngine.java index a7aef9da..ec52a002 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/engines/InMemoryDBEngine.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/engines/InMemoryDBEngine.java @@ -22,6 +22,7 @@ package org.onap.aai.serialization.engines; import java.util.ArrayList; import java.util.Iterator; import java.util.List; + import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy; import org.apache.tinkerpop.gremlin.structure.Graph; @@ -39,29 +40,29 @@ import org.onap.aai.serialization.engines.query.GraphTraversalQueryEngine; import org.onap.aai.serialization.engines.query.QueryEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraph; public class InMemoryDBEngine extends TransactionalGraphEngine { /** - * Instantiates a new titan DB engine. + * Instantiates a new JanusGraph DB engine. * * @param style * the style * @param loader * the loader */ - private TitanGraph graph = null; + private JanusGraph graph = null; private static final TransactionalGraphEngine.Admin admin = null; - public InMemoryDBEngine(QueryStyle style, DBConnectionType connectionType, Loader loader, TitanGraph graph) { + public InMemoryDBEngine(QueryStyle style, DBConnectionType connectionType, Loader loader, JanusGraph graph) { super(style, loader, connectionType, InMemoryGraphSingleton.getInstance(graph)); this.graph = graph; } /** - * Instantiates a new titan DB engine. + * Instantiates a new JanusGraph DB engine. * * @param style * the style @@ -70,7 +71,7 @@ public class InMemoryDBEngine extends TransactionalGraphEngine { * @param connect * the connect */ - public InMemoryDBEngine(QueryStyle style, Loader loader, boolean connect, TitanGraph graph) { + public InMemoryDBEngine(QueryStyle style, Loader loader, boolean connect, JanusGraph graph) { super(style, loader); if (connect) { this.singleton = InMemoryGraphSingleton.getInstance(graph); diff --git a/aai-core/src/main/java/org/onap/aai/serialization/engines/TitanDBEngine.java b/aai-core/src/main/java/org/onap/aai/serialization/engines/JanusGraphDBEngine.java index 4c6cb675..c12aa603 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/engines/TitanDBEngine.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/engines/JanusGraphDBEngine.java @@ -27,31 +27,31 @@ import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.VertexProperty; import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.introspection.Loader; -import org.onap.aai.serialization.db.TitanGraphSingleton; +import org.onap.aai.serialization.db.JanusGraphSingleton; -public class TitanDBEngine extends TransactionalGraphEngine { +public class JanusGraphDBEngine extends TransactionalGraphEngine { /** - * Instantiates a new titan DB engine. + * Instantiates a new JanusGraph DB engine. * * @param style the style * @param loader the loader */ - public TitanDBEngine(QueryStyle style, DBConnectionType connectionType, Loader loader) { - super(style, loader, connectionType, TitanGraphSingleton.getInstance()); + public JanusGraphDBEngine(QueryStyle style, DBConnectionType connectionType, Loader loader) { + super(style, loader, connectionType, JanusGraphSingleton.getInstance()); } /** - * Instantiates a new titan DB engine. + * Instantiates a new JanusGraph DB engine. * * @param style the style * @param loader the loader * @param connect the connect */ - public TitanDBEngine(QueryStyle style, Loader loader, boolean connect) { + public JanusGraphDBEngine(QueryStyle style, Loader loader, boolean connect) { super(style, loader); if (connect) { - this.singleton = TitanGraphSingleton.getInstance(); + this.singleton = JanusGraphSingleton.getInstance(); } } diff --git a/aai-core/src/main/java/org/onap/aai/serialization/engines/TransactionalGraphEngine.java b/aai-core/src/main/java/org/onap/aai/serialization/engines/TransactionalGraphEngine.java index f300bd26..8eedf00d 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/engines/TransactionalGraphEngine.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/engines/TransactionalGraphEngine.java @@ -19,9 +19,6 @@ */ package org.onap.aai.serialization.engines; -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; - import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy; import org.apache.tinkerpop.gremlin.structure.Graph; @@ -36,8 +33,11 @@ import org.onap.aai.serialization.db.GraphSingleton; import org.onap.aai.serialization.engines.query.GraphTraversalQueryEngine; import org.onap.aai.serialization.engines.query.QueryEngine; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.schema.TitanManagement; +import org.janusgraph.core.JanusGraph; +import org.janusgraph.core.schema.JanusGraphManagement; + +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; public abstract class TransactionalGraphEngine { @@ -97,7 +97,7 @@ public abstract class TransactionalGraphEngine { * * @return the graph */ - private TitanGraph getGraph() { + private JanusGraph getGraph() { return singleton.getTxGraph(this.connectionType); } @@ -237,7 +237,7 @@ public abstract class TransactionalGraphEngine { return readOnlyTraversal; } - public TitanManagement getManagementSystem() { + public JanusGraphManagement getManagementSystem() { return getGraph().openManagement(); } } diff --git a/aai-core/src/main/java/org/onap/aai/serialization/queryformats/GraphSON.java b/aai-core/src/main/java/org/onap/aai/serialization/queryformats/GraphSON.java index 3b803b49..4e69c9c2 100644 --- a/aai-core/src/main/java/org/onap/aai/serialization/queryformats/GraphSON.java +++ b/aai-core/src/main/java/org/onap/aai/serialization/queryformats/GraphSON.java @@ -21,7 +21,7 @@ package org.onap.aai.serialization.queryformats; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -import com.thinkaurelius.titan.graphdb.tinkerpop.TitanIoRegistry; +import org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry; import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper; @@ -33,7 +33,7 @@ import java.io.OutputStream; public class GraphSON implements FormatMapper { - private final GraphSONMapper mapper = GraphSONMapper.build().addRegistry(TitanIoRegistry.INSTANCE).create(); + private final GraphSONMapper mapper = GraphSONMapper.build().addRegistry(JanusGraphIoRegistry.getInstance()).create(); private final GraphSONWriter writer = GraphSONWriter.build().mapper(mapper).create(); protected JsonParser parser = new JsonParser(); diff --git a/aai-core/src/main/java/org/onap/aai/util/AAIConstants.java b/aai-core/src/main/java/org/onap/aai/util/AAIConstants.java index 181b499d..f438d16b 100644 --- a/aai-core/src/main/java/org/onap/aai/util/AAIConstants.java +++ b/aai-core/src/main/java/org/onap/aai/util/AAIConstants.java @@ -41,8 +41,8 @@ public final class AAIConstants { public static final String AAI_AUTH_CONFIG_FILENAME = AAI_HOME_ETC_AUTH + "aai_policy.json"; public static final String AAI_MECHID_CONFIG_FILENAME = AAI_HOME_ETC_APP_PROPERTIES + "mechIds.json"; public static final String AAI_HOME_ETC_QUERY = AAI_HOME_ETC + "query" + AAI_FILESEP + "stored-queries.properties"; - public static final String REALTIME_DB_CONFIG = AAI_HOME_ETC_APP_PROPERTIES + "titan-realtime.properties"; - public static final String CACHED_DB_CONFIG = AAI_HOME_ETC_APP_PROPERTIES + "titan-cached.properties"; + public static final String REALTIME_DB_CONFIG = AAI_HOME_ETC_APP_PROPERTIES + "janusgraph-realtime.properties"; + public static final String CACHED_DB_CONFIG = AAI_HOME_ETC_APP_PROPERTIES + "janusgraph-cached.properties"; public static final String AAI_HOME_ETC_OXM = AAI_HOME_ETC + "oxm" + AAI_FILESEP; public static final String AAI_EVENT_DMAAP_PROPS = AAI_HOME_ETC_APP_PROPERTIES + "aaiEventDMaaPPublisher.properties"; public static final String AAI_HOME_ETC_SCRIPT = AAI_HOME_ETC + AAI_FILESEP + "scriptdata" + AAI_FILESEP; diff --git a/aai-core/src/main/java/org/onap/aai/util/UniquePropertyCheck.java b/aai-core/src/main/java/org/onap/aai/util/UniquePropertyCheck.java index 512ac755..bfa0f3a1 100644 --- a/aai-core/src/main/java/org/onap/aai/util/UniquePropertyCheck.java +++ b/aai-core/src/main/java/org/onap/aai/util/UniquePropertyCheck.java @@ -37,8 +37,8 @@ import org.slf4j.MDC; import com.att.eelf.configuration.Configuration; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraphFactory; +import org.janusgraph.core.JanusGraph; import org.onap.aai.dbmap.AAIGraphConfig; public class UniquePropertyCheck { @@ -87,12 +87,12 @@ public class UniquePropertyCheck { try { AAIConfig.init(); System.out.println(" ---- NOTE --- about to open graph (takes a little while)--------\n"); - TitanGraph tGraph = TitanFactory.open(new AAIGraphConfig.Builder(AAIConstants.REALTIME_DB_CONFIG).forService(UniquePropertyCheck.class.getSimpleName()).withGraphType("realtime").buildConfiguration()); + JanusGraph tGraph = JanusGraphFactory.open(new AAIGraphConfig.Builder(AAIConstants.REALTIME_DB_CONFIG).forService(UniquePropertyCheck.class.getSimpleName()).withGraphType("realtime").buildConfiguration()); if( tGraph == null ) { LoggingContext.statusCode(StatusCode.ERROR); LoggingContext.responseCode(LoggingContext.AVAILABILITY_TIMEOUT_ERROR); - logAndPrint(logger, " Error: Could not get TitanGraph "); + logAndPrint(logger, " Error: Could not get JanusGraph "); System.exit(1); } diff --git a/aai-core/src/main/java/org/onap/aai/util/genxsd/YAMLfromOXM.java b/aai-core/src/main/java/org/onap/aai/util/genxsd/YAMLfromOXM.java index ff7d44b6..ce5406a6 100644 --- a/aai-core/src/main/java/org/onap/aai/util/genxsd/YAMLfromOXM.java +++ b/aai-core/src/main/java/org/onap/aai/util/genxsd/YAMLfromOXM.java @@ -287,12 +287,6 @@ public class YAMLfromOXM extends OxmFileProcessor { for ( int k = 0; addTypeV != null && k < addTypeV.size(); ++k ) { String addType = addTypeV.elementAt(k); logger.debug("addType: "+ addType); - if(addType == "overloaded-model" || addType.equals("OverloadedModel") || addType == "owning-entity") { - logger.debug("Description check: "+ addType+"opId="+opId+" itemName=none"); -// Log.info("Element name="+xmlElementElement.getAttribute("name")); - } - - if ( opId == null || !opId.contains(addType)) { processJavaTypeElementSwagger( addType, getJavaTypeElementSwagger(addType), pathSb, definitionsSb, path, tag == null ? useTag : tag, useOpId, null, diff --git a/aai-core/src/main/resources/logback.xml b/aai-core/src/main/resources/logback.xml new file mode 100644 index 00000000..2bf42b76 --- /dev/null +++ b/aai-core/src/main/resources/logback.xml @@ -0,0 +1,391 @@ +<!-- + + ============LICENSE_START======================================================= + org.onap.aai + ================================================================================ + Copyright © 2017 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========================================================= + + ECOMP is a trademark and service mark of AT&T Intellectual Property. + +--> +<configuration scan="true" scanPeriod="60 seconds" debug="false"> + <statusListener class="ch.qos.logback.core.status.NopStatusListener" /> + + <property resource="application.properties" /> + + <property name="namespace" value="aai-resources"/> + + <property name="AJSC_HOME" value="${AJSC_HOME:-.}" /> + <jmxConfigurator /> + <property name="logDirectory" value="${AJSC_HOME}/logs" /> + <property name="eelfLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{statusCode}|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> + <property name="eelfAuditLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{statusCode}|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n|\r\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> + <property name="eelfMetricLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%X{statusCode}|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{targetVirtualEntity}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> + <!-- <property name="eelfErrorLogPattern" value="%ecompStartTime|%X{requestId}|%-10t|%X{serviceName}|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%ecompErrorCategory|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n|\r\n', '^'}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> --> + <property name="eelfErrorLogPattern" value="%ecompStartTime|%X{requestId}|%-10t|%X{serviceName}|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%ecompErrorCategory|%ecompResponseCode|%ecompResponseDescription|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> + <property name="eelfTransLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{statusCode}|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{partnerName}:%m%n"/> + + <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" /> + <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" /> + <conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" /> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern> + %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx} + </pattern> + </encoder> + </appender> + + <appender name="SANE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${logDirectory}/rest/sane.log</file> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/rest/sane.log.%d{yyyy-MM-dd}</fileNamePattern> + </rollingPolicy> + <encoder> + <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n + </pattern> + </encoder> + </appender> + + <appender name="asyncSANE" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>1000</queueSize> + <includeCallerData>true</includeCallerData> + <appender-ref ref="SANE" /> + </appender> + + <appender name="METRIC" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.LevelFilter"> + <level>INFO</level> + <onMatch>ACCEPT</onMatch> + <onMismatch>DENY</onMismatch> + </filter> + <file>${logDirectory}/rest/metrics.log</file> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/rest/metrics.log.%d{yyyy-MM-dd} + </fileNamePattern> + </rollingPolicy> + <encoder class="org.onap.aai.logging.EcompEncoder"> + <pattern>${eelfMetricLogPattern}</pattern> + </encoder> + </appender> + <appender name="asyncMETRIC" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>1000</queueSize> + <includeCallerData>true</includeCallerData> + <appender-ref ref="METRIC" /> + </appender> + + <appender name="DEBUG" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.LevelFilter"> + <level>DEBUG</level> + <onMatch>ACCEPT</onMatch> + <onMismatch>DENY</onMismatch> + </filter> + <file>${logDirectory}/rest/debug.log</file> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/rest/debug.log.%d{yyyy-MM-dd} + </fileNamePattern> + </rollingPolicy> + <encoder class="org.onap.aai.logging.EcompEncoder"> + <pattern>${eelfLogPattern}</pattern> + </encoder> + </appender> + + <appender name="asyncDEBUG" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>1000</queueSize> + <includeCallerData>true</includeCallerData> + <appender-ref ref="DEBUG" /> + </appender> + + <appender name="ERROR" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>WARN</level> + </filter> + <file>${logDirectory}/rest/error.log</file> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/rest/error.log.%d{yyyy-MM-dd} + </fileNamePattern> + </rollingPolicy> + <encoder class="org.onap.aai.logging.EcompEncoder"> + <pattern>${eelfErrorLogPattern}</pattern> + </encoder> + </appender> + + <appender name="asyncERROR" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>1000</queueSize> + <includeCallerData>true</includeCallerData> + <appender-ref ref="ERROR" /> + </appender> + + <appender name="AUDIT" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${logDirectory}/rest/audit.log</file> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/rest/audit.log.%d{yyyy-MM-dd} + </fileNamePattern> + </rollingPolicy> + <encoder class="org.onap.aai.logging.EcompEncoder"> + <pattern>${eelfAuditLogPattern}</pattern> + </encoder> + </appender> + + <appender name="asyncAUDIT" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>1000</queueSize> + <includeCallerData>true</includeCallerData> + <appender-ref ref="AUDIT" /> + </appender> + + <appender name="translog" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.LevelFilter"> + <level>DEBUG</level> + <onMatch>ACCEPT</onMatch> + <onMismatch>DENY</onMismatch> + </filter> + <file>${logDirectory}/rest/translog.log</file> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/rest/translog.log.%d{yyyy-MM-dd} + </fileNamePattern> + </rollingPolicy> + <encoder class="org.onap.aai.logging.EcompEncoder"> + <pattern>${eelfTransLogPattern}</pattern> + </encoder> + </appender> + + <appender name="asynctranslog" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>1000</queueSize> + <includeCallerData>true</includeCallerData> + <appender-ref ref="translog" /> + </appender> + + <appender name="dmaapAAIEventConsumer" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>WARN</level> + </filter> + <File>${logDirectory}/dmaapAAIEventConsumer/error.log</File> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/dmaapAAIEventConsumer/error.log.%d{yyyy-MM-dd} + </fileNamePattern> + </rollingPolicy> + <encoder class="org.onap.aai.logging.EcompEncoder"> + <pattern>${eelfErrorLogPattern}</pattern> + </encoder> + </appender> + + <appender name="dmaapAAIEventConsumerDebug" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.LevelFilter"> + <level>DEBUG</level> + <onMatch>ACCEPT</onMatch> + <onMismatch>DENY</onMismatch> + </filter> + <File>${logDirectory}/dmaapAAIEventConsumer/debug.log</File> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/dmaapAAIEventConsumer/debug.log.%d{yyyy-MM-dd} + </fileNamePattern> + </rollingPolicy> + <encoder class="org.onap.aai.logging.EcompEncoder"> + <pattern>${eelfLogPattern}</pattern> + </encoder> + </appender> + <appender name="dmaapAAIEventConsumerMetric" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.LevelFilter"> + <level>INFO</level> + <onMatch>ACCEPT</onMatch> + <onMismatch>DENY</onMismatch> + </filter> + <File>${logDirectory}/dmaapAAIEventConsumer/metrics.log</File> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/dmaapAAIEventConsumer/metrics.log.%d{yyyy-MM-dd} + </fileNamePattern> + </rollingPolicy> + <encoder class="org.onap.aai.logging.EcompEncoder"> + <pattern>${eelfMetricLogPattern}</pattern> + </encoder> + </appender> + <appender name="external" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>WARN</level> + </filter> + <file>${logDirectory}/external/external.log</file> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/external/external.log.%d{yyyy-MM-dd} + </fileNamePattern> + </rollingPolicy> + <encoder class="org.onap.aai.logging.EcompEncoder"> + <pattern>${eelfLogPattern}</pattern> + </encoder> + </appender> + <logger name="org.onap.aai" level="DEBUG" additivity="false"> + <appender-ref ref="asyncDEBUG" /> + <appender-ref ref="asyncERROR" /> + <appender-ref ref="asyncMETRIC" /> + <appender-ref ref="asyncSANE" /> + </logger> + + <!-- Spring related loggers --> + <logger name="org.springframework" level="WARN" /> + <logger name="org.springframework.beans" level="WARN" /> + <logger name="org.springframework.web" level="WARN" /> + <logger name="com.blog.spring.jms" level="WARN" /> + <logger name="com.jayway.jsonpath" level="WARN" /> + + <!-- AJSC Services (bootstrap services) --> + <logger name="ajsc" level="WARN" /> + <logger name="ajsc.RouteMgmtService" level="WARN" /> + <logger name="ajsc.ComputeService" level="WARN" /> + <logger name="ajsc.VandelayService" level="WARN" /> + <logger name="ajsc.FilePersistenceService" level="WARN" /> + <logger name="ajsc.UserDefinedJarService" level="WARN" /> + <logger name="ajsc.UserDefinedBeansDefService" level="WARN" /> + <logger name="ajsc.LoggingConfigurationService" level="WARN" /> + + <!-- AJSC related loggers (DME2 Registration, csi logging, restlet, servlet + logging) --> + <logger name="org.codehaus.groovy" level="WARN" /> + <logger name="com.att.scamper" level="WARN" /> + <logger name="ajsc.utils" level="WARN" /> + <logger name="ajsc.utils.DME2Helper" level="WARN" /> + <logger name="ajsc.filters" level="WARN" /> + <logger name="ajsc.beans.interceptors" level="WARN" /> + <logger name="ajsc.restlet" level="WARN" /> + <logger name="ajsc.servlet" level="WARN" /> + <logger name="com.att.ajsc" level="WARN" /> + <logger name="com.att.ajsc.csi.logging" level="WARN" /> + <logger name="com.att.ajsc.filemonitor" level="WARN" /> + <logger name="com.netflix.loadbalancer" level="WARN" /> + + <logger name="org.apache.zookeeper" level="OFF" /> + + <!-- Other Loggers that may help troubleshoot --> + <logger name="net.sf" level="WARN" /> + <logger name="org.apache.commons.httpclient" level="WARN" /> + <logger name="org.apache.commons" level="WARN" /> + <logger name="org.apache.coyote" level="WARN" /> + <logger name="org.apache.jasper" level="WARN" /> + + <!-- Camel Related Loggers (including restlet/servlet/jaxrs/cxf logging. + May aid in troubleshooting) --> + <logger name="org.apache.camel" level="WARN" /> + <logger name="org.apache.cxf" level="WARN" /> + <logger name="org.apache.camel.processor.interceptor" level="WARN" /> + <logger name="org.apache.cxf.jaxrs.interceptor" level="WARN" /> + <logger name="org.apache.cxf.service" level="WARN" /> + <logger name="org.restlet" level="WARN" /> + <logger name="org.apache.camel.component.restlet" level="WARN" /> + + <logger name="org.hibernate.validator" level="WARN" /> + <logger name="org.hibernate" level="WARN" /> + <logger name="org.hibernate.ejb" level="OFF" /> + + <!-- logback internals logging --> + <logger name="ch.qos.logback.classic" level="WARN" /> + <logger name="ch.qos.logback.core" level="WARN" /> + + <logger name="org.eclipse.jetty" level="WARN" /> + + <!-- logback jms appenders & loggers definition starts here --> + <appender name="auditLogs" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter" /> + <file>${logDirectory}/perf-audit/Audit-${lrmRVer}-${lrmRO}-${Pid}.log + </file> + <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${logDirectory}/perf-audit/Audit-${lrmRVer}-${lrmRO}-${Pid}.%i.log.zip + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>9</maxIndex> + </rollingPolicy> + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>5MB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern> + </encoder> + </appender> + <appender name="perfLogs" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter" /> + <file>${logDirectory}/perf-audit/Perform-${lrmRVer}-${lrmRO}-${Pid}.log + </file> + <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${logDirectory}/perf-audit/Perform-${lrmRVer}-${lrmRO}-${Pid}.%i.log.zip + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>9</maxIndex> + </rollingPolicy> + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>5MB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern> + </encoder> + </appender> + <logger name="AuditRecord" level="INFO" additivity="false"> + <appender-ref ref="auditLogs" /> + </logger> + <logger name="AuditRecord_DirectCall" level="INFO" additivity="false"> + <appender-ref ref="auditLogs" /> + </logger> + <logger name="PerfTrackerRecord" level="INFO" additivity="false"> + <appender-ref ref="perfLogs" /> + </logger> + <!-- logback jms appenders & loggers definition ends here --> + + <logger name="org.onap.aai.interceptors.post" level="DEBUG" + additivity="false"> + <appender-ref ref="asynctranslog" /> + </logger> + + <logger name="org.onap.aai.interceptors.pre.SetLoggingContext" level="DEBUG"> + <appender-ref ref="asyncAUDIT"/> + </logger> + + <logger name="org.onap.aai.interceptors.post.ResetLoggingContext" level="DEBUG"> + <appender-ref ref="asyncAUDIT"/> + </logger> + + <logger name="org.onap.aai.dmaap" level="DEBUG" additivity="false"> + <appender-ref ref="dmaapAAIEventConsumer" /> + <appender-ref ref="dmaapAAIEventConsumerDebug" /> + <appender-ref ref="dmaapAAIEventConsumerMetric" /> + </logger> + + <logger name="org.apache" level="OFF" /> + <logger name="org.zookeeper" level="OFF" /> + <logger name="org.janusgraph" level="WARN" /> + <logger name="com.att.aft.dme2" level="WARN" /> + + <!-- ============================================================================ --> + <!-- General EELF logger --> + <!-- ============================================================================ --> + <logger name="com.att.eelf" level="WARN" additivity="false"> + <appender-ref ref="asyncDEBUG" /> + <appender-ref ref="asyncERROR" /> + <appender-ref ref="asyncMETRIC" /> + </logger> + + <root level="DEBUG"> + <appender-ref ref="external" /> + </root> +</configuration> diff --git a/aai-core/src/test/java/org/onap/aai/dbmap/AAIGraphTest.java b/aai-core/src/test/java/org/onap/aai/dbmap/AAIGraphTest.java index 4c472ccc..fbff5d06 100644 --- a/aai-core/src/test/java/org/onap/aai/dbmap/AAIGraphTest.java +++ b/aai-core/src/test/java/org/onap/aai/dbmap/AAIGraphTest.java @@ -19,9 +19,9 @@ */ package org.onap.aai.dbmap; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; -import com.thinkaurelius.titan.core.schema.TitanManagement; +import org.janusgraph.core.JanusGraphFactory; +import org.janusgraph.core.JanusGraph; +import org.janusgraph.core.schema.JanusGraphManagement; import org.hamcrest.CoreMatchers; import org.junit.*; import org.onap.aai.AAISetup; @@ -44,7 +44,7 @@ public class AAIGraphTest extends AAISetup{ @Test public void getRealtimeInstanceConnectionName() throws Exception { - TitanManagement graphMgt = AAIGraph.getInstance().getGraph().openManagement(); + JanusGraphManagement graphMgt = AAIGraph.getInstance().getGraph().openManagement(); String connectionInstanceName = graphMgt.getOpenInstances().stream().filter(c -> c.contains("current")).findFirst().get(); assertThat(connectionInstanceName, containsString(SERVICE_NAME)); assertThat(connectionInstanceName, containsString("realtime")); @@ -55,7 +55,7 @@ public class AAIGraphTest extends AAISetup{ @Test public void getCachedInstanceConnectionName() throws Exception { - TitanManagement graphMgt = AAIGraph.getInstance().getGraph(DBConnectionType.CACHED).openManagement(); + JanusGraphManagement graphMgt = AAIGraph.getInstance().getGraph(DBConnectionType.CACHED).openManagement(); String connectionInstanceName = graphMgt.getOpenInstances().stream().filter(c -> c.contains("current")).findFirst().get(); assertThat(connectionInstanceName, containsString(SERVICE_NAME)); assertThat(connectionInstanceName, containsString("cached")); @@ -64,9 +64,9 @@ public class AAIGraphTest extends AAISetup{ } @Test - public void titanGraphOpenNameTest() throws Exception{ - TitanGraph graph = TitanFactory.open(new AAIGraphConfig.Builder(AAIConstants.REALTIME_DB_CONFIG).forService(SERVICE_NAME).withGraphType("graphType").buildConfiguration()); - TitanManagement graphMgt = graph.openManagement(); + public void JanusGraphOpenNameTest() throws Exception{ + JanusGraph graph = JanusGraphFactory.open(new AAIGraphConfig.Builder(AAIConstants.REALTIME_DB_CONFIG).forService(SERVICE_NAME).withGraphType("graphType").buildConfiguration()); + JanusGraphManagement graphMgt = graph.openManagement(); String connectionInstanceName = graphMgt.getOpenInstances().stream().filter(c -> c.contains("current")).findFirst().get(); assertThat(connectionInstanceName,matchesPattern("^\\d+_[\\w\\-\\d]+_" + SERVICE_NAME + "_graphType_\\d+\\(current\\)$")); graphMgt.rollback(); diff --git a/aai-core/src/test/java/org/onap/aai/introspection/sideeffect/DataCopyTest.java b/aai-core/src/test/java/org/onap/aai/introspection/sideeffect/DataCopyTest.java index 27efbdb2..621f24d8 100644 --- a/aai-core/src/test/java/org/onap/aai/introspection/sideeffect/DataCopyTest.java +++ b/aai-core/src/test/java/org/onap/aai/introspection/sideeffect/DataCopyTest.java @@ -19,8 +19,8 @@ */ package org.onap.aai.introspection.sideeffect; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraphFactory; +import org.janusgraph.core.JanusGraph; import org.apache.commons.io.IOUtils; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Graph; @@ -41,7 +41,7 @@ import org.onap.aai.parsers.query.QueryParser; import org.onap.aai.serialization.db.DBSerializer; import org.onap.aai.serialization.db.EdgeProperty; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import java.io.FileInputStream; @@ -60,7 +60,7 @@ import static org.mockito.Mockito.when; @RunWith(value = Parameterized.class) public class DataCopyTest { - private static TitanGraph graph; + private static JanusGraph graph; private final static Version version = Version.getLatest(); private final static ModelType introspectorFactoryType = ModelType.MOXY; private final static DBConnectionType type = DBConnectionType.REALTIME; @@ -84,7 +84,7 @@ public class DataCopyTest { @BeforeClass public static void setup() throws NoSuchFieldException, SecurityException, Exception { - graph = TitanFactory.build().set("storage.backend","inmemory").open(); + graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); System.setProperty("AJSC_HOME", "."); System.setProperty("BUNDLECONFIG_DIR", "src/test/resources/bundleconfig-local"); loader = LoaderFactory.createLoaderForVersion(introspectorFactoryType, version); @@ -107,7 +107,7 @@ public class DataCopyTest { @Before public void initMock() { MockitoAnnotations.initMocks(this); - dbEngine = new TitanDBEngine( + dbEngine = new JanusGraphDBEngine( queryStyle, type, loader); diff --git a/aai-core/src/test/java/org/onap/aai/introspection/sideeffect/DataLinkTest.java b/aai-core/src/test/java/org/onap/aai/introspection/sideeffect/DataLinkTest.java index 59fe8b86..d44c6cc3 100644 --- a/aai-core/src/test/java/org/onap/aai/introspection/sideeffect/DataLinkTest.java +++ b/aai-core/src/test/java/org/onap/aai/introspection/sideeffect/DataLinkTest.java @@ -19,12 +19,17 @@ */ package org.onap.aai.introspection.sideeffect; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraphFactory; +import org.janusgraph.core.schema.JanusGraphManagement; +import org.janusgraph.core.JanusGraph; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Graph; import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.VertexProperty; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.*; import org.junit.*; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; @@ -37,10 +42,11 @@ import org.onap.aai.dbmap.DBConnectionType; import org.onap.aai.exceptions.AAIException; import org.onap.aai.introspection.*; import org.onap.aai.parsers.query.QueryParser; +import org.onap.aai.serialization.db.AAIDirection; import org.onap.aai.serialization.db.DBSerializer; import org.onap.aai.serialization.db.EdgeProperty; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import java.io.UnsupportedEncodingException; @@ -49,16 +55,17 @@ import java.net.MalformedURLException; import java.net.URISyntaxException; import java.util.Arrays; import java.util.Collection; +import java.util.Iterator; import java.util.List; -import static org.junit.Assert.assertEquals; +import static org.junit.Assert.*; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @RunWith(value = Parameterized.class) public class DataLinkTest extends AAISetup { - private static TitanGraph graph; + private static JanusGraph graph; private final static Version version = Version.getLatest(); private final static ModelType introspectorFactoryType = ModelType.MOXY; private final static DBConnectionType type = DBConnectionType.REALTIME; @@ -82,7 +89,7 @@ public class DataLinkTest extends AAISetup { @BeforeClass public static void setup() throws NoSuchFieldException, SecurityException, Exception { - graph = TitanFactory.build().set("storage.backend","inmemory").open(); + graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); loader = LoaderFactory.createLoaderForVersion(introspectorFactoryType, version); graph.traversal().addV("aai-node-type", "vpn-binding", "vpn-id", "addKey", AAIProperties.AAI_URI, "/network/vpn-bindings/vpn-binding/addKey").as("v1") @@ -113,7 +120,7 @@ public class DataLinkTest extends AAISetup { @Before public void initMock() { MockitoAnnotations.initMocks(this); - dbEngine = new TitanDBEngine( + dbEngine = new JanusGraphDBEngine( queryStyle, type, loader); @@ -131,6 +138,24 @@ public class DataLinkTest extends AAISetup { TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); Graph g = graph.newTransaction(); GraphTraversalSource traversal = g.traversal(); +// Graph g = graph.newTransaction(); +// GraphTraversalSource traversal = g; + System.out.println("Begin method inventory:"); + Iterator<Vertex> vertexItr = traversal.V(); + while( vertexItr != null && vertexItr.hasNext() ){ + Vertex v = vertexItr.next(); + System.out.println("\nnodeType="+v.<String>property("aai-node-type")); + for(String key: v.keys()) { + System.out.println("label="+v.label()+";key= "+key+";value= "+v.value(key)+";id= "+v.id()); + } + Direction d = null; + Iterator<Edge> edgeItr = v.edges(Direction.BOTH); + while( edgeItr != null && edgeItr.hasNext() ){ + Edge e = edgeItr.next(); + System.out.println("outV="+e.outVertex().property(AAIProperties.NODE_TYPE)+"/"+e.outVertex().id()+";inV= "+e.inVertex().property(AAIProperties.NODE_TYPE)+"/"+e.inVertex().id()); + } + } + System.out.println("End method inventory:"); when(spy.asAdmin()).thenReturn(adminSpy); when(adminSpy.getTraversalSource()).thenReturn(traversal); when(spy.tx()).thenReturn(g); @@ -158,23 +183,80 @@ public class DataLinkTest extends AAISetup { obj.setValue("route-target-role", "modifyRoleKey2"); TransactionalGraphEngine spy = spy(dbEngine); TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin()); +// Graph g = graph.newTransaction(); +// GraphTraversalSource traversal = g; Graph g = graph.newTransaction(); GraphTraversalSource traversal = g.traversal(); + System.out.println("Begin method inventory:"); + Iterator<Vertex> vertexItr = traversal.V(); + while( vertexItr != null && vertexItr.hasNext() ){ + Vertex v = vertexItr.next(); + System.out.println("\nnodeType="+v.<String>property("aai-node-type")); + for(String key: v.keys()) { + System.out.println("label="+v.label()+";key= "+key+";value= "+v.value(key)+"/"+v.id()); + } + Direction d = null; + Iterator<Edge> edgeItr = v.edges(Direction.BOTH); + while( edgeItr != null && edgeItr.hasNext() ){ + Edge e = edgeItr.next(); + System.out.println("outV="+e.outVertex().property(AAIProperties.NODE_TYPE)+"/"+e.outVertex().id()+";inV= "+e.inVertex().property(AAIProperties.NODE_TYPE)+"/"+e.inVertex().id()); + } + } + System.out.println("End method inventory:"); + when(spy.asAdmin()).thenReturn(adminSpy); when(adminSpy.getTraversalSource()).thenReturn(traversal); +// when(spy.tx()).thenReturn(graph); when(spy.tx()).thenReturn(g); when(self.<String>property(AAIProperties.AAI_URI)).thenReturn(prop); when(prop.orElse(null)).thenReturn(obj.getURI()); DBSerializer serializer = new DBSerializer(version, spy, introspectorFactoryType, "AAI_TEST"); SideEffectRunner runner = new SideEffectRunner .Builder(spy, serializer).addSideEffect(DataLinkWriter.class).build(); - + System.out.println("Traversal Source: "+traversal.toString()); + vertexItr = traversal.V(); + System.out.println("Begin method inventory:"); + while( vertexItr != null && vertexItr.hasNext() ){ + Vertex v = vertexItr.next(); + System.out.println("\nnodeType="+v.<String>property("aai-node-type")); + for(String key: v.keys()) { + System.out.println("label="+v.label()+";key= "+key+";value= "+v.value(key)+"/"+v.id()); + } + Iterator<Edge> edgeItr = v.edges(Direction.BOTH); + while( edgeItr != null && edgeItr.hasNext() ){ + Edge e = edgeItr.next(); + System.out.println("outV="+e.outVertex().property(AAIProperties.NODE_TYPE)+"/"+e.outVertex().id()+";inV= "+e.inVertex().property(AAIProperties.NODE_TYPE)+"/"+e.inVertex().id()); + } + } + System.out.println("End method inventory:"); + try { runner.execute(obj, self); + } catch(Exception e) { - assertEquals("route-target vertex found", true, traversal.V() - .has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "modifyTargetKey2").has("route-target-role", "modifyRoleKey2").has("linked", true).hasNext()); - assertEquals("previous link removed", true, traversal.V() - .has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "modifyTargetKey").has("route-target-role", "modifyRoleKey").hasNot("linked").hasNext()); + } +// runner.execute(obj, self); + System.out.println("=================\n"); + vertexItr = traversal.V(); + while( vertexItr != null && vertexItr.hasNext() ){ + Vertex v = vertexItr.next(); + System.out.println("\nnodeType="+v.<String>property("aai-node-type")); + for(String key: v.keys()) { + System.out.println("label="+v.label()+";key= "+key+";value= "+v.value(key)+"/"+v.id()); + } + Iterator<Edge> edgeItr = v.edges(Direction.BOTH); + while( edgeItr != null && edgeItr.hasNext() ){ + Edge e = edgeItr.next(); + System.out.println("outV="+e.outVertex().property(AAIProperties.NODE_TYPE)+"/"+e.outVertex().id()+";inV= "+e.inVertex().property(AAIProperties.NODE_TYPE)+"/"+e.inVertex().id()); + } + } + assertThat("new route-target vertex found with/or without link", traversal.V() + .has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "modifyTargetKey2").has("route-target-role", "modifyRoleKey2").hasNext(),is(true)); + assertThat("new route-target vertex found", traversal.V() + .has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "modifyTargetKey2").has("route-target-role", "modifyRoleKey2").has("linked", true).hasNext(),is(true)); + assertThat("previous link removed", traversal.V() + .has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "modifyTargetKey").has("route-target-role", "modifyRoleKey").has("linked").hasNext(),is(not(true))); + assertThat("previous vertex still exists", traversal.V() + .has(AAIProperties.NODE_TYPE, "route-target").has("global-route-target", "modifyTargetKey").has("route-target-role", "modifyRoleKey").hasNext(),is(true)); g.tx().rollback(); } diff --git a/aai-core/src/test/java/org/onap/aai/parsers/query/GraphTraversalTest.java b/aai-core/src/test/java/org/onap/aai/parsers/query/GraphTraversalTest.java index 02e9efa1..e901c65f 100644 --- a/aai-core/src/test/java/org/onap/aai/parsers/query/GraphTraversalTest.java +++ b/aai-core/src/test/java/org/onap/aai/parsers/query/GraphTraversalTest.java @@ -37,7 +37,7 @@ import org.onap.aai.introspection.ModelType; import org.onap.aai.introspection.Version; import org.onap.aai.rest.RestTokens; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import javax.ws.rs.core.MultivaluedHashMap; @@ -82,12 +82,12 @@ public class GraphTraversalTest extends AAISetup { @Before public void configure() throws Exception { dbEngine = - new TitanDBEngine(queryStyle, + new JanusGraphDBEngine(queryStyle, LoaderFactory.createLoaderForVersion(ModelType.MOXY, AAIProperties.LATEST), false); dbEnginev9 = - new TitanDBEngine(queryStyle, + new JanusGraphDBEngine(queryStyle, LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v9), false); } diff --git a/aai-core/src/test/java/org/onap/aai/parsers/query/GremlinPipelineTraversalTest.java b/aai-core/src/test/java/org/onap/aai/parsers/query/GremlinPipelineTraversalTest.java new file mode 100644 index 00000000..f56d6f62 --- /dev/null +++ b/aai-core/src/test/java/org/onap/aai/parsers/query/GremlinPipelineTraversalTest.java @@ -0,0 +1,447 @@ +/*- + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright (C) 2017 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========================================================= + */ + +/*package org.onap.aai.parsers.query; + +import static org.hamcrest.CoreMatchers.startsWith; +import static org.junit.Assert.assertEquals; + +import java.io.UnsupportedEncodingException; +import java.net.URI; + +import javax.ws.rs.core.MultivaluedHashMap; +import javax.ws.rs.core.MultivaluedMap; + +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +import org.onap.aai.db.AAIProperties; +import org.onap.aai.exceptions.AAIException; +import org.onap.aai.introspection.LoaderFactory; +import org.onap.aai.introspection.ModelType; +import org.onap.aai.introspection.Version; +import org.onap.aai.logging.LogLineBuilder; +import org.onap.aai.serialization.engines.QueryStyle; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; +import org.onap.aai.serialization.engines.TransactionalGraphEngine; + +import com.tinkerpop.gremlin.java.GremlinPipeline; +import com.tinkerpop.pipes.IdentityPipe; + +public class GremlinPipelineTraversalTest { + + private TransactionalGraphEngine dbEngine = + new JanusGraphDBEngine(QueryStyle.GREMLINPIPELINE_TRAVERSAL, + LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v7, new LogLineBuilder("TEST", "TEST")), + false); + + private TransactionalGraphEngine dbEnginev6 = + new JanusGraphDBEngine(QueryStyle.GREMLINPIPELINE_TRAVERSAL, + LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v6, new LogLineBuilder("TEST", "TEST")), + false); + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @BeforeClass + public static void configure() { + System.setProperty("AJSC_HOME", "."); + System.setProperty("BUNDLECONFIG_DIR", "bundleconfig-local"); + } + + @Test + public void parentQuery() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("cloud-infrastructure/complexes/complex/key1").build(); + + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + + GremlinPipeline expected = new GremlinPipeline(new IdentityPipe()).V().has("physical-location-id", "key1").has("aai-node-type", "complex"); + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal to normal query", + expected.toString(), + query.getQueryBuilder().getParentQuery().toString()); + assertEquals( + "result type should be complex", + "complex", + query.getResultType()); + assertEquals( + "result type should be empty", + "", + query.getParentResultType()); + assertEquals("dependent",false, query.isDependent()); + + + } + + @Test + public void childQuery() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("cloud-infrastructure/complexes/complex/key1/ctag-pools/ctag-pool/key2/key3").build(); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + GremlinPipeline expected = new GremlinPipeline(new IdentityPipe()).V() + .has("physical-location-id", "key1").has("aai-node-type", "complex") + .in("org.onap.relationships.inventory.BelongsTo") + .has("target-pe", "key2").has("availability-zone-name", "key3"); + GremlinPipeline expectedParent = new GremlinPipeline(new IdentityPipe()).V() + .has("physical-location-id", "key1").has("aai-node-type", "complex"); + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for complex", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().toString()); + assertEquals( + "result type should be complex", + "complex", + query.getParentResultType()); + assertEquals( + "result type should be ctag-pool", + "ctag-pool", + query.getResultType()); + assertEquals("dependent",true, query.isDependent()); + + + } + + @Test + public void namingExceptions() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("network/vces/vce/key1/port-groups/port-group/key2/cvlan-tags/cvlan-tag/655").build(); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + GremlinPipeline expected = new GremlinPipeline(new IdentityPipe()).V() + .has("vnf-id", "key1").has("aai-node-type", "vce") + .in("org.onap.relationships.inventory.BelongsTo") + .has("interface-id", "key2").in("org.onap.relationships.inventory.BelongsTo") + .has("cvlan-tag", 655); + GremlinPipeline expectedParent = new GremlinPipeline(new IdentityPipe()).V() + .has("vnf-id", "key1").has("aai-node-type", "vce") + .in("org.onap.relationships.inventory.BelongsTo") + .has("interface-id", "key2"); + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for port group", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().toString()); + assertEquals( + "result type should be cvlan-tag", + "cvlan-tag", + query.getResultType()); + assertEquals( + "result type should be port-group", + "port-group", + query.getParentResultType()); + assertEquals( + "contaner type should be empty", + "", + query.getContainerType()); + assertEquals("dependent",true, query.isDependent()); + + + } + + @Test + public void getAll() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("network/vces/vce/key1/port-groups/port-group/key2/cvlan-tags").build(); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + GremlinPipeline expected = new GremlinPipeline(new IdentityPipe()).V() + .has("vnf-id", "key1").has("aai-node-type", "vce") + .in("org.onap.relationships.inventory.BelongsTo") + .has("interface-id", "key2").in("org.onap.relationships.inventory.BelongsTo") + .has("aai-node-type", "cvlan-tag"); + GremlinPipeline expectedParent = new GremlinPipeline(new IdentityPipe()).V() + .has("vnf-id", "key1").has("aai-node-type", "vce") + .in("org.onap.relationships.inventory.BelongsTo") + .has("interface-id", "key2"); + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for port group", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().toString()); + assertEquals( + "result type should be port-group", + "port-group", + query.getParentResultType()); + assertEquals( + "result type should be cvlan-tag", + "cvlan-tag", + query.getResultType()); + assertEquals( + "container type should be cvlan-tags", + "cvlan-tags", + query.getContainerType()); + assertEquals("dependent",true, query.isDependent()); + + + } + + @Test + public void getItemAffectedByDefaultCloudRegion() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("cloud-infrastructure/tenants/tenant/key1/vservers/vserver/key2/l-interfaces/l-interface/key3").build(); + QueryParser query = dbEnginev6.getQueryBuilder().createQueryFromURI(uri); + GremlinPipeline expected = new GremlinPipeline(new IdentityPipe()).V() + .has("cloud-owner", "att-aic").has("aai-node-type", "cloud-region") + .has("cloud-region-id", "AAIAIC25") + .in("org.onap.relationships.inventory.BelongsTo") + .has("tenant-id", "key1") + .in("org.onap.relationships.inventory.BelongsTo") + .has("vserver-id", "key2") + .in("org.onap.relationships.inventory.BelongsTo") + .has("interface-name", "key3"); + GremlinPipeline expectedParent = new GremlinPipeline(new IdentityPipe()).V() + .has("cloud-owner", "att-aic").has("aai-node-type", "cloud-region") + .has("cloud-region-id", "AAIAIC25") + .in("org.onap.relationships.inventory.BelongsTo") + .has("tenant-id", "key1") + .in("org.onap.relationships.inventory.BelongsTo") + .has("vserver-id", "key2"); + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for vserver", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().toString()); + assertEquals( + "result type should be vserver", + "vserver", + query.getParentResultType()); + assertEquals( + "result type should be l-interface", + "l-interface", + query.getResultType()); + assertEquals( + "container type should be empty", + "", + query.getContainerType()); + assertEquals("dependent",true, query.isDependent()); + + } + + @Test + public void getViaQueryParam() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("cloud-infrastructure/tenants/tenant").build(); + MultivaluedMap<String, String> map = new MultivaluedHashMap<>(); + + .has("tenant-name", "Tenant1"); + + .has("tenant-name", "Tenant2"); + + GremlinPipeline expectedParent = new GremlinPipeline(new IdentityPipe()).V() + .has("cloud-owner", "att-aic").has("aai-node-type", "cloud-region") + .has("cloud-region-id", "AAIAIC25"); + + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for cloud-region", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().toString()); + assertEquals( + "result type should be cloud-region", + "cloud-region", + query.getParentResultType()); + assertEquals( + "result type should be tenant", + "tenant", + query.getResultType()); + assertEquals( + "container type should be empty", + "", + query.getContainerType()); + assertEquals("dependent",true, query.isDependent()); + + } + + @Test + public void getPluralViaQueryParam() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("network/vnfcs").build(); + MultivaluedMap<String, String> map = new MultivaluedHashMap<>(); + map.putSingle("prov-status", "up"); + QueryParser query = dbEnginev6.getQueryBuilder().createQueryFromURI(uri, map); + GremlinPipeline expected = new GremlinPipeline(new IdentityPipe()).V() + .has("aai-node-type", "vnfc") + .has("prov-status", "up"); + + GremlinPipeline expectedParent = new GremlinPipeline(new IdentityPipe()).V() + .has("aai-node-type", "vnfc"); + + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().toString()); + assertEquals( + "parent result type should be empty", + "", + query.getParentResultType()); + assertEquals( + "result type should be vnfc", + "vnfc", + query.getResultType()); + assertEquals( + "container type should be empty", + "vnfcs", + query.getContainerType()); + assertEquals("dependent",true, query.isDependent()); + + } + + @Test + public void getAllQueryParamNamingException() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("network/vces/vce/key1/port-groups/port-group/key2/cvlan-tags").build(); + MultivaluedMap<String, String> map = new MultivaluedHashMap<>(); + map.putSingle("cvlan-tag", "333"); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri, map); + + GremlinPipeline expected = new GremlinPipeline(new IdentityPipe()).V() + .has("vnf-id", "key1").has("aai-node-type", "vce") + .in("org.onap.relationships.inventory.BelongsTo") + .has("interface-id", "key2").in("org.onap.relationships.inventory.BelongsTo") + .has("aai-node-type", "cvlan-tag") + .has("cvlan-tag", 333); + GremlinPipeline expectedParent = new GremlinPipeline(new IdentityPipe()).V() + .has("vnf-id", "key1").has("aai-node-type", "vce") + .in("org.onap.relationships.inventory.BelongsTo") + .has("interface-id", "key2"); + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for port group", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().toString()); + assertEquals( + "result type should be port-group", + "port-group", + query.getParentResultType()); + assertEquals( + "result type should be cvlan-tag", + "cvlan-tag", + query.getResultType()); + assertEquals( + "container type should be cvlan-tags", + "cvlan-tags", + query.getContainerType()); + assertEquals("dependent",true, query.isDependent()); + + + } + + @Test + public void abstractType() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("vnf/key1").build(); + + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + + GremlinPipeline expected = new GremlinPipeline(new IdentityPipe()).V() + .has("vnf-id", "key1").or( + new GremlinPipeline(new IdentityPipe()).has(AAIProperties.NODE_TYPE, "vce"), + new GremlinPipeline(new IdentityPipe()).has(AAIProperties.NODE_TYPE, "generic-vnf")); + + GremlinPipeline expectedParent = expected; + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for port group", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().toString()); + assertEquals( + "result type should be empty", + "", + query.getParentResultType()); + assertEquals( + "result type should be vnf", + "vnf", + query.getResultType()); + + assertEquals("dependent",false, query.isDependent()); + + + } + + @Test + public void nonParentAbstractType() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("cloud-infrastructure/pservers/pserver/key2/vnf/key1").build(); + thrown.expect(AAIException.class); + thrown.expectMessage(startsWith("AAI_3001")); + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + + + + } + + @Test + public void parentAbstractTypeWithNesting() throws UnsupportedEncodingException, AAIException { + URI uri = UriBuilder.fromPath("vnf/key1/vf-modules/vf-module/key2").build(); + + QueryParser query = dbEngine.getQueryBuilder().createQueryFromURI(uri); + + GremlinPipeline expected = new GremlinPipeline(new IdentityPipe()).V() + .has("vnf-id", "key1").or( + new GremlinPipeline(new IdentityPipe()).has(AAIProperties.NODE_TYPE, "vce"), + new GremlinPipeline(new IdentityPipe()).has(AAIProperties.NODE_TYPE, "generic-vnf")) + .outE().has("isParent", true).inV().has("vf-module-id", "key2"); + GremlinPipeline expectedParent = new GremlinPipeline(new IdentityPipe()).V() + .has("vnf-id", "key1").or( + new GremlinPipeline(new IdentityPipe()).has(AAIProperties.NODE_TYPE, "vce"), + new GremlinPipeline(new IdentityPipe()).has(AAIProperties.NODE_TYPE, "generic-vnf")); + assertEquals( + "gremlin query should be " + expected.toString(), + expected.toString(), + query.getQueryBuilder().getQuery().toString()); + assertEquals( + "parent gremlin query should be equal the query for ", + expectedParent.toString(), + query.getQueryBuilder().getParentQuery().toString()); + assertEquals( + "result type should be vnf", + "vnf", + query.getParentResultType()); + assertEquals( + "result type should be vf-module", + "vf-module", + query.getResultType()); + + assertEquals("dependent",true, query.isDependent()); + + } +} +*/ diff --git a/aai-core/src/test/java/org/onap/aai/parsers/query/LegacyQueryTest.java b/aai-core/src/test/java/org/onap/aai/parsers/query/LegacyQueryTest.java index 1a4a2fbd..a2bcf6d0 100644 --- a/aai-core/src/test/java/org/onap/aai/parsers/query/LegacyQueryTest.java +++ b/aai-core/src/test/java/org/onap/aai/parsers/query/LegacyQueryTest.java @@ -29,7 +29,7 @@ import org.onap.aai.introspection.ModelInjestor; import org.onap.aai.introspection.ModelType; import org.onap.aai.introspection.Version; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import javax.ws.rs.core.UriBuilder; @@ -46,7 +46,7 @@ public class LegacyQueryTest extends AAISetup { private ModelInjestor injestor = ModelInjestor.getInstance(); private TransactionalGraphEngine dbEngine = - new TitanDBEngine(QueryStyle.GREMLIN_TRAVERSAL, + new JanusGraphDBEngine(QueryStyle.GREMLIN_TRAVERSAL, LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v8), false); private final Version version = Version.v8; diff --git a/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipGremlinQueryTest.java b/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipGremlinQueryTest.java index 9c853e23..19c48801 100644 --- a/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipGremlinQueryTest.java +++ b/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipGremlinQueryTest.java @@ -30,7 +30,7 @@ import org.onap.aai.AAISetup; import org.onap.aai.exceptions.AAIException; import org.onap.aai.introspection.*; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import javax.xml.bind.JAXBException; @@ -47,7 +47,7 @@ public class RelationshipGremlinQueryTest extends AAISetup { private ModelInjestor injestor = ModelInjestor.getInstance(); private TransactionalGraphEngine dbEngine = - new TitanDBEngine(QueryStyle.GREMLIN_TRAVERSAL, + new JanusGraphDBEngine(QueryStyle.GREMLIN_TRAVERSAL, LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v8), false); private final Version version = Version.v8; diff --git a/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipQueryTest.java b/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipQueryTest.java index 597c6675..c92cab27 100644 --- a/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipQueryTest.java +++ b/aai-core/src/test/java/org/onap/aai/parsers/query/RelationshipQueryTest.java @@ -28,7 +28,7 @@ import org.onap.aai.AAISetup; import org.onap.aai.exceptions.AAIException; import org.onap.aai.introspection.*; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import javax.xml.bind.JAXBException; @@ -45,7 +45,7 @@ public class RelationshipQueryTest extends AAISetup { private ModelInjestor injestor = ModelInjestor.getInstance(); private TransactionalGraphEngine dbEngine = - new TitanDBEngine(QueryStyle.GREMLIN_TRAVERSAL, + new JanusGraphDBEngine(QueryStyle.GREMLIN_TRAVERSAL, LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v8), false); private final Version version = Version.v8; diff --git a/aai-core/src/test/java/org/onap/aai/parsers/query/UniqueRelationshipQueryTest.java b/aai-core/src/test/java/org/onap/aai/parsers/query/UniqueRelationshipQueryTest.java index 8a0c727f..1430b87d 100644 --- a/aai-core/src/test/java/org/onap/aai/parsers/query/UniqueRelationshipQueryTest.java +++ b/aai-core/src/test/java/org/onap/aai/parsers/query/UniqueRelationshipQueryTest.java @@ -32,7 +32,7 @@ import org.onap.aai.AAISetup; import org.onap.aai.exceptions.AAIException; import org.onap.aai.introspection.*; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import javax.xml.bind.JAXBException; @@ -48,7 +48,7 @@ public class UniqueRelationshipQueryTest extends AAISetup { private ModelInjestor injestor = ModelInjestor.getInstance(); private TransactionalGraphEngine dbEngine = - new TitanDBEngine(QueryStyle.GREMLIN_UNIQUE, + new JanusGraphDBEngine(QueryStyle.GREMLIN_UNIQUE, LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v8), false); private final Version version = Version.v8; diff --git a/aai-core/src/test/java/org/onap/aai/parsers/query/UniqueURIQueryTest.java b/aai-core/src/test/java/org/onap/aai/parsers/query/UniqueURIQueryTest.java index 735785b7..edb80bfb 100644 --- a/aai-core/src/test/java/org/onap/aai/parsers/query/UniqueURIQueryTest.java +++ b/aai-core/src/test/java/org/onap/aai/parsers/query/UniqueURIQueryTest.java @@ -32,7 +32,7 @@ import org.onap.aai.introspection.ModelInjestor; import org.onap.aai.introspection.ModelType; import org.onap.aai.introspection.Version; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import javax.ws.rs.core.UriBuilder; @@ -46,7 +46,7 @@ public class UniqueURIQueryTest extends AAISetup { private ModelInjestor injestor = ModelInjestor.getInstance(); private TransactionalGraphEngine dbEngine = - new TitanDBEngine(QueryStyle.GREMLIN_UNIQUE, + new JanusGraphDBEngine(QueryStyle.GREMLIN_UNIQUE, LoaderFactory.createLoaderForVersion(ModelType.MOXY, Version.v8), false); private final Version version = Version.v8; diff --git a/aai-core/src/test/java/org/onap/aai/query/builder/QueryBuilderTestAbstraction.java b/aai-core/src/test/java/org/onap/aai/query/builder/QueryBuilderTestAbstraction.java index 9cdab403..6d45d947 100644 --- a/aai-core/src/test/java/org/onap/aai/query/builder/QueryBuilderTestAbstraction.java +++ b/aai-core/src/test/java/org/onap/aai/query/builder/QueryBuilderTestAbstraction.java @@ -19,7 +19,7 @@ */ package org.onap.aai.query.builder; -import com.thinkaurelius.titan.core.TitanFactory; +import org.janusgraph.core.JanusGraphFactory; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.process.traversal.step.util.BulkSet; import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree; @@ -56,7 +56,7 @@ public abstract class QueryBuilderTestAbstraction extends AAISetup { @BeforeClass public static void setup() throws Exception { loader = LoaderFactory.createLoaderForVersion(ModelType.MOXY, AAIProperties.LATEST); - graph = TitanFactory.build().set("storage.backend", "inmemory").open(); + graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open(); } @Before diff --git a/aai-core/src/test/java/org/onap/aai/serialization/db/DbAliasTest.java b/aai-core/src/test/java/org/onap/aai/serialization/db/DbAliasTest.java index 27d14c94..a2bf5876 100644 --- a/aai-core/src/test/java/org/onap/aai/serialization/db/DbAliasTest.java +++ b/aai-core/src/test/java/org/onap/aai/serialization/db/DbAliasTest.java @@ -19,8 +19,8 @@ */ package org.onap.aai.serialization.db; -import com.thinkaurelius.titan.core.TitanFactory; -import com.thinkaurelius.titan.core.TitanGraph; +import org.janusgraph.core.JanusGraphFactory; +import org.janusgraph.core.JanusGraph; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Graph; import org.apache.tinkerpop.gremlin.structure.Vertex; @@ -36,7 +36,7 @@ import org.onap.aai.introspection.*; import org.onap.aai.parsers.query.QueryParser; import org.onap.aai.schema.enums.PropertyMetadata; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import java.io.UnsupportedEncodingException; @@ -56,7 +56,7 @@ import static org.mockito.Mockito.when; @RunWith(value = Parameterized.class) public class DbAliasTest extends AAISetup { - private TitanGraph graph; + private JanusGraph graph; private final Version version = Version.v9; private final ModelType introspectorFactoryType = ModelType.MOXY; @@ -76,9 +76,9 @@ public class DbAliasTest extends AAISetup { @Before public void setup() throws Exception { - graph = TitanFactory.build().set("storage.backend","inmemory").open(); + graph = JanusGraphFactory.build().set("storage.backend","inmemory").open(); loader = LoaderFactory.createLoaderForVersion(introspectorFactoryType, version); - dbEngine = new TitanDBEngine( + dbEngine = new JanusGraphDBEngine( queryStyle, type, loader); diff --git a/aai-core/src/test/java/org/onap/aai/serialization/db/DbSerializerTest.java b/aai-core/src/test/java/org/onap/aai/serialization/db/DbSerializerTest.java index 3cf43b4a..77513aa3 100644 --- a/aai-core/src/test/java/org/onap/aai/serialization/db/DbSerializerTest.java +++ b/aai-core/src/test/java/org/onap/aai/serialization/db/DbSerializerTest.java @@ -19,7 +19,7 @@ */ package org.onap.aai.serialization.db; -import com.thinkaurelius.titan.core.TitanFactory; +import org.janusgraph.core.JanusGraphFactory; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.*; import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph; @@ -34,7 +34,7 @@ import org.onap.aai.exceptions.AAIException; import org.onap.aai.introspection.*; import org.onap.aai.parsers.query.QueryParser; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import java.io.UnsupportedEncodingException; @@ -80,7 +80,7 @@ public class DbSerializerTest extends AAISetup { @BeforeClass public static void init() throws Exception { - graph = TitanFactory.build().set("storage.backend", "inmemory").open(); + graph = JanusGraphFactory.build().set("storage.backend", "inmemory").open(); } @@ -88,12 +88,12 @@ public class DbSerializerTest extends AAISetup { public void setup() throws Exception { //createGraph(); loader = LoaderFactory.createLoaderForVersion(introspectorFactoryType, version); - dbEngine = new TitanDBEngine(queryStyle, type, loader); + dbEngine = new JanusGraphDBEngine(queryStyle, type, loader); spy = spy(dbEngine); adminSpy = spy(dbEngine.asAdmin()); - engine = new TitanDBEngine(queryStyle, type, loader); + engine = new JanusGraphDBEngine(queryStyle, type, loader); dbser = new DBSerializer(version, engine, introspectorFactoryType, "AAI-TEST"); } diff --git a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/CountQuerySupportTest.java b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/CountQuerySupportTest.java index 606b6f69..0bdfa150 100644 --- a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/CountQuerySupportTest.java +++ b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/CountQuerySupportTest.java @@ -47,7 +47,7 @@ import org.onap.aai.introspection.Version; import org.onap.aai.serialization.db.DBSerializer; import org.onap.aai.serialization.db.EdgeRules; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import org.onap.aai.serialization.queryformats.exceptions.AAIFormatQueryResultFormatNotSupported; import org.onap.aai.serialization.queryformats.exceptions.AAIFormatVertexException; @@ -142,7 +142,7 @@ public class CountQuerySupportTest extends AAISetup { if (loader == null) { loader = LoaderFactory.createLoaderForVersion(factoryType, version); - dbEngine = spy(new TitanDBEngine(QueryStyle.TRAVERSAL, DBConnectionType.CACHED, loader)); + dbEngine = spy(new JanusGraphDBEngine(QueryStyle.TRAVERSAL, DBConnectionType.CACHED, loader)); serializer = new DBSerializer(version, dbEngine, factoryType, "Junit"); ff = new FormatFactory(loader, serializer); diff --git a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/MultiFormatTest.java b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/MultiFormatTest.java index c6aedf9e..27fd78ad 100644 --- a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/MultiFormatTest.java +++ b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/MultiFormatTest.java @@ -49,7 +49,7 @@ import org.onap.aai.introspection.Version; import org.onap.aai.serialization.db.DBSerializer; import org.onap.aai.serialization.db.EdgeRules; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import org.onap.aai.serialization.queryformats.exceptions.AAIFormatQueryResultFormatNotSupported; import org.onap.aai.serialization.queryformats.exceptions.AAIFormatVertexException; @@ -155,7 +155,7 @@ public class MultiFormatTest extends AAISetup { if (loader == null) { loader = LoaderFactory.createLoaderForVersion(factoryType, version); - dbEngine = spy(new TitanDBEngine(QueryStyle.TRAVERSAL, DBConnectionType.CACHED, loader)); + dbEngine = spy(new JanusGraphDBEngine(QueryStyle.TRAVERSAL, DBConnectionType.CACHED, loader)); TransactionalGraphEngine.Admin spyAdmin = spy(dbEngine.asAdmin()); diff --git a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/RawFormatTest.java b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/RawFormatTest.java index 5633e4cb..8f4fd359 100644 --- a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/RawFormatTest.java +++ b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/RawFormatTest.java @@ -43,7 +43,7 @@ import org.onap.aai.introspection.Version; import org.onap.aai.serialization.db.DBSerializer; import org.onap.aai.serialization.db.EdgeRules; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import org.onap.aai.serialization.queryformats.exceptions.AAIFormatQueryResultFormatNotSupported; import org.onap.aai.serialization.queryformats.exceptions.AAIFormatVertexException; @@ -112,7 +112,7 @@ public class RawFormatTest extends AAISetup { if (loader == null) { loader = LoaderFactory.createLoaderForVersion(factoryType, version); - dbEngine = spy(new TitanDBEngine(QueryStyle.TRAVERSAL, DBConnectionType.CACHED, loader)); + dbEngine = spy(new JanusGraphDBEngine(QueryStyle.TRAVERSAL, DBConnectionType.CACHED, loader)); serializer = new DBSerializer(version, dbEngine, factoryType, "Junit"); rawFormat = new RawFormat.Builder(loader, serializer, urlBuilder).build(); diff --git a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/SimpleFormatTest.java b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/SimpleFormatTest.java index 23c8abf2..7636b8d7 100644 --- a/aai-core/src/test/java/org/onap/aai/serialization/queryformats/SimpleFormatTest.java +++ b/aai-core/src/test/java/org/onap/aai/serialization/queryformats/SimpleFormatTest.java @@ -41,7 +41,7 @@ import org.onap.aai.introspection.Version; import org.onap.aai.introspection.exceptions.AAIUnknownObjectException; import org.onap.aai.serialization.db.DBSerializer; import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TitanDBEngine; +import org.onap.aai.serialization.engines.JanusGraphDBEngine; import org.onap.aai.serialization.engines.TransactionalGraphEngine; import org.onap.aai.serialization.queryformats.exceptions.AAIFormatVertexException; import org.onap.aai.serialization.queryformats.utils.UrlBuilder; @@ -149,7 +149,7 @@ public class SimpleFormatTest extends AAISetup { if(loader == null){ loader = LoaderFactory.createLoaderForVersion(factoryType, Version.v10); - dbEngine = spy(new TitanDBEngine(QueryStyle.TRAVERSAL, DBConnectionType.CACHED, loader)); + dbEngine = spy(new JanusGraphDBEngine(QueryStyle.TRAVERSAL, DBConnectionType.CACHED, loader)); TransactionalGraphEngine.Admin spyAdmin = spy(dbEngine.asAdmin()); diff --git a/aai-core/src/test/resources/bundleconfig-local/etc/appprops/error.properties b/aai-core/src/test/resources/bundleconfig-local/etc/appprops/error.properties index da9f5e5b..3a5671c2 100644 --- a/aai-core/src/test/resources/bundleconfig-local/etc/appprops/error.properties +++ b/aai-core/src/test/resources/bundleconfig-local/etc/appprops/error.properties @@ -62,7 +62,7 @@ AAI_5107=5:2:WARN:5107:400:3000:Required information missing AAI_5108=5:2:WARN:5108:200:0:Unexpected information in request being ignored #--- aaidbgen: 6101-6199 -AAI_6101=5:4:ERROR:6101:500:3002:null TitanGraph object passed +AAI_6101=5:4:ERROR:6101:500:3002:null JanusGraph object passed AAI_6102=5:4:WARN:6102:400:3000:Passed-in property is not valid for this nodeType AAI_6103=5:4:WARN:6103:400:3000:Required Node-property not found in input data AAI_6104=5:4:WARN:6104:400:3000:Required Node-property was passed with no data diff --git a/aai-core/src/test/resources/bundleconfig-local/etc/appprops/titan-cached.properties b/aai-core/src/test/resources/bundleconfig-local/etc/appprops/janusgraph-cached.properties index 9306199d..9306199d 100644 --- a/aai-core/src/test/resources/bundleconfig-local/etc/appprops/titan-cached.properties +++ b/aai-core/src/test/resources/bundleconfig-local/etc/appprops/janusgraph-cached.properties diff --git a/aai-core/src/test/resources/bundleconfig-local/etc/appprops/titan-realtime.properties b/aai-core/src/test/resources/bundleconfig-local/etc/appprops/janusgraph-realtime.properties index 6e1863b7..6e1863b7 100644 --- a/aai-core/src/test/resources/bundleconfig-local/etc/appprops/titan-realtime.properties +++ b/aai-core/src/test/resources/bundleconfig-local/etc/appprops/janusgraph-realtime.properties diff --git a/aai-core/src/test/resources/logback.xml b/aai-core/src/test/resources/logback.xml index 37425b97..0258f1de 100644 --- a/aai-core/src/test/resources/logback.xml +++ b/aai-core/src/test/resources/logback.xml @@ -22,24 +22,50 @@ --> <configuration scan="true" scanPeriod="60 seconds" debug="false"> - <contextName>${module.ajsc.namespace.name}</contextName> + <statusListener class="ch.qos.logback.core.status.NopStatusListener" /> + + <property resource="application.properties" /> + + <property name="namespace" value="aai-resources"/> + + <property name="AJSC_HOME" value="${AJSC_HOME:-.}" /> <jmxConfigurator /> <property name="logDirectory" value="${AJSC_HOME}/logs" /> - - <!-- Example evaluator filter applied against console appender --> + <property name="eelfLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{statusCode}|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> + <property name="eelfAuditLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{statusCode}|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n|\r\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> + <property name="eelfMetricLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%X{statusCode}|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{targetVirtualEntity}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> + <!-- <property name="eelfErrorLogPattern" value="%ecompStartTime|%X{requestId}|%-10t|%X{serviceName}|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%ecompErrorCategory|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n|\r\n', '^'}|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> --> + <property name="eelfErrorLogPattern" value="%ecompStartTime|%X{requestId}|%-10t|%X{serviceName}|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%ecompErrorCategory|%ecompResponseCode|%ecompResponseDescription|co=%X{component}:%replace(%replace(%m){'\\|', '!'}){'\r|\n', '^'}%n"/> + <property name="eelfTransLogPattern" value="%ecompStartTime|%date{yyyy-MM-dd'T'HH:mm:ss.SSSZ, UTC}|%X{requestId}|%X{serviceInstanceId}|%-10t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{statusCode}|%X{responseCode}|%replace(%replace(%X{responseDescription}){'\\|', '!'}){'\r|\n', '^'}|%X{instanceUUID}|%level|%X{severity}|%X{serverIpAddress}|%ecompElapsedTime|%X{server}|%X{clientIpAddress}|%eelfClassOfCaller|%X{unused}|%X{processKey}|%X{customField1}|%X{customField2}|%X{customField3}|%X{customField4}|co=%X{partnerName}:%m%n"/> + + <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" /> + <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" /> + <conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" /> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> - <filter class="ch.qos.logback.classic.filter.LevelFilter"> - <!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> --> - <level>ERROR</level> - <onMatch>ACCEPT</onMatch> - <onMismatch>DENY</onMismatch> - </filter> + <encoder> + <pattern> + %clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx} + </pattern> + </encoder> + </appender> + + <appender name="SANE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${logDirectory}/rest/sane.log</file> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/rest/sane.log.%d{yyyy-MM-dd}</fileNamePattern> + </rollingPolicy> <encoder> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n </pattern> </encoder> </appender> + <appender name="asyncSANE" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>1000</queueSize> + <includeCallerData>true</includeCallerData> + <appender-ref ref="SANE" /> + </appender> + <appender name="METRIC" class="ch.qos.logback.core.rolling.RollingFileAppender"> <filter class="ch.qos.logback.classic.filter.LevelFilter"> @@ -47,124 +73,180 @@ <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> - <file>${logDirectory}/rest/metric.log</file> + <file>${logDirectory}/rest/metrics.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${logDirectory}/rest/metric.log.%d{yyyy-MM-dd}</fileNamePattern> + <fileNamePattern>${logDirectory}/rest/metrics.log.%d{yyyy-MM-dd} + </fileNamePattern> </rollingPolicy> - <!-- <triggeringPolicy - class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> - <maxFileSize>5MB</maxFileSize> - </triggeringPolicy> --> - <encoder> - <pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%m%n</pattern> + <encoder class="org.onap.aai.logging.EcompEncoder"> + <pattern>${eelfMetricLogPattern}</pattern> </encoder> </appender> + <appender name="asyncMETRIC" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>1000</queueSize> + <includeCallerData>true</includeCallerData> + <appender-ref ref="METRIC" /> + </appender> <appender name="DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>DEBUG</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> <file>${logDirectory}/rest/debug.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${logDirectory}/rest/debug.log.%d{yyyy-MM-dd}</fileNamePattern> + <fileNamePattern>${logDirectory}/rest/debug.log.%d{yyyy-MM-dd} + </fileNamePattern> </rollingPolicy> - <!-- <triggeringPolicy - class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> - <maxFileSize>5MB</maxFileSize> - </triggeringPolicy>--> - <encoder> - <pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%m%n</pattern> + <encoder class="org.onap.aai.logging.EcompEncoder"> + <pattern>${eelfLogPattern}</pattern> </encoder> </appender> + <appender name="asyncDEBUG" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>1000</queueSize> + <includeCallerData>true</includeCallerData> + <appender-ref ref="DEBUG" /> + </appender> + <appender name="ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender"> <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>WARN</level> - <onMatch>ACCEPT</onMatch> - <onMismatch>DENY</onMismatch> </filter> <file>${logDirectory}/rest/error.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${logDirectory}/rest/error.log.%d{yyyy-MM-dd}</fileNamePattern> + <fileNamePattern>${logDirectory}/rest/error.log.%d{yyyy-MM-dd} + </fileNamePattern> </rollingPolicy> - <!-- <triggeringPolicy - class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> - <maxFileSize>5MB</maxFileSize> - </triggeringPolicy>--> - <encoder> - <!-- <pattern>"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n"</pattern> --> - <pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%m%n</pattern> + <encoder class="org.onap.aai.logging.EcompEncoder"> + <pattern>${eelfErrorLogPattern}</pattern> </encoder> </appender> - - <appender name="AUDIT" + + <appender name="asyncERROR" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>1000</queueSize> + <includeCallerData>true</includeCallerData> + <appender-ref ref="ERROR" /> + </appender> + + <appender name="AUDIT" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> - <evaluator> - <matcher> - <Name>audit</Name> - <!-- filter out odd numbered statements --> - <regex>co\=aairest</regex> - </matcher> - <expression>level == INFO && audit.matches(formattedMessage)</expression> - </evaluator> - <OnMatch>ACCEPT</OnMatch> - <OnMismatch>DENY</OnMismatch> - </filter> <file>${logDirectory}/rest/audit.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${logDirectory}/rest/metric.log.%d{yyyy-MM-dd}</fileNamePattern> + <fileNamePattern>${logDirectory}/rest/audit.log.%d{yyyy-MM-dd} + </fileNamePattern> </rollingPolicy> - <encoder> - <pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%m%n</pattern> + <encoder class="org.onap.aai.logging.EcompEncoder"> + <pattern>${eelfAuditLogPattern}</pattern> + </encoder> + </appender> + + <appender name="asyncAUDIT" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>1000</queueSize> + <includeCallerData>true</includeCallerData> + <appender-ref ref="AUDIT" /> + </appender> + + <appender name="translog" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.LevelFilter"> + <level>DEBUG</level> + <onMatch>ACCEPT</onMatch> + <onMismatch>DENY</onMismatch> + </filter> + <file>${logDirectory}/rest/translog.log</file> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/rest/translog.log.%d{yyyy-MM-dd} + </fileNamePattern> + </rollingPolicy> + <encoder class="org.onap.aai.logging.EcompEncoder"> + <pattern>${eelfTransLogPattern}</pattern> </encoder> </appender> - <appender name="auditLogs" + <appender name="asynctranslog" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>1000</queueSize> + <includeCallerData>true</includeCallerData> + <appender-ref ref="translog" /> + </appender> + + <appender name="dmaapAAIEventConsumer" class="ch.qos.logback.core.rolling.RollingFileAppender"> <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>WARN</level> </filter> - <file>${logDirectory}/rest/audit.log</file> + <File>${logDirectory}/dmaapAAIEventConsumer/error.log</File> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${logDirectory}/rest/audit-${lrmRVer}-${lrmRO}-${Pid}.%d{yyyy-MM-dd}.log.zip + <fileNamePattern>${logDirectory}/dmaapAAIEventConsumer/error.log.%d{yyyy-MM-dd} </fileNamePattern> </rollingPolicy> - <triggeringPolicy - class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> - <maxFileSize>5MB</maxFileSize> - </triggeringPolicy> - <encoder> - <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern> + <encoder class="org.onap.aai.logging.EcompEncoder"> + <pattern>${eelfLogPattern}</pattern> </encoder> </appender> - - <appender name="perfLogs" + + <appender name="dmaapAAIEventConsumerDebug" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.LevelFilter"> + <level>DEBUG</level> + <onMatch>ACCEPT</onMatch> + <onMismatch>DENY</onMismatch> + </filter> + <File>${logDirectory}/dmaapAAIEventConsumer/debug.log</File> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/dmaapAAIEventConsumer/debug.log.%d{yyyy-MM-dd} + </fileNamePattern> + </rollingPolicy> + <encoder class="org.onap.aai.logging.EcompEncoder"> + <pattern>${eelfLogPattern}</pattern> + </encoder> + </appender> + <appender name="dmaapAAIEventConsumerMetric" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.LevelFilter"> + <level>INFO</level> + <onMatch>ACCEPT</onMatch> + <onMismatch>DENY</onMismatch> + </filter> + <File>${logDirectory}/dmaapAAIEventConsumer/metrics.log</File> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <fileNamePattern>${logDirectory}/dmaapAAIEventConsumer/metrics.log.%d{yyyy-MM-dd} + </fileNamePattern> + </rollingPolicy> + <encoder class="org.onap.aai.logging.EcompEncoder"> + <pattern>${eelfMetricLogPattern}</pattern> + </encoder> + </appender> + <appender name="external" class="ch.qos.logback.core.rolling.RollingFileAppender"> <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> + <level>WARN</level> </filter> - <file>${logDirectory}/rest/perform.log</file> + <file>${logDirectory}/external/external.log</file> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${logDirectory}/rest/perform-${lrmRVer}-${lrmRO}-${Pid}.%d{yyyy-MM-dd}.log.zip + <fileNamePattern>${logDirectory}/external/external.log.%d{yyyy-MM-dd} </fileNamePattern> </rollingPolicy> - <!-- <triggeringPolicy - class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> - <maxFileSize>5MB</maxFileSize> - </triggeringPolicy> --> - <encoder> - <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern> + <encoder class="org.onap.aai.logging.EcompEncoder"> + <pattern>${eelfLogPattern}</pattern> </encoder> </appender> + <logger name="org.onap.aai" level="DEBUG" additivity="true"> + <appender-ref ref="asyncDEBUG" /> + <appender-ref ref="asyncERROR" /> + <appender-ref ref="asyncMETRIC" /> + <appender-ref ref="asyncSANE" /> + </logger> <!-- Spring related loggers --> <logger name="org.springframework" level="WARN" /> <logger name="org.springframework.beans" level="WARN" /> <logger name="org.springframework.web" level="WARN" /> <logger name="com.blog.spring.jms" level="WARN" /> + <logger name="com.jayway.jsonpath" level="WARN" /> <!-- AJSC Services (bootstrap services) --> <logger name="ajsc" level="WARN" /> @@ -175,9 +257,11 @@ <logger name="ajsc.UserDefinedJarService" level="WARN" /> <logger name="ajsc.UserDefinedBeansDefService" level="WARN" /> <logger name="ajsc.LoggingConfigurationService" level="WARN" /> - + <!-- AJSC related loggers (DME2 Registration, csi logging, restlet, servlet logging) --> + <logger name="org.codehaus.groovy" level="WARN" /> + <logger name="com.att.scamper" level="WARN" /> <logger name="ajsc.utils" level="WARN" /> <logger name="ajsc.utils.DME2Helper" level="WARN" /> <logger name="ajsc.filters" level="WARN" /> @@ -187,6 +271,9 @@ <logger name="com.att.ajsc" level="WARN" /> <logger name="com.att.ajsc.csi.logging" level="WARN" /> <logger name="com.att.ajsc.filemonitor" level="WARN" /> + <logger name="com.netflix.loadbalancer" level="WARN" /> + + <logger name="org.apache.zookeeper" level="WARN" /> <!-- Other Loggers that may help troubleshoot --> <logger name="net.sf" level="WARN" /> @@ -205,93 +292,101 @@ <logger name="org.restlet" level="WARN" /> <logger name="org.apache.camel.component.restlet" level="WARN" /> + <logger name="org.hibernate.validator" level="WARN" /> + <logger name="org.hibernate" level="WARN" /> + <logger name="org.hibernate.ejb" level="OFF" /> + <!-- logback internals logging --> - <logger name="ch.qos.logback.classic" level="INFO" /> - <logger name="ch.qos.logback.core" level="INFO" /> + <logger name="ch.qos.logback.classic" level="WARN" /> + <logger name="ch.qos.logback.core" level="WARN" /> - <!-- logback jms appenders & loggers definition starts here --> + <logger name="org.eclipse.jetty" level="WARN" /> - <if condition='property("JMS_BROKER").contains("WMQ")'> - <then> - <appender name="Audit-Record-Queue" class="ajsc.JMSQueueAppender"> - <param name="InitialContextFactoryName" value="${JMS_WMQ_INITIAL_CONNECTION_FACTORY_NAME}" /> - <param name="ProviderURL" value="${JMS_WMQ_PROVIDER_URL}" /> - <param name="DestinationName" value="${JMS_WMQ_AUDIT_DESTINATION_NAME}" /> - <param name="ConnectionFactoryName" value="${JMS_WMQ_CONNECTION_FACTORY_NAME}" /> - </appender> - <appender name="Performance-Tracker-Queue" class="ajsc.JMSQueueAppender"> - <param name="InitialContextFactoryName" value="${JMS_WMQ_INITIAL_CONNECTION_FACTORY_NAME}" /> - <param name="ProviderURL" value="${JMS_WMQ_PROVIDER_URL}" /> - <param name="DestinationName" value="${JMS_WMQ_PERF_DESTINATION_NAME}" /> - <param name="ConnectionFactoryName" value="${JMS_WMQ_CONNECTION_FACTORY_NAME}" /> - </appender> - </then> - <else> <!-- logback jms appenders definition starts here --> - <appender name="Audit-Record-Queue" class="ajsc.JMSQueueAppender"> - <param name="InitialContextFactoryName" - value="com.tibco.tibjms.naming.TibjmsInitialContextFactory" /> - <param name="ProviderURL" value="${JMS_TIBCO_PROVIDER_URL}" /> - <param name="userName" value="${JMS_LOGGER_USER_NAME}" /> - <param name="password" value="${JMS_LOGGER_PASSWORD}" /> - <QueueBindingName>${JMS_LOGGER_AUDIT_QUEUE_BINDING} - </QueueBindingName> - </appender> - <appender name="Performance-Tracker-Queue" class="ajsc.JMSQueueAppender"> - <param name="InitialContextFactoryName" - value="com.tibco.tibjms.naming.TibjmsInitialContextFactory" /> - <param name="ProviderURL" value="${JMS_TIBCO_PROVIDER_URL}" /> - <param name="userName" value="${JMS_LOGGER_USER_NAME}" /> - <param name="password" value="${JMS_LOGGER_PASSWORD}" /> - <QueueBindingName>${JMS_LOGGER_PERF_QUEUE_BINDING} - </QueueBindingName> - </appender> - </else> - </if> - - <appender name="ASYNC-audit" class="ch.qos.logback.classic.AsyncAppender"> - <queueSize>1000</queueSize> - <discardingThreshold>0</discardingThreshold> - <appender-ref ref="Audit-Record-Queue" /> + <!-- logback jms appenders & loggers definition starts here --> + <appender name="auditLogs" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter" /> + <file>${logDirectory}/perf-audit/Audit-${lrmRVer}-${lrmRO}-${Pid}.log + </file> + <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${logDirectory}/perf-audit/Audit-${lrmRVer}-${lrmRO}-${Pid}.%i.log.zip + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>9</maxIndex> + </rollingPolicy> + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>5MB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern> + </encoder> </appender> - - <appender name="ASYNC-perf" class="ch.qos.logback.classic.AsyncAppender"> - <queueSize>1000</queueSize> - <discardingThreshold>0</discardingThreshold> - <appender-ref ref="Performance-Tracker-Queue" /> + <appender name="perfLogs" + class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="ch.qos.logback.classic.filter.ThresholdFilter" /> + <file>${logDirectory}/perf-audit/Perform-${lrmRVer}-${lrmRO}-${Pid}.log + </file> + <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${logDirectory}/perf-audit/Perform-${lrmRVer}-${lrmRO}-${Pid}.%i.log.zip + </fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>9</maxIndex> + </rollingPolicy> + <triggeringPolicy + class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>5MB</maxFileSize> + </triggeringPolicy> + <encoder> + <pattern>"%d [%thread] %-5level %logger{1024} - %msg%n"</pattern> + </encoder> </appender> - - <!-- - <logger name="AuditRecord" level="INFO" additivity="FALSE"> - <appender-ref ref="ASYNC-audit" /> + <logger name="AuditRecord" level="INFO" additivity="false"> <appender-ref ref="auditLogs" /> </logger> - <logger name="AuditRecord_DirectCall" level="INFO" additivity="FALSE"> - <appender-ref ref="ASYNC-audit" /> + <logger name="AuditRecord_DirectCall" level="INFO" additivity="false"> <appender-ref ref="auditLogs" /> </logger> - <logger name="PerfTrackerRecord" level="INFO" additivity="FALSE"> - <appender-ref ref="ASYNC-perf" /> + <logger name="PerfTrackerRecord" level="INFO" additivity="false"> <appender-ref ref="perfLogs" /> - </logger> - --> - - <logger name="org.onap.aai" level="INFO" /> - - <!-- - <logger name="org.onap.aai.util" level="WARN" /> - <logger name="org.onap.aai.rest" level="WARN" /> - <logger name="org.onap.aai.rest.Business" level="WARN" /> - --> - + </logger> + <!-- logback jms appenders & loggers definition ends here --> + + <logger name="org.onap.aai.interceptors.post" level="DEBUG" + additivity="false"> + <appender-ref ref="asynctranslog" /> + </logger> + + <logger name="org.onap.aai.interceptors.pre.SetLoggingContext" level="DEBUG"> + <appender-ref ref="asyncAUDIT"/> + </logger> + + <logger name="org.onap.aai.interceptors.post.ResetLoggingContext" level="DEBUG"> + <appender-ref ref="asyncAUDIT"/> + </logger> + + <logger name="org.onap.aai.dmaap" level="DEBUG" additivity="false"> + <appender-ref ref="dmaapAAIEventConsumer" /> + <appender-ref ref="dmaapAAIEventConsumerDebug" /> + <appender-ref ref="dmaapAAIEventConsumerMetric" /> + </logger> + <logger name="org.apache" level="WARN" /> <logger name="org.zookeeper" level="WARN" /> - <logger name="com.thinkaurelius" level="WARN" /> + <logger name="org.janusgraph" level="WARN" /> + <logger name="com.att.aft.dme2" level="WARN" /> - <root level="WARN"> - <appender-ref ref="DEBUG" /> - <appender-ref ref="ERROR" /> - <appender-ref ref="METRIC" /> - <appender-ref ref="AUDIT" /> - </root> + <!-- ============================================================================ --> + <!-- General EELF logger --> + <!-- ============================================================================ --> + <logger name="com.att.eelf" level="WARN" additivity="false"> + <appender-ref ref="asyncDEBUG" /> + <appender-ref ref="asyncERROR" /> + <appender-ref ref="asyncMETRIC" /> + </logger> + <root level="DEBUG"> + <appender-ref ref="external" /> + <appender-ref ref="STDOUT" /> + </root> </configuration> |