Search in sources :

Example 1 with IThriftPool

use of org.scale7.cassandra.pelops.pool.IThriftPool in project scale7-pelops by s7.

the class MutatorIntegrationTest method testNewColumnWithTTLNotSet.

@Test
public void testNewColumnWithTTLNotSet() {
    IThriftPool pool = Mockito.mock(IThriftPool.class);
    Mutator mutator = new Mutator(pool, Long.MAX_VALUE, true, Integer.MAX_VALUE);
    Column column = mutator.newColumn(Bytes.fromUTF8("a"), Bytes.fromUTF8("b"), Mutator.NO_TTL);
    assertEquals("column name is not in the expected state", Bytes.fromUTF8("a").getBytes(), column.name);
    assertEquals("column value is not in the expected state", Bytes.fromUTF8("b").getBytes(), column.value);
    assertFalse("column TTL is not in the expected state", column.isSetTtl());
}
Also used : Column(org.apache.cassandra.thrift.Column) IThriftPool(org.scale7.cassandra.pelops.pool.IThriftPool) Test(org.junit.Test) AbstractIntegrationTest(org.scale7.cassandra.pelops.support.AbstractIntegrationTest)

Example 2 with IThriftPool

use of org.scale7.cassandra.pelops.pool.IThriftPool in project scale7-pelops by s7.

the class MutatorIntegrationTest method testConstructorDeleteIfNullState.

@Test
public void testConstructorDeleteIfNullState() {
    IThriftPool pool = Mockito.mock(IThriftPool.class);
    Mutator mutator = new Mutator(pool, System.currentTimeMillis(), true);
    assertTrue("Mutator is not in the expected state", mutator.deleteIfNull);
}
Also used : IThriftPool(org.scale7.cassandra.pelops.pool.IThriftPool) Test(org.junit.Test) AbstractIntegrationTest(org.scale7.cassandra.pelops.support.AbstractIntegrationTest)

Example 3 with IThriftPool

use of org.scale7.cassandra.pelops.pool.IThriftPool in project scale7-pelops by s7.

the class Pelops method shutdown.

/**
	 * Shutdown Pelops. This proceeds by shutting down all connection pools.
	 */
public static void shutdown() {
    logger.info("Pelops starting to shutdown...");
    for (IThriftPool pool : poolMap.values()) pool.shutdown();
    logger.info("Pelops has shutdown");
}
Also used : IThriftPool(org.scale7.cassandra.pelops.pool.IThriftPool)

Example 4 with IThriftPool

use of org.scale7.cassandra.pelops.pool.IThriftPool in project scale7-pelops by s7.

the class Pelops method addPool.

/**
	 * Add a new Thrift connection pool for a specific cluster and keyspace. The name given to the pool is later used
	 * when creating operands such as <code>Mutator</code> and <code>Selector</code>.
	 * @param poolName				A name used to reference the pool e.g. "MainDatabase" or "LucandraIndexes"
	 * @param cluster				The Cassandra cluster that network connections will be made to
	 * @param keyspace				The keyspace in the Cassandra cluster against which pool operations will apply
	 */
public static void addPool(String poolName, Cluster cluster, String keyspace) {
    IThriftPool pool = new CommonsBackedPool(cluster, keyspace);
    addPool(poolName, pool);
}
Also used : IThriftPool(org.scale7.cassandra.pelops.pool.IThriftPool) CommonsBackedPool(org.scale7.cassandra.pelops.pool.CommonsBackedPool)

Example 5 with IThriftPool

use of org.scale7.cassandra.pelops.pool.IThriftPool in project scale7-pelops by s7.

the class Pelops method addPool.

/**
	 * Add a new Thrift connection pool for a specific cluster and keyspace. The name given to the pool is later used
	 * when creating operands such as <code>Mutator</code> and <code>Selector</code>.
	 * @param poolName				A name used to reference the pool e.g. "MainDatabase" or "LucandraIndexes"
     * @param cluster				The Cassandra cluster that network connections will be made to
     * @param keyspace				The keyspace in the Cassandra cluster against which pool operations will apply
     * @param policy                The configuration used by the pool
     * @param operandPolicy         The configuration used by the {@link org.scale7.cassandra.pelops.Operand}
     */
public static void addPool(String poolName, Cluster cluster, String keyspace, CommonsBackedPool.Policy policy, OperandPolicy operandPolicy) {
    IThriftPool pool = new CommonsBackedPool(cluster, keyspace, policy, operandPolicy);
    addPool(poolName, pool);
}
Also used : IThriftPool(org.scale7.cassandra.pelops.pool.IThriftPool) CommonsBackedPool(org.scale7.cassandra.pelops.pool.CommonsBackedPool)

Aggregations

IThriftPool (org.scale7.cassandra.pelops.pool.IThriftPool)11 Test (org.junit.Test)7 AbstractIntegrationTest (org.scale7.cassandra.pelops.support.AbstractIntegrationTest)7 Column (org.apache.cassandra.thrift.Column)4 CommonsBackedPool (org.scale7.cassandra.pelops.pool.CommonsBackedPool)2 Mutation (org.apache.cassandra.thrift.Mutation)1 DebuggingPool (org.scale7.cassandra.pelops.pool.DebuggingPool)1