use of com.datastax.oss.driver.internal.core.metadata.schema.refresh.SchemaRefresh in project java-driver by datastax.
the class SchemaParserTest method should_parse_multiple_keyspaces.
@Test
public void should_parse_multiple_keyspaces() {
SchemaRefresh refresh = (SchemaRefresh) parse(rows -> rows.withKeyspaces(ImmutableList.of(mockModernKeyspaceRow("ks1"), mockModernKeyspaceRow("ks2"))).withTypes(ImmutableList.of(mockTypeRow("ks1", "t1", ImmutableList.of("i"), ImmutableList.of("int")), mockTypeRow("ks2", "t2", ImmutableList.of("i"), ImmutableList.of("int")))));
Map<CqlIdentifier, KeyspaceMetadata> keyspaces = refresh.newKeyspaces;
assertThat(keyspaces).hasSize(2);
KeyspaceMetadata ks1 = keyspaces.get(CqlIdentifier.fromInternal("ks1"));
KeyspaceMetadata ks2 = keyspaces.get(CqlIdentifier.fromInternal("ks2"));
assertThat(ks1.getName().asInternal()).isEqualTo("ks1");
assertThat(ks1.getUserDefinedTypes()).hasSize(1).containsKey(CqlIdentifier.fromInternal("t1"));
assertThat(ks2.getName().asInternal()).isEqualTo("ks2");
assertThat(ks2.getUserDefinedTypes()).hasSize(1).containsKey(CqlIdentifier.fromInternal("t2"));
}
Aggregations