static public junit.framework.Test suite() {
VoltServerConfig config = null;
final MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder(TestSPBasecaseSuite.class);
final VoltProjectBuilder project = new VoltProjectBuilder();
// necessary because at least one procedure is required
project.addStmtProcedure("CountP1", "select count(*) from p1;");
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);"
);
project.addPartitionInfo("p3", "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");
} catch (IOException error) {
fail(error.getMessage());
}