Search in sources :

Example 71 with VoltProjectBuilder

use of org.voltdb.compiler.VoltProjectBuilder in project voltdb by VoltDB.

the class TestCRUDSuite method suite.

public static junit.framework.Test suite() {
    VoltServerConfig config = null;
    final MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder(TestCRUDSuite.class);
    final VoltProjectBuilder project = new VoltProjectBuilder();
    project.addStmtProcedure("CountP1", "select count(*) from p1;");
    project.addStmtProcedure("CountR1", "select count(*) from r1;");
    try {
        // a table that should generate procedures
        // use column names such that lexical order != column order.
        project.addLiteralSchema("CREATE TABLE p1(b1 INTEGER NOT NULL, a2 VARCHAR(10) NOT NULL, PRIMARY KEY (b1));");
        project.addPartitionInfo("p1", "b1");
        // a partitioned table that should not generate procedures (no pkey)
        project.addLiteralSchema("CREATE TABLE p2(a1 INTEGER NOT NULL, a2 VARCHAR(10) NOT NULL); " + "CREATE UNIQUE INDEX p2_tree_idx ON p2(a1);");
        project.addPartitionInfo("p2", "a1");
        // a partitioned table that should not generate procedures (pkey not partition key)
        project.addLiteralSchema("CREATE TABLE p3(a1 INTEGER NOT NULL, a2 VARCHAR(10) NOT NULL); " + "CREATE ASSUMEUNIQUE INDEX p3_tree_idx ON p3(a1); " + "PARTITION TABLE P3 ON COLUMN a2;");
        // a replicated table (should not generate procedures).
        project.addLiteralSchema("CREATE TABLE r1(a1 INTEGER NOT NULL, a2 VARCHAR(10) NOT NULL, PRIMARY KEY (a1));");
        // table with a multi-column pkey. verify that pkey column ordering is
        // in the index column order, not table order and not index column lex. order
        project.addLiteralSchema("CREATE TABLE p4(z INTEGER NOT NULL, x VARCHAR(10) NOT NULL, y INTEGER NOT NULL, PRIMARY KEY(y,x,z));");
        project.addPartitionInfo("p4", "y");
        // table with a bigint pkey
        project.addLiteralSchema("CREATE TABLE p5(x BIGINT NOT NULL, PRIMARY KEY(x));");
        project.addPartitionInfo("p5", "x");
    } catch (IOException error) {
        fail(error.getMessage());
    }
    // JNI
    config = new LocalCluster("crud-onesite.jar", 1, 1, 0, BackendTarget.NATIVE_EE_JNI);
    boolean t1 = config.compile(project);
    assertTrue(t1);
    builder.addServerConfig(config);
    // CLUSTER
    config = new LocalCluster("crud-cluster.jar", 2, 3, 1, BackendTarget.NATIVE_EE_JNI);
    boolean t2 = config.compile(project);
    assertTrue(t2);
    builder.addServerConfig(config);
    return builder;
}
Also used : VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder) IOException(java.io.IOException)

Example 72 with VoltProjectBuilder

use of org.voltdb.compiler.VoltProjectBuilder in project voltdb by VoltDB.

the class TestGiantDeleteSuite method suite.

public static junit.framework.Test suite() {
    VoltServerConfig config = null;
    MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder(TestGiantDeleteSuite.class);
    VoltProjectBuilder project = new VoltProjectBuilder();
    project.addSchema(Insert.class.getResource("giant-delete-ddl.sql"));
    project.addProcedures(PROCEDURES);
    project.addStmtProcedure("Delete", "DELETE FROM ASSET WHERE ASSET_ID > -1;");
    config = new LocalCluster("giantdelete-onesite.jar", 2, 1, 0, BackendTarget.NATIVE_EE_JNI);
    config.compile(project);
    builder.addServerConfig(config);
    return builder;
}
Also used : VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder) Insert(org.voltdb_testprocs.regressionsuites.fixedsql.Insert)

Example 73 with VoltProjectBuilder

use of org.voltdb.compiler.VoltProjectBuilder in project voltdb by VoltDB.

