use of org.junit.BeforeClass in project cassandra by apache.
the class AbstractPendingRepairTest method setupClass.
@BeforeClass
public static void setupClass() {
SchemaLoader.prepareServer();
ARS = ActiveRepairService.instance;
LocalSessionAccessor.startup();
// cutoff messaging service
MessagingService.instance().addMessageSink(new IMessageSink() {
public boolean allowOutgoingMessage(MessageOut message, int id, InetAddress to) {
return false;
}
public boolean allowIncomingMessage(MessageIn message, int id) {
return false;
}
});
}
use of org.junit.BeforeClass in project cassandra by apache.
the class VerifyTest method defineSchema.
@BeforeClass
public static void defineSchema() throws ConfigurationException {
CompressionParams compressionParameters = CompressionParams.snappy(32768);
loadSchema();
createKeyspace(KEYSPACE, KeyspaceParams.simple(1), standardCFMD(KEYSPACE, CF).compression(compressionParameters), standardCFMD(KEYSPACE, CF2).compression(compressionParameters), standardCFMD(KEYSPACE, CF3), standardCFMD(KEYSPACE, CF4), standardCFMD(KEYSPACE, CORRUPT_CF), standardCFMD(KEYSPACE, CORRUPT_CF2), counterCFMD(KEYSPACE, COUNTER_CF).compression(compressionParameters), counterCFMD(KEYSPACE, COUNTER_CF2).compression(compressionParameters), counterCFMD(KEYSPACE, COUNTER_CF3), counterCFMD(KEYSPACE, COUNTER_CF4), counterCFMD(KEYSPACE, CORRUPTCOUNTER_CF), counterCFMD(KEYSPACE, CORRUPTCOUNTER_CF2), standardCFMD(KEYSPACE, CF_UUID, 0, UUIDType.instance));
}
use of org.junit.BeforeClass in project cassandra by apache.
the class SSTableCorruptionDetectionTest method setUp.
@BeforeClass
public static void setUp() {
TableMetadata.Builder cfm = TableMetadata.builder(keyspace, table).addPartitionKeyColumn("pk", AsciiType.instance).addClusteringColumn("ck1", AsciiType.instance).addClusteringColumn("ck2", AsciiType.instance).addRegularColumn("reg1", BytesType.instance).addRegularColumn("reg2", BytesType.instance).compression(CompressionParams.noCompression());
SchemaLoader.createKeyspace(keyspace, KeyspaceParams.simple(1), cfm);
cfs = Keyspace.open(keyspace).getColumnFamilyStore(table);
cfs.disableAutoCompaction();
maxValueSize = DatabaseDescriptor.getMaxValueSize();
DatabaseDescriptor.setMaxValueSize(1024 * 1024);
long seed = System.nanoTime();
logger.info("Seed {}", seed);
random = new Random(seed);
truncate(cfs);
File dir = cfs.getDirectories().getDirectoryForNewSSTables();
txn = LifecycleTransaction.offline(OperationType.WRITE);
// Setting up/writing large values is an expensive operation, we only want to do it once per run
writer = getWriter(cfs, dir, txn);
for (int i = 0; i < numberOfPks; i++) {
UpdateBuilder builder = UpdateBuilder.create(cfs.metadata(), String.format("pkvalue_%07d", i)).withTimestamp(1);
byte[] reg1 = new byte[valueSize];
random.nextBytes(reg1);
byte[] reg2 = new byte[valueSize];
random.nextBytes(reg2);
builder.newRow("clustering_" + i, "clustering_" + (i + 1)).add("reg1", ByteBuffer.wrap(reg1)).add("reg2", ByteBuffer.wrap(reg2));
writer.append(builder.build().unfilteredIterator());
}
cfs.forceBlockingFlush();
ssTableReader = writer.finish(true);
txn.update(ssTableReader, false);
LifecycleTransaction.waitForDeletions();
}
use of org.junit.BeforeClass in project jstorm by alibaba.
the class ZooKeeperDataViewTest method init.
@BeforeClass
public static void init() {
String CONFIG_PATH = System.getProperty("user.home") + CONFIG_FILE;
File file = new File(CONFIG_PATH);
if (file.exists() == false) {
SKIP = true;
return;
}
try {
zkobj = new Zookeeper();
System.getProperties().setProperty("storm.conf.file", CONFIG_PATH);
Map conf = Utils.readStormConfig();
zk = zkobj.mkClient(conf, (List<String>) conf.get(Config.STORM_ZOOKEEPER_SERVERS), conf.get(Config.STORM_ZOOKEEPER_PORT), (String) conf.get(Config.STORM_ZOOKEEPER_ROOT));
gson = new GsonBuilder().setPrettyPrinting().create();
} catch (Throwable e) {
e.printStackTrace();
SKIP = true;
}
}
use of org.junit.BeforeClass 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();
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 " + TABLE + " (id int PRIMARY KEY, val text);");
ps = session.prepare("INSERT INTO " + KEYSPACE + '.' + TABLE + " (id, val) VALUES (?, ?);");
}
Aggregations