Package org.voltdb.catalog

Examples of org.voltdb.catalog.Database


            }
            else {
                assertTrue(String.format("Unexpected compilation failure.\n%s", s), success);

                // Check that the catalog table is appropriately configured.
                Database db = compiler.m_catalog.getClusters().get("cluster").getDatabases().get("database");
                assertNotNull(db);
                assertEquals(1 + additionalTables, db.getTables().size());
                Table t = db.getTables().getIgnoreCase("books");
                assertNotNull(t);
                Column c = t.getPartitioncolumn();
                if (partitioned) {
                    assertNotNull(c);
                }
View Full Code Here


        }
        JSONObject jobj;
        try {
            jobj = new JSONObject( prettyJson );
            JSONArray jarray =  jobj.getJSONArray("PLAN_NODES");
            Database db = s_singleton.getDatabase();
            pnt.loadFromJSONArray(jarray, db);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return pnt;
View Full Code Here

        assertTrue("Compilation failed unexpectedly", success);

        Catalog catalog = new Catalog();
        catalog.execute(CatalogUtil.getSerializedCatalogStringFromJar(CatalogUtil.loadAndUpgradeCatalogFromJar(MiscUtils.fileToBytes(new File(jarOut.getPath()))).getFirst()));

        Database db = catalog.getClusters().get("cluster").getDatabases().get("database");
        Table t = db.getTables().get("T");
        assertEquals("C2", t.getPartitioncolumn().getTypeName());
    }
View Full Code Here

        assertTrue("Compilation failed unexpectedly", success);

        Catalog catalog = new Catalog();
        catalog.execute(CatalogUtil.getSerializedCatalogStringFromJar(CatalogUtil.loadAndUpgradeCatalogFromJar(MiscUtils.fileToBytes(new File(jarOut.getPath()))).getFirst()));

        Database db = catalog.getClusters().get("cluster").getDatabases().get("database");
        Table t = db.getTables().get("T");
        assertEquals(null, t);
    }
View Full Code Here

        assertTrue("Compilation failed unexpectedly", success);

        Catalog catalog = new Catalog();
        catalog.execute(CatalogUtil.getSerializedCatalogStringFromJar(CatalogUtil.loadAndUpgradeCatalogFromJar(MiscUtils.fileToBytes(new File(jarOut.getPath()))).getFirst()));

        Database db = catalog.getClusters().get("cluster").getDatabases().get("database");
        Table t = db.getTables().get("T");
        assertEquals(null, t);
    }
View Full Code Here

            "   <snapshot frequency=\"5s\" retain=\"10\" prefix=\"pref2\" enabled=\"true\"/>" +
            "</deployment>";

        final File tmpDepOff = VoltProjectBuilder.writeStringToTempFile(depOff);
        CatalogUtil.compileDeployment(catalog, tmpDepOff.getPath(), true, false);
        Database db = catalog.getClusters().get("cluster").getDatabases().get("database");
        assertFalse(db.getSnapshotschedule().get("default").getEnabled());

        setUp();
        final File tmpDepOn = VoltProjectBuilder.writeStringToTempFile(depOn);
        CatalogUtil.compileDeployment(catalog, tmpDepOn.getPath(), true, false);
        db = catalog.getClusters().get("cluster").getDatabases().get("database");
        assertFalse(db.getSnapshotschedule().isEmpty());
        assertTrue(db.getSnapshotschedule().get("default").getEnabled());
        assertEquals(10, db.getSnapshotschedule().get("default").getRetain());
    }
View Full Code Here

            "</deployment>";

        final File tmpSecOff = VoltProjectBuilder.writeStringToTempFile(secOff);
        CatalogUtil.compileDeployment(catalog, tmpSecOff.getPath(), true, false);
        Cluster cluster =  catalog.getClusters().get("cluster");
        Database db = cluster.getDatabases().get("database");
        assertTrue(cluster.getSecurityenabled());
        assertEquals("hash", db.getSecurityprovider());

        setUp();
        final File tmpSecOn = VoltProjectBuilder.writeStringToTempFile(secOn);
        CatalogUtil.compileDeployment(catalog, tmpSecOn.getPath(), true, false);
        cluster =  catalog.getClusters().get("cluster");
        db = cluster.getDatabases().get("database");
        assertTrue(cluster.getSecurityenabled());
        assertEquals("kerberos", db.getSecurityprovider());
    }
View Full Code Here

        catalog_db.getGroups().add("ladue");
        catalog_db.getGroups().add("latre");

        final File tmpRole = VoltProjectBuilder.writeStringToTempFile(depRole);
        CatalogUtil.compileDeployment(catalog, tmpRole.getPath(), true, false);
        Database db = catalog.getClusters().get("cluster")
                .getDatabases().get("database");

        User joe = db.getUsers().get("joe");
        assertNotNull(joe);
        assertNotNull(joe.getGroups().get("louno"));
        assertNotNull(joe.getGroups().get("lodue"));
        assertNotNull(joe.getGroups().get("lotre"));
        assertNull(joe.getGroups().get("latre"));

        User jane = db.getUsers().get("jane");
        assertNotNull(jane);
        assertNotNull(jane.getGroups().get("launo"));
        assertNotNull(jane.getGroups().get("ladue"));
        assertNotNull(jane.getGroups().get("latre"));
        assertNull(jane.getGroups().get("lotre"));
