Ejemplo n.º 1
0
 def test_get_main_dataset_query_from_xml(self):
     config = Config()
     config.input = os.path.join(self.RESOURCES_DIR, 'reports',
                                 'CancelAck.jrxml')
     instance = Report(config, config.input)
     dataset_query = instance.get_main_dataset_query()
     self.assertEqual(dataset_query, '/CancelResponse/CancelResult/ID')
Ejemplo n.º 2
0
 def test_get_main_dataset_query_from_jsonql(self):
     config = Config()
     config.input = os.path.join(self.RESOURCES_DIR, 'reports',
                                 'jsonql.jrxml')
     instance = Report(config, config.input)
     dataset_query = instance.get_main_dataset_query()
     self.assertEqual(dataset_query, 'contacts.person')
Ejemplo n.º 3
0
 def test_compile_to_file(self):
     config = Config()
     config.input = os.path.join(self.RESOURCES_DIR, 'reports', 'csv.jrxml')
     config.output = os.path.join(self.RESOURCES_DIR, 'reports',
                                  'compile_to_file')
     instance = Report(config, config.input)
     instance.fill()
     instance.export_jrprint()
     self.assertEqual(os.path.isfile(config.output + '.jrprint'), True)
Ejemplo n.º 4
0
 def test_compile_to_file_jasperreports_functions2(self):
     config = Config()
     config.input = os.path.join(self.RESOURCES_DIR, 'reports',
                                 'Blank_A4_1.jrxml')
     config.output = os.path.join(self.RESOURCES_DIR, 'reports',
                                  'blank_A4_1')
     instance = Report(config, config.input)
     instance.fill()
     instance.export_jrprint()
     self.assertEqual(os.path.isfile(config.output + '.jrprint'), True)
Ejemplo n.º 5
0
 def test_fill_javascript(self):
     config = Config()
     config.input = os.path.join(self.RESOURCES_DIR, 'reports',
                                 'charactersetTestWithJavaScript.jrxml')
     config.output = os.path.join(self.RESOURCES_DIR, 'reports',
                                  'characterset_test_with_javascript')
     instance = Report(config, config.input)
     instance.fill()
     instance.export_jrprint()
     self.assertEqual(os.path.isfile(config.output + '.jrprint'), True)
Ejemplo n.º 6
0
    def test_get_report_parameters(self):
        config = Config()
        config.input = os.path.join(self.RESOURCES_DIR, 'reports',
                                    'noDB-params.jrxml')
        instance = Report(config, config.input)
        result = instance.get_report_parameters()

        self.assertEqual(str(result[result.length - 4].getName()), "myString")
        self.assertEqual(str(result[result.length - 3].getName()), "myInt")
        self.assertEqual(str(result[result.length - 2].getName()), "myDate")
        self.assertEqual(str(result[result.length - 1].getName()), "myImage")
Ejemplo n.º 7
0
 def test_compile_to_file_jasperreports_functions(self):
     config = Config()
     config.input = os.path.join(
         self.RESOURCES_DIR, 'reports',
         'charactersetTestWithStudioBuiltinFunctions.jrxml')
     config.output = os.path.join(
         self.RESOURCES_DIR, 'reports',
         'characterset_test_with_studio_builtin_functions')
     instance = Report(config, config.input)
     instance.fill()
     instance.export_jrprint()
     self.assertEqual(os.path.isfile(config.output + '.jrprint'), True)
Ejemplo n.º 8
0
 def test_fill_from_jsonql_datasource(self):
     config = Config()
     config.input = os.path.join(self.RESOURCES_DIR, 'reports',
                                 'jsonql.jrxml')
     config.output = os.path.join(self.RESOURCES_DIR, 'reports', 'jsonql')
     config.dataFile = os.path.join(self.RESOURCES_DIR, 'contacts.json')
     config.dbType = 'jsonql'
     config.jsonQuery = 'contacts.person'
     instance = Report(config, config.input)
     instance.fill()
     instance.export_jrprint()
     self.assertEqual(os.path.isfile(config.output + '.jrprint'), True)
Ejemplo n.º 9
0
 def test_export_pdf_barcode4j(self):
     config = Config()
     config.input = os.path.join(self.RESOURCES_DIR, 'reports',
                                 'barcode4j.jrxml')
     config.output = os.path.join(self.RESOURCES_DIR, 'reports',
                                  'barcode4j')
     config.dataFile = os.path.join(self.RESOURCES_DIR, 'barcode4j.xml')
     config.dbType = 'xml'
     config.xmlXpath = '/nalepka/ident'
     instance = Report(config, config.input)
     instance.fill()
     instance.export_pdf()
     self.assertEqual(os.path.isfile(config.output + '.pdf'), True)
Ejemplo n.º 10
0
 def test_fill_from_xml_datasource(self):
     config = Config()
     config.input = os.path.join(self.RESOURCES_DIR, 'reports',
                                 'CancelAck.jrxml')
     config.output = os.path.join(self.RESOURCES_DIR, 'reports',
                                  'cancel_ack')
     config.dataFile = os.path.join(self.RESOURCES_DIR, 'CancelAck.xml')
     config.dbType = 'xml'
     config.xmlXpath = '/CancelResponse/CancelResult/ID'
     instance = Report(config, config.input)
     instance.fill()
     instance.export_jrprint()
     self.assertEqual(os.path.isfile(config.output + '.jrprint'), True)
Ejemplo n.º 11
0
 def get_config_csv(self):
     config = Config()
     config.input = os.path.join(self.RESOURCES_DIR, 'reports', 'csv.jrxml')
     config.output = os.path.join(self.RESOURCES_DIR, 'reports',
                                  'compile_to_file')
     config.dataFile = os.path.join(self.RESOURCES_DIR,
                                    'csvExampleHeaders.csv')
     config.dbType = 'csv'
     config.csvCharset = "utf-8"
     config.outCharset = "utf-8"
     config.csvFieldDel = "|"
     config.outFieldDel = "|"
     config.csvRecordDel = "\r\n"
     config.csvFirstRow = True
     config.csvColumns = "Name,Street,City,Phone".split(",")
     return config