Best Python code snippet using localstack_python
java_jar_test.py
Source:java_jar_test.py
1"""2 This is the test module for java_jar target.3"""4import blade_test5class TestJavaJar(blade_test.TargetTest):6 """Test java_jar """7 def setUp(self):8 """setup method. """9 self.doSetUp('test_java_jar/java', ':poppy_java_client',10 generate_php=False)11 self.upper_target_path = 'test_java_jar'12 def testLoadBuildsNotNone(self):13 """Test direct targets and all command targets are not none. """14 pass15 def testGenerateRules(self):16 """Test that rules are generated correctly. """17 self.all_targets = self.blade.analyze_targets()18 self.rules_buf = self.blade.generate_build_rules()19 swig_library = (self.upper_target_path, 'poppy_client')20 java_client = (self.target_path, 'poppy_java_client')21 proto_library = (self.upper_target_path, 'rpc_option_proto')22 self.command_file = 'cmds.tmp'23 self.assertTrue(swig_library in self.all_targets.keys())24 self.assertTrue(java_client in self.all_targets.keys())25 self.assertTrue(proto_library in self.all_targets.keys())26 self.assertTrue(self.dryRun())27 com_proto_cpp_option = ''28 com_proto_java_option = ''29 com_proto_cpp_meta = ''30 com_proto_java_meta = ''31 com_proto_option_cc = ''32 com_proto_meta_cc = ''33 com_swig_python = ''34 com_swig_java = ''35 com_swig_python_cxx = ''36 com_swig_java_cxx = ''37 swig_python_so = ''38 swig_java_so = ''39 java_com_line = ''40 java_so_line = ''41 jar_line = ''42 java_com_idx = 043 java_so_idx = 044 jar_idx = 045 index = 046 for line in self.scons_output:47 index += 148 if 'protobuf/bin/protoc' in line:49 if 'cpp_out' in line:50 if 'rpc_option.proto' in line:51 com_proto_cpp_option = line52 elif 'rpc_meta_info.proto' in line:53 com_proto_cpp_meta = line54 if 'java_out' in line:55 if 'rpc_option.proto' in line:56 com_proto_java_option = line57 elif 'rpc_meta_info.proto' in line:58 com_proto_java_meta = line59 if 'rpc_option.pb.cc.o -c' in line:60 com_proto_option_cc = line61 if 'rpc_meta_info.pb.cc.o -c' in line:62 com_proto_meta_cc = line63 if 'swig -python' in line:64 com_swig_python = line65 if 'swig -java' in line:66 com_swig_java = line67 if 'poppy_client_pywrap.cxx.o -c' in line:68 com_swig_python_cxx = line69 if 'poppy_client_javawrap.cxx.o -c' in line:70 com_swig_java_cxx = line71 if 'javac -classpath' in line:72 java_com_line = line73 java_com_idx = index74 if 'libpoppy_client_java.so -m64' in line:75 java_so_line = line76 java_so_idx = index77 if 'jar cf' in line:78 jar_line = line79 jar_idx = index80 self.assertTrue(com_proto_cpp_option)81 self.assertTrue(com_proto_cpp_meta)82 self.assertTrue(com_proto_java_option)83 self.assertTrue(com_proto_java_meta)84 self.assertTrue('-fPIC' in com_proto_option_cc)85 self.assertTrue('-Wall -Wextra' not in com_proto_option_cc)86 self.assertTrue('-Wframe-larger-than=' not in com_proto_option_cc)87 self.assertTrue('-Werror=overloaded-virtual' not in com_proto_option_cc)88 self.assertTrue('-fPIC' in com_proto_meta_cc)89 self.assertTrue('poppy_client_pywrap.cxx' in com_swig_python)90 self.assertTrue('poppy_client_javawrap.cxx' in com_swig_java)91 self.assertTrue('-fno-omit-frame-pointer' in com_swig_python_cxx)92 self.assertTrue('-mcx16 -pipe -g' in com_swig_python_cxx)93 self.assertTrue('-DNDEBUG -D_FILE_OFFSET_BITS' in com_swig_python_cxx)94 self.assertTrue('-fno-omit-frame-pointer' in com_swig_java_cxx)95 self.assertTrue('-mcx16 -pipe -g' in com_swig_java_cxx)96 self.assertTrue('-DNDEBUG -D_FILE_OFFSET_BITS' in com_swig_java_cxx)97 self.assertTrue(java_com_line)98 self.assertTrue(java_so_line)99 self.assertTrue(jar_line)100 self.assertTrue('test_java_jar/java/lib/junit.jar' in java_com_line)101 self.assertTrue('com/soso/poppy/swig/*.java' in java_com_line)102 self.assertTrue('com/soso/poppy/*.java' in java_com_line)103 whole_archive = ('--whole-archive build64_release/test_java_jar/'104 'librpc_meta_info_proto.a build64_release/test_java_jar/'105 'librpc_option_proto.a -Wl,--no-whole-archive')106 self.assertTrue(whole_archive in java_so_line)107 self.assertTrue(jar_idx > java_com_idx)108 self.assertTrue(jar_idx > java_so_idx)109if __name__ == '__main__':...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!