use of io.crate.testing.SQLResponse in project crate by crate.
the class TransportSQLActionClassLifecycleTest method testSysNodesVersionFromMultipleNodes.
@Test
public void testSysNodesVersionFromMultipleNodes() throws Exception {
SQLResponse response = execute("select version, version['number'], " + "version['build_hash'], version['build_snapshot'] " + "from sys.nodes");
assertThat(response.rowCount(), is(2L));
for (int i = 0; i <= 1; i++) {
assertThat(response.rows()[i][0], instanceOf(Map.class));
assertThat((Map<String, Object>) response.rows()[i][0], allOf(hasKey("number"), hasKey("build_hash"), hasKey("build_snapshot")));
assertThat((String) response.rows()[i][1], Matchers.is(Version.CURRENT.number()));
assertThat((String) response.rows()[i][2], is(Build.CURRENT.hash()));
assertThat((Boolean) response.rows()[i][3], is(Version.CURRENT.snapshot()));
}
}
use of io.crate.testing.SQLResponse in project crate by crate.
the class TransportSQLActionClassLifecycleTest method testCountWithGroupByOrderOnKeyDescAndLimit.
@Test
public void testCountWithGroupByOrderOnKeyDescAndLimit() throws Exception {
SQLResponse response = execute("select count(*), race from characters group by race order by race desc limit 2");
assertEquals(2L, response.rowCount());
assertEquals(2L, response.rows()[0][0]);
assertEquals("Vogon", response.rows()[0][1]);
assertEquals(4L, response.rows()[1][0]);
assertEquals("Human", response.rows()[1][1]);
}
use of io.crate.testing.SQLResponse in project crate by crate.
the class SysShardsTest method testSelectWithOrderByColumnNotInOutputs.
@Test
public void testSelectWithOrderByColumnNotInOutputs() throws Exception {
// regression test... query failed with ArrayOutOfBoundsException due to inputColumn mangling in planner
SQLResponse response = execute("select id from sys.shards order by table_name limit 1");
assertThat(response.rowCount(), is(1L));
assertThat(response.rows()[0][0], instanceOf(Integer.class));
}
use of io.crate.testing.SQLResponse in project crate by crate.
the class SysShardsTest method testSelectWhereBoolean.
@Test
public void testSelectWhereBoolean() throws Exception {
SQLResponse response = execute("select * from sys.shards where \"primary\" = false");
assertEquals(13L, response.rowCount());
}
use of io.crate.testing.SQLResponse in project crate by crate.
the class SysShardsTest method testSelectGlobalAggregates.
@Test
public void testSelectGlobalAggregates() throws Exception {
SQLResponse response = execute("select sum(size), min(size), max(size), avg(size) from sys.shards");
assertEquals(1L, response.rowCount());
assertEquals(4, response.rows()[0].length);
assertNotNull(response.rows()[0][0]);
assertNotNull(response.rows()[0][1]);
assertNotNull(response.rows()[0][2]);
assertNotNull(response.rows()[0][3]);
}
Aggregations