Search in sources :

Example 6 with SchemaRows

use of com.datastax.oss.driver.internal.core.metadata.schema.queries.SchemaRows in project java-driver by datastax.

the class TableParserTest method should_parse_modern_tables.

@Test
public void should_parse_modern_tables() {
    SchemaRows rows = modernRows(TABLE_ROW_3_0, COLUMN_ROWS_3_0, INDEX_ROWS_3_0);
    TableParser parser = new TableParser(rows, context);
    TableMetadata table = parser.parseTable(TABLE_ROW_3_0, KEYSPACE_ID, Collections.emptyMap());
    checkTable(table);
    @SuppressWarnings("unchecked") Map<String, String> caching = (Map<String, String>) table.getOptions().get(CqlIdentifier.fromInternal("caching"));
    assertThat(caching).hasSize(2).containsEntry("keys", "ALL").containsEntry("rows_per_partition", "NONE");
}
Also used : TableMetadata(com.datastax.oss.driver.api.core.metadata.schema.TableMetadata) ImmutableMap(com.datastax.oss.driver.shaded.guava.common.collect.ImmutableMap) Map(java.util.Map) CassandraSchemaRows(com.datastax.oss.driver.internal.core.metadata.schema.queries.CassandraSchemaRows) SchemaRows(com.datastax.oss.driver.internal.core.metadata.schema.queries.SchemaRows) Test(org.junit.Test)

Example 7 with SchemaRows

use of com.datastax.oss.driver.internal.core.metadata.schema.queries.SchemaRows in project java-driver by datastax.

the class ViewParserTest method should_skip_when_no_column_rows.

@Test
public void should_skip_when_no_column_rows() {
    SchemaRows rows = rows(VIEW_ROW_3_0, Collections.emptyList());
    ViewParser parser = new ViewParser(rows, context);
    ViewMetadata view = parser.parseView(VIEW_ROW_3_0, KEYSPACE_ID, Collections.emptyMap());
    assertThat(view).isNull();
}
Also used : CassandraSchemaRows(com.datastax.oss.driver.internal.core.metadata.schema.queries.CassandraSchemaRows) SchemaRows(com.datastax.oss.driver.internal.core.metadata.schema.queries.SchemaRows) ViewMetadata(com.datastax.oss.driver.api.core.metadata.schema.ViewMetadata) Test(org.junit.Test)

Aggregations

CassandraSchemaRows (com.datastax.oss.driver.internal.core.metadata.schema.queries.CassandraSchemaRows)7 SchemaRows (com.datastax.oss.driver.internal.core.metadata.schema.queries.SchemaRows)7 Test (org.junit.Test)6 TableMetadata (com.datastax.oss.driver.api.core.metadata.schema.TableMetadata)4 ViewMetadata (com.datastax.oss.driver.api.core.metadata.schema.ViewMetadata)2 ColumnMetadata (com.datastax.oss.driver.api.core.metadata.schema.ColumnMetadata)1 AdminRow (com.datastax.oss.driver.internal.core.adminrequest.AdminRow)1 ImmutableMap (com.datastax.oss.driver.shaded.guava.common.collect.ImmutableMap)1 Map (java.util.Map)1