How to use get_kcl_classpath method in localstack

Best Python code snippet using localstack_python

amazon_kclpy_helper.py

Source:amazon_kclpy_helper.py Github

copy

Full Screen

...42 :rtype: str43 :return: The absolute path of the KCL jar files needed to run the MultiLangDaemon.44 '''45 return ':'.join(glob(os.path.join(get_kcl_dir(), 'jars', '*jar')))46def get_kcl_classpath(properties=None, paths=[]):47 '''48 Generates a classpath that includes the location of the kcl jars, the49 properties file and the optional paths.50 :type properties: str51 :param properties: Path to properties file.52 :type paths: list53 :param paths: List of strings. The paths that will be prepended to the classpath.54 :rtype: str55 :return: A java class path that will allow your properties to be found and the MultiLangDaemon and its deps and56 any custom paths you provided.57 '''58 # First make all the user provided paths absolute59 paths = [os.path.abspath(p) for p in paths]60 # We add our paths after the user provided paths because this permits users to61 # potentially inject stuff before our paths (otherwise our stuff would always62 # take precedence).63 paths.append(get_kcl_jar_path())64 if properties:65 # Add the dir that the props file is in66 dir_of_file = get_dir_of_file(properties)67 paths.append(dir_of_file)68 return ":".join([p for p in paths if p != ''])69def get_kcl_app_command(args, multi_lang_daemon_class, properties, log_configuration, paths=[]):70 '''71 Generates a command to run the MultiLangDaemon.72 :type java: str73 :param java: Path to java74 :type multi_lang_daemon_class: str75 :param multi_lang_daemon_class: Name of multi language daemon class e.g. com.amazonaws.services.kinesis.multilang.MultiLangDaemon76 :type properties: str77 :param properties: Optional properties file to be included in the classpath.78 :type paths: list79 :param paths: List of strings. Additional paths to prepend to the classpath.80 :rtype: str81 :return: A command that will run the MultiLangDaemon with your properties and custom paths and java.82 '''83 return "{java} -cp {cp} {daemon} {props} {log_config}".format(java=args.java,84 cp = get_kcl_classpath(args.properties, paths),85 daemon = multi_lang_daemon_class,86 # Just need the basename becasue the path is added to the classpath87 props = properties,88 log_config = log_configuration)89if __name__ == '__main__':90 parser = argparse.ArgumentParser("A script for generating a command to run an Amazon KCLpy app")91 parser.add_argument("--print_classpath", dest="print_classpath", action="store_true",92 default=False,93 help="Print a java class path.\noptional arguments: --path")94 parser.add_argument("--print_command", dest="print_command", action="store_true",95 default=False,96 help="Print a command for running an Amazon KCLpy app.\nrequired "97 + "args: --java --properties\noptional args: --classpath")98 parser.add_argument("-j", "--java", dest="java",99 help="The path to the java executable e.g. <some root>/jdk/bin/java",100 metavar="PATH_TO_JAVA")101 parser.add_argument("-p", "--properties", "--props", "--prop", dest="properties",102 help="The path to a properties file (relative to where you are running this script)",103 metavar="PATH_TO_PROPERTIES")104 parser.add_argument("--sample", "--sample-props", "--use-sample-properties", dest="use_sample_props",105 help="This will use the sample.properties file included in this package as the properties file.",106 action="store_true", default=False)107 parser.add_argument("-c", "--classpath", "--path", dest="paths", action="append", default=[],108 help="Additional path to add to java class path. May be specified any number of times",109 metavar="PATH")110 parser.add_argument("-l", "--log-configuration", dest="log_configuration",111 help="This will use the logback.xml which will be used by the KCL to log.",112 metavar="PATH_TO_LOG_CONFIGURATION")113 args = parser.parse_args()114 # Possibly replace the properties with the sample. Useful if they just want to run the sample app.115 if args.use_sample_props:116 if args.properties:117 sys.stderr.write('Replacing provided properties with sample properties due to arg --sample\n')118 args.properties = os.path.join(get_dir_of_file(samples.__file__), 'sample.properties')119 # Print what the asked for120 if args.print_classpath:121 print(get_kcl_classpath(args.properties, args.paths))122 elif args.print_command:123 if args.java and args.properties:124 multi_lang_daemon_class = 'software.amazon.kinesis.multilang.MultiLangDaemon'125 properties_argument = "--properties-file {props}".format(props = args.properties)126 log_argument = ''127 if args.log_configuration is not None:128 log_argument = "--log-configuration {log}".format(log = args.log_configuration)129 print(get_kcl_app_command(args, multi_lang_daemon_class, properties_argument, log_argument, paths=args.paths))130 else:131 sys.stderr.write("Must provide arguments: --java and --properties\n")132 parser.print_usage()133 else:...

Full Screen

Full Screen

amazon_kcl_helper.py

Source:amazon_kcl_helper.py Github

copy

Full Screen

...42 :rtype: str43 :return: The absolute path of the KCL jar files needed to run the MultiLangDaemon.44 '''45 return ':'.join(glob(os.path.join(get_kcl_dir(), 'jars', '*jar')))46def get_kcl_classpath(properties=None, paths=[]):47 '''48 Generates a classpath that includes the location of the kcl jars, the49 properties file and the optional paths.50 :type properties: str51 :param properties: Path to properties file.52 :type paths: list53 :param paths: List of strings. The paths that will be prepended to the classpath.54 :rtype: str55 :return: A java class path that will allow your properties to be found and the MultiLangDaemon and its deps and56 any custom paths you provided.57 '''58 # First make all the user provided paths absolute59 paths = [os.path.abspath(p) for p in paths]60 # We add our paths after the user provided paths because this permits users to61 # potentially inject stuff before our paths (otherwise our stuff would always62 # take precedence).63 paths.append(get_kcl_jar_path())64 if properties:65 # Add the dir that the props file is in66 dir_of_file = get_dir_of_file(properties)67 paths.append(dir_of_file)68 return ":".join([p for p in paths if p != ''])69def get_kcl_app_command(args, multi_lang_daemon_class, properties, log_configuration, paths=[]):70 '''71 Generates a command to run the MultiLangDaemon.72 :type java: str73 :param java: Path to java74 :type multi_lang_daemon_class: str75 :param multi_lang_daemon_class: Name of multi language daemon class e.g. com.amazonaws.services.kinesis.multilang.MultiLangDaemon76 :type properties: str77 :param properties: Optional properties file to be included in the classpath.78 :type paths: list79 :param paths: List of strings. Additional paths to prepend to the classpath.80 :rtype: str81 :return: A command that will run the MultiLangDaemon with your properties and custom paths and java.82 '''83 return "{java} -cp {cp} {daemon} {props} {log_config}".format(java=args.java,84 cp = get_kcl_classpath(args.properties, paths),85 daemon = multi_lang_daemon_class,86 # Just need the basename becasue the path is added to the classpath87 props = properties,88 log_config = log_configuration)89if __name__ == '__main__':90 parser = argparse.ArgumentParser("A script for generating a command to run an Amazon KCLpy app")91 parser.add_argument("--print_classpath", dest="print_classpath", action="store_true",92 default=False,93 help="Print a java class path.\noptional arguments: --path")94 parser.add_argument("--print_command", dest="print_command", action="store_true",95 default=False,96 help="Print a command for running an Amazon KCLpy app.\nrequired "97 + "args: --java --properties\noptional args: --classpath")98 parser.add_argument("-j", "--java", dest="java",99 help="The path to the java executable e.g. <some root>/jdk/bin/java",100 metavar="PATH_TO_JAVA")101 parser.add_argument("-p", "--properties", "--props", "--prop", dest="properties",102 help="The path to a properties file (relative to where you are running this script)",103 metavar="PATH_TO_PROPERTIES")104 parser.add_argument("--sample", "--sample-props", "--use-sample-properties", dest="use_sample_props",105 help="This will use the sample.properties file included in this package as the properties file.",106 action="store_true", default=False)107 parser.add_argument("-c", "--classpath", "--path", dest="paths", action="append", default=[],108 help="Additional path to add to java class path. May be specified any number of times",109 metavar="PATH")110 parser.add_argument("-l", "--log-configuration", dest="log_configuration",111 help="This will use the logback.xml which will be used by the KCL to log.",112 metavar="PATH_TO_LOG_CONFIGURATION")113 args = parser.parse_args()114 # Possibly replace the properties with the sample. Useful if they just want to run the sample app.115 if args.use_sample_props:116 if args.properties:117 sys.stderr.write('Replacing provided properties with sample properties due to arg --sample\n')118 args.properties = os.path.join(get_dir_of_file(samples.__file__), 'sample.properties')119 # Print what the asked for120 if args.print_classpath:121 print(get_kcl_classpath(args.properties, args.paths))122 elif args.print_command:123 if args.java and args.properties:124 multi_lang_daemon_class = 'software.amazon.kinesis.multilang.MultiLangDaemon'125 properties_argument = "--properties-file {props}".format(props = args.properties)126 log_argument = ''127 if args.log_configuration is not None:128 log_argument = "--log-configuration {log}".format(log = args.log_configuration)129 print(get_kcl_app_command(args, multi_lang_daemon_class, properties_argument, log_argument, paths=args.paths))130 else:131 sys.stderr.write("Must provide arguments: --java and --properties\n")132 parser.print_usage()133 else:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful