Package com.alibaba.otter.canal.parse.inbound

Source Code of com.alibaba.otter.canal.parse.inbound.TableMetaCacheTest

package com.alibaba.otter.canal.parse.inbound;

import java.io.IOException;
import java.net.InetSocketAddress;

import org.junit.Assert;
import org.junit.Test;

import com.alibaba.otter.canal.parse.inbound.TableMeta.FieldMeta;
import com.alibaba.otter.canal.parse.inbound.mysql.MysqlConnection;
import com.alibaba.otter.canal.parse.inbound.mysql.dbsync.TableMetaCache;

public class TableMetaCacheTest {

    @Test
    public void testSimple() {

        MysqlConnection connection = new MysqlConnection(new InetSocketAddress("127.0.0.1", 3306), "xxxxx", "xxxxx");
        try {
            connection.connect();
        } catch (IOException e) {
            Assert.fail(e.getMessage());
        }

        TableMetaCache cache = new TableMetaCache(connection);
        TableMeta meta = cache.getTableMeta("otter1", "otter_stability1");
        Assert.assertNotNull(meta);
        for (FieldMeta field : meta.getFileds()) {
            System.out.println("filed :" + field.getColumnName() + " , isKey : " + field.isKey() + " , isNull : "
                               + field.isNullable());
        }
    }
}
TOP

Related Classes of com.alibaba.otter.canal.parse.inbound.TableMetaCacheTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.