Search in sources :

Example 21 with DbResource

use of com.github.mgramin.sqlboot.model.resource.DbResource in project sql-boot by sql-boot.

the class FunctionJdbcResourceTypeTest method read.

@Test
@Ignore
public void read() {
    final ResourceType function = new FunctionJdbcResourceType(dataSource);
    final Stream<DbResource> functions = function.read(new SqlPlaceholdersWrapper(new DbUri("function", asList("*"))));
    assertEquals(1, functions.count());
}
Also used : SqlPlaceholdersWrapper(com.github.mgramin.sqlboot.model.uri.wrappers.SqlPlaceholdersWrapper) DbUri(com.github.mgramin.sqlboot.model.uri.impl.DbUri) DbResource(com.github.mgramin.sqlboot.model.resource.DbResource) ResourceType(com.github.mgramin.sqlboot.model.resource_type.ResourceType) ProcedureJdbcResourceType(com.github.mgramin.sqlboot.model.resource_type.impl.jdbc.schema.procedure.ProcedureJdbcResourceType) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 22 with DbResource

use of com.github.mgramin.sqlboot.model.resource.DbResource in project sql-boot by sql-boot.

the class ProcedureJdbcResourceTypeTest method read.

@Test
public void read() {
    final ResourceType procedure = new ProcedureJdbcResourceType(dataSource);
    final Stream<DbResource> procedures = procedure.read(new SqlPlaceholdersWrapper(new DbUri("procedure", asList("*"))));
    assertEquals(1, procedures.count());
}
Also used : SqlPlaceholdersWrapper(com.github.mgramin.sqlboot.model.uri.wrappers.SqlPlaceholdersWrapper) DbUri(com.github.mgramin.sqlboot.model.uri.impl.DbUri) DbResource(com.github.mgramin.sqlboot.model.resource.DbResource) ResourceType(com.github.mgramin.sqlboot.model.resource_type.ResourceType) Test(org.junit.Test)

Example 23 with DbResource

use of com.github.mgramin.sqlboot.model.resource.DbResource in project sql-boot by sql-boot.

the class TableJdbcResourceTypeTest method read.

@Test
public void read() {
    final ResourceType table = new TableJdbcResourceType(dataSource);
    final Stream<DbResource> tables = table.read(new SqlPlaceholdersWrapper(new DbUri("table", asList("*"))));
    assertEquals(2, tables.count());
}
Also used : SqlPlaceholdersWrapper(com.github.mgramin.sqlboot.model.uri.wrappers.SqlPlaceholdersWrapper) DbUri(com.github.mgramin.sqlboot.model.uri.impl.DbUri) DbResource(com.github.mgramin.sqlboot.model.resource.DbResource) ResourceType(com.github.mgramin.sqlboot.model.resource_type.ResourceType) Test(org.junit.Test)

Example 24 with DbResource

use of com.github.mgramin.sqlboot.model.resource.DbResource 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());
}
Also used : SqlPlaceholdersWrapper(com.github.mgramin.sqlboot.model.uri.wrappers.SqlPlaceholdersWrapper) DbUri(com.github.mgramin.sqlboot.model.uri.impl.DbUri) DbResource(com.github.mgramin.sqlboot.model.resource.DbResource) ResourceType(com.github.mgramin.sqlboot.model.resource_type.ResourceType) Test(org.junit.Test)

Example 25 with DbResource

use of com.github.mgramin.sqlboot.model.resource.DbResource 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());
}
Also used : SqlPlaceholdersWrapper(com.github.mgramin.sqlboot.model.uri.wrappers.SqlPlaceholdersWrapper) DbUri(com.github.mgramin.sqlboot.model.uri.impl.DbUri) DbResource(com.github.mgramin.sqlboot.model.resource.DbResource) ResourceType(com.github.mgramin.sqlboot.model.resource_type.ResourceType) Test(org.junit.Test)

Aggregations

DbResource (com.github.mgramin.sqlboot.model.resource.DbResource)26 DbUri (com.github.mgramin.sqlboot.model.uri.impl.DbUri)25 DbResourceImpl (com.github.mgramin.sqlboot.model.resource.impl.DbResourceImpl)13 ResourceType (com.github.mgramin.sqlboot.model.resource_type.ResourceType)13 BootException (com.github.mgramin.sqlboot.exceptions.BootException)12 SqlPlaceholdersWrapper (com.github.mgramin.sqlboot.model.uri.wrappers.SqlPlaceholdersWrapper)12 LinkedHashMap (java.util.LinkedHashMap)12 Test (org.junit.Test)12 ResultSet (java.sql.ResultSet)11 ResultSetMetaData (java.sql.ResultSetMetaData)11 SQLException (java.sql.SQLException)11 ArrayList (java.util.ArrayList)11 TableJdbcResourceType (com.github.mgramin.sqlboot.model.resource_type.impl.jdbc.schema.table.TableJdbcResourceType)5 Uri (com.github.mgramin.sqlboot.model.uri.Uri)2 Connection (java.sql.Connection)2 Entry (java.util.Map.Entry)2 DbResourceBodyWrapper (com.github.mgramin.sqlboot.model.resource.wrappers.DbResourceBodyWrapper)1 FsResourceTypes (com.github.mgramin.sqlboot.model.resource_type.impl.composite.FsResourceTypes)1 ProcedureJdbcResourceType (com.github.mgramin.sqlboot.model.resource_type.impl.jdbc.schema.procedure.ProcedureJdbcResourceType)1 SqlQuery (com.github.mgramin.sqlboot.sql.SqlQuery)1