use of org.apache.cassandra.service.EmbeddedCassandraService in project pinpoint by naver.
the class CassandraTestHelper method init.
public static void init(final String cassandraVersion) throws IOException, ConfigurationException {
final String cassandraStorageDir = String.format("%s/data_%s", CASSANDRA_HOME, cassandraVersion);
final String cassandraConfigFile = String.format("cassandra/cassandra_%s.yaml", cassandraVersion);
System.setProperty("cassandra.storagedir", cassandraStorageDir);
System.setProperty("cassandra.config", cassandraConfigFile);
prepareEnvironment();
EmbeddedCassandraService cassandra = new EmbeddedCassandraService();
cassandra.start();
}
use of org.apache.cassandra.service.EmbeddedCassandraService in project cassandra by apache.
the class AuditLoggerAuthTest method setup.
@BeforeClass
public static void setup() throws Exception {
OverrideConfigurationLoader.override((config) -> {
config.authenticator = "PasswordAuthenticator";
config.role_manager = "CassandraRoleManager";
config.authorizer = "CassandraAuthorizer";
config.audit_logging_options.enabled = true;
config.audit_logging_options.logger = new ParameterizedClass("InMemoryAuditLogger", null);
});
CQLTester.prepareServer();
System.setProperty("cassandra.superuser_setup_delay_ms", "0");
embedded = new EmbeddedCassandraService();
embedded.start();
executeWithCredentials(Arrays.asList(getCreateRoleCql(TEST_USER, true, false, false), getCreateRoleCql("testuser_nologin", false, false, false), "CREATE KEYSPACE testks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}", "CREATE TABLE testks.table1 (key text PRIMARY KEY, col1 int, col2 int)"), "cassandra", "cassandra", null);
}
use of org.apache.cassandra.service.EmbeddedCassandraService in project cassandra by apache.
the class CQLMetricsTest method setup.
@BeforeClass()
public static void setup() throws ConfigurationException, IOException {
Schema.instance.clear();
EmbeddedCassandraService cassandra = new EmbeddedCassandraService();
cassandra.start();
cluster = Cluster.builder().addContactPoint("127.0.0.1").withPort(DatabaseDescriptor.getNativeTransportPort()).build();
session = cluster.connect();
session.execute("CREATE KEYSPACE IF NOT EXISTS junit WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };");
session.execute("CREATE TABLE IF NOT EXISTS junit.metricstest (id int PRIMARY KEY, val text);");
}
use of org.apache.cassandra.service.EmbeddedCassandraService in project cassandra by apache.
the class BatchMetricsTest method setup.
@BeforeClass()
public static void setup() throws ConfigurationException, IOException {
Schema.instance.clear();
cassandra = new EmbeddedCassandraService();
cassandra.start();
DatabaseDescriptor.setWriteRpcTimeout(TimeUnit.SECONDS.toMillis(10));
cluster = Cluster.builder().addContactPoint("127.0.0.1").withPort(DatabaseDescriptor.getNativeTransportPort()).build();
session = cluster.connect();
session.execute("CREATE KEYSPACE IF NOT EXISTS " + KEYSPACE + " WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };");
session.execute("USE " + KEYSPACE);
session.execute("CREATE TABLE IF NOT EXISTS " + LOGGER_TABLE + " (id int PRIMARY KEY, val text);");
session.execute("CREATE TABLE IF NOT EXISTS " + COUNTER_TABLE + " (id int PRIMARY KEY, val counter);");
psLogger = session.prepare("INSERT INTO " + KEYSPACE + '.' + LOGGER_TABLE + " (id, val) VALUES (?, ?);");
psCounter = session.prepare("UPDATE " + KEYSPACE + '.' + COUNTER_TABLE + " SET val = val + 1 WHERE id = ?;");
}
use of org.apache.cassandra.service.EmbeddedCassandraService in project cassandra by apache.
the class ClientRequestMetricsTest method setup.
@BeforeClass
public static void setup() throws ConfigurationException, IOException {
Schema.instance.clear();
cassandra = new EmbeddedCassandraService();
cassandra.start();
cluster = builder().addContactPoint("127.0.0.1").withPort(DatabaseDescriptor.getNativeTransportPort()).build();
session = cluster.connect();
session.execute("CREATE KEYSPACE IF NOT EXISTS " + KEYSPACE + " WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };");
session.execute("USE " + KEYSPACE);
session.execute("CREATE TABLE IF NOT EXISTS " + TABLE + " (id int, ord int, val text, PRIMARY KEY (id, ord));");
writePS = session.prepare("INSERT INTO " + KEYSPACE + '.' + TABLE + " (id, ord, val) VALUES (?, ?, ?);");
paxosPS = session.prepare("INSERT INTO " + KEYSPACE + '.' + TABLE + " (id, ord, val) VALUES (?, ?, ?) IF NOT EXISTS;");
readPS = session.prepare("SELECT * FROM " + KEYSPACE + '.' + TABLE + " WHERE id=?;");
readRangePS = session.prepare("SELECT * FROM " + KEYSPACE + '.' + TABLE + " WHERE id=? AND ord>=? AND ord <= ?;");
}
Aggregations