Update the license for 2017-2018 license
[aai/aai-common.git] / aai-core / src / main / java / org / onap / aai / dbgen / GenTester.java
index 7b9eb2f..174b157 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * org.onap.aai
  * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 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.
@@ -16,8 +16,6 @@
  * 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.
  */
 package org.onap.aai.dbgen;
 
@@ -28,10 +26,13 @@ import com.thinkaurelius.titan.core.TitanGraph;
 import com.thinkaurelius.titan.core.schema.TitanManagement;
 import org.onap.aai.dbmap.AAIGraph;
 import org.onap.aai.logging.ErrorLogHelper;
+import org.onap.aai.logging.LoggingContext;
+import org.onap.aai.logging.LoggingContext.StatusCode;
 import org.onap.aai.util.AAIConfig;
 import org.onap.aai.util.AAIConstants;
 
 import java.util.Properties;
+import java.util.UUID;
 
 
 public class GenTester {
@@ -46,7 +47,7 @@ public class GenTester {
        public static void main(String[] args) {
           
                TitanGraph 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_CREATE_DB_SCHEMA_LOGBACK_PROPS);
@@ -54,7 +55,16 @@ public class GenTester {
                LOGGER = EELFManager.getInstance().getLogger(GenTester.class);
                boolean addDefaultCR = true;
                
-               try {   
+               LoggingContext.init();
+               LoggingContext.component("DBGenTester");
+               LoggingContext.partnerName("AAI-TOOLS");
+               LoggingContext.targetEntity("AAI");
+               LoggingContext.requestId(UUID.randomUUID().toString());
+               LoggingContext.serviceName("AAI");
+               LoggingContext.targetServiceName("main");
+               LoggingContext.statusCode(StatusCode.COMPLETE);
+               LoggingContext.responseCode(LoggingContext.SUCCESS);
+               try {
                        AAIConfig.init();
                if (args != null && args.length > 0 ){
                        if( "genDbRulesOnly".equals(args[0]) ){
@@ -88,6 +98,8 @@ public class GenTester {
                                
                                String emsg = "Unrecognized argument passed to GenTester.java: [" + args[0] + "]. ";
                                System.out.println(emsg);
+                               LoggingContext.statusCode(StatusCode.ERROR);
+                               LoggingContext.responseCode(LoggingContext.BUSINESS_PROCESS_ERROR);
                                LOGGER.error(emsg);
                                
                                emsg = "Either pass no argument for normal processing, or use 'GEN_DB_WITH_NO_SCHEMA'.";