Search in sources :

Example 1 with KeyspaceMetadata

use of com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata in project zipkin by openzipkin.

the class ITEnsureSchema method upgradesOldSchema_autocomplete.

@Test
void upgradesOldSchema_autocomplete() {
    Schema.applyCqlFile(storage.keyspace, session(), "/zipkin2-schema.cql");
    Schema.applyCqlFile(storage.keyspace, session(), "/zipkin2-schema-indexes-original.cql");
    Schema.ensureExists(storage.keyspace, true, session());
    KeyspaceMetadata metadata = session().getMetadata().getKeyspace(storage.keyspace).get();
    assertThat(Schema.hasUpgrade1_autocompleteTags(metadata)).isTrue();
}
Also used : KeyspaceMetadata(com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata) Test(org.junit.jupiter.api.Test)

Example 2 with KeyspaceMetadata

use of com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata in project zipkin by openzipkin.

the class ITEnsureSchema method installsTablesWhenMissing.

@Test
void installsTablesWhenMissing() {
    session().execute("CREATE KEYSPACE " + storage.keyspace + " WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'};");
    Schema.ensureExists(storage.keyspace, false, session());
    KeyspaceMetadata metadata = session().getMetadata().getKeyspace(storage.keyspace).get();
    assertThat(metadata.getTable(TABLE_SPAN)).isNotNull();
    assertThat(metadata.getTable(TABLE_DEPENDENCY)).isNotNull();
    for (String searchTable : SEARCH_TABLES) {
        assertThat(metadata.getTable(searchTable)).withFailMessage("Expected to not find " + searchTable).isEmpty();
    }
}
Also used : KeyspaceMetadata(com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata) Test(org.junit.jupiter.api.Test)

Example 3 with KeyspaceMetadata

use of com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata in project zipkin by openzipkin.

the class ITEnsureSchema method upgradesOldSchema_remoteService.

@Test
void upgradesOldSchema_remoteService() {
    Schema.applyCqlFile(storage.keyspace, session(), "/zipkin2-schema.cql");
    Schema.applyCqlFile(storage.keyspace, session(), "/zipkin2-schema-indexes-original.cql");
    Schema.applyCqlFile(storage.keyspace, session(), "/zipkin2-schema-upgrade-1.cql");
    Schema.ensureExists(storage.keyspace, true, session());
    KeyspaceMetadata metadata = session().getMetadata().getKeyspace(storage.keyspace).get();
    assertThat(Schema.hasUpgrade2_remoteService(metadata)).isTrue();
}
Also used : KeyspaceMetadata(com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata) Test(org.junit.jupiter.api.Test)

Example 4 with KeyspaceMetadata

use of com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata in project zipkin by openzipkin.

the class ITEnsureSchema method installsKeyspaceWhenMissing.

@Test
void installsKeyspaceWhenMissing() {
    Schema.ensureExists(storage.keyspace, false, session());
    KeyspaceMetadata metadata = session().getMetadata().getKeyspace(storage.keyspace).get();
    assertThat(metadata).isNotNull();
}
Also used : KeyspaceMetadata(com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata) Test(org.junit.jupiter.api.Test)

Example 5 with KeyspaceMetadata

use of com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata in project zipkin by openzipkin.

the class ITEnsureSchema method installsSearchTablesWhenMissing.

@Test
void installsSearchTablesWhenMissing() {
    session().execute("CREATE KEYSPACE " + storage.keyspace + " WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'};");
    Schema.ensureExists(storage.keyspace, true, session());
    KeyspaceMetadata metadata = session().getMetadata().getKeyspace(storage.keyspace).get();
    for (String searchTable : SEARCH_TABLES) {
        assertThat(metadata.getTable(searchTable)).withFailMessage("Expected to find " + searchTable).isPresent();
    }
}
Also used : KeyspaceMetadata(com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata) Test(org.junit.jupiter.api.Test)

Aggregations

KeyspaceMetadata (com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata)12 Test (org.junit.jupiter.api.Test)5 CqlSession (com.datastax.oss.driver.api.core.CqlSession)3 Metadata (com.datastax.oss.driver.api.core.metadata.Metadata)3 Node (com.datastax.oss.driver.api.core.metadata.Node)3 Test (org.junit.Test)2 UdtValue (com.datastax.oss.driver.api.core.data.UdtValue)1 TableMetadata (com.datastax.oss.driver.api.core.metadata.schema.TableMetadata)1 MutableCodecRegistry (com.datastax.oss.driver.api.core.type.codec.registry.MutableCodecRegistry)1 Resources.resourceToString (zipkin2.storage.cassandra.internal.Resources.resourceToString)1