the class TestIndexesSuite method suite.

public static junit.framework.Test suite() {
    VoltServerConfig config = null;
    MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder(TestIndexesSuite.class);
    VoltProjectBuilder project = new VoltProjectBuilder();
    project.addSchema(Insert.class.getResource("indexes-ddl.sql"));
    project.addProcedures(PROCEDURES);
    project.addStmtProcedure("Eng397LimitIndexR1", "select * from R1 where R1.ID > 2 Limit ?");
    project.addStmtProcedure("Eng397LimitIndexP1", "select * from P1 where P1.ID > 2 Limit ?");
    project.addStmtProcedure("Eng397LimitIndexR2", "select * from R2 where R2.ID > 2 Limit ?");
    project.addStmtProcedure("Eng397LimitIndexP2", "select * from P2 where P2.ID > 2 Limit ?");
    project.addStmtProcedure("Eng2914BigKeyP1", "select * from P1 where ID < 600000000000");
    project.addStmtProcedure("Eng506UpdateRange", "UPDATE R1IX SET NUM = ? WHERE (R1IX.ID>R1IX.NUM) AND (R1IX.NUM>?)");
    project.addStmtProcedure("InsertR1IX", "insert into R1IX values (?, ?, ?, ?);");
    project.addStmtProcedure("InlinedInListP3with5DESCs", "select * from P3 T where T.DESC IN (?, ?, ?, ?, ?)" + " and T.NUM IN (100, 200, 300, 400, 500)");
    project.addStmtProcedure("InlinedInListR3with5DESCs", "select * from R3 T where T.DESC IN (?, ?, ?, ?, ?)" + " and T.NUM IN (100, 200, 300, 400, 500)");
    project.addStmtProcedure("InlinedInListP3withDESCs", "select * from P3 T where T.DESC IN ?" + " and T.NUM IN (100, 200, 300, 400, 500)");
    project.addStmtProcedure("InlinedInListP3with5NUMs", "select * from P3 T where T.DESC IN ('a', 'b', 'c', 'g', " + "'this here is a longish string to force a permanent object allocation'" + ")" + " and T.NUM IN (?, ?, ?, ?, ?)");
    project.addStmtProcedure("InlinedInListR3with5NUMs", "select * from R3 T where T.DESC IN ('a', 'b', 'c', 'g', " + "'this here is a longish string to force a permanent object allocation'" + ")" + " and T.NUM IN (?, ?, ?, ?, ?)");
    project.addStmtProcedure("InlinedInListP3withNUMs", "select * from P3 T where T.DESC IN ('a', 'b', 'c', 'g', " + "'this here is a longish string to force a permanent object allocation'" + ")" + " and T.NUM IN ?");
    //project.addStmtProcedure("InlinedUpdateInListP3with5NUMs",
    //        "update P3 set NUM = 0 where DESC IN ('a', 'b', 'c', 'g', " +
    //        "'this here is a longish string to force a permanent object allocation'" +
    //        ")" +
    //        " and NUM IN (111,222,333,444,555)");
    boolean success;
    //* CONFIG #1: HSQL -- keep this enabled by default with //
    config = new LocalCluster("testindexes-hsql.jar", 1, 1, 0, BackendTarget.HSQLDB_BACKEND);
    success = config.compile(project);
    assertTrue(success);
    builder.addServerConfig(config);
    // end of easy-to-disable code section */
    //* CONFIG #2: JNI -- keep this enabled by default with //
    config = new LocalCluster("testindexes-threesite.jar", 3, 1, 0, BackendTarget.NATIVE_EE_JNI);
    success = config.compile(project);
    assertTrue(success);
    builder.addServerConfig(config);
    return builder;
}
Also used : VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder) Insert(org.voltdb_testprocs.regressionsuites.indexes.Insert)

Example 74 with VoltProjectBuilder

use of org.voltdb.compiler.VoltProjectBuilder in project voltdb by VoltDB.

the class TestInitStartLocalClusterAllOutOfProcess method setUp.

