use of com.github.mgramin.sqlboot.model.resource_type.ResourceType in project sql-boot by sql-boot.
the class TableJdbcResourceTypeTest method path.
@Test
public void path() {
final ResourceType table = new TableJdbcResourceType(dataSource);
assertEquals(2, table.path().size());
assertEquals("schema", table.path().get(0));
assertEquals("table", table.path().get(1));
}
use of com.github.mgramin.sqlboot.model.resource_type.ResourceType in project sql-boot by sql-boot.
the class ColumnJdbcResourceTypeTest method path.
@Test
public void path() {
final ResourceType column = new ColumnJdbcResourceType(dataSource);
assertEquals(3, column.path().size());
assertEquals("schema", column.path().get(0));
assertEquals("table", column.path().get(1));
assertEquals("column", column.path().get(2));
}
use of com.github.mgramin.sqlboot.model.resource_type.ResourceType in project sql-boot by sql-boot.
the class FkJdbcResourceTypeTest method read.
@Test
public void read() {
final ResourceType fk = new FkJdbcResourceType(dataSource);
final Stream<DbResource> foreignKeys = fk.read(new SqlPlaceholdersWrapper(new DbUri("fk", asList("*"))));
assertEquals(1, foreignKeys.count());
}
use of com.github.mgramin.sqlboot.model.resource_type.ResourceType in project sql-boot by sql-boot.
the class ChildTableJdbcResourceTypeTest method read.
@Test
public void read() {
final ResourceType pk = new ChildTableJdbcResourceType(dataSource);
final Stream<DbResource> primaryKeys = pk.read(new SqlPlaceholdersWrapper(new DbUri("child_table", asList("*"))));
assertEquals(1, primaryKeys.count());
}
use of com.github.mgramin.sqlboot.model.resource_type.ResourceType in project sql-boot by sql-boot.
the class SqlResourceTypeTest method read2.
@Test
public void read2() {
final String sql = "select * from (select table_schema as \"@table_schema\", table_name as \"@table_name\", column_name as \"@column_name\"" + "from information_schema.columns)";
ResourceType type = new WhereWrapper(new SqlResourceType(new JdbcSqlQuery(dataSource, new GroovyTemplateGenerator(sql)), asList("column")));
assertEquals(8, type.read(new DbUri("column/main_schema.users")).count());
}
Aggregations