Search in sources :

Example 86 with ClientResponse

use of org.voltdb.client.ClientResponse in project voltdb by VoltDB.

the class TestLoadingSuite method countPartitionedRows.

public long countPartitionedRows(Client client) throws Exception {
    ClientResponse r = client.callProcedure("@AdHoc", "select count(*) from PARTITIONED");
    assertEquals(ClientResponse.SUCCESS, r.getStatus());
    assertEquals(1, r.getResults().length);
    return r.getResults()[0].asScalarLong();
}
Also used : ClientResponse(org.voltdb.client.ClientResponse)

Example 87 with ClientResponse

use of org.voltdb.client.ClientResponse in project voltdb by VoltDB.

the class TestMPBasecaseSuite method testOneShotWrite.

public void testOneShotWrite() throws Exception {
    final Client client = this.getClient();
    loadData(client);
    ClientResponse resp = client.callProcedure("UpdateP1");
    assertTrue("Successful oneshot write.", resp.getStatus() == ClientResponse.SUCCESS);
    assertEquals("Touched 10 rows", 10L, resp.getResults()[0].asScalarLong());
    // verify the update results.
    resp = client.callProcedure("SumP1");
    assertTrue("Verified updates", resp.getStatus() == ClientResponse.SUCCESS);
    assertEquals("Updated sum=20", 20L, resp.getResults()[0].asScalarLong());
}
Also used : ClientResponse(org.voltdb.client.ClientResponse) Client(org.voltdb.client.Client)

Example 88 with ClientResponse

use of org.voltdb.client.ClientResponse in project voltdb by VoltDB.

the class TestMPBasecaseSuite method testOneShotRead.

public void testOneShotRead() throws Exception {
    final Client client = this.getClient();
    loadData(client);
    // testcase: single-stmt read.
    ClientResponse resp = client.callProcedure("CountP1");
    assertTrue("Successful oneshot read.", resp.getStatus() == ClientResponse.SUCCESS);
    assertEquals("Expect count=10", 10L, resp.getResults()[0].asScalarLong());
}
Also used : ClientResponse(org.voltdb.client.ClientResponse) Client(org.voltdb.client.Client)

Example 89 with ClientResponse

use of org.voltdb.client.ClientResponse in project voltdb by VoltDB.

the class TestMPBasecaseSuite method testOneShotConstraintViolationAllSites.

public void testOneShotConstraintViolationAllSites() throws Exception {
    final Client client = this.getClient();
    loadData(client);
    boolean caught = false;
    try {
        client.callProcedure("ConstraintViolationUpdate");
        assertFalse("Failed to produce constraint violation", true);
    } catch (ProcCallException e) {
        assertEquals("Client response is rollback.", ClientResponse.GRACEFUL_FAILURE, e.getClientResponse().getStatus());
        caught = true;
    }
    assertTrue("Expected exception.", caught);
    // verify initial result is unchanged (transactions!)
    ClientResponse resp = client.callProcedure("SumB1");
    assertTrue("Verified updates", resp.getStatus() == ClientResponse.SUCCESS);
    assertEquals("Updated sum=45", 45L, resp.getResults()[0].asScalarLong());
}
Also used : ClientResponse(org.voltdb.client.ClientResponse) Client(org.voltdb.client.Client) ProcCallException(org.voltdb.client.ProcCallException)

Example 90 with ClientResponse

use of org.voltdb.client.ClientResponse in project voltdb by VoltDB.

the class TestMPMultiRoundTripSuite method testMultiRoundtripMixReplicatedReadsAndWrites.

public void testMultiRoundtripMixReplicatedReadsAndWrites() throws Exception {
    final Client client = this.getClient();
    ClientResponse resp = client.callProcedure("MultiRoundMixReplicatedReadsAndWrites", 10, 20);
    assertTrue("Successful multi-roundtrip read/write.", resp.getStatus() == ClientResponse.SUCCESS);
    assertEquals("Expect count=55", 55L, resp.getResults()[0].asScalarLong());
}
Also used : ClientResponse(org.voltdb.client.ClientResponse) Client(org.voltdb.client.Client)

Aggregations

ClientResponse (org.voltdb.client.ClientResponse)381 VoltTable (org.voltdb.VoltTable)193 Client (org.voltdb.client.Client)184 ProcCallException (org.voltdb.client.ProcCallException)105 IOException (java.io.IOException)52 NoConnectionsException (org.voltdb.client.NoConnectionsException)33 Test (org.junit.Test)32 ProcedureCallback (org.voltdb.client.ProcedureCallback)32 VoltProjectBuilder (org.voltdb.compiler.VoltProjectBuilder)29 Configuration (org.voltdb.VoltDB.Configuration)28 File (java.io.File)18 Timestamp (java.sql.Timestamp)16 VoltDB (org.voltdb.VoltDB)16 InMemoryJarfile (org.voltdb.utils.InMemoryJarfile)16 VoltCompiler (org.voltdb.compiler.VoltCompiler)15 JSONException (org.json_voltpatches.JSONException)11 BigDecimal (java.math.BigDecimal)10 ExecutionException (java.util.concurrent.ExecutionException)10 ClientResponseImpl (org.voltdb.ClientResponseImpl)10 KeeperException (org.apache.zookeeper_voltpatches.KeeperException)9