use of com.github.mgramin.sqlboot.model.uri.impl.DbUri 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.uri.impl.DbUri 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.uri.impl.DbUri 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());
}
use of com.github.mgramin.sqlboot.model.uri.impl.DbUri in project sql-boot by sql-boot.
the class SqlResourceTypeTest method read.
@Test
public void read() throws Exception {
final String sql = "select * from (select table_schema as \"@table_schema\", table_name as \"@table_name\" " + "from information_schema.tables)";
final ResourceType type = new WhereWrapper(new SqlResourceType(new JdbcSqlQuery(dataSource, new GroovyTemplateGenerator(sql)), asList("table")));
assertEquals(3, type.read(new DbUri("table/m.column")).count());
}
use of com.github.mgramin.sqlboot.model.uri.impl.DbUri in project sql-boot by sql-boot.
the class DbUriTest method test.
private void test(String uriString, String jsonExpected) throws BootException {
Uri uri = new DbUri(uriString);
assertEquals(uriString, uri.toString());
assertEquals(new JsonWrapper(new DbUri(uriString)).toString(), jsonExpected);
}
Aggregations