Package org.voltdb.catalog

Examples of org.voltdb.catalog.Catalog


import junit.framework.*;

public class TestCatalogSerialization extends TestCase {

    public void testSimplest() {
        Catalog catalog1 = new Catalog();
        catalog1.execute(LoadCatalogToString.THE_CATALOG);

        String commands = catalog1.serialize();
        // System.out.println(commands);

        Catalog catalog2 = new Catalog();
        try {
            catalog2.execute(commands);
        } catch (Exception e) {
            e.printStackTrace();
        }
        String commands2 = catalog2.serialize();

        Catalog catalog3 = catalog2.deepCopy();
        String commands3 = catalog3.serialize();

        assertTrue(commands.equals(commands2));
        assertTrue(commands.equals(commands3));

        assertTrue(catalog1.equals(catalog2));
View Full Code Here


                                     m_siteCount,
                                     m_replication,
                                     "localhost");
       
        // (1) Load catalog from Jar
        Catalog tmpCatalog = CatalogUtil.loadCatalogFromJar(m_jarFileName);
       
        // (2) Update catalog to include target cluster configuration
        ClusterConfiguration cc = new ClusterConfiguration();
        // Update cc with a bunch of hosts/sites/partitions
        for (int site = 0, currentPartition = 0; site < m_siteCount; ++site) {
View Full Code Here

* Tests native execution engine JNI interface.
*/
public class TestExecutionEngine extends TestCase {

    public void testLoadCatalogs() throws Exception {
        Catalog catalog = new Catalog();
        catalog.execute(LoadCatalogToString.THE_CATALOG);
        sourceEngine.loadCatalog(catalog.serialize());
    }
View Full Code Here

        }
        sourceEngine.loadTable(STOCK_TABLEID, stockdata, 0, 0, Long.MAX_VALUE, allowExport);
    }

    public void testLoadTable() throws Exception {
        Catalog catalog = new Catalog();
        catalog.execute(LoadCatalogToString.THE_CATALOG);
        sourceEngine.loadCatalog(catalog.serialize());

        int WAREHOUSE_TABLEID = warehouseTableId(catalog);
        int STOCK_TABLEID = stockTableId(catalog);

        loadTestTables(catalog);
View Full Code Here

        assertEquals(200, sourceEngine.serializeTable(WAREHOUSE_TABLEID).getRowCount());
        assertEquals(1000, sourceEngine.serializeTable(STOCK_TABLEID).getRowCount());
    }

    public void testStreamTables() throws Exception {
        final Catalog catalog = new Catalog();
        catalog.execute(LoadCatalogToString.THE_CATALOG);
        sourceEngine.loadCatalog(catalog.serialize());
        ExecutionEngine destinationEngine = new ExecutionEngineJNI(null, CLUSTER_ID, NODE_ID, 0, 0, "");
        destinationEngine.loadCatalog(catalog.serialize());

        int WAREHOUSE_TABLEID = warehouseTableId(catalog);
        int STOCK_TABLEID = stockTableId(catalog);

        loadTestTables(catalog);
View Full Code Here

    private int stockTableId(Catalog catalog) {
        return catalog.getClusters().get("cluster").getDatabases().get("database").getTables().get("STOCK").getRelativeIndex();
    }

    public void testGetStats() throws Exception {
        final Catalog catalog = new Catalog();
        catalog.execute(LoadCatalogToString.THE_CATALOG);
        sourceEngine.loadCatalog(catalog.serialize());

        final int WAREHOUSE_TABLEID = catalog.getClusters().get("cluster").getDatabases().get("database").getTables().get("WAREHOUSE").getRelativeIndex();
        final int STOCK_TABLEID = catalog.getClusters().get("cluster").getDatabases().get("database").getTables().get("STOCK").getRelativeIndex();
        final int locators[] = new int[] { WAREHOUSE_TABLEID, STOCK_TABLEID };
        final VoltTable results[] = sourceEngine.getStats(SysProcSelector.TABLE, locators, false, 0L);
        assertNotNull(results);
        assertEquals(1, results.length);
        assertNotNull(results[0]);
View Full Code Here

public class TestClusterCompiler extends TestCase
{
    public void testNonZeroReplicationFactor()
    {
        ClusterConfig config = new ClusterConfig(3, 1, 2, "localhost");
        Catalog catalog = new Catalog();
        catalog.execute("add / clusters cluster");
        ClusterCompiler.compile(catalog, config);
        System.out.println(catalog.serialize());
        Cluster cluster = catalog.getClusters().get("cluster");
        Collection<Partition> partitions = CatalogUtil.getAllPartitions(cluster);
        // despite 3 hosts, should only have 1 partition with k-safety of 2
//        assertEquals(1, partitions.size());
//        // All the execution sites should have the same relative index
//        int part_guid = CatalogUtil.getPartitionById(cluster, 0).getRelativeIndex();
View Full Code Here

    public void testSufficientHostsToReplicate()
    {
        // 2 hosts, 6 sites per host, 2 copies of each partition.
        // there are sufficient execution sites, but insufficient hosts
        ClusterConfig config = new ClusterConfig(2, 6, 2, "localhost");
        Catalog catalog = new Catalog();
        catalog.execute("add / clusters cluster");
        boolean caught = false;
        try
        {
            ClusterCompiler.compile(catalog, config);
        }
View Full Code Here

     * @param ddlurl URL to the schema/ddl file.
     * @param basename Unique string, JSON plans [basename]-stmt-#_json.txt on disk
     * @throws Exception
     */
    public PlannerTestAideDeCamp(URL ddlurl, String basename) throws Exception {
        catalog = new Catalog();
        catalog.execute("add / clusters cluster");
        catalog.execute("add /clusters[cluster] databases database");
        db = catalog.getClusters().get("cluster").getDatabases().get("database");
        proc = db.getProcedures().add(basename);

View Full Code Here

        // read in the catalog
        String serializedCatalog = CatalogUtil.loadCatalogFromJar(catalogJar, null);
        assert(serializedCatalog != null);

        // create the catalog (that will be passed to the ClientInterface
        Catalog catalog = new Catalog();
        catalog.execute(serializedCatalog);

        return catalog;
    }
View Full Code Here

TOP

Related Classes of org.voltdb.catalog.Catalog

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.