Search in sources :

Example 66 with VoltProjectBuilder

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

the class StatisticsTestSuiteBase method suite.

public static Test suite(Class classzz, boolean isCommandLogTest, int replicationPort, boolean reuseServer) throws IOException {
    VoltServerConfig config = null;
    MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder(classzz);
    // Not really using TPCC functionality but need a database.
    // The testLoadMultipartitionTable procedure assumes partitioning
    // on warehouse id.
    VoltProjectBuilder project = new VoltProjectBuilder();
    project.addLiteralSchema("CREATE TABLE WAREHOUSE (\n" + "  W_ID SMALLINT DEFAULT '0' NOT NULL,\n" + "  W_NAME VARCHAR(16) DEFAULT NULL,\n" + "  W_STREET_1 VARCHAR(32) DEFAULT NULL,\n" + "  W_STREET_2 VARCHAR(32) DEFAULT NULL,\n" + "  W_CITY VARCHAR(32) DEFAULT NULL,\n" + "  W_STATE VARCHAR(2) DEFAULT NULL,\n" + "  W_ZIP VARCHAR(9) DEFAULT NULL,\n" + "  W_TAX FLOAT DEFAULT NULL,\n" + "  W_YTD FLOAT DEFAULT NULL,\n" + "  CONSTRAINT W_PK_TREE PRIMARY KEY (W_ID)\n" + ");\n" + "CREATE TABLE ITEM (\n" + "  I_ID INTEGER DEFAULT '0' NOT NULL,\n" + "  I_IM_ID INTEGER DEFAULT NULL,\n" + "  I_NAME VARCHAR(32) DEFAULT NULL,\n" + "  I_PRICE FLOAT DEFAULT NULL,\n" + "  I_DATA VARCHAR(64) DEFAULT NULL,\n" + "  CONSTRAINT I_PK_TREE PRIMARY KEY (I_ID)\n" + ");\n" + "CREATE TABLE NEW_ORDER (\n" + "  NO_W_ID SMALLINT DEFAULT '0' NOT NULL\n" + ");\n");
    project.addPartitionInfo("WAREHOUSE", "W_ID");
    project.addPartitionInfo("NEW_ORDER", "NO_W_ID");
    project.addProcedures(PROCEDURES);
    // Enable asynchronous logging for test of commandlog test
    if (MiscUtils.isPro() && isCommandLogTest) {
        project.configureLogging(null, null, false, true, FSYNC_INTERVAL_GOLD, null, null);
    }
    /*
         * Create a cluster configuration.
         * Some of the sysproc results come back a little strange when applied to a cluster that is being
         * simulated through LocalCluster -- all the hosts have the same HOSTNAME, just different host ids.
         * So, these tests shouldn't rely on the usual uniqueness of host names in a cluster.
         */
    config = new LocalCluster(jarName, StatisticsTestSuiteBase.SITES, StatisticsTestSuiteBase.HOSTS, StatisticsTestSuiteBase.KFACTOR, BackendTarget.NATIVE_EE_JNI);
    ((LocalCluster) config).setHasLocalServer(hasLocalServer);
    if (MiscUtils.isPro() && isCommandLogTest) {
        ((LocalCluster) config).setJavaProperty("LOG_SEGMENT_SIZE", "1");
        ((LocalCluster) config).setJavaProperty("LOG_SEGMENTS", "1");
    }
    if (replicationPort > 0) {
        // cluster id is default to 0
        project.addLiteralSchema(drSchema);
        project.setDrProducerEnabled();
        ((LocalCluster) config).setReplicationPort(replicationPort);
        ((LocalCluster) config).overrideAnyRequestForValgrind();
    }
    boolean success = config.compile(project);
    assertTrue(success);
    builder.addServerConfig(config, reuseServer);
    return builder;
}
Also used : VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder)

Example 67 with VoltProjectBuilder

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

the class TestAdminMode method getBuilderForTest.

