Package org.voltdb.client

Examples of org.voltdb.client.ClientResponse


   
    private void executeTestWorkload(Client client) throws Exception {
        RegressionSuiteUtil.initializeTPCCDatabase(this.getCatalogContext(), client);
        Object params[] = RegressionSuiteUtil.generateNewOrder(NUM_WAREHOUSES, false, WAREHOUSE_ID, DISTRICT_ID);
        String procName = neworder.class.getSimpleName();
        ClientResponse cresponse = client.callProcedure(procName, params);
        assertNotNull(cresponse);
        assertEquals(Status.OK, cresponse.getStatus());
    }
View Full Code Here


    public void testAdHocSQL() throws Exception {
        // This was originally from org.voltdb.TestAdHocQueries
       
        Client client = this.getClient();
        String procName = VoltSystemProcedure.procCallName(AdHoc.class);
        ClientResponse cr;
       
        cr = client.callProcedure(procName, "INSERT INTO NEW_ORDER VALUES (1, 1, 1);");
        VoltTable modCount = cr.getResults()[0];
        assertTrue(modCount.getRowCount() == 1);
        assertTrue(modCount.asScalarLong() == 1);

        cr = client.callProcedure(procName, "SELECT * FROM NEW_ORDER;");
        VoltTable result = cr.getResults()[0];
        assertTrue(result.getRowCount() == 1);
        // System.out.println(result.toString());

        boolean caught = false;
        try {
View Full Code Here

               
                // Once with a callback
                client.callProcedure(callbacks[p], "GetItem", hints, 1);
               
                // And once without a callback
                ClientResponse cresponse = client.callProcedure("GetItem", hints, 1);
                assertNotNull(cresponse);
                assertEquals(Status.OK, cresponse.getStatus());
                assertEquals(p, cresponse.getBasePartition());
            } // FOR
        } // FOR
       
        latch.await();
    }
View Full Code Here

    public void testInitialize() throws Exception {
        Client client = this.getClient();
        this.initializeDatabase(client, NUM_TUPLES);
       
        String query = "SELECT COUNT(*) FROM " + YCSBConstants.TABLE_NAME;
        ClientResponse cresponse = client.callProcedure("@AdHoc", query);
        assertEquals(Status.OK, cresponse.getStatus());
        VoltTable results[] = cresponse.getResults();
        assertEquals(1, results.length);
        assertEquals(NUM_TUPLES, results[0].asScalarLong());
        System.err.println(results[0]);
    }
View Full Code Here

        this.initializeDatabase(client, NUM_TUPLES);
       
        long key = NUM_TUPLES / 2;
        String procName = ReadRecord.class.getSimpleName();
        Object params[] = { key };
        ClientResponse cresponse = client.callProcedure(procName, params);
        assertNotNull(cresponse);
        assertEquals(Status.OK, cresponse.getStatus());
        assertEquals(1, cresponse.getResults().length);
       
        VoltTable vt = cresponse.getResults()[0];
        boolean adv = vt.advanceRow();
        assert(adv);
        assertEquals(key, vt.getLong(0));
    }
View Full Code Here

    public void testYCSB() throws IOException, InterruptedException, ProcCallException {
       
        System.out.println("Starting testYCSB - Physical Recovery");               
      
        VoltTable results[] = null;
        ClientResponse cresponse = null;
        Client client = this.getClient();
        CatalogContext cc = this.getCatalogContext();      

        // Load database       
        try{
View Full Code Here

        assertEquals(expectedNumItems, numItems);
       
        String procName = UpdateItemName.class.getSimpleName();
        long itemId = this.getRandom().number(TPCCConstants.STARTING_ITEM, numItems);
        String itemName = "Tone Loc";
        ClientResponse cr = client.callProcedure(procName, itemId, itemName);
        assertEquals(cr.toString(), Status.OK, cr.getStatus());
        assertEquals(cr.toString(), 1, cr.getResults().length);
        try {
            if(cr.getResults()[0].getRowCount() != 0){
                assertTrue(cr.toString(), cr.getResults()[0].advanceRow());
                assertEquals(itemName, cr.getResults()[0].getString(0));
            }
        } catch (Throwable ex) {
            System.err.printf("TARGET: %d/%s\n", itemId, itemName);
            cr = RegressionSuiteUtil.sql(client, "SELECT * FROM " + TPCCConstants.TABLENAME_ITEM);
            System.err.println(VoltTableUtil.format(cr.getResults()));
            throw new Exception(ex);
        }       
    }
View Full Code Here

    }

    public void testBatchedMultipartitionTxns() throws IOException, ProcCallException {
        Client client = getClient();

        ClientResponse cresponse = client.callProcedure("BatchedMultiPartitionTest");
        System.err.println(cresponse);
        VoltTable[] results = cresponse.getResults();
        assertEquals(5, results.length);
        assertEquals(1, results[0].asScalarLong());
        assertEquals(1, results[1].asScalarLong());
        assertEquals(1, results[2].asScalarLong());
        assertEquals(2, results[3].getRowCount());
View Full Code Here

            return;
        }

        int ctr = 0;
        Iterator<LogEntry> log_itr = reader.iterator();
        ClientResponse cresponse = null;
        Client client = this.getClient();
        CatalogContext cc = this.getCatalogContext();
        VoltTable results[] = null;

        while (log_itr.hasNext()) {
            LogEntry entry = log_itr.next();

            assert(entry != null);
            //System.err.println("REDO :: TXN ID :" + entry.getTransactionId().longValue());
            //System.err.println("REDO :: PROC ID :" + entry.getProcedureId());

            Object[] entryParams = entry.getProcedureParams().toArray();
       
            String procName = cc.getProcedureById(entry.getProcedureId()).fullName();
            Procedure catalog_proc = cc.procedures.getIgnoreCase(procName);

            if(catalog_proc.getReadonly() == false){
                // System.out.println("Invoking procedure ::" + procName);

                cresponse = client.callProcedure(procName, entryParams);
                assertEquals(cresponse.getStatus(), Status.OK);
               
                // results = cresponse.getResults();
                // assertEquals(results.length, 1);
            }
View Full Code Here

            VoterConstants.NUM_CONTESTANTS,
            VoterConstants.CONTESTANT_NAMES_CSV
        };
       
        System.err.println("Initializing database...");
        ClientResponse cresponse = client.callProcedure(Initialize.class.getSimpleName(), params);
        assertNotNull(cresponse);
        assertEquals(Status.OK, cresponse.getStatus());
    }
View Full Code Here

TOP

Related Classes of org.voltdb.client.ClientResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.