diff options
author | 2024-11-25 11:05:01 +0000 | |
---|---|---|
committer | 2024-11-25 11:05:01 +0000 | |
commit | 3582b9fb35239a475086dd28e7924589b15d9de6 (patch) | |
tree | 705544f9fb32fdafc0971269e6daa2e7d928f880 /src | |
parent | 266d4ba4f01ac7d451e0b62fd24a381fa75265a7 (diff) | |
parent | 2b77ba67d51b8bd6198e240dc0f653d5d2a10e65 (diff) |
Merge "Use 1.15.3-SNAPSHOT of aai-common"
Diffstat (limited to 'src')
20 files changed, 87 insertions, 170 deletions
diff --git a/src/main/java/org/onap/aai/dataexport/DataExportTasks.java b/src/main/java/org/onap/aai/dataexport/DataExportTasks.java index 8d4ebb0..8386b18 100644 --- a/src/main/java/org/onap/aai/dataexport/DataExportTasks.java +++ b/src/main/java/org/onap/aai/dataexport/DataExportTasks.java @@ -56,7 +56,6 @@ import org.springframework.context.annotation.PropertySource; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; -import com.att.eelf.configuration.Configuration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; @@ -81,9 +80,6 @@ public class DataExportTasks { static { System.setProperty("aai.service.name", DataExportTasks.class.getSimpleName()); - Properties props = System.getProperties(); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, AAIConstants.AAI_LOGBACK_PROPS); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, AAIConstants.AAI_HOME_BUNDLECONFIG); LOGGER = LoggerFactory.getLogger(DataExportTasks.class); } diff --git a/src/main/java/org/onap/aai/datagrooming/DataGrooming.java b/src/main/java/org/onap/aai/datagrooming/DataGrooming.java index de14ae6..796e491 100644 --- a/src/main/java/org/onap/aai/datagrooming/DataGrooming.java +++ b/src/main/java/org/onap/aai/datagrooming/DataGrooming.java @@ -19,7 +19,6 @@ */ package org.onap.aai.datagrooming; -import com.att.eelf.configuration.Configuration; import com.beust.jcommander.JCommander; import com.beust.jcommander.Parameter; import java.io.BufferedReader; @@ -287,10 +286,6 @@ public class DataGrooming { // Set the logging file properties to be used by EELFManager System.setProperty("aai.service.name", DataGrooming.class.getSimpleName()); - Properties props = System.getProperties(); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, AAIConstants.AAI_LOGBACK_PROPS); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, AAIConstants.AAI_HOME_BUNDLECONFIG); - AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); PropertyPasswordConfiguration initializer = new PropertyPasswordConfiguration(); initializer.initialize(ctx); diff --git a/src/main/java/org/onap/aai/datasnapshot/DataSnapshot.java b/src/main/java/org/onap/aai/datasnapshot/DataSnapshot.java index 9feb6d7..3b9f7d4 100644 --- a/src/main/java/org/onap/aai/datasnapshot/DataSnapshot.java +++ b/src/main/java/org/onap/aai/datasnapshot/DataSnapshot.java @@ -60,7 +60,6 @@ import org.onap.aai.util.GraphAdminDBUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.att.eelf.configuration.Configuration; import com.beust.jcommander.JCommander; import com.beust.jcommander.Parameter; import com.beust.jcommander.ParameterException; @@ -118,9 +117,6 @@ public class DataSnapshot { // Set the logging file properties to be used by EELFManager System.setProperty("aai.service.name", DataSnapshot.class.getSimpleName()); - Properties props = System.getProperties(); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, AAIConstants.AAI_LOGBACK_PROPS); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, AAIConstants.AAI_HOME_BUNDLECONFIG); LOGGER = LoggerFactory.getLogger(DataSnapshot.class); cArgs = new CommandLineArgs(); diff --git a/src/main/java/org/onap/aai/datasnapshot/DataSnapshot4HistInit.java b/src/main/java/org/onap/aai/datasnapshot/DataSnapshot4HistInit.java index fa5c6e1..b143e71 100644 --- a/src/main/java/org/onap/aai/datasnapshot/DataSnapshot4HistInit.java +++ b/src/main/java/org/onap/aai/datasnapshot/DataSnapshot4HistInit.java @@ -67,7 +67,6 @@ import org.onap.aai.util.FormatDate; import org.onap.aai.util.GraphAdminDBUtils; import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import com.att.eelf.configuration.Configuration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.beust.jcommander.JCommander; @@ -112,10 +111,6 @@ public class DataSnapshot4HistInit { // Set the logging file properties to be used by EELFManager System.setProperty("aai.service.name", DataSnapshot4HistInit.class.getSimpleName()); - Properties props = System.getProperties(); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, AAIConstants.AAI_LOGBACK_PROPS); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, AAIConstants.AAI_HOME_BUNDLECONFIG); - AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); PropertyPasswordConfiguration initializer = new PropertyPasswordConfiguration(); diff --git a/src/main/java/org/onap/aai/dbgen/DupeTool.java b/src/main/java/org/onap/aai/dbgen/DupeTool.java index f442eac..8dbe1c6 100644 --- a/src/main/java/org/onap/aai/dbgen/DupeTool.java +++ b/src/main/java/org/onap/aai/dbgen/DupeTool.java @@ -19,7 +19,6 @@ */ package org.onap.aai.dbgen; -import com.att.eelf.configuration.Configuration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; @@ -462,10 +461,6 @@ public class DupeTool { public static void main(String[] args) throws AAIException { System.setProperty("aai.service.name", DupeTool.class.getSimpleName()); - // Set the logging file properties to be used by EELFManager - Properties props = System.getProperties(); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, "dupeTool-logback.xml"); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, AAIConstants.AAI_HOME_BUNDLECONFIG); MDC.put("logFilenameAppender", DupeTool.class.getSimpleName()); diff --git a/src/main/java/org/onap/aai/dbgen/ForceDeleteTool.java b/src/main/java/org/onap/aai/dbgen/ForceDeleteTool.java index 451e344..b1b70f0 100644 --- a/src/main/java/org/onap/aai/dbgen/ForceDeleteTool.java +++ b/src/main/java/org/onap/aai/dbgen/ForceDeleteTool.java @@ -44,7 +44,6 @@ import org.onap.aai.util.AAIConfig; import org.onap.aai.util.AAIConstants; import org.slf4j.MDC; -import com.att.eelf.configuration.Configuration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.janusgraph.core.JanusGraphFactory; @@ -78,10 +77,6 @@ public class ForceDeleteTool { // the Terminal. System.setProperty("aai.service.name", ForceDelete.class.getSimpleName()); - // Set the logging file properties to be used by EELFManager - Properties props = System.getProperties(); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, AAIConstants.AAI_FORCE_DELETE_LOGBACK_PROPS); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, AAIConstants.AAI_HOME_BUNDLECONFIG); Logger logger = LoggerFactory.getLogger(ForceDeleteTool.class.getSimpleName()); MDC.put("logFilenameAppender", ForceDeleteTool.class.getSimpleName()); diff --git a/src/main/java/org/onap/aai/dbgen/UpdatePropertyTool.java b/src/main/java/org/onap/aai/dbgen/UpdatePropertyTool.java index 9a6094b..bb1908c 100644 --- a/src/main/java/org/onap/aai/dbgen/UpdatePropertyTool.java +++ b/src/main/java/org/onap/aai/dbgen/UpdatePropertyTool.java @@ -22,7 +22,6 @@ package org.onap.aai.dbgen; import org.janusgraph.core.JanusGraph; import org.onap.aai.util.AAIConstants; -import com.att.eelf.configuration.Configuration; import org.slf4j.MDC; import java.util.Properties; @@ -55,10 +54,6 @@ public class UpdatePropertyTool { public static void main(String[] args) { System.setProperty("aai.service.name", UpdatePropertyTool.class.getSimpleName()); - // Set the logging file properties to be used by EELFManager - Properties props = System.getProperties(); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, PROPERTY_LOGGING_FILE_NAME); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, AAIConstants.AAI_HOME_BUNDLECONFIG); MDC.put("logFilenameAppender", UpdatePropertyTool.class.getSimpleName()); @@ -76,4 +71,4 @@ public class UpdatePropertyTool { exit(EXIT_VM_STATUS_CODE); } -}
\ No newline at end of file +} diff --git a/src/main/java/org/onap/aai/dbgen/schemamod/SchemaMod.java b/src/main/java/org/onap/aai/dbgen/schemamod/SchemaMod.java index 50d195f..4a2dcb6 100644 --- a/src/main/java/org/onap/aai/dbgen/schemamod/SchemaMod.java +++ b/src/main/java/org/onap/aai/dbgen/schemamod/SchemaMod.java @@ -19,7 +19,6 @@ */ package org.onap.aai.dbgen.schemamod; -import com.att.eelf.configuration.Configuration; import org.onap.aai.restclient.PropertyPasswordConfiguration; import org.onap.aai.exceptions.AAIException; import org.onap.aai.introspection.Loader; @@ -174,10 +173,6 @@ public class SchemaMod { public static void main(String[] args) throws AAIException { - Properties props = System.getProperties(); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, AAIConstants.AAI_SCHEMA_MOD_LOGBACK_PROPS); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, AAIConstants.AAI_HOME_BUNDLECONFIG); - MDC.put("logFilenameAppender", SchemaMod.class.getSimpleName()); AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); diff --git a/src/main/java/org/onap/aai/dbgen/schemamod/SchemaMod4Hist.java b/src/main/java/org/onap/aai/dbgen/schemamod/SchemaMod4Hist.java index eacdb13..bb8e653 100644 --- a/src/main/java/org/onap/aai/dbgen/schemamod/SchemaMod4Hist.java +++ b/src/main/java/org/onap/aai/dbgen/schemamod/SchemaMod4Hist.java @@ -19,7 +19,6 @@ */ package org.onap.aai.dbgen.schemamod; -import com.att.eelf.configuration.Configuration; import org.onap.aai.restclient.PropertyPasswordConfiguration; import org.onap.aai.exceptions.AAIException; import org.onap.aai.introspection.Loader; @@ -57,11 +56,6 @@ public class SchemaMod4Hist { public void execute(String[] args) { - // Set the logging file properties to be used by EELFManager - Properties props = System.getProperties(); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, AAIConstants.AAI_SCHEMA_MOD_LOGBACK_PROPS); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, AAIConstants.AAI_HOME_BUNDLECONFIG); - Logger logger = LoggerFactory.getLogger(SchemaMod4Hist.class.getSimpleName()); MDC.put("logFilenameAppender", SchemaMod4Hist.class.getSimpleName()); diff --git a/src/main/java/org/onap/aai/historytruncate/HistoryTruncate.java b/src/main/java/org/onap/aai/historytruncate/HistoryTruncate.java index b2a3c91..8796ec5 100644 --- a/src/main/java/org/onap/aai/historytruncate/HistoryTruncate.java +++ b/src/main/java/org/onap/aai/historytruncate/HistoryTruncate.java @@ -39,7 +39,6 @@ import org.onap.aai.util.AAIConstants; import org.onap.aai.util.AAISystemExitUtil; import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import com.att.eelf.configuration.Configuration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.janusgraph.core.JanusGraph; @@ -74,12 +73,6 @@ public class HistoryTruncate { */ public static void main(String[] args) { - // Set the logging file properties to be used by EELFManager - System.setProperty("aai.service.name", HistoryTruncate.class.getSimpleName()); - Properties props = System.getProperties(); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, AAIConstants.AAI_LOGBACK_PROPS); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, AAIConstants.AAI_HOME_BUNDLECONFIG); - try (AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext()) { try { ctx.refresh(); diff --git a/src/main/java/org/onap/aai/migration/MigrationControllerInternal.java b/src/main/java/org/onap/aai/migration/MigrationControllerInternal.java index 7a170c3..47e7544 100644 --- a/src/main/java/org/onap/aai/migration/MigrationControllerInternal.java +++ b/src/main/java/org/onap/aai/migration/MigrationControllerInternal.java @@ -20,7 +20,6 @@ package org.onap.aai.migration; -import com.att.eelf.configuration.Configuration; import com.beust.jcommander.JCommander; import com.beust.jcommander.Parameter; import org.apache.commons.configuration2.ex.ConfigurationException; @@ -97,10 +96,6 @@ public class MigrationControllerInternal { public void run(String[] args) { // Set the logging file properties to be used by EELFManager System.setProperty("aai.service.name", MigrationController.class.getSimpleName()); - Properties props = System.getProperties(); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, "migration-logback.xml"); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, AAIConstants.AAI_HOME_ETC_APP_PROPERTIES); - MDC.put("logFilenameAppender", MigrationController.class.getSimpleName()); logger = LoggerFactory.getLogger(MigrationControllerInternal.class.getSimpleName()); diff --git a/src/main/java/org/onap/aai/rest/client/ApertureServiceNoAuthClient.java b/src/main/java/org/onap/aai/rest/client/ApertureServiceNoAuthClient.java index 778a821..703420e 100644 --- a/src/main/java/org/onap/aai/rest/client/ApertureServiceNoAuthClient.java +++ b/src/main/java/org/onap/aai/rest/client/ApertureServiceNoAuthClient.java @@ -20,9 +20,9 @@ package org.onap.aai.rest.client; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import org.onap.aai.restclient.NoAuthRestClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; @@ -35,7 +35,7 @@ import java.util.UUID; public class ApertureServiceNoAuthClient extends NoAuthRestClient { - private static EELFLogger logger = EELFManager.getInstance().getLogger(ApertureServiceNoAuthClient.class); + private static Logger logger = LoggerFactory.getLogger(ApertureServiceNoAuthClient.class); @Value("${aperture.service.base.url}") private String baseUrl; diff --git a/src/main/java/org/onap/aai/schema/GenTester.java b/src/main/java/org/onap/aai/schema/GenTester.java index afcd99f..cb79f2c 100644 --- a/src/main/java/org/onap/aai/schema/GenTester.java +++ b/src/main/java/org/onap/aai/schema/GenTester.java @@ -19,7 +19,6 @@ */ package org.onap.aai.schema; -import com.att.eelf.configuration.Configuration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.janusgraph.core.EdgeLabel; @@ -59,10 +58,7 @@ public class GenTester { 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(); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, AAIConstants.AAI_LOGBACK_PROPS); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, AAIConstants.AAI_HOME_BUNDLECONFIG); + LOGGER = LoggerFactory.getLogger(GenTester.class); boolean addDefaultCR = true; diff --git a/src/main/java/org/onap/aai/schema/GenTester4Hist.java b/src/main/java/org/onap/aai/schema/GenTester4Hist.java index 65dc35e..adfbe90 100644 --- a/src/main/java/org/onap/aai/schema/GenTester4Hist.java +++ b/src/main/java/org/onap/aai/schema/GenTester4Hist.java @@ -19,7 +19,6 @@ */ package org.onap.aai.schema; -import com.att.eelf.configuration.Configuration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.janusgraph.core.JanusGraph; @@ -50,10 +49,7 @@ public class GenTester4Hist { JanusGraph graph = null; System.setProperty("aai.service.name", GenTester4Hist.class.getSimpleName()); - // Set the logging file properties to be used by EELFManager - Properties props = System.getProperties(); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, AAIConstants.AAI_LOGBACK_PROPS); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, AAIConstants.AAI_HOME_BUNDLECONFIG); + LOGGER = LoggerFactory.getLogger(GenTester4Hist.class); boolean addDefaultCR = false; // For History, we do not add the default CloudRegion diff --git a/src/main/java/org/onap/aai/util/SendDeleteMigrationNotifications.java b/src/main/java/org/onap/aai/util/SendDeleteMigrationNotifications.java index 6cb6ed6..0fd75dc 100644 --- a/src/main/java/org/onap/aai/util/SendDeleteMigrationNotifications.java +++ b/src/main/java/org/onap/aai/util/SendDeleteMigrationNotifications.java @@ -19,7 +19,6 @@ */ package org.onap.aai.util; -import com.att.eelf.configuration.Configuration; import org.onap.aai.config.SpringContextAware; import org.onap.aai.dbmap.AAIGraph; @@ -72,9 +71,6 @@ public class SendDeleteMigrationNotifications { public SendDeleteMigrationNotifications(LoaderFactory loaderFactory, SchemaVersions schemaVersions, String config, String path, int sleepInMilliSecs, int numToBatch, String requestId, EventAction eventAction, String eventSource) { System.setProperty("aai.service.name", SendDeleteMigrationNotifications.class.getSimpleName()); - Properties props = System.getProperties(); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, "migration-logback.xml"); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, AAIConstants.AAI_HOME_ETC_APP_PROPERTIES); MDC.put("logFilenameAppender", SendDeleteMigrationNotifications.class.getSimpleName()); diff --git a/src/main/java/org/onap/aai/util/SendMigrationNotifications.java b/src/main/java/org/onap/aai/util/SendMigrationNotifications.java index a66e491..a138402 100644 --- a/src/main/java/org/onap/aai/util/SendMigrationNotifications.java +++ b/src/main/java/org/onap/aai/util/SendMigrationNotifications.java @@ -19,7 +19,6 @@ */ package org.onap.aai.util; -import com.att.eelf.configuration.Configuration; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.onap.aai.config.SpringContextAware; @@ -74,9 +73,6 @@ public class SendMigrationNotifications { public SendMigrationNotifications(LoaderFactory loaderFactory, SchemaVersions schemaVersions, String config, String path, Set<String> notifyOn, int sleepInMilliSecs, int numToBatch, String requestId, EventAction eventAction, String eventSource) { System.setProperty("aai.service.name", SendMigrationNotifications.class.getSimpleName()); - Properties props = System.getProperties(); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, "migration-logback.xml"); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, AAIConstants.AAI_HOME_ETC_APP_PROPERTIES); MDC.put("logFilenameAppender", SendMigrationNotifications.class.getSimpleName()); diff --git a/src/main/java/org/onap/aai/util/UniquePropertyCheck.java b/src/main/java/org/onap/aai/util/UniquePropertyCheck.java index 20432e6..8dfa706 100644 --- a/src/main/java/org/onap/aai/util/UniquePropertyCheck.java +++ b/src/main/java/org/onap/aai/util/UniquePropertyCheck.java @@ -39,26 +39,20 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; -import com.att.eelf.configuration.Configuration; - public class UniquePropertyCheck { private static final String FROMAPPID = "AAI-UTILS"; private static final String TRANSID = UUID.randomUUID().toString(); private static final String COMPONENT = "UniquePropertyCheck"; - + /** * The main method. * * @param args the arguments */ public static void main(String[] args) { - - - Properties props = System.getProperties(); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_NAME, AAIConstants.AAI_LOGBACK_PROPS); - props.setProperty(Configuration.PROPERTY_LOGGING_FILE_PATH, AAIConstants.AAI_HOME_BUNDLECONFIG); + Logger logger = LoggerFactory.getLogger(UniquePropertyCheck.class); MDC.put("logFilenameAppender", UniquePropertyCheck.class.getSimpleName()); AaiScheduledTaskAuditLog auditLog = new AaiScheduledTaskAuditLog(); @@ -72,7 +66,7 @@ public class UniquePropertyCheck { } String propertyName = args[0]; Graph graph = null; - + try(JanusGraph tGraph = JanusGraphFactory.open(new AAIGraphConfig.Builder(AAIConstants.REALTIME_DB_CONFIG).forService(UniquePropertyCheck.class.getSimpleName()).withGraphType("realtime").buildConfiguration())) { AAIConfig.init(); System.out.println(" ---- NOTE --- about to open graph (takes a little while)--------\n"); @@ -81,7 +75,7 @@ public class UniquePropertyCheck { logAndPrint(logger, " Error: Could not get JanusGraph "); System.exit(1); } - + graph = tGraph.newTransaction(); if( graph == null ){ logAndPrint(logger, "could not get graph object in UniquePropertyCheck() \n"); @@ -98,14 +92,14 @@ public class UniquePropertyCheck { logAndPrint(logger, msg); System.exit(0); } - + runTheCheckForUniqueness( TRANSID, FROMAPPID, graph, propertyName, logger ); auditLog.logAfter(); System.exit(0); - + }// End main() - - + + /** * Run the check for uniqueness. * @@ -116,17 +110,17 @@ public class UniquePropertyCheck { * @param logger the logger * @return the boolean */ - public static Boolean runTheCheckForUniqueness( String transId, String fromAppId, Graph graph, + public static Boolean runTheCheckForUniqueness( String transId, String fromAppId, Graph graph, String propertyName, Logger logger ){ - - // Note - property can be found in more than one nodetype - // our uniqueness constraints are always across the entire db - so this + + // Note - property can be found in more than one nodetype + // our uniqueness constraints are always across the entire db - so this // tool looks across all nodeTypes that the property is found in. Boolean foundDupesFlag = false; - + HashMap <String,String> valuesAndVidHash = new HashMap <> (); HashMap <String,String> dupeHash = new HashMap <> (); - + int propCount = 0; int dupeCount = 0; Iterator<Vertex> vertItor = graph.traversal().V().has(propertyName); @@ -151,10 +145,10 @@ public class UniquePropertyCheck { } else { valuesAndVidHash.put(val.toString(), thisVid); - } + } } - - + + String info = "\n Found this property [" + propertyName + "] " + propCount + " times in our db."; logAndPrint(logger, info); info = " Found " + dupeCount + " cases of duplicate values for this property.\n\n"; @@ -169,9 +163,9 @@ public class UniquePropertyCheck { String dupeValue = pair.getKey().toString(); String vidsStr = pair.getValue().toString(); String[] vidArr = vidsStr.split("\\|"); - logAndPrint(logger, "\n\n -------------- Found " + vidArr.length + logAndPrint(logger, "\n\n -------------- Found " + vidArr.length + " nodes with " + propertyName + " of this value: [" + dupeValue + "]. Node details: "); - + for( int i = 0; i < vidArr.length; i++ ){ String vidString = vidArr[i]; Long idLong = Long.valueOf(vidString); @@ -183,14 +177,14 @@ public class UniquePropertyCheck { } catch( Exception e2 ){ logAndPrint(logger, "Threw Exception: [" + e2.toString() + "]"); - } - - + } + + return foundDupesFlag; - + }// end of runTheCheckForUniqueness() - - + + /** * Show properties and edges. * @@ -200,7 +194,7 @@ public class UniquePropertyCheck { * @param logger the logger */ private static void showPropertiesAndEdges( String transId, String fromAppId, Vertex tVert, - Logger logger ){ + Logger logger ){ if( tVert == null ){ logAndPrint(logger, "Null node passed to showPropertiesAndEdges."); @@ -214,16 +208,16 @@ public class UniquePropertyCheck { else{ nodeType = ob.toString(); } - + logAndPrint(logger, " AAINodeType/VtxID for this Node = [" + nodeType + "/" + tVert.id() + "]"); logAndPrint(logger, " Property Detail: "); Iterator<VertexProperty<Object>> pI = tVert.properties(); while( pI.hasNext() ){ VertexProperty<Object> tp = pI.next(); Object val = tp.value(); - logAndPrint(logger, "Prop: [" + tp.key() + "], val = [" + val + "] "); + logAndPrint(logger, "Prop: [" + tp.key() + "], val = [" + val + "] "); } - + Iterator <Edge> eI = tVert.edges(Direction.BOTH); if( ! eI.hasNext() ){ logAndPrint(logger, "No edges were found for this vertex. "); @@ -249,7 +243,7 @@ public class UniquePropertyCheck { } } // End of showPropertiesAndEdges() - + /** * Log and print. * @@ -260,5 +254,5 @@ public class UniquePropertyCheck { System.out.println(msg); logger.info(msg); } - -}
\ No newline at end of file + +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 0fda84d..d0a7d63 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -111,3 +111,4 @@ aai.notifications.enabled=false BOOTSTRAP_SERVERS=localhost:9092 JAAS_CONFIG= +aai.graph.properties.path=${server.local.startpath}/etc/appprops/janusgraph-realtime.properties diff --git a/src/test/java/org/onap/aai/migration/v13/MigrateInMaintDefaultToFalseTest.java b/src/test/java/org/onap/aai/migration/v13/MigrateInMaintDefaultToFalseTest.java index 9dc0dc1..eca979d 100644 --- a/src/test/java/org/onap/aai/migration/v13/MigrateInMaintDefaultToFalseTest.java +++ b/src/test/java/org/onap/aai/migration/v13/MigrateInMaintDefaultToFalseTest.java @@ -23,17 +23,14 @@ import org.onap.aai.edges.EdgeIngestor; import org.onap.aai.serialization.db.EdgeSerializer;
import org.onap.aai.serialization.engines.TransactionalGraphEngine;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
import org.janusgraph.core.JanusGraph;
import org.janusgraph.core.JanusGraphFactory;
import org.janusgraph.core.JanusGraphTransaction;
import org.janusgraph.core.schema.JanusGraphManagement;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
import org.onap.aai.AAISetup;
import org.onap.aai.dbmap.DBConnectionType;
import org.onap.aai.introspection.Loader;
@@ -46,16 +43,16 @@ import org.onap.aai.migration.v13.MigrateInMaintDefaultToFalse; import org.onap.aai.migration.v13.MigrateInMaintDefaultToFalseTest.InMaintDefaultMigrator;
import org.onap.aai.serialization.engines.QueryStyle;
import org.onap.aai.serialization.engines.JanusGraphDBEngine;
-import org.onap.aai.serialization.engines.TransactionalGraphEngine; - -import static org.junit.jupiter.api.Assertions.assertTrue; +import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
import java.util.HashMap;
import java.util.Map;
-import java.util.Optional; - +import java.util.Optional;
+
public class MigrateInMaintDefaultToFalseTest extends
AAISetup {
protected static final String VNF_NODE_TYPE = "generic-vnf";
@@ -119,7 +116,7 @@ public class MigrateInMaintDefaultToFalseTest extends g.addV().property("aai-node-type", "generic-vnf")
.property("vnf-id", "generic-vnf3")
.property("in-maint", false)
- .next();
+ .next();
//l-interface
g.addV().property("aai-node-type", "l-interface")
.property("interface-name", "l-interface0")
@@ -135,7 +132,7 @@ public class MigrateInMaintDefaultToFalseTest extends g.addV().property("aai-node-type", "l-interface")
.property("interface-name", "l-interface3")
.property("in-maint", false)
- .next();
+ .next();
//lag-interface
g.addV().property("aai-node-type", "lag-interface")
.property("interface-name", "lag-interface0")
@@ -151,7 +148,7 @@ public class MigrateInMaintDefaultToFalseTest extends g.addV().property("aai-node-type", "lag-interface")
.property("interface-name", "lag-interface3")
.property("in-maint", false)
- .next();
+ .next();
//logical-link
g.addV().property("aai-node-type", "logical-link")
.property("link-name", "logical-link0")
@@ -167,7 +164,7 @@ public class MigrateInMaintDefaultToFalseTest extends g.addV().property("aai-node-type", "logical-link")
.property("link-name", "logical-link3")
.property("in-maint", false)
- .next();
+ .next();
//p-interface
g.addV().property("aai-node-type", "p-interface")
.property("interface-name", "p-interface0")
@@ -183,7 +180,7 @@ public class MigrateInMaintDefaultToFalseTest extends g.addV().property("aai-node-type", "p-interface")
.property("interface-name", "p-interface3")
.property("in-maint", false)
- .next();
+ .next();
//pnf
g.addV().property("aai-node-type", "pnf")
.property("pnf-name", "pnf0")
@@ -199,7 +196,7 @@ public class MigrateInMaintDefaultToFalseTest extends g.addV().property("aai-node-type", "pnf")
.property("pnf-name", "pnf3")
.property("in-maint", false)
- .next();
+ .next();
//pserver
g.addV().property("aai-node-type", "pserver")
.property("pserver-id", "pserver0")
@@ -215,7 +212,7 @@ public class MigrateInMaintDefaultToFalseTest extends g.addV().property("aai-node-type", "pserver")
.property("pserver-id", "pserver3")
.property("in-maint", false)
- .next();
+ .next();
//vlan
g.addV().property("aai-node-type", "vlan")
.property("vlan-interface", "vlan0")
@@ -276,7 +273,7 @@ public class MigrateInMaintDefaultToFalseTest extends .property("nos-server-id", "nos-server1")
.property("nos-server-name", "nos-server-name1")
.property("vendor", "vendor1")
- .property("nos-server-selflink", "nos-server-selflink1")
+ .property("nos-server-selflink", "nos-server-selflink1")
.property("in-maint", "")
.next();
g.addV().property("aai-node-type", "nos-server")
@@ -293,7 +290,7 @@ public class MigrateInMaintDefaultToFalseTest extends .property("nos-server-selflink", "nos-server-selflink3")
.property("in-maint", false)
.next();
-
+
TransactionalGraphEngine spy = spy(dbEngine);
TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
GraphTraversalSource traversal = g;
@@ -324,13 +321,13 @@ public class MigrateInMaintDefaultToFalseTest extends assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc0").has("in-maint", false).hasNext(),
"Value of vnfc should be updated since the property in-maint doesn't exist");
assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver0").has("in-maint", false).hasNext(),
- "Value of vserver should be updated since the property in-maint doesn't exist");
+ "Value of vserver should be updated since the property in-maint doesn't exist");
assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server0").has("in-maint", false).hasNext(),
- "Value of nos-server should be updated since the property in-maint doesn't exist");
+ "Value of nos-server should be updated since the property in-maint doesn't exist");
}
@Test
- public void testEmptyValue() {
+ public void testEmptyValue() {
assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("in-maint", false).hasNext(),
"Value of generic-vnf should be updated since the value for in-maint is an empty string");
assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("in-maint", false).hasNext(),
@@ -354,7 +351,7 @@ public class MigrateInMaintDefaultToFalseTest extends assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server1").has("in-maint", false).hasNext(),
"Value of nos-server should be updated since the value for in-maint is an empty string");
}
-
+
@Test
public void testExistingTrueValues() {
assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf2").has("in-maint", true).hasNext(),
@@ -380,7 +377,7 @@ public class MigrateInMaintDefaultToFalseTest extends assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server2").has("in-maint", true).hasNext(),
"Value of nos-server shouldn't be updated since in-maint already exists");
}
-
+
@Test
public void testExistingFalseValues() {
assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf3").has("in-maint", false).hasNext(),
@@ -406,4 +403,4 @@ public class MigrateInMaintDefaultToFalseTest extends assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server3").has("in-maint", false).hasNext(),
"Value of nos-server shouldn't be updated since in-maint already exists");
}
-}
\ No newline at end of file +}
diff --git a/src/test/java/org/onap/aai/migration/v15/MigrateInMaintDefaultToFalseTest.java b/src/test/java/org/onap/aai/migration/v15/MigrateInMaintDefaultToFalseTest.java index 97cc8b6..3a80d75 100644 --- a/src/test/java/org/onap/aai/migration/v15/MigrateInMaintDefaultToFalseTest.java +++ b/src/test/java/org/onap/aai/migration/v15/MigrateInMaintDefaultToFalseTest.java @@ -23,17 +23,14 @@ import org.onap.aai.edges.EdgeIngestor; import org.onap.aai.serialization.db.EdgeSerializer;
import org.onap.aai.serialization.engines.TransactionalGraphEngine;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
import org.janusgraph.core.JanusGraph;
import org.janusgraph.core.JanusGraphFactory;
import org.janusgraph.core.JanusGraphTransaction;
import org.janusgraph.core.schema.JanusGraphManagement;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
import org.onap.aai.AAISetup;
import org.onap.aai.dbmap.DBConnectionType;
import org.onap.aai.introspection.Loader;
@@ -46,16 +43,16 @@ import org.onap.aai.migration.v15.MigrateInMaintDefaultToFalse; import org.onap.aai.migration.v15.MigrateInMaintDefaultToFalseTest.InMaintDefaultMigrator;
import org.onap.aai.serialization.engines.QueryStyle;
import org.onap.aai.serialization.engines.JanusGraphDBEngine;
-import org.onap.aai.serialization.engines.TransactionalGraphEngine; - -import static org.junit.jupiter.api.Assertions.assertTrue; +import org.onap.aai.serialization.engines.TransactionalGraphEngine;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
import java.util.HashMap;
import java.util.Map;
-import java.util.Optional; - +import java.util.Optional;
+
public class MigrateInMaintDefaultToFalseTest extends
AAISetup {
protected static final String VNF_NODE_TYPE = "generic-vnf";
@@ -118,7 +115,7 @@ public class MigrateInMaintDefaultToFalseTest extends g.addV().property("aai-node-type", "generic-vnf")
.property("vnf-id", "generic-vnf3")
.property("in-maint", false)
- .next();
+ .next();
//l-interface
g.addV().property("aai-node-type", "l-interface")
.property("interface-name", "l-interface0")
@@ -134,7 +131,7 @@ public class MigrateInMaintDefaultToFalseTest extends g.addV().property("aai-node-type", "l-interface")
.property("interface-name", "l-interface3")
.property("in-maint", false)
- .next();
+ .next();
//lag-interface
g.addV().property("aai-node-type", "lag-interface")
.property("interface-name", "lag-interface0")
@@ -150,7 +147,7 @@ public class MigrateInMaintDefaultToFalseTest extends g.addV().property("aai-node-type", "lag-interface")
.property("interface-name", "lag-interface3")
.property("in-maint", false)
- .next();
+ .next();
//logical-link
g.addV().property("aai-node-type", "logical-link")
.property("link-name", "logical-link0")
@@ -166,7 +163,7 @@ public class MigrateInMaintDefaultToFalseTest extends g.addV().property("aai-node-type", "logical-link")
.property("link-name", "logical-link3")
.property("in-maint", false)
- .next();
+ .next();
//p-interface
g.addV().property("aai-node-type", "p-interface")
.property("interface-name", "p-interface0")
@@ -182,7 +179,7 @@ public class MigrateInMaintDefaultToFalseTest extends g.addV().property("aai-node-type", "p-interface")
.property("interface-name", "p-interface3")
.property("in-maint", false)
- .next();
+ .next();
//pnf
g.addV().property("aai-node-type", "pnf")
.property("pnf-name", "pnf0")
@@ -198,7 +195,7 @@ public class MigrateInMaintDefaultToFalseTest extends g.addV().property("aai-node-type", "pnf")
.property("pnf-name", "pnf3")
.property("in-maint", false)
- .next();
+ .next();
//pserver
g.addV().property("aai-node-type", "pserver")
.property("pserver-id", "pserver0")
@@ -214,7 +211,7 @@ public class MigrateInMaintDefaultToFalseTest extends g.addV().property("aai-node-type", "pserver")
.property("pserver-id", "pserver3")
.property("in-maint", false)
- .next();
+ .next();
//vlan
g.addV().property("aai-node-type", "vlan")
.property("vlan-interface", "vlan0")
@@ -275,7 +272,7 @@ public class MigrateInMaintDefaultToFalseTest extends .property("nos-server-id", "nos-server1")
.property("nos-server-name", "nos-server-name1")
.property("vendor", "vendor1")
- .property("nos-server-selflink", "nos-server-selflink1")
+ .property("nos-server-selflink", "nos-server-selflink1")
.property("in-maint", "")
.next();
g.addV().property("aai-node-type", "nos-server")
@@ -292,7 +289,7 @@ public class MigrateInMaintDefaultToFalseTest extends .property("nos-server-selflink", "nos-server-selflink3")
.property("in-maint", false)
.next();
-
+
TransactionalGraphEngine spy = spy(dbEngine);
TransactionalGraphEngine.Admin adminSpy = spy(dbEngine.asAdmin());
GraphTraversalSource traversal = g;
@@ -323,13 +320,13 @@ public class MigrateInMaintDefaultToFalseTest extends assertTrue(g.V().has("aai-node-type", "vnfc").has("vnfc-name", "vnfc0").has("in-maint", false).hasNext(),
"Value of vnfc should be updated since the property in-maint doesn't exist");
assertTrue(g.V().has("aai-node-type", "vserver").has("vserver-id", "vserver0").has("in-maint", false).hasNext(),
- "Value of vserver should be updated since the property in-maint doesn't exist");
+ "Value of vserver should be updated since the property in-maint doesn't exist");
assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server0").has("in-maint", false).hasNext(),
- "Value of nos-server should be updated since the property in-maint doesn't exist");
+ "Value of nos-server should be updated since the property in-maint doesn't exist");
}
@Test
- public void testEmptyValue() {
+ public void testEmptyValue() {
assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf1").has("in-maint", false).hasNext(),
"Value of generic-vnf should be updated since the value for in-maint is an empty string");
assertTrue(g.V().has("aai-node-type", "l-interface").has("interface-name", "l-interface1").has("in-maint", false).hasNext(),
@@ -353,7 +350,7 @@ public class MigrateInMaintDefaultToFalseTest extends assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server1").has("in-maint", false).hasNext(),
"Value of nos-server should be updated since the value for in-maint is an empty string");
}
-
+
@Test
public void testExistingTrueValues() {
assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf2").has("in-maint", true).hasNext(),
@@ -379,7 +376,7 @@ public class MigrateInMaintDefaultToFalseTest extends assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server2").has("in-maint", true).hasNext(),
"Value of nos-server shouldn't be updated since in-maint already exists");
}
-
+
@Test
public void testExistingFalseValues() {
assertTrue(g.V().has("aai-node-type", "generic-vnf").has("vnf-id", "generic-vnf3").has("in-maint", false).hasNext(),
@@ -405,4 +402,4 @@ public class MigrateInMaintDefaultToFalseTest extends assertTrue(g.V().has("aai-node-type", "nos-server").has("nos-server-id", "nos-server3").has("in-maint", false).hasNext(),
"Value of nos-server shouldn't be updated since in-maint already exists");
}
-}
\ No newline at end of file +}
|