當前位置: 首頁>>代碼示例>>Python>>正文


Python Validator.check_job_configuration方法代碼示例

本文整理匯總了Python中aeneas.validator.Validator.check_job_configuration方法的典型用法代碼示例。如果您正苦於以下問題:Python Validator.check_job_configuration方法的具體用法?Python Validator.check_job_configuration怎麽用?Python Validator.check_job_configuration使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在aeneas.validator.Validator的用法示例。


在下文中一共展示了Validator.check_job_configuration方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

# 需要導入模塊: from aeneas.validator import Validator [as 別名]
# 或者: from aeneas.validator.Validator import check_job_configuration [as 別名]
def main():
    """ Entry point """
    if len(sys.argv) < 3:
        usage()
        return
    validator = Validator()
    mode = sys.argv[1]
    result = None
    msg = ""

    if mode == "config":
        if sys.argv[2].endswith(".txt"):
            try:
                config_file = open(sys.argv[2], "r")
                config_contents = config_file.read()
                config_file.close()
                result = validator.check_contents_txt_config_file(config_contents, True)
                msg = "TXT configuration"
            except:
                print "[ERRO] Unable to read file %s" % sys.argv[2]
        elif sys.argv[2].endswith(".xml"):
            try:
                config_file = open(sys.argv[2], "r")
                config_contents = config_file.read()
                config_file.close()
                result = validator.check_contents_xml_config_file(config_contents)
                msg = "XML configuration"
            except:
                print "[ERRO] Unable to read file %s" % sys.argv[2]
        else:
            usage()
            return
    elif mode == "container":
        result = validator.check_container(sys.argv[2])
        msg = "container"
    elif mode == "job":
        result = validator.check_job_configuration(sys.argv[2])
        msg = "job configuration string"
    elif mode == "task":
        result = validator.check_task_configuration(sys.argv[2])
        msg = "task configuration string"
    elif mode == "wizard":
        if len(sys.argv) < 4:
            usage()
            return
        result = validator.check_container_from_wizard(sys.argv[2], sys.argv[3])
        msg = "container + configuration string from wizard"
    else:
        usage()
        return

    if result.passed:
        print "[INFO] Valid %s" % msg
        if len(result.warnings) > 0:
            for warning in result.warnings:
                print "[WARN] " + warning
    else:
        print "[INFO] Invalid %s" % msg
        for error in result.errors:
            print "[ERRO] " + error
開發者ID:fduch2k,項目名稱:aeneas,代碼行數:62,代碼來源:validate.py

示例2: test_check_job_configuration_05

# 需要導入模塊: from aeneas.validator import Validator [as 別名]
# 或者: from aeneas.validator.Validator import check_job_configuration [as 別名]
 def test_check_job_configuration_05(self):
     logger = Logger()
     validator = Validator(logger=logger)
     string = "malformed="
     result = validator.check_job_configuration(string)
     self.assertFalse(result.passed)
     self.assertGreater(len(result.errors), 0)
開發者ID:cbeer,項目名稱:aeneas,代碼行數:9,代碼來源:test_validator.py

示例3: test_check_job_configuration_01

# 需要導入模塊: from aeneas.validator import Validator [as 別名]
# 或者: from aeneas.validator.Validator import check_job_configuration [as 別名]
 def test_check_job_configuration_01(self):
     logger = Logger()
     validator = Validator(logger=logger)
     string = u"dummy config string with bad encoding é".encode("latin-1")
     result = validator.check_job_configuration(string)
     self.assertFalse(result.passed)
     self.assertGreater(len(result.errors), 0)
開發者ID:cbeer,項目名稱:aeneas,代碼行數:9,代碼來源:test_validator.py

示例4: test_check_job_configuration_02

# 需要導入模塊: from aeneas.validator import Validator [as 別名]
# 或者: from aeneas.validator.Validator import check_job_configuration [as 別名]
 def test_check_job_configuration_02(self):
     logger = Logger()
     validator = Validator(logger=logger)
     string = "dummy config string with ~ reserved characters"
     result = validator.check_job_configuration(string)
     self.assertFalse(result.passed)
     self.assertGreater(len(result.errors), 0)
