Search in sources :

Example 11 with SyncCallback

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

the class TestUpdateDeployment method testUpdateSchemaModificationIsBlacklisted.

public void testUpdateSchemaModificationIsBlacklisted() throws Exception {
    System.out.println("\n\n-----\n testUpdateSchemaModificationIsBlacklisted \n-----\n\n");
    Client client = getClient();
    loadSomeData(client, 0, 10);
    client.drain();
    assertTrue(callbackSuccess);
    String deploymentURL = Configuration.getPathToCatalogForTest("catalogupdate-cluster-change_schema_update.xml");
    // Try to change the schem setting
    SyncCallback cb = new SyncCallback();
    client.updateApplicationCatalog(cb, null, new File(deploymentURL));
    cb.waitForResponse();
    assertEquals(ClientResponse.GRACEFUL_FAILURE, cb.getResponse().getStatus());
    System.out.println(cb.getResponse().getStatusString());
    assertTrue(cb.getResponse().getStatusString().contains("May not dynamically modify"));
}
Also used : Client(org.voltdb.client.Client) SyncCallback(org.voltdb.client.SyncCallback) File(java.io.File)

Example 12 with SyncCallback

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

the class TestUpdateDeployment method testUpdateSecurityNoUsers.

public void testUpdateSecurityNoUsers() throws Exception {
    System.out.println("\n\n-----\n testUpdateSecurityNoUsers \n-----\n\n");
    Client client = getClient();
    loadSomeData(client, 0, 10);
    client.drain();
    assertTrue(callbackSuccess);
    String deploymentURL = Configuration.getPathToCatalogForTest("catalogupdate-security-no-users.xml");
    // Try to change the schem setting
    SyncCallback cb = new SyncCallback();
    client.updateApplicationCatalog(cb, null, new File(deploymentURL));
    cb.waitForResponse();
    assertEquals(ClientResponse.GRACEFUL_FAILURE, cb.getResponse().getStatus());
    System.out.println(cb.getResponse().getStatusString());
    assertTrue(cb.getResponse().getStatusString().contains("Unable to update"));
}
Also used : Client(org.voltdb.client.Client) SyncCallback(org.voltdb.client.SyncCallback) File(java.io.File)

Example 13 with SyncCallback

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

the class TestUpdateDeployment method testUpdateSecurityBadUsername.

public void testUpdateSecurityBadUsername() throws Exception {
    System.out.println("\n\n-----\n testUpdateSecurityBadUsername \n-----\n\n");
    Client client = getClient();
    loadSomeData(client, 0, 10);
    client.drain();
    assertTrue(callbackSuccess);
    String deploymentURL = Configuration.getPathToCatalogForTest("catalogupdate-bad-username.xml");
    // Try to change the schem setting
    SyncCallback cb = new SyncCallback();
    client.updateApplicationCatalog(cb, null, new File(deploymentURL));
    cb.waitForResponse();
    assertEquals(ClientResponse.GRACEFUL_FAILURE, cb.getResponse().getStatus());
    System.out.println(cb.getResponse().getStatusString());
    assertTrue(cb.getResponse().getStatusString().contains("Unable to update"));
}
Also used : Client(org.voltdb.client.Client) SyncCallback(org.voltdb.client.SyncCallback) File(java.io.File)

Example 14 with SyncCallback

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

the class TestUpdateDeployment method testConsecutiveCatalogDeploymentRace.

public void testConsecutiveCatalogDeploymentRace() throws Exception {
    System.out.println("\n\n-----\n testConsecutiveCatalogDeploymentRace \n-----\n\n");
    Client client = getClient();
    loadSomeData(client, 0, 10);
    client.drain();
    assertTrue(callbackSuccess);
    String newCatalogURL = Configuration.getPathToCatalogForTest("catalogupdate-cluster-addtable.jar");
    String deploymentURL = Configuration.getPathToCatalogForTest("catalogupdate-cluster-addtable.xml");
    // Asynchronously attempt consecutive catalog update and deployment update
    client.updateApplicationCatalog(new CatTestCallback(ClientResponse.SUCCESS), new File(newCatalogURL), null);
    // Then, update the users in the deployment
    SyncCallback cb2 = new SyncCallback();
    client.updateApplicationCatalog(cb2, null, new File(deploymentURL));
    cb2.waitForResponse();
    assertEquals(ClientResponse.USER_ABORT, cb2.getResponse().getStatus());
    assertTrue(cb2.getResponse().getStatusString().contains("Invalid catalog update"));
    // Verify the heartbeat timeout change didn't take
    Client client3 = getClient();
    boolean found = false;
    int timeout = -1;
    VoltTable result = client3.callProcedure("@SystemInformation", "DEPLOYMENT").getResults()[0];
    while (result.advanceRow()) {
        if (result.getString("PROPERTY").equalsIgnoreCase("heartbeattimeout")) {
            found = true;
            timeout = Integer.valueOf(result.getString("VALUE"));
        }
    }
    assertTrue(found);
    assertEquals(org.voltcore.common.Constants.DEFAULT_HEARTBEAT_TIMEOUT_SECONDS, timeout);
    // Verify that table A exists
    ClientResponse response = client3.callProcedure("@AdHoc", "insert into NEWTABLE values (100);");
    assertEquals(ClientResponse.SUCCESS, response.getStatus());
}
Also used : ClientResponse(org.voltdb.client.ClientResponse) Client(org.voltdb.client.Client) File(java.io.File) SyncCallback(org.voltdb.client.SyncCallback) VoltTable(org.voltdb.VoltTable)

Example 15 with SyncCallback

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

the class TestLimitOffsetSuite method load.

private static void load(Client client) throws NoConnectionsException, IOException, InterruptedException {
    for (int i = 0; i < 10; i++) {
        SyncCallback cb = new SyncCallback();
        client.callProcedure(cb, "InsertA", i, i);
        cb.waitForResponse();
        assertEquals(1, cb.getResponse().getResults()[0].asScalarLong());
    }
    for (int i = 0; i < 10; i++) {
        SyncCallback cb = new SyncCallback();
        client.callProcedure(cb, "InsertB", i, i);
        cb.waitForResponse();
        assertEquals(1, cb.getResponse().getResults()[0].asScalarLong());
    }
}
Also used : SyncCallback(org.voltdb.client.SyncCallback)

Aggregations

SyncCallback (org.voltdb.client.SyncCallback)15 Client (org.voltdb.client.Client)9 File (java.io.File)8 VoltTable (org.voltdb.VoltTable)6 ClientResponse (org.voltdb.client.ClientResponse)2 TimestampType (org.voltdb.types.TimestampType)2 HashMap (java.util.HashMap)1 Properties (java.util.Properties)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 ZooKeeper (org.apache.zookeeper_voltpatches.ZooKeeper)1 TPCCProjectBuilder (org.voltdb.benchmark.tpcc.TPCCProjectBuilder)1 InsertNewOrder (org.voltdb.benchmark.tpcc.procedures.InsertNewOrder)1 ProcCallException (org.voltdb.client.ProcCallException)1 DrRoleType (org.voltdb.compiler.deploymentfile.DrRoleType)1