Search in sources :

Example 6 with DefaultKeyspaceMetadata

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

the class SchemaRefreshTest method should_detect_created_keyspace.

@Test
public void should_detect_created_keyspace() {
    DefaultKeyspaceMetadata ks2 = newKeyspace("ks2", true);
    SchemaRefresh refresh = new SchemaRefresh(ImmutableMap.of(OLD_KS1.getName(), OLD_KS1, ks2.getName(), ks2));
    MetadataRefresh.Result result = refresh.compute(oldMetadata, false, context);
    assertThat(result.newMetadata.getKeyspaces()).hasSize(2);
    assertThat(result.events).containsExactly(KeyspaceChangeEvent.created(ks2));
}
Also used : DefaultKeyspaceMetadata(com.datastax.oss.driver.internal.core.metadata.schema.DefaultKeyspaceMetadata) MetadataRefresh(com.datastax.oss.driver.internal.core.metadata.MetadataRefresh) Test(org.junit.Test)

Aggregations

DefaultKeyspaceMetadata (com.datastax.oss.driver.internal.core.metadata.schema.DefaultKeyspaceMetadata)6 UserDefinedType (com.datastax.oss.driver.api.core.type.UserDefinedType)4 MetadataRefresh (com.datastax.oss.driver.internal.core.metadata.MetadataRefresh)4 Test (org.junit.Test)4 CqlIdentifier (com.datastax.oss.driver.api.core.CqlIdentifier)2 UserDefinedTypeBuilder (com.datastax.oss.driver.internal.core.type.UserDefinedTypeBuilder)2