logger.info("Using ext jars folder %s", TestCommonDefs.extJarsDirs) if not path.exists(TestCommonDefs.extJarsDirs): logger.info('Creating folder %s', TestCommonDefs.extJarsDirs) mkdir(TestCommonDefs.extJarsDirs) logger.info("Adding a JAR to IAS_EXTERNAL_JARS") f = open(TestCommonDefs.extJarFileName, "w+") for i in range(10): f.write("This is line %d\r\n" % (i + 1)) f.close() assert path.exists(TestCommonDefs.extJarFileName) @classmethod def tearDownClass(cls): if path.exists(TestCommonDefs.extJarsDirs): logger.info('Deleting folder %s', TestCommonDefs.extJarsDirs) rmtree(TestCommonDefs.extJarsDirs) def testImportOfExtJars(self): ''' Checks if the jars in the IAS_EXTERNAL_JARS are added to the classpath ''' logger.info("Importing of external jar from %s", TestCommonDefs.extJarsDirs) cp = CommonDefs.buildClasspath() logger.info("Classpath = %s", cp) self.assertTrue(TestCommonDefs.extJarFileName in cp) if __name__ == '__main__': logger = Log.getLogger(__file__) logger.info("Start main") unittest.main()
action='store', choices=['info', 'debug', 'warning', 'error', 'critical'], default='info', required=False) parser.add_argument('className', help='The name of the class to run the program') parser.add_argument('params', nargs=argparse.REMAINDER, help='Command line parameters') args = parser.parse_args() #Start the logger with param define by the user. stdoutLevel = args.levelStdOut consoleLevel = args.levelConsole logger = Log.getLogger(__file__, stdoutLevel, consoleLevel) logger.info("Start IASRun") verbose = args.verbose if verbose: logger.info("\nVerbose mode ON") # Get java options from JAVA_OPTS environment variable javaOptions = javaOpts() # Build the command line if args.language == 's' or args.language == 'scala': cmd = ['scala'] if verbose: logger.info("Running a SCALA program.") else:
from IASLogging.logConf import Log from IASTools.CommonDefs import CommonDefs if __name__ == '__main__': parser = argparse.ArgumentParser(description='Get the classpath.') parser.add_argument( '-lso', '--levelStdOut', help= 'Logging level: Set the level of the message for the file logger, default: Debug level', action='store', choices=['info', 'debug', 'warning', 'error', 'critical'], default='info', required=False) parser.add_argument( '-lcon', '--levelConsole', help= 'Logging level: Set the level of the message for the console logger, default: Debug level', action='store', choices=['info', 'debug', 'warning', 'error', 'critical'], default='info', required=False) args = parser.parse_args() stdoutLevel = args.levelStdOut consoleLevel = args.levelConsole logger = Log.getLogger(os.path.basename(__file__), stdoutLevel, consoleLevel) logger.info(CommonDefs.buildClasspath())