Package com.datastax.driver.core

Examples of com.datastax.driver.core.KeyspaceMetadata


    @Test
    public void should_exception_when_counter_pk_column_not_matching() {
        // Given
        // Given
        KeyspaceMetadata keyspaceMeta = mock(KeyspaceMetadata.class);
        when(keyspaceMeta.getTable(ACHILLES_COUNTER_TABLE)).thenReturn(tableMetaData);

        ColumnMetadata fqcnColumn = ColumnMetadataBuilder.create(tableMetaData, ACHILLES_COUNTER_FQCN, text());
        ColumnMetadata pkColumn = ColumnMetadataBuilder.create(tableMetaData, ACHILLES_COUNTER_PRIMARY_KEY, text());
        when(tableMetaData.getColumn(ACHILLES_COUNTER_FQCN)).thenReturn(fqcnColumn);
        when(tableMetaData.getColumn(ACHILLES_COUNTER_PRIMARY_KEY)).thenReturn(pkColumn);
View Full Code Here


    }

    @Test
    public void should_exception_when_no_counter_property_column() {
        // Given
        KeyspaceMetadata keyspaceMeta = mock(KeyspaceMetadata.class);
        when(keyspaceMeta.getTable(ACHILLES_COUNTER_TABLE)).thenReturn(tableMetaData);

        ColumnMetadata fqcnColumn = ColumnMetadataBuilder.create(tableMetaData, ACHILLES_COUNTER_FQCN, text());
        ColumnMetadata pkColumn = ColumnMetadataBuilder.create(tableMetaData, ACHILLES_COUNTER_PRIMARY_KEY, text());

        when(tableMetaData.getColumn(ACHILLES_COUNTER_FQCN)).thenReturn(fqcnColumn);
View Full Code Here

    }

    @Test
    public void should_exception_when_counter_property_column_bad_type() {
        // Given
        KeyspaceMetadata keyspaceMeta = mock(KeyspaceMetadata.class);
        when(keyspaceMeta.getTable(ACHILLES_COUNTER_TABLE)).thenReturn(tableMetaData);

        ColumnMetadata fqcnColumn = ColumnMetadataBuilder.create(tableMetaData, ACHILLES_COUNTER_FQCN, text());
        ColumnMetadata pkColumn = ColumnMetadataBuilder.create(tableMetaData, ACHILLES_COUNTER_PRIMARY_KEY, text());
        ColumnMetadata propertyColumn = ColumnMetadataBuilder.create(tableMetaData, ACHILLES_COUNTER_PROPERTY_NAME, inet());
View Full Code Here

    }

    @Test
    public void should_exception_when_counter_property_column_not_matching() {
        // Given
        KeyspaceMetadata keyspaceMeta = mock(KeyspaceMetadata.class);
        when(keyspaceMeta.getTable(ACHILLES_COUNTER_TABLE)).thenReturn(tableMetaData);

        ColumnMetadata fqcnColumn = ColumnMetadataBuilder.create(tableMetaData, ACHILLES_COUNTER_FQCN, text());
        ColumnMetadata pkColumn = ColumnMetadataBuilder.create(tableMetaData, ACHILLES_COUNTER_PRIMARY_KEY, text());
        ColumnMetadata propertyColumn = ColumnMetadataBuilder.create(tableMetaData, ACHILLES_COUNTER_PROPERTY_NAME, text());
View Full Code Here

    }

    @Test
    public void should_exception_when_no_counter_value_column() {
        // Given
        KeyspaceMetadata keyspaceMeta = mock(KeyspaceMetadata.class);
        when(keyspaceMeta.getTable(ACHILLES_COUNTER_TABLE)).thenReturn(tableMetaData);

        ColumnMetadata fqcnColumn = ColumnMetadataBuilder.create(tableMetaData, ACHILLES_COUNTER_FQCN, text());
        ColumnMetadata pkColumn = ColumnMetadataBuilder.create(tableMetaData, ACHILLES_COUNTER_PRIMARY_KEY, text());
        ColumnMetadata propertyColumn = ColumnMetadataBuilder.create(tableMetaData, ACHILLES_COUNTER_PROPERTY_NAME, text());
View Full Code Here

    }

    @Test
    public void should_exception_when_counter_value_column_bad_type() {
        // Given
        KeyspaceMetadata keyspaceMeta = mock(KeyspaceMetadata.class);
        when(keyspaceMeta.getTable(ACHILLES_COUNTER_TABLE)).thenReturn(tableMetaData);

        ColumnMetadata fqcnColumn = ColumnMetadataBuilder.create(tableMetaData, ACHILLES_COUNTER_FQCN, text());
        ColumnMetadata pkColumn = ColumnMetadataBuilder.create(tableMetaData, ACHILLES_COUNTER_PRIMARY_KEY, text());
        ColumnMetadata propertyColumn = ColumnMetadataBuilder.create(tableMetaData, ACHILLES_COUNTER_PROPERTY_NAME, text());
        ColumnMetadata counterColumnMeta = ColumnMetadataBuilder.create(tableMetaData, ACHILLES_COUNTER_VALUE, inet());
View Full Code Here

    public void should_fetch_table_meta_from_different_keyspaces() throws Exception {
        //Given
        EntityMeta meta1 = mock(EntityMeta.class, RETURNS_DEEP_STUBS);
        EntityMeta meta2 = mock(EntityMeta.class, RETURNS_DEEP_STUBS);

        KeyspaceMetadata ks1Meta = mock(KeyspaceMetadata.class, RETURNS_DEEP_STUBS);
        KeyspaceMetadata ks2Meta = mock(KeyspaceMetadata.class, RETURNS_DEEP_STUBS);

        TableMetadata tableMeta1 = mock(TableMetadata.class, RETURNS_DEEP_STUBS);
        TableMetadata tableMeta2 = mock(TableMetadata.class, RETURNS_DEEP_STUBS);

        when(meta1.config().getKeyspaceName()).thenReturn("ks1");
        when(meta1.config().getTableName()).thenReturn("table1");
        when(meta1.config().getQualifiedTableName()).thenReturn("ks1.table1");
        when(meta2.config().getKeyspaceName()).thenReturn("ks2");
        when(meta2.config().getTableName()).thenReturn("table2");
        when(meta2.config().getQualifiedTableName()).thenReturn("ks2.table2");

        when(cluster.getMetadata().getKeyspace("ks1")).thenReturn(ks1Meta);
        when(cluster.getMetadata().getKeyspace("ks2")).thenReturn(ks2Meta);

        when(ks1Meta.getTable("table1")).thenReturn(tableMeta1);
        when(ks2Meta.getTable("table2")).thenReturn(tableMeta2);

        //When
        final Map<String, TableMetadata> tableMetaData = reader.fetchTableMetaData(cluster, Arrays.asList(meta1, meta2));

        //Then
View Full Code Here

    @Test
    public void should_return_empty_map_when_table_meta_is_not_found() throws Exception {
        //Given
        EntityMeta meta = mock(EntityMeta.class, RETURNS_DEEP_STUBS);
        KeyspaceMetadata ksMeta = mock(KeyspaceMetadata.class, RETURNS_DEEP_STUBS);

        when(meta.config().getKeyspaceName()).thenReturn("ks");
        when(meta.config().getTableName()).thenReturn("table");
        when(meta.config().getQualifiedTableName()).thenReturn("ks.table");

        when(cluster.getMetadata().getKeyspace("ks")).thenReturn(ksMeta);
        when(ksMeta.getTable("table")).thenReturn(null);


        //When
        assertThat(reader.fetchTableMetaData(cluster, Arrays.asList(meta))).isEmpty();
    }
View Full Code Here

TOP

Related Classes of com.datastax.driver.core.KeyspaceMetadata

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.