当前位置: 首页>>代码示例>>Java>>正文


Java IndexType.KEYS属性代码示例

本文整理汇总了Java中org.apache.cassandra.thrift.IndexType.KEYS属性的典型用法代码示例。如果您正苦于以下问题:Java IndexType.KEYS属性的具体用法?Java IndexType.KEYS怎么用?Java IndexType.KEYS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.cassandra.thrift.IndexType的用法示例。


在下文中一共展示了IndexType.KEYS属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSerializeDeserialize

@Test
public void testSerializeDeserialize() throws Exception
{
    ColumnDefinition cd0 = new ColumnDefinition(ByteBufferUtil.bytes("TestColumnDefinitionName0"),
                                                BytesType.instance,
                                                IndexType.KEYS,
                                                null,
                                                "random index name 0",
                                                null);

    ColumnDefinition cd1 = new ColumnDefinition(ByteBufferUtil.bytes("TestColumnDefinition1"),
                                                LongType.instance,
                                                null,
                                                null,
                                                null,
                                                null);

    testSerializeDeserialize(cd0);
    testSerializeDeserialize(cd1);
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:20,代码来源:ColumnDefinitionTest.java

示例2: testSerializeDeserialize

@Test
public void testSerializeDeserialize() throws Exception
{
    ColumnDefinition cd0 = new ColumnDefinition(ByteBufferUtil.bytes("TestColumnDefinitionName0"),
                                                BytesType.instance,
                                                IndexType.KEYS,
                                                "random index name 0");

    ColumnDefinition cd1 = new ColumnDefinition(ByteBufferUtil.bytes("TestColumnDefinition1"),
                                                LongType.instance,
                                                null,
                                                null);

    testSerializeDeserialize(cd0);
    testSerializeDeserialize(cd1);
}
 
开发者ID:devdattakulkarni,项目名称:Cassandra-KVPM,代码行数:16,代码来源:ColumnDefinitionTest.java

示例3: testThriftConversion

@Test
public void testThriftConversion() throws Exception
{
    CfDef cfDef = new CfDef().setDefault_validation_class(AsciiType.class.getCanonicalName())
                             .setComment("Test comment")
                             .setColumn_metadata(columnDefs)
                             .setKeyspace(KEYSPACE)
                             .setName(COLUMN_FAMILY);

    // convert Thrift to CFMetaData
    CFMetaData cfMetaData = CFMetaData.fromThrift(cfDef);

    CfDef thriftCfDef = new CfDef();
    thriftCfDef.keyspace = KEYSPACE;
    thriftCfDef.name = COLUMN_FAMILY;
    thriftCfDef.default_validation_class = cfDef.default_validation_class;
    thriftCfDef.comment = cfDef.comment;
    thriftCfDef.column_metadata = new ArrayList<ColumnDef>();
    for (ColumnDef columnDef : columnDefs)
    {
        ColumnDef c = new ColumnDef();
        c.name = ByteBufferUtil.clone(columnDef.name);
        c.validation_class = columnDef.getValidation_class();
        c.index_name = columnDef.getIndex_name();
        c.index_type = IndexType.KEYS;
        thriftCfDef.column_metadata.add(c);
    }

    CfDef converted = cfMetaData.toThrift();

    assertEquals(thriftCfDef.keyspace, converted.keyspace);
    assertEquals(thriftCfDef.name, converted.name);
    assertEquals(thriftCfDef.default_validation_class, converted.default_validation_class);
    assertEquals(thriftCfDef.comment, converted.comment);
    assertEquals(new HashSet<>(thriftCfDef.column_metadata), new HashSet<>(converted.column_metadata));
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:36,代码来源:CFMetaDataTest.java

示例4: testThriftConversion

@Test
public void testThriftConversion() throws Exception
{
    CfDef cfDef = new CfDef().setDefault_validation_class(AsciiType.class.getCanonicalName())
                             .setComment("Test comment")
                             .setColumn_metadata(columnDefs)
                             .setKeyspace(KEYSPACE)
                             .setName(COLUMN_FAMILY);

    // convert Thrift to CFMetaData
    CFMetaData cfMetaData = CFMetaData.fromThrift(cfDef);

    CfDef thriftCfDef = new CfDef();
    thriftCfDef.keyspace = KEYSPACE;
    thriftCfDef.name = COLUMN_FAMILY;
    thriftCfDef.default_validation_class = cfDef.default_validation_class;
    thriftCfDef.comment = cfDef.comment;
    thriftCfDef.column_metadata = new ArrayList<ColumnDef>();
    for (ColumnDef columnDef : columnDefs)
    {
        ColumnDef c = new ColumnDef();
        c.name = ByteBufferUtil.clone(columnDef.name);
        c.validation_class = columnDef.getValidation_class();
        c.index_name = columnDef.getIndex_name();
        c.index_type = IndexType.KEYS;
        thriftCfDef.column_metadata.add(c);
    }

    CfDef converted = cfMetaData.toThrift();

    assertEquals(thriftCfDef.keyspace, converted.keyspace);
    assertEquals(thriftCfDef.name, converted.name);
    assertEquals(thriftCfDef.default_validation_class, converted.default_validation_class);
    assertEquals(thriftCfDef.comment, converted.comment);
    assertEquals(thriftCfDef.column_metadata, converted.column_metadata);
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:36,代码来源:CFMetaDataTest.java

示例5: testThriftConversion

@Test
public void testThriftConversion() throws Exception
{
    CfDef cfDef = new CfDef().setDefault_validation_class(AsciiType.class.getCanonicalName())
                             .setComment("Test comment")
                             .setColumn_metadata(columnDefs)
                             .setKeyspace(KEYSPACE1)
                             .setName(CF_STANDARD1);

    // convert Thrift to CFMetaData
    CFMetaData cfMetaData = ThriftConversion.fromThrift(cfDef);

    CfDef thriftCfDef = new CfDef();
    thriftCfDef.keyspace = KEYSPACE1;
    thriftCfDef.name = CF_STANDARD1;
    thriftCfDef.default_validation_class = cfDef.default_validation_class;
    thriftCfDef.comment = cfDef.comment;
    thriftCfDef.column_metadata = new ArrayList<>();
    for (ColumnDef columnDef : columnDefs)
    {
        ColumnDef c = new ColumnDef();
        c.name = ByteBufferUtil.clone(columnDef.name);
        c.validation_class = columnDef.getValidation_class();
        c.index_name = columnDef.getIndex_name();
        c.index_type = IndexType.KEYS;
        thriftCfDef.column_metadata.add(c);
    }

    CfDef converted = ThriftConversion.toThrift(cfMetaData);

    assertEquals(thriftCfDef.keyspace, converted.keyspace);
    assertEquals(thriftCfDef.name, converted.name);
    assertEquals(thriftCfDef.default_validation_class, converted.default_validation_class);
    assertEquals(thriftCfDef.comment, converted.comment);
    assertEquals(new HashSet<>(thriftCfDef.column_metadata), new HashSet<>(converted.column_metadata));
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:36,代码来源:SchemaKeyspaceTest.java

示例6: testThriftConversion

@Test
public void testThriftConversion() throws Exception
{
    CfDef cfDef = new CfDef().setDefault_validation_class(AsciiType.class.getCanonicalName())
                             .setComment("Test comment")
                             .setColumn_metadata(columnDefs)
                             .setKeyspace(KEYSPACE1)
                             .setName(CF_STANDARD1);

    // convert Thrift to CFMetaData
    CFMetaData cfMetaData = CFMetaData.fromThrift(cfDef);

    CfDef thriftCfDef = new CfDef();
    thriftCfDef.keyspace = KEYSPACE1;
    thriftCfDef.name = CF_STANDARD1;
    thriftCfDef.default_validation_class = cfDef.default_validation_class;
    thriftCfDef.comment = cfDef.comment;
    thriftCfDef.column_metadata = new ArrayList<ColumnDef>();
    for (ColumnDef columnDef : columnDefs)
    {
        ColumnDef c = new ColumnDef();
        c.name = ByteBufferUtil.clone(columnDef.name);
        c.validation_class = columnDef.getValidation_class();
        c.index_name = columnDef.getIndex_name();
        c.index_type = IndexType.KEYS;
        thriftCfDef.column_metadata.add(c);
    }

    CfDef converted = cfMetaData.toThrift();

    assertEquals(thriftCfDef.keyspace, converted.keyspace);
    assertEquals(thriftCfDef.name, converted.name);
    assertEquals(thriftCfDef.default_validation_class, converted.default_validation_class);
    assertEquals(thriftCfDef.comment, converted.comment);
    assertEquals(new HashSet<>(thriftCfDef.column_metadata), new HashSet<>(converted.column_metadata));
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:36,代码来源:CFMetaDataTest.java

示例7: testThriftToAvroConversion

@Test
public void testThriftToAvroConversion() throws Exception
{
    CfDef cfDef = new CfDef().setDefault_validation_class(AsciiType.class.getCanonicalName())
                             .setComment("Test comment")
                             .setColumn_metadata(columnDefs)
                             .setKeyspace(KEYSPACE)
                             .setName(COLUMN_FAMILY);

    // convert Thrift to CFMetaData
    CFMetaData cfMetaData = CFMetaData.fromThrift(cfDef);

    // make a correct Avro object
    CfDef thriftCfDef = new CfDef();
    thriftCfDef.keyspace = KEYSPACE;
    thriftCfDef.name = COLUMN_FAMILY;
    thriftCfDef.default_validation_class = cfDef.default_validation_class;
    thriftCfDef.comment = cfDef.comment;
    thriftCfDef.column_metadata = new ArrayList<ColumnDef>();
    for (ColumnDef columnDef : columnDefs)
    {
        ColumnDef c = new ColumnDef();
        c.name = ByteBufferUtil.clone(columnDef.name);
        c.validation_class = columnDef.getValidation_class();
        c.index_name = columnDef.getIndex_name();
        c.index_type = IndexType.KEYS;
        thriftCfDef.column_metadata.add(c);
    }

    CfDef converted = cfMetaData.toThrift();

    assertEquals(thriftCfDef.keyspace, converted.keyspace);
    assertEquals(thriftCfDef.name, converted.name);
    assertEquals(thriftCfDef.default_validation_class, converted.default_validation_class);
    assertEquals(thriftCfDef.comment, converted.comment);
    assertEquals(thriftCfDef.column_metadata, converted.column_metadata);
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:37,代码来源:CFMetaDataTest.java

示例8: addColumn

/**
 * adding a column to an column family
 *
 * @throws Exception
 */
@Test
public void addColumn() throws Exception {
	String KEYSPACE = "mock";
	client.set_keyspace(KEYSPACE);
	//
	String COLUMN_FAMILY = "student";
	CfDef cd = getColumnFamily(client, KEYSPACE, COLUMN_FAMILY);

	// column
	String COLUMN = "grad";
	ColumnDef columnDef = new ColumnDef(
			ByteBufferHelper.toByteBuffer(COLUMN), "UTF8Type");
	columnDef.index_type = IndexType.KEYS;
	columnDef.index_name = "ix_" + COLUMN_FAMILY + "_" + COLUMN;
	cd.addToColumn_metadata(columnDef);
	client.system_update_column_family(cd);
	//
	System.out.println("add column [" + COLUMN + "]");// InvalidRequestException(why:Duplicate
														// index name
														// student_grade_idx)

	// column
	COLUMN = "math";
	ColumnDef columnDef2 = new ColumnDef(
			ByteBufferHelper.toByteBuffer(COLUMN), "UTF8Type");
	columnDef2.index_type = IndexType.KEYS;
	columnDef2.index_name = "ix_" + COLUMN_FAMILY + "_" + COLUMN;
	cd.addToColumn_metadata(columnDef2);
	client.system_update_column_family(cd);
	//
	System.out.println("add column [" + COLUMN + "]");

	// column
	COLUMN = "art";
	ColumnDef columnDef3 = new ColumnDef(
			ByteBufferHelper.toByteBuffer(COLUMN), "UTF8Type");
	columnDef3.index_type = IndexType.KEYS;
	columnDef3.index_name = "ix_" + COLUMN_FAMILY + "_" + COLUMN;
	cd.addToColumn_metadata(columnDef3);
	client.system_update_column_family(cd);
	//
	System.out.println("add column [" + COLUMN + "]");
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:48,代码来源:CassandraThriftDDLTest.java


注:本文中的org.apache.cassandra.thrift.IndexType.KEYS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。