@Before
public void setUp() throws Exception {
    String simpleSchema = "create table blah (" + "ival bigint default 0 not null, " + "PRIMARY KEY(ival));";
    builder = new VoltProjectBuilder();
    builder.addLiteralSchema(simpleSchema);
    builder.addProcedures(CrashJVM.class);
    builder.addProcedures(CrashVoltDBProc.class);
    builder.setUseDDLSchema(true);
    cluster = new LocalCluster("collect.jar", SITES_PER_HOST, HOSTS, K, BackendTarget.NATIVE_EE_JNI);
    boolean success = cluster.compile(builder);
    assert (success);
    File voltDbRoot;
    cluster.startUp(true);
    //Get server specific root after startup.
    if (cluster.isNewCli()) {
        voltDbRoot = new File(cluster.getServerSpecificRoot("1"));
    } else {
        String voltDbFilePrefix = cluster.getSubRoots().get(0).getPath();
        voltDbRoot = new File(voltDbFilePrefix, builder.getPathToVoltRoot().getPath());
    }
    voltDbRootPath = voltDbRoot.getCanonicalPath();
    voltDBRootParentPath = voltDbRoot.getParentFile().getCanonicalPath();
    listener = cluster.getListenerAddresses().get(0);
    client = ClientFactory.createClient();
    client.createConnection(listener);
}
Also used : VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder) File(java.io.File) Before(org.junit.Before)

Example 75 with VoltProjectBuilder

use of org.voltdb.compiler.VoltProjectBuilder in project voltdb by VoltDB.

the class TestIndexScanCountSuite method suite.

/**
     * Build a list of the tests that will be run when TestTPCCSuite gets run by JUnit.
     * Use helper classes that are part of the RegressionSuite framework.
     * This particular class runs all tests on the the local JNI backend with both
     * one and two partition configurations, as well as on the hsql backend.
     *
     * @return The TestSuite containing all the tests to be run.
     */
