Search in sources :

Example 1 with DeploymentType

use of org.voltdb.compiler.deploymentfile.DeploymentType in project voltdb by VoltDB.

the class PushSpecificGeneration method main.

/**
     * @param args the command line arguments
     */
public static void main(String[] args) {
    // Arguments deployment, directory
    try {
        if (args.length != 2) {
            System.out.println("Usage: draingen deployment.xml dir-where-where-generations-are");
            System.exit(1);
        }
        DeploymentType dep = CatalogUtil.getDeployment(new FileInputStream(new File(args[0])));
        ExportConfigurationType exportConfiguration = dep.getExport().getConfiguration().get(0);
        String exportClientClassName = null;
        switch(exportConfiguration.getType()) {
            case FILE:
                exportClientClassName = "org.voltdb.exportclient.ExportToFileClient";
                break;
            case JDBC:
                exportClientClassName = "org.voltdb.exportclient.JDBCExportClient";
                break;
            case KAFKA:
                exportClientClassName = "org.voltdb.exportclient.kafka.KafkaExportClient";
                break;
            case RABBITMQ:
                exportClientClassName = "org.voltdb.exportclient.RabbitMQExportClient";
                break;
            case HTTP:
                exportClientClassName = "org.voltdb.exportclient.HttpExportClient";
                break;
            case ELASTICSEARCH:
                exportClientClassName = "org.voltdb.exportclient.ElasticSearchHttpExportClient";
                break;
            //Validate that we can load the class.
            case CUSTOM:
                exportClientClassName = exportConfiguration.getExportconnectorclass();
                if (exportConfiguration.isEnabled()) {
                    try {
                        CatalogUtil.class.getClassLoader().loadClass(exportClientClassName);
                    } catch (ClassNotFoundException ex) {
                        String msg = "Custom Export failed to configure, failed to load" + " export plugin class: " + exportConfiguration.getExportconnectorclass() + " Disabling export.";
                        throw new CatalogUtil.DeploymentCheckException(msg);
                    }
                }
                break;
        }
        StandaloneExportManager.initialize(0, args[1], exportClientClassName, dep.getExport().getConfiguration().get(0).getProperty());
        int maxPart = dep.getCluster().getSitesperhost();
        System.out.println("Please wait...|");
        while (true) {
            System.out.print(".");
            Thread.yield();
            Thread.sleep(1000);
            long sz = 0;
            for (int i = 0; i < maxPart; i++) {
                sz += StandaloneExportManager.getQueuedExportBytes(i, "");
            }
            if (sz <= 0 && StandaloneExportManager.shouldExit()) {
                break;
            }
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    } finally {
        StandaloneExportManager.instance().shutdown(null);
    }
}
Also used : ExportConfigurationType(org.voltdb.compiler.deploymentfile.ExportConfigurationType) CatalogUtil(org.voltdb.utils.CatalogUtil) DeploymentType(org.voltdb.compiler.deploymentfile.DeploymentType) File(java.io.File) FileInputStream(java.io.FileInputStream)

Example 2 with DeploymentType

use of org.voltdb.compiler.deploymentfile.DeploymentType in project voltdb by VoltDB.

the class CatalogPasswordScrambler method getDeployment.

public static DeploymentType getDeployment(File sourceFH) {
    try {
        JAXBContext jc = JAXBContext.newInstance("org.voltdb.compiler.deploymentfile");
        // This schema shot the sheriff.
        SchemaFactory sf = SchemaFactory.newInstance(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI);
        Schema schema = sf.newSchema(DependencyPair.class.getResource("compiler/DeploymentFileSchema.xsd"));
        Unmarshaller unmarshaller = jc.createUnmarshaller();
        unmarshaller.setSchema(schema);
        @SuppressWarnings("unchecked") JAXBElement<DeploymentType> result = (JAXBElement<DeploymentType>) unmarshaller.unmarshal(sourceFH);
        DeploymentType deployment = result.getValue();
        return deployment;
    } catch (JAXBException e) {
        // Convert some linked exceptions to more friendly errors.
        if (e.getLinkedException() instanceof java.io.FileNotFoundException) {
            System.err.println(e.getLinkedException().getMessage());
            return null;
        } else if (e.getLinkedException() instanceof org.xml.sax.SAXParseException) {
            System.err.println("Error schema validating deployment.xml file. " + e.getLinkedException().getMessage());
            return null;
        } else {
            throw new RuntimeException(e);
        }
    } catch (SAXException e) {
        System.err.println("Error schema validating deployment.xml file. " + e.getMessage());
        return null;
    }
}
Also used : SchemaFactory(javax.xml.validation.SchemaFactory) Schema(javax.xml.validation.Schema) JAXBException(javax.xml.bind.JAXBException) JAXBContext(javax.xml.bind.JAXBContext) JAXBElement(javax.xml.bind.JAXBElement) DeploymentType(org.voltdb.compiler.deploymentfile.DeploymentType) SAXException(org.xml.sax.SAXException) Unmarshaller(javax.xml.bind.Unmarshaller) DependencyPair(org.voltdb.DependencyPair)

Example 3 with DeploymentType

use of org.voltdb.compiler.deploymentfile.DeploymentType in project voltdb by VoltDB.

the class RealVoltDB method readDeploymentAndCreateStarterCatalogContext.

boolean readDeploymentAndCreateStarterCatalogContext(VoltDB.Configuration config) {
    /*
         * Debate with the cluster what the deployment file should be
         */
    try {
        ZooKeeper zk = m_messenger.getZK();
        byte[] deploymentBytes = null;
        try {
            deploymentBytes = org.voltcore.utils.CoreUtils.urlToBytes(m_config.m_pathToDeployment);
        } catch (Exception ex) {
        //Let us get bytes from ZK
        }
        DeploymentType deployment = null;
        try {
            if (deploymentBytes != null) {
                CatalogUtil.writeCatalogToZK(zk, // Fill in innocuous values for non-deployment stuff
                0, 0L, 0L, // spin loop in Inits.LoadCatalog.run() needs
                new byte[] {}, // this to be of zero length until we have a real catalog.
                null, deploymentBytes);
                hostLog.info("URL of deployment: " + m_config.m_pathToDeployment);
            } else {
                CatalogAndIds catalogStuff = CatalogUtil.getCatalogFromZK(zk);
                deploymentBytes = catalogStuff.deploymentBytes;
            }
        } catch (KeeperException.NodeExistsException e) {
            CatalogAndIds catalogStuff = CatalogUtil.getCatalogFromZK(zk);
            byte[] deploymentBytesTemp = catalogStuff.deploymentBytes;
            if (deploymentBytesTemp != null) {
                //We will ignore the supplied or default deployment anyways.
                if (deploymentBytes != null && !m_config.m_deploymentDefault) {
                    byte[] deploymentHashHere = CatalogUtil.makeDeploymentHash(deploymentBytes);
                    if (!(Arrays.equals(deploymentHashHere, catalogStuff.getDeploymentHash()))) {
                        hostLog.warn("The locally provided deployment configuration did not " + " match the configuration information found in the cluster.");
                    } else {
                        hostLog.info("Deployment configuration pulled from other cluster node.");
                    }
                }
                //Use remote deployment obtained.
                deploymentBytes = deploymentBytesTemp;
            } else {
                hostLog.error("Deployment file could not be loaded locally or remotely, " + "local supplied path: " + m_config.m_pathToDeployment);
                deploymentBytes = null;
            }
        } catch (KeeperException.NoNodeException e) {
            // no deploymentBytes case is handled below. So just log this error.
            if (hostLog.isDebugEnabled()) {
                hostLog.debug("Error trying to get deployment bytes from cluster", e);
            }
        }
        if (deploymentBytes == null) {
            hostLog.error("Deployment information could not be obtained from cluster node or locally");
            VoltDB.crashLocalVoltDB("No such deployment file: " + m_config.m_pathToDeployment, false, null);
        }
        if (deployment == null) {
            deployment = CatalogUtil.getDeployment(new ByteArrayInputStream(deploymentBytes));
        }
        // wasn't a valid xml deployment file
        if (deployment == null) {
            hostLog.error("Not a valid XML deployment file at URL: " + m_config.m_pathToDeployment);
            VoltDB.crashLocalVoltDB("Not a valid XML deployment file at URL: " + m_config.m_pathToDeployment, false, null);
        }
        /*
             * Check for invalid deployment file settings (enterprise-only) in the community edition.
             * Trick here is to print out all applicable problems and then stop, rather than stopping
             * after the first one is found.
             */
        if (!m_config.m_isEnterprise) {
            boolean shutdownDeployment = false;
            boolean shutdownAction = false;
            // check license features for community version
            if ((deployment.getCluster() != null) && (deployment.getCluster().getKfactor() > 0)) {
                consoleLog.error("K-Safety is not supported " + "in the community edition of VoltDB.");
                shutdownDeployment = true;
            }
            if ((deployment.getSnapshot() != null) && (deployment.getSnapshot().isEnabled())) {
                consoleLog.error("Snapshots are not supported " + "in the community edition of VoltDB.");
                shutdownDeployment = true;
            }
            if ((deployment.getCommandlog() != null) && (deployment.getCommandlog().isEnabled())) {
                consoleLog.error("Command logging is not supported " + "in the community edition of VoltDB.");
                shutdownDeployment = true;
            }
            if ((deployment.getExport() != null) && deployment.getExport().getConfiguration() != null && !deployment.getExport().getConfiguration().isEmpty()) {
                consoleLog.error("Export is not supported " + "in the community edition of VoltDB.");
                shutdownDeployment = true;
            }
            // check the start action for the community edition
            if (m_config.m_startAction != StartAction.CREATE) {
                consoleLog.error("Start action \"" + m_config.m_startAction.getClass().getSimpleName() + "\" is not supported in the community edition of VoltDB.");
                shutdownAction = true;
            }
            // if the process needs to stop, try to be helpful
            if (shutdownAction || shutdownDeployment) {
                String msg = "This process will exit. Please run VoltDB with ";
                if (shutdownDeployment) {
                    msg += "a deployment file compatible with the community edition";
                }
                if (shutdownDeployment && shutdownAction) {
                    msg += " and ";
                }
                if (shutdownAction && !shutdownDeployment) {
                    msg += "the CREATE start action";
                }
                msg += ".";
                VoltDB.crashLocalVoltDB(msg, false, null);
            }
        }
        // note the heart beats are specified in seconds in xml, but ms internally
        HeartbeatType hbt = deployment.getHeartbeat();
        if (hbt != null) {
            m_config.m_deadHostTimeoutMS = hbt.getTimeout() * 1000;
            m_messenger.setDeadHostTimeout(m_config.m_deadHostTimeoutMS);
        } else {
            hostLog.info("Dead host timeout set to " + m_config.m_deadHostTimeoutMS + " milliseconds");
        }
        PartitionDetectionType pt = deployment.getPartitionDetection();
        if (pt != null) {
            m_config.m_partitionDetectionEnabled = pt.isEnabled();
            m_messenger.setPartitionDetectionEnabled(m_config.m_partitionDetectionEnabled);
        }
        // get any consistency settings into config
        ConsistencyType consistencyType = deployment.getConsistency();
        if (consistencyType != null) {
            m_config.m_consistencyReadLevel = Consistency.ReadLevel.fromReadLevelType(consistencyType.getReadlevel());
        }
        final String elasticSetting = deployment.getCluster().getElastic().trim().toUpperCase();
        if (elasticSetting.equals("ENABLED")) {
            TheHashinator.setConfiguredHashinatorType(HashinatorType.ELASTIC);
        } else if (!elasticSetting.equals("DISABLED")) {
            VoltDB.crashLocalVoltDB("Error in deployment file,  elastic attribute of " + "cluster element must be " + "'enabled' or 'disabled' but was '" + elasticSetting + "'", false, null);
        } else {
            TheHashinator.setConfiguredHashinatorType(HashinatorType.LEGACY);
        }
        // log system setting information
        SystemSettingsType sysType = deployment.getSystemsettings();
        if (sysType != null) {
            if (sysType.getElastic() != null) {
                hostLog.info("Elastic duration set to " + sysType.getElastic().getDuration() + " milliseconds");
                hostLog.info("Elastic throughput set to " + sysType.getElastic().getThroughput() + " mb/s");
            }
            if (sysType.getTemptables() != null) {
                hostLog.info("Max temptable size set to " + sysType.getTemptables().getMaxsize() + " mb");
            }
            if (sysType.getSnapshot() != null) {
                hostLog.info("Snapshot priority set to " + sysType.getSnapshot().getPriority() + " [0 - 10]");
            }
            if (sysType.getQuery() != null) {
                if (sysType.getQuery().getTimeout() > 0) {
                    hostLog.info("Query timeout set to " + sysType.getQuery().getTimeout() + " milliseconds");
                    m_config.m_queryTimeout = sysType.getQuery().getTimeout();
                } else if (sysType.getQuery().getTimeout() == 0) {
                    hostLog.info("Query timeout set to unlimited");
                    m_config.m_queryTimeout = 0;
                }
            }
        }
        // log a warning on console log if security setting is turned off, like durability warning.
        SecurityType securityType = deployment.getSecurity();
        if (securityType == null || !securityType.isEnabled()) {
            consoleLog.warn(SECURITY_OFF_WARNING);
        }
        // create a dummy catalog to load deployment info into
        Catalog catalog = new Catalog();
        // Need these in the dummy catalog
        Cluster cluster = catalog.getClusters().add("cluster");
        cluster.getDatabases().add("database");
        String result = CatalogUtil.compileDeployment(catalog, deployment, true);
        if (result != null) {
            // Any other non-enterprise deployment errors will be caught and handled here
            // (such as <= 0 host count)
            VoltDB.crashLocalVoltDB(result);
        }
        m_catalogContext = new CatalogContext(//txnid
        TxnEgo.makeZero(MpInitiator.MP_INIT_PID).getTxnId(), //timestamp
        0, catalog, new DbSettings(m_clusterSettings, m_nodeSettings), new byte[] {}, null, deploymentBytes, 0, m_messenger);
        return ((deployment.getCommandlog() != null) && (deployment.getCommandlog().isEnabled()));
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : CatalogAndIds(org.voltdb.utils.CatalogUtil.CatalogAndIds) SecurityType(org.voltdb.compiler.deploymentfile.SecurityType) Cluster(org.voltdb.catalog.Cluster) DeploymentType(org.voltdb.compiler.deploymentfile.DeploymentType) SocketException(java.net.SocketException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) JSONException(org.json_voltpatches.JSONException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) KeeperException(org.apache.zookeeper_voltpatches.KeeperException) SettingsException(org.voltdb.settings.SettingsException) Catalog(org.voltdb.catalog.Catalog) DbSettings(org.voltdb.settings.DbSettings) HeartbeatType(org.voltdb.compiler.deploymentfile.HeartbeatType) ConsistencyType(org.voltdb.compiler.deploymentfile.ConsistencyType) ZooKeeper(org.apache.zookeeper_voltpatches.ZooKeeper) SystemSettingsType(org.voltdb.compiler.deploymentfile.SystemSettingsType) ByteArrayInputStream(java.io.ByteArrayInputStream) PartitionDetectionType(org.voltdb.compiler.deploymentfile.PartitionDetectionType) KeeperException(org.apache.zookeeper_voltpatches.KeeperException)

Example 4 with DeploymentType

use of org.voltdb.compiler.deploymentfile.DeploymentType in project voltdb by VoltDB.

the class DeploymentBuilder method getXML.

/**
     * Writes deployment.xml file to a temporary file. It is constructed from the passed parameters and the m_users
     * field.
     *
     * @param voltRoot
     * @param dinfo an instance {@link DeploymentInfo}
     * @return deployment path
     * @throws IOException
     * @throws JAXBException
     */
public String getXML() {
    // make sure voltroot exists
    new File(m_voltRootPath).mkdirs();
    org.voltdb.compiler.deploymentfile.ObjectFactory factory = new org.voltdb.compiler.deploymentfile.ObjectFactory();
    // <deployment>
    DeploymentType deployment = factory.createDeploymentType();
    JAXBElement<DeploymentType> doc = factory.createDeployment(deployment);
    // <cluster>
    ClusterType cluster = factory.createClusterType();
    deployment.setCluster(cluster);
    cluster.setHostcount(m_hostCount);
    cluster.setSitesperhost(m_sitesPerHost);
    cluster.setKfactor(m_replication);
    cluster.setSchema(m_useDDLSchema ? SchemaType.DDL : SchemaType.CATALOG);
    // <paths>
    PathsType paths = factory.createPathsType();
    deployment.setPaths(paths);
    Voltdbroot voltdbroot = factory.createPathsTypeVoltdbroot();
    paths.setVoltdbroot(voltdbroot);
    voltdbroot.setPath(m_voltRootPath);
    if (m_snapshotPath != null) {
        PathsType.Snapshots snapshotPathElement = factory.createPathsTypeSnapshots();
        snapshotPathElement.setPath(m_snapshotPath);
        paths.setSnapshots(snapshotPathElement);
    }
    if (m_commandLogPath != null) {
        PathsType.Commandlog commandLogPathElement = factory.createPathsTypeCommandlog();
        commandLogPathElement.setPath(m_commandLogPath);
        paths.setCommandlog(commandLogPathElement);
    }
    if (m_internalSnapshotPath != null) {
        PathsType.Commandlogsnapshot commandLogSnapshotPathElement = factory.createPathsTypeCommandlogsnapshot();
        commandLogSnapshotPathElement.setPath(m_internalSnapshotPath);
        paths.setCommandlogsnapshot(commandLogSnapshotPathElement);
    }
    if (m_snapshotPrefix != null) {
        SnapshotType snapshot = factory.createSnapshotType();
        deployment.setSnapshot(snapshot);
        snapshot.setFrequency(m_snapshotFrequency);
        snapshot.setPrefix(m_snapshotPrefix);
        snapshot.setRetain(m_snapshotRetain);
    }
    SecurityType security = factory.createSecurityType();
    deployment.setSecurity(security);
    security.setEnabled(m_securityEnabled);
    SecurityProviderString provider = SecurityProviderString.HASH;
    if (m_securityEnabled)
        try {
            provider = SecurityProviderString.fromValue(m_securityProvider);
        } catch (IllegalArgumentException shouldNotHappenSeeSetter) {
        }
    security.setProvider(provider);
    if (m_commandLogSync != null || m_commandLogEnabled != null || m_commandLogFsyncInterval != null || m_commandLogMaxTxnsBeforeFsync != null || m_commandLogSize != null) {
        CommandLogType commandLogType = factory.createCommandLogType();
        if (m_commandLogSync != null) {
            commandLogType.setSynchronous(m_commandLogSync.booleanValue());
        }
        if (m_commandLogEnabled != null) {
            commandLogType.setEnabled(m_commandLogEnabled);
        }
        if (m_commandLogSize != null) {
            commandLogType.setLogsize(m_commandLogSize);
        }
        if (m_commandLogFsyncInterval != null || m_commandLogMaxTxnsBeforeFsync != null) {
            CommandLogType.Frequency frequency = factory.createCommandLogTypeFrequency();
            if (m_commandLogFsyncInterval != null) {
                frequency.setTime(m_commandLogFsyncInterval);
            }
            if (m_commandLogMaxTxnsBeforeFsync != null) {
                frequency.setTransactions(m_commandLogMaxTxnsBeforeFsync);
            }
            commandLogType.setFrequency(frequency);
        }
        deployment.setCommandlog(commandLogType);
    }
    // <partition-detection>/<snapshot>
    PartitionDetectionType ppd = factory.createPartitionDetectionType();
    deployment.setPartitionDetection(ppd);
    ppd.setEnabled(m_ppdEnabled);
    // <systemsettings>
    SystemSettingsType systemSettingType = factory.createSystemSettingsType();
    Temptables temptables = factory.createSystemSettingsTypeTemptables();
    temptables.setMaxsize(m_maxTempTableMemory);
    systemSettingType.setTemptables(temptables);
    if (m_snapshotPriority != null) {
        SystemSettingsType.Snapshot snapshot = factory.createSystemSettingsTypeSnapshot();
        snapshot.setPriority(m_snapshotPriority);
        systemSettingType.setSnapshot(snapshot);
    }
    deployment.setSystemsettings(systemSettingType);
    // <users>
    if (m_users.size() > 0) {
        UsersType users = factory.createUsersType();
        deployment.setUsers(users);
        // <user>
        for (final UserInfo info : m_users) {
            User user = factory.createUsersTypeUser();
            users.getUser().add(user);
            user.setName(info.name);
            user.setPassword(info.password);
            // build up user/roles.
            if (info.roles.length > 0) {
                final StringBuilder roles = new StringBuilder();
                for (final String role : info.roles) {
                    if (roles.length() > 0)
                        roles.append(",");
                    roles.append(role.toLowerCase());
                }
                user.setRoles(roles.toString());
            }
        }
    }
    SslType ssl = factory.createSslType();
    deployment.setSsl(ssl);
    ssl.setEnabled(false);
    // <httpd>. Disabled unless port # is configured by a testcase
    HttpdType httpd = factory.createHttpdType();
    deployment.setHttpd(httpd);
    httpd.setEnabled(m_httpdPortNo != -1);
    httpd.setPort(m_httpdPortNo);
    Jsonapi json = factory.createHttpdTypeJsonapi();
    httpd.setJsonapi(json);
    json.setEnabled(m_jsonApiEnabled);
    // <export>
    ExportType export = factory.createExportType();
    deployment.setExport(export);
    // <dr>
    if (m_drRole != DrRoleType.NONE) {
        final DrType drType = factory.createDrType();
        deployment.setDr(drType);
        drType.setRole(m_drRole);
        drType.setId(1);
    }
    // Have some yummy boilerplate!
    String xml = null;
    try {
        JAXBContext context = JAXBContext.newInstance(DeploymentType.class);
        Marshaller marshaller = context.createMarshaller();
        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
        StringWriter writer = new StringWriter();
        marshaller.marshal(doc, writer);
        xml = writer.toString();
    } catch (Exception e) {
        e.printStackTrace();
        assert (false);
    }
    return xml;
}
Also used : SecurityType(org.voltdb.compiler.deploymentfile.SecurityType) User(org.voltdb.compiler.deploymentfile.UsersType.User) SecurityProviderString(org.voltdb.compiler.deploymentfile.SecurityProviderString) Jsonapi(org.voltdb.compiler.deploymentfile.HttpdType.Jsonapi) JAXBContext(javax.xml.bind.JAXBContext) DeploymentType(org.voltdb.compiler.deploymentfile.DeploymentType) SecurityProviderString(org.voltdb.compiler.deploymentfile.SecurityProviderString) PathsType(org.voltdb.compiler.deploymentfile.PathsType) CommandLogType(org.voltdb.compiler.deploymentfile.CommandLogType) SystemSettingsType(org.voltdb.compiler.deploymentfile.SystemSettingsType) StringWriter(java.io.StringWriter) PartitionDetectionType(org.voltdb.compiler.deploymentfile.PartitionDetectionType) Marshaller(javax.xml.bind.Marshaller) ExportType(org.voltdb.compiler.deploymentfile.ExportType) Voltdbroot(org.voltdb.compiler.deploymentfile.PathsType.Voltdbroot) ClusterType(org.voltdb.compiler.deploymentfile.ClusterType) IOException(java.io.IOException) JAXBException(javax.xml.bind.JAXBException) DrType(org.voltdb.compiler.deploymentfile.DrType) Temptables(org.voltdb.compiler.deploymentfile.SystemSettingsType.Temptables) HttpdType(org.voltdb.compiler.deploymentfile.HttpdType) UsersType(org.voltdb.compiler.deploymentfile.UsersType) SslType(org.voltdb.compiler.deploymentfile.SslType) SnapshotType(org.voltdb.compiler.deploymentfile.SnapshotType) File(java.io.File)

Example 5 with DeploymentType

use of org.voltdb.compiler.deploymentfile.DeploymentType in project voltdb by VoltDB.

the class TestDefaultDeployment method testDefaultDeploymentInitialization.

@Test
public void testDefaultDeploymentInitialization() throws Exception {
    String ddl = "CREATE TABLE WAREHOUSE (" + "W_ID INTEGER DEFAULT '0' NOT NULL, " + "W_NAME VARCHAR(16) DEFAULT NULL, " + "PRIMARY KEY  (W_ID)" + ");";
    VoltProjectBuilder builder = new VoltProjectBuilder();
    builder.addLiteralSchema(ddl);
    builder.addStmtProcedure("hello", "select * from warehouse");
    // compileWithDefaultDeployment() generates no deployment.xml so that the default is used.
    String jarPath = Configuration.getPathToCatalogForTest("test.jar");
    assertTrue(builder.compileWithDefaultDeployment(jarPath));
    final File jar = new File(jarPath);
    jar.deleteOnExit();
    String pathToDeployment = builder.getPathToDeployment();
    assertEquals(pathToDeployment, null);
    // the default deployment file includes an http server on port 8080.
    // do some verification without starting VoltDB, since that port
    // number conflicts with jenkins on some test servers.
    String absolutePath = RealVoltDB.setupDefaultDeployment(new VoltLogger("HOST"));
    DeploymentType dflt = CatalogUtil.parseDeployment(absolutePath);
    assertTrue(dflt != null);
    assertTrue(dflt.getCluster().getHostcount() == 1);
    assertTrue(dflt.getCluster().getSitesperhost() == 8);
}
Also used : VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder) VoltLogger(org.voltcore.logging.VoltLogger) DeploymentType(org.voltdb.compiler.deploymentfile.DeploymentType) VoltFile(org.voltdb.utils.VoltFile) File(java.io.File) Test(org.junit.Test)

Aggregations

DeploymentType (org.voltdb.compiler.deploymentfile.DeploymentType)27 File (java.io.File)20 FileInputStream (java.io.FileInputStream)9 VoltProjectBuilder (org.voltdb.compiler.VoltProjectBuilder)7 IOException (java.io.IOException)6 VoltFile (org.voltdb.utils.VoltFile)6 JAXBException (javax.xml.bind.JAXBException)5 Configuration (org.voltdb.VoltDB.Configuration)5 Catalog (org.voltdb.catalog.Catalog)5 JAXBContext (javax.xml.bind.JAXBContext)4 Marshaller (javax.xml.bind.Marshaller)4 UnsupportedEncodingException (java.io.UnsupportedEncodingException)3 SocketException (java.net.SocketException)3 HashMap (java.util.HashMap)3 ExecutionException (java.util.concurrent.ExecutionException)3 KeeperException (org.apache.zookeeper_voltpatches.KeeperException)3 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)3 JSONException (org.json_voltpatches.JSONException)3 VoltCompiler (org.voltdb.compiler.VoltCompiler)3 ClusterType (org.voltdb.compiler.deploymentfile.ClusterType)3