Package org.scale7.cassandra.pelops.pool

Examples of org.scale7.cassandra.pelops.pool.CommonsBackedPool$ConnectionFactory


        throw new KunderaException("All hosts are down. please check servers manully.");
    }

    RowDeletor getRowDeletor(IThriftPool pool)
    {
        IThriftPool iThriftPool = pool;
        boolean success = false;
        while (!success)
        {
            if (iThriftPool != null)
            {
View Full Code Here


   * @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);
  }
View Full Code Here

     * @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);
  }
View Full Code Here

     *
     * @param poolName A name used to reference the pool e.g. "MainDatabase" or "LucandraIndexes"
     */
    public static void removePool(String poolName) {
        logger.info("Pelops removes pool {}", poolName);
        IThriftPool pool = poolMap.remove(poolName);
        if (pool != null) // avoid null pointers
            pool.shutdown();
    }
View Full Code Here

                .setSubcomparator_type(CFDEF_COMPARATOR_BYTES)));
  }

    @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);
    }
View Full Code Here

    @Test
    public void testConstructorDeleteIfNullFromPolicyState() {
        OperandPolicy policy = new OperandPolicy();
        policy.setDeleteIfNull(true);

        IThriftPool pool = Mockito.mock(IThriftPool.class);
        Mockito.when(pool.getOperandPolicy()).thenReturn(policy);

        Mutator mutator = new Mutator(pool);
        assertTrue("Mutator is not in the expected state", mutator.deleteIfNull);
    }
View Full Code Here

        assertTrue("Mutator is not in the expected state", mutator.deleteIfNull);
    }

    @Test
    public void testConstructorArgs() {
        IThriftPool pool = Mockito.mock(IThriftPool.class);

        Mutator mutator = new Mutator(pool, Long.MAX_VALUE, true, Integer.MAX_VALUE);
        assertEquals("Mutator timestamp is not in the expected state", Long.MAX_VALUE, mutator.timestamp);
        assertTrue("Mutator deleteIfNull is not in the expected state", mutator.deleteIfNull);
        assertEquals("Mutator TTL is not in the expected state", Integer.MAX_VALUE, (int) mutator.ttl);
View Full Code Here

        assertEquals("Mutator TTL is not in the expected state", Integer.MAX_VALUE, (int) mutator.ttl);
    }

    @Test
    public void testNewColumnWithTTL() {
        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"), 1234);

        assertEquals("column name is not in the expected state", Bytes.fromUTF8("a").getBytes(), column.name);
View Full Code Here

        assertEquals("column TTL is not in the expected state", 1234, column.ttl);
    }

    @Test
    public void testNewColumnWithTTLDefaultFromMemberVariable() {
        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"));

        assertEquals("column name is not in the expected state", Bytes.fromUTF8("a").getBytes(), column.name);
View Full Code Here

        assertEquals("column TTL is not in the expected state", Integer.MAX_VALUE, column.ttl);
    }

    @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);
View Full Code Here

TOP

Related Classes of org.scale7.cassandra.pelops.pool.CommonsBackedPool$ConnectionFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.