use of io.crate.testing.SQLResponse in project crate by crate.
the class SysShardsTest method testSelectStarWhereTable.
@Test
public void testSelectStarWhereTable() throws Exception {
SQLResponse response = execute("select * from sys.shards where table_name = 'characters'");
assertEquals(8L, response.rowCount());
assertEquals(15, response.cols().length);
}
use of io.crate.testing.SQLResponse in project crate by crate.
the class SysShardsTest method testSelectWhereTable.
@Test
public void testSelectWhereTable() throws Exception {
SQLResponse response = execute("select id, size from sys.shards " + "where table_name = 'characters'");
assertEquals(8L, response.rowCount());
}
use of io.crate.testing.SQLResponse in project crate by crate.
the class SysShardsTest method testSelectGroupByHaving.
@Test
public void testSelectGroupByHaving() throws Exception {
SQLResponse response = execute("select count(*) " + "from sys.shards " + "group by table_name " + "having table_name = 'quotes'");
assertThat(TestingHelpers.printedTable(response.rows()), is("8\n"));
}
use of io.crate.testing.SQLResponse in project crate by crate.
the class SysShardsTest method testSelectRecoveryExpression.
@Test
public void testSelectRecoveryExpression() throws Exception {
SQLResponse response = execute("select recovery, " + "recovery['files'], recovery['files']['used'], recovery['files']['reused'], recovery['files']['recovered'], " + "recovery['size'], recovery['size']['used'], recovery['size']['reused'], recovery['size']['recovered'] " + "from sys.shards");
for (Object[] row : response.rows()) {
Map recovery = (Map) row[0];
Map<String, Integer> files = (Map<String, Integer>) row[1];
assertThat(((Map<String, Integer>) recovery.get("files")).entrySet(), equalTo(files.entrySet()));
Map<String, Long> size = (Map<String, Long>) row[5];
assertThat(((Map<String, Long>) recovery.get("size")).entrySet(), equalTo(size.entrySet()));
}
}
use of io.crate.testing.SQLResponse in project crate by crate.
the class SysShardsTest method testSelectStarLike.
@Test
public void testSelectStarLike() throws Exception {
SQLResponse response = execute("select * from sys.shards where table_name like 'charact%'");
assertEquals(8L, response.rowCount());
assertEquals(15, response.cols().length);
}
Aggregations