use of org.apache.cassandra.service.CassandraDaemon in project cassandra-indexing by hmsonline.
the class AbstractIndexingTest method setUp.
@Before
public void setUp() throws Exception {
if (cassandraService == null) {
// Start cassandra server
cassandraService = new CassandraDaemon();
cassandraService.activate();
//Thread.sleep(4000);
cluster = HFactory.getOrCreateCluster(CLUSTER_NAME, CASSANDRA_HOST + ":" + CASSANDRA_PORT);
// Create indexing schema
indexKeyspace = createSchema(INDEX_KS, Arrays.asList(CONF_CF, INDEX_CF), cluster);
// Create data schema
dataKeyspace = createSchema(DATA_KS, Arrays.asList(DATA_CF, DATA_CF2), cluster);
cluster.describeKeyspaces();
configureIndexes();
// Thread.sleep(10000000);
}
}
use of org.apache.cassandra.service.CassandraDaemon in project scale7-pelops by s7.
the class EmbeddedCassandraServer method start.
/**
* starts embedded Cassandra server.
*
* @throws Exception
* if an error occurs
*/
public void start() throws Exception {
try {
cleanupDirectoriesFailover();
FileUtils.createDirectory(baseDirectory);
System.setProperty("log4j.configuration", "file:target/test-classes/log4j.properties");
System.setProperty("cassandra.config", "file:target/test-classes/cassandra.yaml");
cassandraDaemon = new CassandraDaemon();
cassandraDaemon.init(null);
cassandraThread = new Thread(new Runnable() {
public void run() {
try {
cassandraDaemon.start();
} catch (Exception e) {
logger.error("Embedded casandra server run failed", e);
}
}
});
cassandraThread.setDaemon(true);
cassandraThread.start();
} catch (Exception e) {
logger.error("Embedded casandra server start failed", e);
// cleanup
stop();
}
}
use of org.apache.cassandra.service.CassandraDaemon in project cassandra by apache.
the class CommitLogFailurePolicyTest method testCommitFailurePolicy_ignore_beforeStartup.
@Test
public void testCommitFailurePolicy_ignore_beforeStartup() {
//startup was not completed successfuly (since method completeSetup() was not called)
CassandraDaemon daemon = new CassandraDaemon();
StorageService.instance.registerDaemon(daemon);
KillerForTests killerForTests = new KillerForTests();
JVMStabilityInspector.Killer originalKiller = JVMStabilityInspector.replaceKiller(killerForTests);
Config.CommitFailurePolicy oldPolicy = DatabaseDescriptor.getCommitFailurePolicy();
try {
DatabaseDescriptor.setCommitFailurePolicy(Config.CommitFailurePolicy.ignore);
CommitLog.handleCommitError("Testing ignore policy", new Throwable());
//even though policy is ignore, JVM must die because Daemon has not finished initializing
Assert.assertTrue(killerForTests.wasKilled());
//killed quietly due to startup failure
Assert.assertTrue(killerForTests.wasKilledQuietly());
} finally {
DatabaseDescriptor.setCommitFailurePolicy(oldPolicy);
JVMStabilityInspector.replaceKiller(originalKiller);
}
}
use of org.apache.cassandra.service.CassandraDaemon in project gora by apache.
the class GoraCassandraTestDriver method setUpClass.
/**
* Starts embedded Cassandra server.
*
* @throws Exception
* if an error occurs
*/
@Override
public void setUpClass() {
log.info("Starting embedded Cassandra Server...");
try {
cleanupDirectoriesFailover();
FileUtils.createDirectory(baseDirectory);
System.setProperty("log4j.configuration", "log4j-server.properties");
System.setProperty("cassandra.config", "cassandra.yaml");
cassandraDaemon = new CassandraDaemon();
cassandraDaemon.init(null);
cassandraThread = new Thread(new Runnable() {
public void run() {
try {
cassandraDaemon.start();
} catch (Exception e) {
log.error("Embedded casandra server run failed!", e);
}
}
});
cassandraThread.setDaemon(true);
cassandraThread.start();
} catch (Exception e) {
log.error("Embedded casandra server start failed!", e);
// cleanup
tearDownClass();
}
}
use of org.apache.cassandra.service.CassandraDaemon in project ignite by apache.
the class CassandraLifeCycleBean method startEmbeddedCassandra.
/**
* Starts embedded Cassandra instance
*/
private void startEmbeddedCassandra() {
if (log != null) {
log.info("-------------------------------");
log.info("| Starting embedded Cassandra |");
log.info("-------------------------------");
}
try {
if (jmxPort != null)
System.setProperty(CASSANDRA_JMX_PORT_PROP, jmxPort);
if (cassandraCfgFile != null)
System.setProperty(CASSANDRA_CONFIG_PROP, FILE_PREFIX + cassandraCfgFile);
embeddedCassandraDaemon = new CassandraDaemon(true);
embeddedCassandraDaemon.init(null);
embeddedCassandraDaemon.start();
} catch (Exception e) {
throw new RuntimeException("Failed to start embedded Cassandra", e);
}
if (log != null) {
log.info("------------------------------");
log.info("| Embedded Cassandra started |");
log.info("------------------------------");
}
}
Aggregations