Search in sources :

Example 6 with MetaMockHelper

use of com.pingcap.tikv.meta.MetaUtils.MetaMockHelper in project tispark by pingcap.

the class CatalogTransactionTest method getTablesTest.

@Test
public void getTablesTest() {
    MetaMockHelper helper = new MetaMockHelper(pdServer, kvServer);
    helper.preparePDForRegionRead();
    helper.addTable(130, 42, "test");
    helper.addTable(130, 43, "test1");
    CatalogTransaction trx = new CatalogTransaction(session.createSnapshot());
    List<TiTableInfo> tables = trx.getTables(130);
    assertEquals(2, tables.size());
    assertEquals("test", tables.get(0).getName());
    assertEquals("test1", tables.get(1).getName());
}
Also used : MetaMockHelper(com.pingcap.tikv.meta.MetaUtils.MetaMockHelper) TiTableInfo(com.pingcap.tikv.meta.TiTableInfo) Test(org.junit.Test)

Aggregations

MetaMockHelper (com.pingcap.tikv.meta.MetaUtils.MetaMockHelper)6 Test (org.junit.Test)6 TiDBInfo (com.pingcap.tikv.meta.TiDBInfo)4 PDMockServerTest (com.pingcap.tikv.PDMockServerTest)2 TiTableInfo (com.pingcap.tikv.meta.TiTableInfo)2 ReflectionWrapper (com.pingcap.tikv.util.ReflectionWrapper)2