Search in sources :

Example 16 with CassandraVersion

use of com.datastax.driver.core.utils.CassandraVersion in project java-driver by datastax.

the class IndexMetadataTest method should_allow_multiple_indexes_on_map_column.

@Test(groups = "short")
@CassandraVersion("3.0")
public void should_allow_multiple_indexes_on_map_column() {
    String createEntriesIndex = String.format("CREATE INDEX map_all_entries_index ON %s.indexing (entries(map_all));", keyspace);
    session().execute(createEntriesIndex);
    String createKeysIndex = String.format("CREATE INDEX map_all_keys_index ON %s.indexing (keys(map_all));", keyspace);
    session().execute(createKeysIndex);
    String createValuesIndex = String.format("CREATE INDEX map_all_values_index ON %s.indexing (values(map_all));", keyspace);
    session().execute(createValuesIndex);
    ColumnMetadata column = getColumn("map_all");
    TableMetadata table = (TableMetadata) column.getParent();
    assertThat(getIndex("map_all_entries_index")).hasParent(table).asCqlQuery(createEntriesIndex);
    assertThat(getIndex("map_all_keys_index")).hasParent(table).asCqlQuery(createKeysIndex);
    assertThat(getIndex("map_all_values_index")).hasParent(table).asCqlQuery(createValuesIndex);
}
Also used : ColumnMetadata(com.datastax.driver.core.ColumnMetadata) Test(org.testng.annotations.Test) CassandraVersion(com.datastax.driver.core.utils.CassandraVersion)

Aggregations

CassandraVersion (com.datastax.driver.core.utils.CassandraVersion)16 Test (org.testng.annotations.Test)15 ColumnMetadata (com.datastax.driver.core.ColumnMetadata)8 Row (com.datastax.driver.core.Row)3 ResultSet (com.datastax.driver.core.ResultSet)2 CustomStatement (com.datastax.driver.core.StatementWrapperTest.CustomStatement)1 UnsupportedProtocolVersionException (com.datastax.driver.core.exceptions.UnsupportedProtocolVersionException)1 DseVersion (com.datastax.driver.core.utils.DseVersion)1 Option (com.datastax.driver.mapping.Mapper.Option)1 Pattern (java.util.regex.Pattern)1