public static Test suite() {
    VoltServerConfig config = null;
    // the suite made here will all be using the tests from this class
    MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder(TestIndexScanCountSuite.class);
    // build up a project builder for the workload
    VoltProjectBuilder project = new VoltProjectBuilder();
    project.addSchema(BatchedMultiPartitionTest.class.getResource("sqlindex-ddl.sql"));
    project.addProcedures(PROCEDURES);
    project.addStmtProcedure("TU1_LT", "SELECT COUNT(ID) FROM TU1 WHERE POINTS < ?");
    project.addStmtProcedure("TU1_LET", "SELECT COUNT(ID) FROM TU1 WHERE POINTS <= ?");
    project.addStmtProcedure("TU1_GT", "SELECT COUNT(ID) FROM TU1 WHERE POINTS > ?");
    project.addStmtProcedure("TU1_GET", "SELECT COUNT(ID) FROM TU1 WHERE POINTS >= ?");
    project.addStmtProcedure("TU3_LT", "SELECT COUNT(ID) FROM TU3 WHERE TEL = ? AND POINTS < ?");
    project.addStmtProcedure("TU3_LET", "SELECT COUNT(ID) FROM TU3 WHERE TEL = ? AND POINTS <= ?");
    project.addStmtProcedure("TU3_GT_LT", "SELECT COUNT(ID) FROM TU3 WHERE TEL = ? AND POINTS > ? AND POINTS < ?");
    project.addStmtProcedure("TU3_GT_LET", "SELECT COUNT(ID) FROM TU3 WHERE TEL = ? AND POINTS > ? AND POINTS <= ?");
    project.addStmtProcedure("TU3_GET_LT", "SELECT COUNT(ID) FROM TU3 WHERE TEL = ? AND POINTS >= ? AND POINTS < ?");
    project.addStmtProcedure("TU3_GET_LET", "SELECT COUNT(ID) FROM TU3 WHERE TEL = ? AND POINTS >= ? AND POINTS <= ?");
    project.addStmtProcedure("TM1_LT", "SELECT COUNT(ID) FROM TM1 WHERE POINTS < ?");
    project.addStmtProcedure("TM1_LET", "SELECT COUNT(ID) FROM TM1 WHERE POINTS <= ?");
    project.addStmtProcedure("TM1_GT", "SELECT COUNT(ID) FROM TM1 WHERE POINTS > ?");
    project.addStmtProcedure("TM1_GET", "SELECT COUNT(ID) FROM TM1 WHERE POINTS >= ?");
    project.addStmtProcedure("TM2_LT", "SELECT COUNT(ID) FROM TM2 WHERE UNAME = ? AND POINTS < ?");
    project.addStmtProcedure("TM2_LET", "SELECT COUNT(ID) FROM TM2 WHERE UNAME = ? AND POINTS <= ?");
    project.addStmtProcedure("TM2_GT_LT", "SELECT COUNT(ID) FROM TM2 WHERE UNAME = ? AND POINTS > ? AND POINTS < ?");
    project.addStmtProcedure("TM2_GT_LET", "SELECT COUNT(ID) FROM TM2 WHERE UNAME = ? AND POINTS > ? AND POINTS <= ?");
    project.addStmtProcedure("TM2_GET_LT", "SELECT COUNT(ID) FROM TM2 WHERE UNAME = ? AND POINTS >= ? AND POINTS < ?");
    project.addStmtProcedure("TM2_GET_LET", "SELECT COUNT(ID) FROM TM2 WHERE UNAME = ? AND POINTS >= ? AND POINTS <= ?");
    project.addStmtProcedure("ENG_6131", "SELECT COUNT(DISTINCT 1) FROM TU3 WHERE TEL = ? AND POINTS > ? ");
    boolean success;
    /////////////////////////////////////////////////////////////
    // CONFIG #1: 1 Local Site/Partitions running on JNI backend
    /////////////////////////////////////////////////////////////
    // get a server config for the native backend with one sites/partitions
    config = new LocalCluster("sqlIndex-onesite.jar", 1, 1, 0, BackendTarget.NATIVE_EE_JNI);
    // build the jarfile
    success = config.compile(project);
    assert (success);
    // add this config to the set of tests to run
    builder.addServerConfig(config);
    /////////////////////////////////////////////////////////////
    // CONFIG #2: 1 Local Site/Partition running on HSQL backend
    /////////////////////////////////////////////////////////////
    config = new LocalCluster("sqlIndex-hsql.jar", 1, 1, 0, BackendTarget.HSQLDB_BACKEND);
    success = config.compile(project);
    assert (success);
    builder.addServerConfig(config);
    /////////////////////////////////////////////////////////////
    // CONFIG #3: 2 Local Site/Partitions running on JNI backend
    /////////////////////////////////////////////////////////////
    config = new LocalCluster("sql-twosites.jar", 2, 1, 0, BackendTarget.NATIVE_EE_JNI);
    success = config.compile(project);
    assert (success);
    builder.addServerConfig(config);
    return builder;
}
Also used : VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder) BatchedMultiPartitionTest(org.voltdb_testprocs.regressionsuites.sqlfeatureprocs.BatchedMultiPartitionTest)

Aggregations

VoltProjectBuilder (org.voltdb.compiler.VoltProjectBuilder)269 Configuration (org.voltdb.VoltDB.Configuration)89 IOException (java.io.IOException)49 Test (org.junit.Test)45 File (java.io.File)40 ProcCallException (org.voltdb.client.ProcCallException)38 ClientResponse (org.voltdb.client.ClientResponse)37 VoltDB (org.voltdb.VoltDB)22 LocalCluster (org.voltdb.regressionsuites.LocalCluster)18 Client (org.voltdb.client.Client)17 Before (org.junit.Before)14 HashMap (java.util.HashMap)13 VoltTable (org.voltdb.VoltTable)13 ServerThread (org.voltdb.ServerThread)12 InMemoryJarfile (org.voltdb.utils.InMemoryJarfile)12 VoltCompiler (org.voltdb.compiler.VoltCompiler)11 HttpResponse (org.apache.http.HttpResponse)10 BeforeClass (org.junit.BeforeClass)8 ClientConfig (org.voltdb.client.ClientConfig)7 UserInfo (org.voltdb.compiler.VoltProjectBuilder.UserInfo)7