View Full Code Here

        final File tmpRole = VoltProjectBuilder.writeStringToTempFile(depRole);

        CatalogUtil.compileDeployment(catalog, tmpRole.getPath(), true, false);

        Database db = catalog.getClusters().get("cluster")
                .getDatabases().get("database");

        User joe = db.getUsers().get("joe");
        assertNotNull(joe);
        assertNotNull(joe.getGroups().get("louno"));
        assertNotNull(joe.getShadowpassword());

        User jane = db.getUsers().get("jane");
        assertNotNull(jane);
        assertNotNull(jane.getGroups().get("launo"));
        assertNotNull(joe.getShadowpassword());
    }
View Full Code Here

        Catalog cat = compiler.compileCatalogFromDDL(x);

        long crc = CatalogUtil.compileDeployment(cat, bad_deployment, true, false);
        assertTrue("Deployment file failed to parse", crc != -1);

        Database db = cat.getClusters().get("cluster").getDatabases().get("database");
        org.voltdb.catalog.Connector catconn = db.getConnectors().get("0");
        assertNotNull(catconn);

        assertFalse(bad_deployment.getExport().isEnabled());

        //This is a good deployment with custom class that can be found
        final File tmpGood = VoltProjectBuilder.writeStringToTempFile(withGoodCustomExport);
        DeploymentType good_deployment = CatalogUtil.getDeployment(new FileInputStream(tmpGood));

        Catalog cat2 = compiler.compileCatalogFromDDL(x);
        crc = CatalogUtil.compileDeployment(cat2, good_deployment, true, false);
        assertTrue("Deployment file failed to parse", crc != -1);

        db = cat2.getClusters().get("cluster").getDatabases().get("database");
        catconn = db.getConnectors().get("0");
        assertNotNull(catconn);

        assertTrue(good_deployment.getExport().isEnabled());
        assertEquals(good_deployment.getExport().getTarget(), ServerExportEnum.CUSTOM);
        assertEquals(good_deployment.getExport().getExportconnectorclass(),
                "org.voltdb.exportclient.NoOpTestExportClient");
        ConnectorProperty prop = catconn.getConfig().get(ExportDataProcessor.EXPORT_TO_TYPE);
        assertEquals(prop.getValue(), "org.voltdb.exportclient.NoOpTestExportClient");

        // This is to test previous deployment with builtin export functionality.
        final File tmpBuiltin = VoltProjectBuilder.writeStringToTempFile(withBuiltinFileExport);
        DeploymentType builtin_deployment = CatalogUtil.getDeployment(new FileInputStream(tmpBuiltin));

        Catalog cat3 = compiler.compileCatalogFromDDL(x);
        crc = CatalogUtil.compileDeployment(cat3, builtin_deployment, true, false);
        assertTrue("Deployment file failed to parse", crc != -1);

        db = cat3.getClusters().get("cluster").getDatabases().get("database");
        catconn = db.getConnectors().get("0");
        assertNotNull(catconn);

        assertTrue(builtin_deployment.getExport().isEnabled());
        assertEquals(builtin_deployment.getExport().getTarget(), ServerExportEnum.FILE);
        prop = catconn.getConfig().get(ExportDataProcessor.EXPORT_TO_TYPE);
        assertEquals(prop.getValue(), "org.voltdb.exportclient.ExportToFileClient");

        //Check kafka option.
        final File tmpKafkaBuiltin = VoltProjectBuilder.writeStringToTempFile(withBuiltinKafkaExport);
        DeploymentType builtin_kafkadeployment = CatalogUtil.getDeployment(new FileInputStream(tmpKafkaBuiltin));

        Catalog cat4 = compiler.compileCatalogFromDDL(x);
        crc = CatalogUtil.compileDeployment(cat4, builtin_kafkadeployment, true, false);
        assertTrue("Deployment file failed to parse", crc != -1);

        db = cat4.getClusters().get("cluster").getDatabases().get("database");
        catconn = db.getConnectors().get("0");
        assertNotNull(catconn);

        assertTrue(builtin_kafkadeployment.getExport().isEnabled());
        assertEquals(builtin_kafkadeployment.getExport().getTarget(), ServerExportEnum.KAFKA);
        prop = catconn.getConfig().get(ExportDataProcessor.EXPORT_TO_TYPE);
        assertEquals(prop.getValue(), "org.voltdb.exportclient.KafkaExportClient");

        // Check RabbitMQ option
        final File tmpRabbitMQBuiltin = VoltProjectBuilder.writeStringToTempFile(withBuiltinRabbitMQExport);
        DeploymentType builtin_rabbitmqdeployment = CatalogUtil.getDeployment(new FileInputStream(tmpRabbitMQBuiltin));
        Catalog cat5 = compiler.compileCatalogFromDDL(x);
        crc = CatalogUtil.compileDeployment(cat5, builtin_rabbitmqdeployment, true, false);
        assertTrue("Deployment file failed to parse", crc != -1);
        db = cat5.getClusters().get("cluster").getDatabases().get("database");
        catconn = db.getConnectors().get("0");
        assertNotNull(catconn);
        assertTrue(builtin_rabbitmqdeployment.getExport().isEnabled());
        assertEquals(ServerExportEnum.RABBITMQ, builtin_rabbitmqdeployment.getExport().getTarget());
        prop = catconn.getConfig().get(ExportDataProcessor.EXPORT_TO_TYPE);
        assertEquals("org.voltdb.exportclient.RabbitMQExportClient", prop.getValue());
View Full Code Here

TOP

Related Classes of org.voltdb.catalog.Database

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.