use of org.apache.cassandra.service.EmbeddedCassandraService in project cassandra by apache.
the class DebuggableScheduledThreadPoolExecutorTest method startup.
@BeforeClass
public static void startup() throws IOException {
// The DSTPE checks for if we are in the service shutdown hook so
// to test it we need to start C* internally.
service = new EmbeddedCassandraService();
service.start();
}
use of org.apache.cassandra.service.EmbeddedCassandraService in project cassandra by apache.
the class PagingTest method setup.
@BeforeClass
public static void setup() throws Exception {
System.setProperty("cassandra.config", "cassandra-murmur.yaml");
EmbeddedCassandraService cassandra = new EmbeddedCassandraService();
cassandra.start();
// Currently the native server start method return before the server is fully binded to the socket, so we need
// to wait slightly before trying to connect to it. We should fix this but in the meantime using a sleep.
Thread.sleep(500);
cluster = Cluster.builder().addContactPoint("127.0.0.1").withPort(DatabaseDescriptor.getNativeTransportPort()).build();
session = cluster.connect();
session.execute(dropKsStatement);
session.execute(createKsStatement);
}
use of org.apache.cassandra.service.EmbeddedCassandraService in project cassandra by apache.
the class TableMetricsTest method setup.
@BeforeClass
public static void setup() throws ConfigurationException, IOException {
Schema.instance.clear();
EmbeddedCassandraService cassandra = new EmbeddedCassandraService();
cassandra.start();
Cluster cluster = Cluster.builder().addContactPoint("127.0.0.1").withPort(DatabaseDescriptor.getNativeTransportPort()).build();
session = cluster.connect();
session.execute(String.format("CREATE KEYSPACE IF NOT EXISTS %s WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };", KEYSPACE));
session.execute(String.format("CREATE TABLE IF NOT EXISTS %s.%s (id_c counter, id int, val text, PRIMARY KEY(id, val));", KEYSPACE, COUNTER_TABLE));
}
use of org.apache.cassandra.service.EmbeddedCassandraService in project cassandra by apache.
the class KeyspaceMetricsTest method setup.
@BeforeClass
public static void setup() throws ConfigurationException, IOException {
Schema.instance.clear();
EmbeddedCassandraService cassandra = new EmbeddedCassandraService();
cassandra.start();
Cluster cluster = Cluster.builder().addContactPoint("127.0.0.1").withPort(DatabaseDescriptor.getNativeTransportPort()).build();
session = cluster.connect();
}
use of org.apache.cassandra.service.EmbeddedCassandraService in project cassandra by apache.
the class CQLUserAuditTest method setup.
@BeforeClass
public static void setup() throws Exception {
OverrideConfigurationLoader.override((config) -> {
config.authenticator = "PasswordAuthenticator";
config.role_manager = "CassandraRoleManager";
config.diagnostic_events_enabled = true;
config.audit_logging_options.enabled = true;
config.audit_logging_options.logger = new ParameterizedClass("DiagnosticEventAuditLogger", null);
});
CQLTester.prepareServer();
System.setProperty("cassandra.superuser_setup_delay_ms", "0");
embedded = new EmbeddedCassandraService();
embedded.start();
executeAs(Arrays.asList("CREATE ROLE testuser WITH LOGIN = true AND SUPERUSER = false AND PASSWORD = 'foo'", "CREATE ROLE testuser_nologin WITH LOGIN = false AND SUPERUSER = false AND PASSWORD = 'foo'", "CREATE KEYSPACE testks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}", "CREATE TABLE testks.table1 (a text, b int, c int, PRIMARY KEY (a, b))", "CREATE TABLE testks.table2 (a text, b int, c int, PRIMARY KEY (a, b))"), "cassandra", "cassandra", null);
DiagnosticEventService.instance().subscribe(AuditEvent.class, auditEvents::add);
AuditLogManager.instance.initialize();
}
Aggregations