Search in sources :

Example 46 with ClientResponse

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

the class TestVoltProcedure method testNullDecimal.

public void testNullDecimal() {
    ClientResponse r = call(DecimalProcedure.class);
    assertEquals(null, DecimalProcedure.arg);
    assertEquals(ClientResponse.SUCCESS, r.getStatus());
}
Also used : ClientResponse(org.voltdb.client.ClientResponse)

Example 47 with ClientResponse

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

the class TestVoltProcedure method testUnexpectedFailureFour.

public void testUnexpectedFailureFour() {
    ClientResponse r = call(UnexpectedFailureFourProcedure.class);
    assertEquals(ClientResponse.UNEXPECTED_FAILURE, r.getStatus());
    System.out.println(r.getStatusString());
    assertTrue(r.getStatusString().contains("java.lang.ArrayIndexOutOfBoundsException"));
}
Also used : ClientResponse(org.voltdb.client.ClientResponse)

Example 48 with ClientResponse

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

the class TestVoltProcedure method testNullDouble.

public void testNullDouble() {
    ClientResponse r = call(DoubleProcedure.class);
    assertEquals(VoltType.NULL_FLOAT, DoubleProcedure.arg);
    assertEquals(ClientResponse.SUCCESS, r.getStatus());
}
Also used : ClientResponse(org.voltdb.client.ClientResponse)

Example 49 with ClientResponse

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

the class TestVoltProcedure method testNullTimestamp.

public void testNullTimestamp() {
    ClientResponse r = call(TimestampProcedure.class);
    assertEquals(null, TimestampProcedure.arg);
    assertEquals(ClientResponse.SUCCESS, r.getStatus());
}
Also used : ClientResponse(org.voltdb.client.ClientResponse)

Example 50 with ClientResponse

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

the class TestFixedSQLSuite method subTestTicketEng2250_IsNull.

private void subTestTicketEng2250_IsNull() throws IOException, ProcCallException, InterruptedException {
    System.out.println("STARTING testTicketEng2250_IsNull");
    Client client = getClient();
    ProcedureCallback callback = new ProcedureCallback() {

        @Override
        public void clientCallback(ClientResponse clientResponse) throws Exception {
            if (clientResponse.getStatus() != ClientResponse.SUCCESS) {
                throw new RuntimeException("Failed with response: " + clientResponse.getStatusString());
            }
        }
    };
    /*
        CREATE TABLE P1 (
                ID INTEGER DEFAULT '0' NOT NULL,
                DESC VARCHAR(300),
                NUM INTEGER,
                RATIO FLOAT,
                PRIMARY KEY (ID)
                );
        */
    System.out.println("Eng2250: null entries.");
    for (int id = 0; id < 5; id++) {
        client.callProcedure(callback, "P1.insert", id, null, 10, 1.1);
        client.drain();
    }
    System.out.println("Eng2250: not null entries.");
    for (int id = 5; id < 8; id++) {
        client.callProcedure(callback, "P1.insert", id, "description", 10, 1.1);
        client.drain();
    }
    VoltTable r1 = client.callProcedure("@AdHoc", "select count(*) from P1 where desc is null").getResults()[0];
    //* enable for debugging */ System.out.println(r1);
    assertEquals(5, r1.asScalarLong());
    VoltTable r2 = client.callProcedure("@AdHoc", "select count(*) from P1 where not desc is null").getResults()[0];
    //* enable for debugging */ System.out.println(r2);
    assertEquals(3, r2.asScalarLong());
    VoltTable r3 = client.callProcedure("@AdHoc", "select count(*) from P1 where NOT (id=2 and desc is null)").getResults()[0];
    //* enable for debugging */ System.out.println(r3);
    assertEquals(7, r3.asScalarLong());
    VoltTable r4 = client.callProcedure("@AdHoc", "select count(*) from P1 where NOT (id=6 and desc is null)").getResults()[0];
    //* enable for debugging */ System.out.println(r4);
    assertEquals(8, r4.asScalarLong());
    VoltTable r5 = client.callProcedure("@AdHoc", "select count(*) from P1 where id < 6 and NOT desc is null;").getResults()[0];
    //* enable for debugging */ System.out.println(r5);
    assertEquals(1, r5.asScalarLong());
    truncateTable(client, "P1");
}
Also used : ProcedureCallback(org.voltdb.client.ProcedureCallback) ClientResponse(org.voltdb.client.ClientResponse) Client(org.voltdb.client.Client) VoltTable(org.voltdb.VoltTable)

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