Example #1
0
    def test_write_buffer_flush_interval(self):
        hbase = HBase().write_buffer_flush_interval('123')

        properties = hbase.to_properties()
        expected = {
            'connector.type': 'hbase',
            'connector.write.buffer-flush.interval': '123',
            'connector.property-version': '1'
        }
        self.assertEqual(expected, properties)

        hbase = HBase().write_buffer_flush_interval(123)

        properties = hbase.to_properties()
        self.assertEqual(expected, properties)

        hbase = HBase().write_buffer_flush_interval('123ms')

        properties = hbase.to_properties()
        expected = {
            'connector.type': 'hbase',
            'connector.write.buffer-flush.interval': '123ms',
            'connector.property-version': '1'
        }
        self.assertEqual(expected, properties)
Example #2
0
    def test_version(self):
        hbase = HBase().version("1.4.3")

        properties = hbase.to_properties()
        expected = {'connector.version': '1.4.3',
                    'connector.type': 'hbase',
                    'connector.property-version': '1'}
        self.assertEqual(expected, properties)

        hbase = HBase().version(1.1)
        properties = hbase.to_properties()
        expected = {'connector.version': '1.1',
                    'connector.type': 'hbase',
                    'connector.property-version': '1'}
        self.assertEqual(expected, properties)
Example #3
0
    def test_write_buffer_flush_max_rows(self):
        hbase = HBase().write_buffer_flush_max_rows(10)

        properties = hbase.to_properties()
        expected = {'connector.type': 'hbase',
                    'connector.write.buffer-flush.max-rows': '10',
                    'connector.property-version': '1'}
        self.assertEqual(expected, properties)
Example #4
0
    def test_zookeeper_node_parent(self):
        hbase = HBase().zookeeper_node_parent('/hbase/example-root-znode')

        properties = hbase.to_properties()
        expected = {'connector.type': 'hbase',
                    'connector.zookeeper.znode.parent': '/hbase/example-root-znode',
                    'connector.property-version': '1'}
        self.assertEqual(expected, properties)
Example #5
0
    def test_zookeeper_quorum(self):
        hbase = HBase().zookeeper_quorum("localhost:2181,localhost:2182")

        properties = hbase.to_properties()
        expected = {'connector.type': 'hbase',
                    'connector.zookeeper.quorum': 'localhost:2181,localhost:2182',
                    'connector.property-version': '1'}
        self.assertEqual(expected, properties)
Example #6
0
    def test_table_name(self):
        hbase = HBase().table_name('tableName1')

        properties = hbase.to_properties()
        expected = {'connector.type': 'hbase',
                    'connector.table-name': 'tableName1',
                    'connector.property-version': '1'}
        self.assertEqual(expected, properties)
Example #7
0
    def test_write_buffer_flush_max_size(self):
        hbase = HBase().write_buffer_flush_max_size('1000')

        properties = hbase.to_properties()
        expected = {'connector.type': 'hbase',
                    'connector.write.buffer-flush.max-size': '1000 bytes',
                    'connector.property-version': '1'}
        self.assertEqual(expected, properties)

        hbase = HBase().write_buffer_flush_max_size(1000)
        properties = hbase.to_properties()
        self.assertEqual(expected, properties)

        hbase = HBase().write_buffer_flush_max_size('10mb')
        properties = hbase.to_properties()
        expected = {'connector.type': 'hbase',
                    'connector.write.buffer-flush.max-size': '10 mb',
                    'connector.property-version': '1'}
        self.assertEqual(expected, properties)