use of io.seata.rm.datasource.sql.struct.TableMetaCache in project seata by seata.
the class OracleTableMetaCacheTest method getTableMetaTest.
@Test
public void getTableMetaTest() throws SQLException {
MockDriver mockDriver = new MockDriver(columnMetas, indexMetas, pkMetas);
DruidDataSource dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setDriver(mockDriver);
DataSourceProxy proxy = new DataSourceProxy(dataSource);
TableMetaCache tableMetaCache = TableMetaCacheFactory.getTableMetaCache(JdbcConstants.ORACLE);
TableMeta tableMeta = tableMetaCache.getTableMeta(proxy.getPlainConnection(), "t.ot1", proxy.getResourceId());
Assertions.assertNotNull(tableMeta);
tableMeta = tableMetaCache.getTableMeta(proxy.getPlainConnection(), "t.\"ot1\"", proxy.getResourceId());
Assertions.assertNotNull(tableMeta);
}
use of io.seata.rm.datasource.sql.struct.TableMetaCache in project seata by seata.
the class PostgresqlTableMetaCacheTest method getTableMetaTest.
@Test
public void getTableMetaTest() throws SQLException {
MockDriver mockDriver = new MockDriver(columnMetas, indexMetas, pkMetas);
DruidDataSource dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setDriver(mockDriver);
DataSourceProxy proxy = new DataSourceProxy(dataSource);
TableMetaCache tableMetaCache = TableMetaCacheFactory.getTableMetaCache(JdbcConstants.POSTGRESQL);
TableMeta tableMeta = tableMetaCache.getTableMeta(proxy.getPlainConnection(), "pt1", proxy.getResourceId());
Assertions.assertNotNull(tableMeta);
tableMeta = tableMetaCache.getTableMeta(proxy.getPlainConnection(), "t.pt1", proxy.getResourceId());
Assertions.assertNotNull(tableMeta);
tableMeta = tableMetaCache.getTableMeta(proxy.getPlainConnection(), "t.\"pt1\"", proxy.getResourceId());
Assertions.assertNotNull(tableMeta);
}
use of io.seata.rm.datasource.sql.struct.TableMetaCache in project seata by seata.
the class MysqlTableMetaCacheTest method testTableMeta.
@Test
public void testTableMeta() {
TableMetaCache tableMetaCache = getTableMetaCache();
Assertions.assertNotNull(tableMetaCache);
Assertions.assertThrows(IllegalArgumentException.class, () -> {
tableMetaCache.getTableMeta(null, null, null);
});
}
Aggregations