Search in sources :

Example 21 with SQLResponse

use of io.crate.testing.SQLResponse in project crate by crate.

the class SysCheckerIntegrationTest method testMinimumMasterNodesCheckWithResetCorrectSetting.

@Test
public void testMinimumMasterNodesCheckWithResetCorrectSetting() {
    int setMinimumMasterNodes = numberOfMasterNodes() / 2 + 1;
    execute("set global discovery.zen.minimum_master_nodes=?", new Object[] { setMinimumMasterNodes });
    SQLResponse response = execute("select severity, passed from sys.checks where id=?", new Object[] { 1 });
    assertThat(TestingHelpers.printedTable(response.rows()), is("3| true\n"));
}
Also used : SQLResponse(io.crate.testing.SQLResponse) Test(org.junit.Test)

Example 22 with SQLResponse

use of io.crate.testing.SQLResponse in project crate by crate.

the class SysCheckerIntegrationTest method testNumberOfPartitionCheckPassedForDocTablesCustomAndDefaultSchemas.

@Test
public void testNumberOfPartitionCheckPassedForDocTablesCustomAndDefaultSchemas() {
    execute("create table foo.bar (id int) partitioned by (id)");
    execute("create table bar (id int) partitioned by (id)");
    execute("insert into foo.bar (id) values (?)", new Object[] { 1 });
    execute("insert into bar (id) values (?)", new Object[] { 1 });
    SQLResponse response = execute("select severity, passed from sys.checks where id=?", new Object[] { 2 });
    assertThat(TestingHelpers.printedTable(response.rows()), is("2| true\n"));
}
Also used : SQLResponse(io.crate.testing.SQLResponse) Test(org.junit.Test)

Example 23 with SQLResponse

use of io.crate.testing.SQLResponse in project crate by crate.

the class SysCheckerIntegrationTest method testMinimumMasterNodesCheckSetNotCorrectNumberOfMasterNodes.

@Test
public void testMinimumMasterNodesCheckSetNotCorrectNumberOfMasterNodes() throws InterruptedException {
    int setMinimumMasterNodes = numberOfMasterNodes() / 2;
    execute("set global discovery.zen.minimum_master_nodes=?", new Object[] { setMinimumMasterNodes });
    SQLResponse response = execute("select severity, passed from sys.checks where id=?", new Object[] { 1 });
    assertThat(TestingHelpers.printedTable(response.rows()), is("3| false\n"));
}
Also used : SQLResponse(io.crate.testing.SQLResponse) Test(org.junit.Test)

Example 24 with SQLResponse

use of io.crate.testing.SQLResponse in project crate by crate.

the class SysShardsTest method testSelectGlobalCountAndOthers.

@Test
public void testSelectGlobalCountAndOthers() throws Exception {
    SQLResponse response = execute("select count(*), max(table_name) from sys.shards");
    assertEquals(1L, response.rowCount());
    assertEquals(26L, response.rows()[0][0]);
    assertEquals("quotes", response.rows()[0][1]);
}
Also used : SQLResponse(io.crate.testing.SQLResponse) Test(org.junit.Test)

Example 25 with SQLResponse

use of io.crate.testing.SQLResponse in project crate by crate.

the class SysShardsTest method testSelectGroupByAllTables.

@Test
public void testSelectGroupByAllTables() throws Exception {
    SQLResponse response = execute("select count(*), table_name from sys.shards " + "group by table_name order by table_name");
    assertEquals(3L, response.rowCount());
    assertEquals(10L, response.rows()[0][0]);
    assertEquals("blobs", response.rows()[0][1]);
    assertEquals("characters", response.rows()[1][1]);
    assertEquals("quotes", response.rows()[2][1]);
}
Also used : SQLResponse(io.crate.testing.SQLResponse) Test(org.junit.Test)

Aggregations

SQLResponse (io.crate.testing.SQLResponse)109 Test (org.junit.Test)78 Map (java.util.Map)13 UseJdbc (io.crate.testing.UseJdbc)10 HashMap (java.util.HashMap)10 ArrayList (java.util.ArrayList)8 PartitionName (io.crate.metadata.PartitionName)4 TestingHelpers.resolveCanonicalString (io.crate.testing.TestingHelpers.resolveCanonicalString)4 Path (java.nio.file.Path)4 BytesRef (org.apache.lucene.util.BytesRef)4 CountDownLatch (java.util.concurrent.CountDownLatch)3 AtomicReference (java.util.concurrent.atomic.AtomicReference)3 TreeMap (java.util.TreeMap)2 List (java.util.List)1 UUID (java.util.UUID)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 ClusterRerouteRequestBuilder (org.elasticsearch.action.admin.cluster.reroute.ClusterRerouteRequestBuilder)1 ClusterStateResponse (org.elasticsearch.action.admin.cluster.state.ClusterStateResponse)1 SearchRequest (org.elasticsearch.action.search.SearchRequest)1 SearchResponse (org.elasticsearch.action.search.SearchResponse)1