Search in sources :

Example 1 with SqlPlaceholdersWrapper

use of com.github.mgramin.sqlboot.model.uri.wrappers.SqlPlaceholdersWrapper in project sql-boot by sql-boot.

the class ColumnJdbcResourceTypeTest method read.

@Test
public void read() {
    final ResourceType table = new ColumnJdbcResourceType(dataSource);
    final Stream<DbResource> tables = table.read(new SqlPlaceholdersWrapper(new DbUri("table", asList("MAIN_SCHEMA", "CITY"))));
    tables.forEach(v -> System.out.println(v.name()));
}
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 2 with SqlPlaceholdersWrapper

use of com.github.mgramin.sqlboot.model.uri.wrappers.SqlPlaceholdersWrapper in project sql-boot by sql-boot.

the class IndexJdbcResourceTypeTest method read.

@Test
public void read() {
    final ResourceType index = new IndexJdbcResourceType(dataSource);
    final Stream<DbResource> indexes = index.read(new SqlPlaceholdersWrapper(new DbUri("index", asList("*"))));
    assertEquals(5, indexes.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 3 with SqlPlaceholdersWrapper

use of com.github.mgramin.sqlboot.model.uri.wrappers.SqlPlaceholdersWrapper in project sql-boot by sql-boot.

the class PkJdbcResourceTypeTest method read.

@Test
public void read() {
    final ResourceType pk = new PkJdbcResourceType(dataSource);
    final Stream<DbResource> primaryKeys = pk.read(new SqlPlaceholdersWrapper(new DbUri("pk", asList("*"))));
    assertEquals(2, 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)

Example 4 with SqlPlaceholdersWrapper

use of com.github.mgramin.sqlboot.model.uri.wrappers.SqlPlaceholdersWrapper in project sql-boot by sql-boot.

the class ParentTableJdbcResourceTypeTest method read.

@Test
public void read() {
    final ResourceType pk = new ParentTableJdbcResourceType(dataSource);
    final Stream<DbResource> primaryKeys = pk.read(new SqlPlaceholdersWrapper(new DbUri("parent_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)

Example 5 with SqlPlaceholdersWrapper

use of com.github.mgramin.sqlboot.model.uri.wrappers.SqlPlaceholdersWrapper in project sql-boot by sql-boot.

the class ViewJdbcResourceTypeTest method read.

@Test
public void read() {
    final ResourceType view = new ViewJdbcResourceType(dataSource);
    final Stream<DbResource> views = view.read(new SqlPlaceholdersWrapper(new DbUri("view", asList("*"))));
    assertEquals(2, views.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

ResourceType (com.github.mgramin.sqlboot.model.resource_type.ResourceType)13 DbUri (com.github.mgramin.sqlboot.model.uri.impl.DbUri)13 SqlPlaceholdersWrapper (com.github.mgramin.sqlboot.model.uri.wrappers.SqlPlaceholdersWrapper)13 DbResource (com.github.mgramin.sqlboot.model.resource.DbResource)12 Test (org.junit.Test)11 FsResourceTypes (com.github.mgramin.sqlboot.model.resource_type.impl.composite.FsResourceTypes)2 Uri (com.github.mgramin.sqlboot.model.uri.Uri)2 ResponseEntity (org.springframework.http.ResponseEntity)2 ProcedureJdbcResourceType (com.github.mgramin.sqlboot.model.resource_type.impl.jdbc.schema.procedure.ProcedureJdbcResourceType)1 Map (java.util.Map)1 Ignore (org.junit.Ignore)1