Search in sources :

Example 36 with AdminRow

use of com.datastax.oss.driver.internal.core.adminrequest.AdminRow in project java-driver by datastax.

the class SchemaParserTestBase method mockTypeRow.

protected static AdminRow mockTypeRow(String keyspace, String name, List<String> fieldNames, List<String> fieldTypes) {
    AdminRow row = mock(AdminRow.class);
    when(row.getString("keyspace_name")).thenReturn(keyspace);
    when(row.getString("type_name")).thenReturn(name);
    when(row.getListOfString("field_names")).thenReturn(fieldNames);
    when(row.getListOfString("field_types")).thenReturn(fieldTypes);
    return row;
}
Also used : AdminRow(com.datastax.oss.driver.internal.core.adminrequest.AdminRow)

Example 37 with AdminRow

use of com.datastax.oss.driver.internal.core.adminrequest.AdminRow in project java-driver by datastax.

the class SchemaParserTestBase method mockModernTableRow.

protected static AdminRow mockModernTableRow(String keyspace, String name) {
    AdminRow row = mock(AdminRow.class);
    when(row.contains("flags")).thenReturn(true);
    when(row.contains("table_name")).thenReturn(true);
    when(row.getString("keyspace_name")).thenReturn(keyspace);
    when(row.getString("table_name")).thenReturn(name);
    when(row.getSetOfString("flags")).thenReturn(ImmutableSet.of("compound"));
    when(row.isString("caching")).thenReturn(false);
    when(row.get("caching", RelationParser.MAP_OF_TEXT_TO_TEXT)).thenReturn(ImmutableMap.of("keys", "ALL", "rows_per_partition", "NONE"));
    when(row.get("compaction", RelationParser.MAP_OF_TEXT_TO_TEXT)).thenReturn(ImmutableMap.of("class", "org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy", "mock_option", "1"));
    return row;
}
Also used : AdminRow(com.datastax.oss.driver.internal.core.adminrequest.AdminRow)

Example 38 with AdminRow

use of com.datastax.oss.driver.internal.core.adminrequest.AdminRow in project java-driver by datastax.

the class SchemaParserTestBase method mockViewRow.

protected static AdminRow mockViewRow(String keyspaceName, String viewName, String baseTableName, boolean includeAllColumns, String whereClause) {
    AdminRow row = mock(AdminRow.class);
    when(row.getString("keyspace_name")).thenReturn(keyspaceName);
    when(row.getString("view_name")).thenReturn(viewName);
    when(row.getString("base_table_name")).thenReturn(baseTableName);
    when(row.getBoolean("include_all_columns")).thenReturn(includeAllColumns);
    when(row.getString("where_clause")).thenReturn(whereClause);
    return row;
}
Also used : AdminRow(com.datastax.oss.driver.internal.core.adminrequest.AdminRow)

Example 39 with AdminRow

use of com.datastax.oss.driver.internal.core.adminrequest.AdminRow in project java-driver by datastax.

the class SchemaParserTestBase method mockModernColumnRow.

protected static AdminRow mockModernColumnRow(String keyspaceName, String tableName, String name, String kind, String dataType, String clusteringOrder, Integer position) {
    AdminRow row = mock(AdminRow.class);
    when(row.contains("kind")).thenReturn(true);
    when(row.contains("position")).thenReturn(true);
    when(row.contains("clustering_order")).thenReturn(true);
    when(row.getString("keyspace_name")).thenReturn(keyspaceName);
    when(row.getString("table_name")).thenReturn(tableName);
    when(row.getString("column_name")).thenReturn(name);
    when(row.getString("kind")).thenReturn(kind);
    when(row.getString("type")).thenReturn(dataType);
    when(row.getInteger("position")).thenReturn(position);
    when(row.getString("clustering_order")).thenReturn(clusteringOrder);
    return row;
}
Also used : AdminRow(com.datastax.oss.driver.internal.core.adminrequest.AdminRow)

Example 40 with AdminRow

use of com.datastax.oss.driver.internal.core.adminrequest.AdminRow in project java-driver by datastax.

the class SchemaParserTestBase method mockModernKeyspaceRow.

protected static AdminRow mockModernKeyspaceRow(String keyspaceName) {
    AdminRow row = mock(AdminRow.class);
    when(row.getString("keyspace_name")).thenReturn(keyspaceName);
    when(row.getBoolean("durable_writes")).thenReturn(true);
    when(row.contains("strategy_class")).thenReturn(false);
    when(row.getMapOfStringToString("replication")).thenReturn(ImmutableMap.of("class", "org.apache.cassandra.locator.SimpleStrategy", "replication_factor", "1"));
    return row;
}
Also used : AdminRow(com.datastax.oss.driver.internal.core.adminrequest.AdminRow)

Aggregations

AdminRow (com.datastax.oss.driver.internal.core.adminrequest.AdminRow)43 Test (org.junit.Test)12 CqlIdentifier (com.datastax.oss.driver.api.core.CqlIdentifier)7 Optional (java.util.Optional)6 ImmutableMap (com.datastax.oss.driver.shaded.guava.common.collect.ImmutableMap)5 UnknownHostException (java.net.UnknownHostException)3 UUID (java.util.UUID)3 ClusteringOrder (com.datastax.oss.driver.api.core.metadata.schema.ClusteringOrder)2 ColumnMetadata (com.datastax.oss.driver.api.core.metadata.schema.ColumnMetadata)2 IndexMetadata (com.datastax.oss.driver.api.core.metadata.schema.IndexMetadata)2 KeyspaceMetadata (com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata)2 TableMetadata (com.datastax.oss.driver.api.core.metadata.schema.TableMetadata)2 DataType (com.datastax.oss.driver.api.core.type.DataType)2 SchemaRefresh (com.datastax.oss.driver.internal.core.metadata.schema.refresh.SchemaRefresh)2 ImmutableList (com.datastax.oss.driver.shaded.guava.common.collect.ImmutableList)2 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)2 InetSocketAddress (java.net.InetSocketAddress)2 DseColumnMetadata (com.datastax.dse.driver.api.core.metadata.schema.DseColumnMetadata)1 DseIndexMetadata (com.datastax.dse.driver.api.core.metadata.schema.DseIndexMetadata)1 DseKeyspaceMetadata (com.datastax.dse.driver.api.core.metadata.schema.DseKeyspaceMetadata)1