Example usage for org.apache.cassandra.config DatabaseDescriptor daemonInitialization

List of usage examples for org.apache.cassandra.config DatabaseDescriptor daemonInitialization

Introduction

In this page you can find the example usage for org.apache.cassandra.config DatabaseDescriptor daemonInitialization.

Prototype

public static void daemonInitialization() throws ConfigurationException 

Source Link

Usage

From source file:org.apache.calcite.test.CassandraAdapterTest.java

License:Apache License

private static ExternalResource initCassandraIfEnabled() {
    if (!enabled()) {
        // Return NOP resource (to avoid nulls)
        return new ExternalResource() {
            @Override/*from  ww w . ja va  2  s .c o  m*/
            public Statement apply(final Statement base, final Description description) {
                return super.apply(base, description);
            }
        };
    }

    String configurationFileName = null; // use default one
    // Apache Jenkins often fails with
    // CassandraAdapterTest Cassandra daemon did not start within timeout (20 sec by default)
    long startUpTimeoutMillis = TimeUnit.SECONDS.toMillis(60);

    CassandraCQLUnit rule = new CassandraCQLUnit(new ClassPathCQLDataSet("twissandra.cql"),
            configurationFileName, startUpTimeoutMillis);

    // This static init is necessary otherwise tests fail with CassandraUnit in IntelliJ (jdk10)
    // should be called right after constructor
    // NullPointerException for DatabaseDescriptor.getDiskFailurePolicy
    // for more info see
    // https://github.com/jsevellec/cassandra-unit/issues/249
    // https://github.com/jsevellec/cassandra-unit/issues/221
    DatabaseDescriptor.daemonInitialization();

    return rule;
}

From source file:org.springframework.data.cassandra.test.util.EmbeddedCassandraServerHelper.java

License:Apache License

private static void cleanupAndRecreateDirectories() throws IOException {

    DatabaseDescriptor.daemonInitialization();
    createCassandraDirectories();/*from   w  w w . j a  v a2 s. c  o m*/
    cleanup();
    createCassandraDirectories();

    CommitLog commitLog = CommitLog.instance;

    commitLog.getCurrentPosition(); // wait for commit log allocator instantiation to avoid hanging on a race condition
    commitLog.resetUnsafe(true); // cleanup screws w/ CommitLog, this brings it back to safe state
}

From source file:org.springframework.data.cql.EmbeddedCassandraServerHelper.java

License:Apache License

private static void cleanupAndRecreateDirectories() throws IOException {

    DatabaseDescriptor.daemonInitialization();
    createCassandraDirectories();//from   w  w  w  .  j  av a  2  s. c  om
    cleanup();
    createCassandraDirectories();

    CommitLog commitLog = CommitLog.instance;
    commitLog.getCurrentPosition(); // wait for commit log allocator instantiation to avoid hanging on a race condition
    commitLog.resetUnsafe(true); // cleanup screws w/ CommitLog, this brings it back to safe state
}