def setUp(self): self.yaml = {} self.yaml['name'] = 'thrift' self.yaml['bin'] = '/bin/' self.yaml['options'] = 'SuperOption' self.yaml['supported_languages'] = ['a', 'b', 'c'] self.yaml['compiler_postfix'] = 'postfix' self.yaml['version'] = '1.2.3.4' self.compiler = ThriftCompiler(self.yaml)
def __get_client__(self): self.config = Config() compiler = None for item in self.config.get_thrift_option("compilers"): compiler = ThriftCompiler(item) compiler.postfix = "" break return JavaClient([], compiler)
def test_bad_init_data(self): dict = {} conf = Config() bad_compiler = ThriftCompiler(dict) self.assertEquals(bad_compiler.version, "0.6.1") self.assertEquals(bad_compiler.postfix, "") language = "java" self.assertEquals(bad_compiler.is_language_supported("java"), False) self.assertEquals(bad_compiler.language_options(), conf.get_thrift_option("global_compiler_options")[language])
def test_bad_init_data(self): dict = {} conf = Config() bad_compiler = ThriftCompiler(dict) self.assertEquals(bad_compiler.version, "0.6.1") self.assertEquals(bad_compiler.postfix, "") language = "java" self.assertEquals(bad_compiler.is_language_supported("java"), False) self.assertEquals( bad_compiler.language_options(), conf.get_thrift_option("global_compiler_options")[language])
def test_thrift_compiler(self): init = {} init['name'] = 'testThrift' init['bin'] = '/dev/null' init['options'] = 'testoptions' init['supported_languages'] = ['java', 'ruby', 'python'] t = ThriftCompiler(init) self.failUnless('testThrift' == t.name) self.failUnless('/dev/null' == t.bin) self.failUnless('testoptions' == t.options) self.failUnless(len(t.languages) == 3) self.failUnless(t.is_language_supported('ruby')) self.failUnless(not t.is_language_supported('erlang'))
def test_thrift_compiler(self): init = {} init['name'] = 'testThrift' init['bin'] = '/dev/null' init['options'] = 'testoptions' init['supported_languages'] = ['java', 'ruby', 'python'] t = ThriftCompiler(init) self.failUnless('testThrift' == t.name) self.failUnless('/dev/null' == t.bin) self.failUnless('testoptions' == t.options) self.failUnless(len(t.languages) == 3) self.failUnless(t.is_language_supported('ruby')) self.failUnless(not t.is_language_supported('erlang') )
def __get_client__(self): self.config = Config() self.config.reset_configuration() compiler = None for item in self.config.get_thrift_option("compilers"): compiler = ThriftCompiler(item) return Documentation([], compiler)
def setUp(self): self.yaml = {} self.yaml["name"] = "thrift" self.yaml["bin"] = "/bin/" self.yaml["options"] = "SuperOption" self.yaml["supported_languages"] = ["a", "b", "c"] self.yaml["compiler_postfix"] = "postfix" self.yaml["version"] = "1.2.3.4" self.compiler = ThriftCompiler(self.yaml)
def setUp(self): self.config = Config() self.config.reset_configuration() compilers = self.config.get_thrift_option("compilers") if compilers is None or len(compilers) == 0: self.helper = Thrift(None) else: thrift_compiler = ThriftCompiler(compilers[0]) self.helper = Thrift(thrift_compiler) project_path = os.path.join( os.path.dirname( os.path.abspath(inspect.getfile(inspect.currentframe()))), "../") project_path = os.path.realpath(project_path) self.config.repo_dir = project_path
def process_thrift_services(self): """ This method will iterate through all the service and business object thrift files, and deploy the maven artifacts and its dependencies """ compiler_list = [] for item in self.config.get_thrift_option("compilers"): t = ThriftCompiler(item) compiler_list.append(t) #ensure that vcs is enabled, and thrift-file override hasn't been passed in. thrift_objects = [] if self.config.is_local() and self.config.get_service_override() is not None: pass elif not self.config.is_vcs or self.config.is_local(): #flatten list thrift_objects = self.service_objects + self.business_objects + self.enum_objects + self.exception_objects else: vcs = self.config.get_vcs_instance() file_objects = vcs.get_modified_files() if file_objects is None or len(file_objects) == 0: self.config.is_vcs = False thrift_objects = self.service_objects + self.business_objects + self.enum_objects + self.exception_objects else: self.log.info("Using list of objects from VCS") thrift_objects = map(lambda current_file: os.path.basename(current_file), file_objects) self.log.info("VCS object list is: " + str(thrift_objects)) if self.config.is_local() and self.config.get_service_override() is not None: self.service_objects = [] thrift_objects = [self.config.get_service_override()] self.update_client_list(thrift_objects, compiler_list) process_list = [] for client in self.client_list: p = Process(target=client.run) p.start() process_list.append(p) #wait for all threads that have been started to terminate. map(lambda proc: proc.join(), process_list) # #Check exit codes for proc in process_list: self.local_assert(proc.exitcode, str(proc))
class ThriftCompilerTest(unittest2.TestCase): def setUp(self): self.yaml = {} self.yaml["name"] = "thrift" self.yaml["bin"] = "/bin/" self.yaml["options"] = "SuperOption" self.yaml["supported_languages"] = ["a", "b", "c"] self.yaml["compiler_postfix"] = "postfix" self.yaml["version"] = "1.2.3.4" self.compiler = ThriftCompiler(self.yaml) def test_version(self): expected = self.yaml["version"] self.assertEquals(expected, self.compiler.version) expected = HelperTools.get_random() self.compiler.version = expected self.assertEquals(expected, self.compiler.version) def test_bin(self): expected = self.yaml["bin"] self.assertEquals(expected, self.compiler.bin) expected = HelperTools.get_random() self.compiler.bin = expected self.assertEquals(expected, self.compiler.bin) def test_name(self): expected = self.yaml["name"] self.assertEquals(expected, self.compiler.name) expected = HelperTools.get_random() self.compiler.name = expected self.assertEquals(expected, self.compiler.name) def test_options(self): expected = self.yaml["options"] self.assertEquals(expected, self.compiler.options) expected = HelperTools.get_random() self.compiler.options = expected self.assertEquals(expected, self.compiler.options) def test_compiler_postfix(self): expected = self.yaml["compiler_postfix"] self.assertEquals(expected, self.compiler.postfix) expected = HelperTools.get_random() self.compiler.postfix = expected self.assertEquals(expected, self.compiler.postfix) def test_supported_languages(self): expected = self.yaml["supported_languages"] self.assertEquals(expected, self.compiler.languages) expected = HelperTools.get_random() self.compiler.languages = expected self.assertEquals(expected, self.compiler.languages) self.assertTrue(self.compiler.is_language_supported(expected[0])) self.assertFalse(self.compiler.is_language_supported("zzzzzzzz")) def test_bad_init_data(self): dict = {} conf = Config() bad_compiler = ThriftCompiler(dict) self.assertEquals(bad_compiler.version, "0.6.1") self.assertEquals(bad_compiler.postfix, "") language = "java" self.assertEquals(bad_compiler.is_language_supported("java"), False) self.assertEquals(bad_compiler.language_options(), conf.get_thrift_option("global_compiler_options")[language])
class ThriftCompilerTest(unittest2.TestCase): def setUp(self): self.yaml = {} self.yaml['name'] = 'thrift' self.yaml['bin'] = '/bin/' self.yaml['options'] = 'SuperOption' self.yaml['supported_languages'] = ['a', 'b', 'c'] self.yaml['compiler_postfix'] = 'postfix' self.yaml['version'] = '1.2.3.4' self.compiler = ThriftCompiler(self.yaml) def test_version(self): expected = self.yaml['version'] self.assertEquals(expected, self.compiler.version) expected = HelperTools.get_random() self.compiler.version = expected self.assertEquals(expected, self.compiler.version) def test_bin(self): expected = self.yaml['bin'] self.assertEquals(expected, self.compiler.bin) expected = HelperTools.get_random() self.compiler.bin = expected self.assertEquals(expected, self.compiler.bin) def test_name(self): expected = self.yaml['name'] self.assertEquals(expected, self.compiler.name) expected = HelperTools.get_random() self.compiler.name = expected self.assertEquals(expected, self.compiler.name) def test_options(self): expected = self.yaml['options'] self.assertEquals(expected, self.compiler.options) expected = HelperTools.get_random() self.compiler.options = expected self.assertEquals(expected, self.compiler.options) def test_compiler_postfix(self): expected = self.yaml['compiler_postfix'] self.assertEquals(expected, self.compiler.postfix) expected = HelperTools.get_random() self.compiler.postfix = expected self.assertEquals(expected, self.compiler.postfix) def test_supported_languages(self): expected = self.yaml['supported_languages'] self.assertEquals(expected, self.compiler.languages) expected = HelperTools.get_random() self.compiler.languages = expected self.assertEquals(expected, self.compiler.languages) self.assertTrue(self.compiler.is_language_supported(expected[0])) self.assertFalse(self.compiler.is_language_supported("zzzzzzzz")) def test_bad_init_data(self): dict = {} conf = Config() bad_compiler = ThriftCompiler(dict) self.assertEquals(bad_compiler.version, "0.6.1") self.assertEquals(bad_compiler.postfix, "") language = "java" self.assertEquals(bad_compiler.is_language_supported("java"), False) self.assertEquals( bad_compiler.language_options(), conf.get_thrift_option("global_compiler_options")[language])