static VoltProjectBuilder getBuilderForTest() throws IOException {
    VoltProjectBuilder builder = new VoltProjectBuilder();
    builder.addLiteralSchema("CREATE TABLE T(A1 INTEGER NOT NULL, A2 INTEGER, PRIMARY KEY(A1));");
    builder.addPartitionInfo("T", "A1");
    builder.addStmtProcedure("InsertA", "INSERT INTO T VALUES(?,?);", "T.A1: 0");
    builder.addStmtProcedure("CountA", "SELECT COUNT(*) FROM T");
    builder.addStmtProcedure("SelectA", "SELECT * FROM T");
    return builder;
}
Also used : VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder)

Example 68 with VoltProjectBuilder

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

the class TestAdminPort method setUp.

/**
     * JUnit special method called to setup the test. This instance will start
     * the VoltDB server using the VoltServerConfig instance provided.
     */
@Before
public void setUp() throws Exception {
    rport = SecureRandom.getInstance("SHA1PRNG").nextInt(2000) + 22000;
    System.out.println("Random Admin port is: " + rport);
    ncprocess = new PortListener(rport);
    try {
        //Build the catalog
        VoltProjectBuilder builder = new VoltProjectBuilder();
        builder.addLiteralSchema("");
        String catalogJar = "dummy.jar";
        LocalCluster config = new LocalCluster(catalogJar, 2, 1, 0, BackendTarget.NATIVE_EE_JNI);
        config.portGenerator.enablePortProvider();
        config.portGenerator.pprovider.setAdmin(rport);
        config.setHasLocalServer(false);
        //We expect it to crash
        config.setExpectedToCrash(true);
        boolean success = config.compile(builder);
        assertTrue(success);
        config.startUp();
        pf = config.m_pipes.get(0);
        Thread.currentThread().sleep(10000);
    } catch (IOException ex) {
        fail(ex.getMessage());
    } finally {
    }
}
Also used : VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder) IOException(java.io.IOException) Before(org.junit.Before)

Example 69 with VoltProjectBuilder

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

the class TestBigBatchAndFallbackBufferResults method suite.

public static junit.framework.Test suite() {
    VoltServerConfig config = null;
    MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder(TestBigBatchAndFallbackBufferResults.class);
    VoltProjectBuilder project = new VoltProjectBuilder();
    project.addProcedures(PROCEDURES);
    final String literalSchema = "CREATE TABLE p1 ( " + "id INTEGER DEFAULT 0 NOT NULL assumeunique, " + "num INTEGER DEFAULT 0 NOT NULL, " + "str VARCHAR(1048576 BYTES), " + "PRIMARY KEY (id, num) ); " + "PARTITION TABLE p1 ON COLUMN num; " + "";
    try {
        project.addLiteralSchema(literalSchema);
    } catch (IOException e) {
        assertFalse(true);
    }
    boolean success;
    config = new LocalCluster("catchexceptions-onesite.jar", 1, 1, 0, BackendTarget.NATIVE_EE_JNI);
    success = config.compile(project);
    assertTrue(success);
    builder.addServerConfig(config);
    return builder;
}
Also used : VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder) IOException(java.io.IOException)

Example 70 with VoltProjectBuilder

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

the class TestBooleanLiteralsSuite method suite.

public static junit.framework.Test suite() {
    VoltServerConfig config = null;
    MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder(TestBooleanLiteralsSuite.class);
    boolean success;
    VoltProjectBuilder project = new VoltProjectBuilder();
    // T1 and T2 are replicated table, while T3 and T4 are partitioned.
    for (int i = 1; i <= 4; i++) {
        addTableToProject(project, i, isTablePartitioned(i));
    }
    // CONFIG #1: Local Site/Partitions running on JNI backend
    config = new LocalCluster("bool-voltdbBackend.jar", 2, 1, 0, BackendTarget.NATIVE_EE_JNI);
    // alternative to enable for debugging */ config = new LocalCluster("IPC-onesite.jar", 1, 1, 0, BackendTarget.NATIVE_EE_IPC);
    success = config.compile(project);
    assertTrue(success);
    builder.addServerConfig(config);
    // CONFIG #2: HSQL
    config = new LocalCluster("bool-hsqlBackend.jar", 2, 1, 0, BackendTarget.HSQLDB_BACKEND);
    success = config.compile(project);
    assertTrue(success);
    builder.addServerConfig(config);
    return builder;
}
Also used : VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder)

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