開發者ID:cbeer,項目名稱:aeneas,代碼行數:9,代碼來源:test_validator.py

示例5: test_check_job_configuration_17

# 需要導入模塊: from aeneas.validator import Validator [as 別名]
# 或者: from aeneas.validator.Validator import check_job_configuration [as 別名]
 def test_check_job_configuration_17(self):
     logger = Logger()
     validator = Validator(logger=logger)
     string = "job_language=it|os_job_file_name=output.zip|os_job_file_container=zip|os_job_file_hierarchy_type=flat"
     result = validator.check_job_configuration(string)
     self.assertTrue(result.passed)
     self.assertEqual(len(result.errors), 0)
開發者ID:cbeer,項目名稱:aeneas,代碼行數:9,代碼來源:test_validator.py

示例6: test_check_job_configuration_14

# 需要導入模塊: from aeneas.validator import Validator [as 別名]
# 或者: from aeneas.validator.Validator import check_job_configuration [as 別名]
 def test_check_job_configuration_14(self):
     logger = Logger()
     validator = Validator(logger=logger)
     string = "job_language=it|os_job_file_name=output.zip|os_job_file_container=zip|is_hierarchy_type=paged"
     result = validator.check_job_configuration(string)
     self.assertFalse(result.passed)
     self.assertGreater(len(result.errors), 0)
開發者ID:cbeer,項目名稱:aeneas,代碼行數:9,代碼來源:test_validator.py

示例7: test_check_job_configuration_08

# 需要導入模塊: from aeneas.validator import Validator [as 別名]
# 或者: from aeneas.validator.Validator import check_job_configuration [as 別名]
 def test_check_job_configuration_08(self):
     logger = Logger()
     validator = Validator(logger=logger)
     string = "job_language=it|os_job_file_name=output.zip"
     result = validator.check_job_configuration(string)
     self.assertFalse(result.passed)
     self.assertGreater(len(result.errors), 0)
開發者ID:cbeer,項目名稱:aeneas,代碼行數:9,代碼來源:test_validator.py

示例8: test_check_job_configuration_07

# 需要導入模塊: from aeneas.validator import Validator [as 別名]
# 或者: from aeneas.validator.Validator import check_job_configuration [as 別名]
 def test_check_job_configuration_07(self):
     logger = Logger()
     validator = Validator(logger=logger)
     string = "job_language=it|missing=other"
     result = validator.check_job_configuration(string)
     self.assertFalse(result.passed)
     self.assertGreater(len(result.errors), 0)
開發者ID:cbeer,項目名稱:aeneas,代碼行數:9,代碼來源:test_validator.py

示例9: test_check_job_configuration_06

# 需要導入模塊: from aeneas.validator import Validator [as 別名]
# 或者: from aeneas.validator.Validator import check_job_configuration [as 別名]
 def test_check_job_configuration_06(self):
     logger = Logger()
     validator = Validator(logger=logger)
     string = "not=relevant|config=string"
     result = validator.check_job_configuration(string)
     self.assertFalse(result.passed)
     self.assertGreater(len(result.errors), 0)
開發者ID:cbeer,項目名稱:aeneas,代碼行數:9,代碼來源:test_validator.py

示例10: jc

# 需要導入模塊: from aeneas.validator import Validator [as 別名]
# 或者: from aeneas.validator.Validator import check_job_configuration [as 別名]
 def jc(self, string, expected):
     validator = Validator()
     result = validator.check_job_configuration(string)
     self.assertEqual(result.passed, expected)
     if expected:
         self.assertEqual(len(result.errors), 0)
     else:
         self.assertGreater(len(result.errors), 0)
開發者ID:fduch2k,項目名稱:aeneas,代碼行數:10,代碼來源:test_validator.py


注:本文中的aeneas.validator.Validator.check_job_configuration方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。