Search in sources :

Example 1 with PortGenerator

use of org.voltcore.utils.PortGenerator in project voltdb by VoltDB.

the class TestCanonicalDDLThroughSQLcmd method secondCanonicalDDLFromSQLcmd.

private void secondCanonicalDDLFromSQLcmd(boolean fastModeDDL) throws Exception {
    String pathToCatalog = Configuration.getPathToCatalogForTest("emptyDDL.jar");
    String pathToDeployment = Configuration.getPathToCatalogForTest("emptyDDL.xml");
    VoltProjectBuilder builder = new VoltProjectBuilder();
    builder.setUseDDLSchema(true);
    PortGenerator pg = new PortGenerator();
    int httpdPort = pg.next();
    builder.setHTTPDPort(httpdPort);
    boolean success = builder.compile(pathToCatalog);
    assertTrue(success);
    MiscUtils.copyFile(builder.getPathToDeployment(), pathToDeployment);
    VoltDB.Configuration config = new VoltDB.Configuration();
    config.m_pathToCatalog = pathToCatalog;
    config.m_pathToDeployment = pathToDeployment;
    startSystem(config);
    String roundtripDDL;
    assert (firstCanonicalDDL != null);
    if (!triedSqlcmdDryRun) {
        assertEquals("sqlcmd dry run failed -- maybe some sqlcmd component (the voltdb jar file?) needs to be rebuilt.", 0, callSQLcmd("\n", fastModeDDL));
        triedSqlcmdDryRun = true;
    }
    assertEquals("sqlcmd failed on input:\n" + firstCanonicalDDL, 0, callSQLcmd(firstCanonicalDDL, fastModeDDL));
    roundtripDDL = getDDLFromHTTP(httpdPort);
    // IZZY: we force single statement SQL keywords to lower case, it seems
    // Sanity check that we're not trimming the entire fullddl.sql file away
    assertTrue(firstCanonicalDDL.indexOf('\n') < 100);
    assertEquals(firstCanonicalDDL.substring(firstCanonicalDDL.indexOf('\n')).toLowerCase(), roundtripDDL.substring(roundtripDDL.indexOf('\n')).toLowerCase());
    assertEquals("sqlcmd failed on last call", 0, callSQLcmd("CREATE TABLE NONSENSE (id INTEGER);\n", fastModeDDL));
    roundtripDDL = getDDLFromHTTP(httpdPort);
    assertTrue(firstCanonicalDDL.indexOf('\n') < 100);
    assertFalse(firstCanonicalDDL.substring(firstCanonicalDDL.indexOf('\n')).toLowerCase().equals(roundtripDDL.substring(roundtripDDL.indexOf('\n')).toLowerCase()));
    teardownSystem();
}
Also used : VoltDB(org.voltdb.VoltDB) Configuration(org.voltdb.VoltDB.Configuration) SSLConfiguration(org.voltcore.utils.ssl.SSLConfiguration) VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder) PortGenerator(org.voltcore.utils.PortGenerator) Configuration(org.voltdb.VoltDB.Configuration)

Example 2 with PortGenerator

use of org.voltcore.utils.PortGenerator in project voltdb by VoltDB.

the class AdHocQueryTester method setUpSPDB.

public static VoltDB.Configuration setUpSPDB() throws IOException, Exception {
    String pathToCatalog = Configuration.getPathToCatalogForTest("adhocsp.jar");
    String pathToDeployment = Configuration.getPathToCatalogForTest("adhocsp.xml");
    VoltProjectBuilder builder = new VoltProjectBuilder();
    setUpSchema(builder, pathToCatalog, pathToDeployment);
    boolean success = builder.compile(pathToCatalog, 2, 1, 0);
    assertTrue(success);
    MiscUtils.copyFile(builder.getPathToDeployment(), pathToDeployment);
    VoltDB.Configuration config = new VoltDB.Configuration(new PortGenerator());
    config.m_pathToCatalog = pathToCatalog;
    config.m_pathToDeployment = pathToDeployment;
    return config;
}
Also used : Configuration(org.voltdb.VoltDB.Configuration) VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder) PortGenerator(org.voltcore.utils.PortGenerator) Configuration(org.voltdb.VoltDB.Configuration)

Aggregations

PortGenerator (org.voltcore.utils.PortGenerator)2 Configuration (org.voltdb.VoltDB.Configuration)2 VoltProjectBuilder (org.voltdb.compiler.VoltProjectBuilder)2 SSLConfiguration (org.voltcore.utils.ssl.SSLConfiguration)1 VoltDB (org.voltdb.VoltDB)1