Package com.netflix.astyanax.ddl

Examples of com.netflix.astyanax.ddl.ColumnFamilyDefinition


  }

  @Override
  public Properties getColumnFamilyProperties(String columnFamily) throws ConnectionException {
        KeyspaceDefinition ksDef = this.describeKeyspace();
        ColumnFamilyDefinition cfDef = ksDef.getColumnFamily(columnFamily);
        if (cfDef == null)
            throw new NotFoundException(String.format("Column family '%s' in keyspace '%s' not found", columnFamily, getKeyspaceName()));
        try {
      return cfDef.getProperties();
    } catch (Exception e) {
      throw new RuntimeException();
    }
  }
View Full Code Here


  }

  @Override
  public SerializerPackage getSerializerPackage(String cfName, boolean ignoreErrors) throws ConnectionException, UnknownComparatorException {
   
    ColumnFamilyDefinition cfDef = describeKeyspace().getColumnFamily(cfName);
    return new SerializerPackageImpl(cfDef, ignoreErrors);
  }
View Full Code Here

    Assert.assertEquals("0.01", String.valueOf(cfProps.get("bloom_filter_fp_chance")));
    Assert.assertEquals("KEYS_ONLY", String.valueOf(cfProps.get("caching")));
    Assert.assertEquals("4", String.valueOf(cfProps.get("min_compaction_threshold")));
    Assert.assertEquals("32", String.valueOf(cfProps.get("max_compaction_threshold")));
   
    ColumnFamilyDefinition cfDef = ksDef.getColumnFamily("testcf1");
    Assert.assertEquals("testcf1", cfDef.getName());
    Assert.assertEquals(0.2, cfDef.getReadRepairChance());
    Assert.assertEquals("KEYS_ONLY", cfDef.getCaching());
    Assert.assertTrue(32 == cfDef.getMaxCompactionThreshold());
    Assert.assertTrue(4 == cfDef.getMinCompactionThreshold());
    Assert.assertEquals(0.01, cfDef.getBloomFilterFpChance());

    cfDef = ksDef.getColumnFamily("testcf2");
    Assert.assertEquals("testcf2", cfDef.getName());
    Assert.assertEquals(0.4, cfDef.getReadRepairChance());
    Assert.assertEquals("KEYS_ONLY", cfDef.getCaching());
    Assert.assertTrue(32 == cfDef.getMaxCompactionThreshold());
    Assert.assertTrue(4 == cfDef.getMinCompactionThreshold());
    Assert.assertEquals(0.01, cfDef.getBloomFilterFpChance());

    List<ColumnFamilyDefinition> cfDefs = ksDef.getColumnFamilyList();
    Assert.assertTrue(2 == cfDefs.size());
   
    cfDef = cfDefs.get(0);
    Assert.assertEquals("testcf1", cfDef.getName());
    Assert.assertEquals(0.2, cfDef.getReadRepairChance());
    Assert.assertEquals("KEYS_ONLY", cfDef.getCaching());
    Assert.assertTrue(32 == cfDef.getMaxCompactionThreshold());
    Assert.assertTrue(4 == cfDef.getMinCompactionThreshold());
    Assert.assertEquals(0.01, cfDef.getBloomFilterFpChance());

    cfDef = cfDefs.get(1);
    Assert.assertEquals("testcf2", cfDef.getName());
    Assert.assertEquals(0.4, cfDef.getReadRepairChance());
    Assert.assertEquals("KEYS_ONLY", cfDef.getCaching());
    Assert.assertTrue(32 == cfDef.getMaxCompactionThreshold());
    Assert.assertTrue(4 == cfDef.getMinCompactionThreshold());
    Assert.assertEquals(0.01, cfDef.getBloomFilterFpChance());

    keyspace.dropKeyspace();
  }
View Full Code Here

    if (ClusterConfiguration.getDriver().equals(Driver.JAVA_DRIVER)) {
      List<ColumnFamilyDefinition> list = ksDef.getColumnFamilyList();
      Assert.assertTrue(1 == list.size());
   
      ColumnFamilyDefinition cfDef = list.get(0);
      Assert.assertEquals("population", cfDef.getName());
   
      List<ColumnDefinition> colDefs = cfDef.getColumnDefinitionList();
      Assert.assertTrue(7 == colDefs.size());
   
      for (int i=1; i<=5; i++) {
        ColumnDefinition colDef = colDefs.get(i-1);
        Assert.assertEquals("column" + i, colDef.getName());
        Assert.assertNotNull(colDef.getValidationClass());
      }
      ColumnDefinition colDef = colDefs.get(6);
      Assert.assertEquals("value", colDef.getName());
      Assert.assertNotNull(colDef.getValidationClass());
     
      cfDef = ksDef.getColumnFamily("population");
      Assert.assertEquals("population", cfDef.getName());
     
      colDefs = cfDef.getColumnDefinitionList();
      Assert.assertTrue(7 == colDefs.size());
   
      for (int i=1; i<=5; i++) {
        colDef = colDefs.get(i-1);
        Assert.assertEquals("column" + i, colDef.getName());
View Full Code Here

       
        cluster.createColumnFamily(cfProps);
       
        Properties cfProps1 = cluster.getKeyspaceProperties(keyspaceName);
        KeyspaceDefinition ksdef = cluster.describeKeyspace(keyspaceName);
        ColumnFamilyDefinition cfdef = ksdef.getColumnFamily("cf1");
        LOG.info(cfProps1.toString());
       
        LOG.info(cfdef.getProperties().toString());
        Assert.assertEquals(cfProps1.get("cf_defs.cf1.comparator_type"), "org.apache.cassandra.db.marshal.BytesType");
       
    }
View Full Code Here

    }

    @Override
    public Properties getColumnFamilyProperties(String columnFamily) throws ConnectionException {
        KeyspaceDefinition ksDef = this.describeKeyspace();
        ColumnFamilyDefinition cfDef = ksDef.getColumnFamily(columnFamily);
        if (cfDef == null)
            throw new NotFoundException(String.format("Column family '%s' in keyspace '%s' not found", columnFamily, getKeyspaceName()));
       
        Properties props = new Properties();
        ThriftColumnFamilyDefinitionImpl thriftCfDef = (ThriftColumnFamilyDefinitionImpl)cfDef;
View Full Code Here

    }

    @Override
    public Properties getColumnFamilyProperties(String keyspace, String columnFamily) throws ConnectionException {
        KeyspaceDefinition ksDef = this.describeKeyspace(keyspace);
        ColumnFamilyDefinition cfDef = ksDef.getColumnFamily(columnFamily);
        if (cfDef == null)
            throw new NotFoundException(String.format("Column family '%s' in keyspace '%s' not found", columnFamily, keyspace));
       
        Properties props = new Properties();
        ThriftColumnFamilyDefinitionImpl thriftCfDef = (ThriftColumnFamilyDefinitionImpl)cfDef;
View Full Code Here

TOP

Related Classes of com.netflix.astyanax.ddl.ColumnFamilyDefinition

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.