Search in sources :

Example 66 with BeforeClass

use of org.junit.BeforeClass in project cassandra by apache.

the class CQLMetricsTest 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 junit WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };");
    session.execute("CREATE TABLE IF NOT EXISTS junit.metricstest (id int PRIMARY KEY, val text);");
}
Also used : EmbeddedCassandraService(org.apache.cassandra.service.EmbeddedCassandraService) BeforeClass(org.junit.BeforeClass)

Example 67 with BeforeClass

use of org.junit.BeforeClass in project cassandra by apache.

the class MessagePayloadTest method makeCqlQueryHandlerAccessible.

@BeforeClass
public static void makeCqlQueryHandlerAccessible() {
    try {
        cqlQueryHandlerField = ClientState.class.getDeclaredField("cqlQueryHandler");
        cqlQueryHandlerField.setAccessible(true);
        Field modifiersField = Field.class.getDeclaredField("modifiers");
        modifiersAccessible = modifiersField.isAccessible();
        modifiersField.setAccessible(true);
        modifiersField.setInt(cqlQueryHandlerField, cqlQueryHandlerField.getModifiers() & ~Modifier.FINAL);
    } catch (IllegalAccessException | NoSuchFieldException e) {
        throw new RuntimeException(e);
    }
}
Also used : ClientState(org.apache.cassandra.service.ClientState) Field(java.lang.reflect.Field) BeforeClass(org.junit.BeforeClass)

Example 68 with BeforeClass

use of org.junit.BeforeClass in project cassandra by apache.

the class StorageServiceServerTest method setUp.

@BeforeClass
public static void setUp() throws ConfigurationException {
    DatabaseDescriptor.daemonInitialization();
    IEndpointSnitch snitch = new PropertyFileSnitch();
    DatabaseDescriptor.setEndpointSnitch(snitch);
    Keyspace.setInitialized();
}
Also used : PropertyFileSnitch(org.apache.cassandra.locator.PropertyFileSnitch) IEndpointSnitch(org.apache.cassandra.locator.IEndpointSnitch) BeforeClass(org.junit.BeforeClass)

Example 69 with BeforeClass

use of org.junit.BeforeClass in project cassandra by apache.

the class SerializationsTest method defineSchema.

@BeforeClass
public static void defineSchema() throws Exception {
    DatabaseDescriptor.daemonInitialization();
    partitionerSwitcher = Util.switchPartitioner(RandomPartitioner.instance);
    RANDOM_UUID = UUID.fromString("b5c3d033-75aa-4c2f-a819-947aac7a0c54");
    FULL_RANGE = new Range<>(Util.testPartitioner().getMinimumToken(), Util.testPartitioner().getMinimumToken());
    DESC = new RepairJobDesc(RANDOM_UUID, RANDOM_UUID, "Keyspace1", "Standard1", Arrays.asList(FULL_RANGE));
}
Also used : RepairJobDesc(org.apache.cassandra.repair.RepairJobDesc) BeforeClass(org.junit.BeforeClass)

Example 70 with BeforeClass

use of org.junit.BeforeClass in project cassandra by apache.

the class StorageProxyTest method beforeClass.

@BeforeClass
public static void beforeClass() throws Throwable {
    DatabaseDescriptor.daemonInitialization();
    DatabaseDescriptor.getHintsDirectory().mkdir();
    TokenMetadata tmd = StorageService.instance.getTokenMetadata();
    tmd.updateNormalToken(token("1"), InetAddress.getByName("127.0.0.1"));
    tmd.updateNormalToken(token("6"), InetAddress.getByName("127.0.0.6"));
}
Also used : TokenMetadata(org.apache.cassandra.locator.TokenMetadata) BeforeClass(org.junit.BeforeClass)

Aggregations

BeforeClass (org.junit.BeforeClass)2813 File (java.io.File)388 Configuration (org.apache.hadoop.conf.Configuration)287 IOException (java.io.IOException)128 Connection (java.sql.Connection)126 Properties (java.util.Properties)108 Reader (java.io.Reader)99 SqlSessionFactoryBuilder (org.apache.ibatis.session.SqlSessionFactoryBuilder)98 Provisioning (com.zimbra.cs.account.Provisioning)93 ScriptRunner (org.apache.ibatis.jdbc.ScriptRunner)91 HiveConf (org.apache.hadoop.hive.conf.HiveConf)86 MockProvisioning (com.zimbra.cs.account.MockProvisioning)77 Path (org.apache.hadoop.fs.Path)75 URI (java.net.URI)73 HashMap (java.util.HashMap)70 URL (java.net.URL)63 SqlSession (org.apache.ibatis.session.SqlSession)62 MiniDFSCluster (org.apache.hadoop.hdfs.MiniDFSCluster)61 Injector (com.google.inject.Injector)57 CConfiguration (co.cask.cdap.common.conf.CConfiguration)56