Package info.archinnov.achilles.schemabuilder.Create.Options

Examples of info.archinnov.achilles.schemabuilder.Create.Options.ClusteringOrder


        for (Field clusteringField : clusteringFields) {
            final Order order = clusteringField.getAnnotation(Order.class);
            final String cqlColumnName = introspector.inferCQLColumnName(clusteringField, context.getClassNamingStrategy());
            validateNotStaticColumn(clusteringField);
            sortOrders.add(new ClusteringOrder(cqlColumnName, order.reversed() ? Sorting.DESC : Sorting.ASC));
        }

        return sortOrders;

    }
View Full Code Here


        PropertyMeta longColPM = PropertyMetaTestBuilder.valueClass(Long.class).type(SIMPLE).cqlColumnName("longcol").build();

        PropertyMeta idMeta = PropertyMetaTestBuilder.valueClass(EmbeddedKey.class)
                .type(EMBEDDED_ID).propertyName("compound")
                .partitionKeyMetas(idPM).clusteringKeyMetas(namePM)
                .clusteringOrders(new ClusteringOrder("name", Sorting.DESC))
                .build();

        when(meta.structure().isClusteredCounter()).thenReturn(false);
        when(meta.getAllMetasExceptIdAndCounters()).thenReturn(asList(longColPM));
        when(meta.getIdMeta()).thenReturn(idMeta);
View Full Code Here

        PropertyMeta namePM = PropertyMetaTestBuilder.valueClass(String.class).type(SIMPLE).cqlColumnName("name").build();

        PropertyMeta idMeta = PropertyMetaTestBuilder.valueClass(EmbeddedKey.class)
                .type(EMBEDDED_ID).propertyName("compound")
                .partitionKeyMetas(idPM).clusteringKeyMetas(namePM)
                .clusteringOrders(new ClusteringOrder("name", Sorting.DESC))
                .build();
        PropertyMeta counterColPM = PropertyMetaTestBuilder.keyValueClass(Void.class, Counter.class).type(COUNTER).cqlColumnName("countercol").build();

        when(meta.getIdMeta()).thenReturn(idMeta);
        when(meta.structure().isClusteredCounter()).thenReturn(true);
View Full Code Here

    }

    @Test
    public void should_get_clustering_order() throws Exception {
        //Given
        ClusteringOrder clusteringOrder = new ClusteringOrder("name", Sorting.DESC);
        when(meta.getIdMeta().forSliceQuery().getClusteringOrder()).thenReturn(clusteringOrder);

        //When
        final ClusteringOrder actual = view.getClusteringOrderForSliceQuery();

        //Then
        assertThat(actual).isSameAs(clusteringOrder);
    }
View Full Code Here

        final ClusteringComponents clusteringComponents = props.getClusteringComponents();
        assertThat(clusteringComponents.getComponentClasses()).containsExactly(int.class);
        assertThat(clusteringComponents.getComponentFields()).containsExactly(rankField);
        assertThat(clusteringComponents.getComponentNames()).containsExactly("rank");
        assertThat(clusteringComponents.getCQL3ComponentNames()).containsExactly("rank");
        assertThat(clusteringComponents.getClusteringOrders()).containsExactly(new ClusteringOrder("rank", Sorting.ASC));
    }
View Full Code Here

        final ClusteringComponents clusteringComponents = props.getClusteringComponents();
        assertThat(clusteringComponents.getComponentClasses()).containsExactly(int.class, int.class);
        assertThat(clusteringComponents.getComponentFields()).containsExactly(rankField, countField);
        assertThat(clusteringComponents.getComponentNames()).containsExactly("rank", "count");
        assertThat(clusteringComponents.getCQL3ComponentNames()).containsExactly("rank", "count");
        assertThat(clusteringComponents.getClusteringOrders()).containsExactly(new ClusteringOrder("rank", Sorting.DESC), new ClusteringOrder("count", Sorting.DESC));
    }
View Full Code Here

        final ClusteringComponents clusteringComponents = props.getClusteringComponents();
        assertThat(clusteringComponents.getComponentClasses()).containsExactly(UUID.class);
        assertThat(clusteringComponents.getComponentFields()).containsExactly(dateField);
        assertThat(clusteringComponents.getComponentNames()).containsExactly("date");
        assertThat(clusteringComponents.getCQL3ComponentNames()).containsExactly("date");
        assertThat(clusteringComponents.getClusteringOrders()).containsExactly(new ClusteringOrder("date", Sorting.ASC));

    }
View Full Code Here

        final ClusteringComponents clusteringComponents = props.getClusteringComponents();
        assertThat(clusteringComponents.getComponentClasses()).containsExactly(Long.class);
        assertThat(clusteringComponents.getComponentFields()).containsExactly(clusteringKeyField);
        assertThat(clusteringComponents.getComponentNames()).containsExactly("clustering");
        assertThat(clusteringComponents.getCQL3ComponentNames()).containsExactly("clustering_key");
        assertThat(clusteringComponents.getClusteringOrders()).containsExactly(new ClusteringOrder("clustering_key", Sorting.ASC));
    }
View Full Code Here

        final ClusteringComponents clusteringComponents = props.getClusteringComponents();
        assertThat(clusteringComponents.getComponentClasses()).containsExactly(UUID.class);
        assertThat(clusteringComponents.getComponentFields()).containsExactly(clusteringKeyField);
        assertThat(clusteringComponents.getComponentNames()).containsExactly("clustering");
        assertThat(clusteringComponents.getCQL3ComponentNames()).containsExactly("clustering_key");
        assertThat(clusteringComponents.getClusteringOrders()).containsExactly(new ClusteringOrder("clustering_key", Sorting.ASC));
    }
View Full Code Here

    }

    @Test
    public void should_get_clustering_order() throws Exception {
        //Given
        ClusteringOrder clusteringOrder = new ClusteringOrder("column", Sorting.DESC);
        when(meta.structure().isClustered()).thenReturn(true);
        when(meta.getEmbeddedIdProperties().getClusteringComponents().getClusteringOrders()).thenReturn(Arrays.asList(clusteringOrder));

        //When
        final ClusteringOrder actual = view.getClusteringOrder();

        //Then
        assertThat(actual).isSameAs(clusteringOrder);
    }
View Full Code Here

TOP

Related Classes of info.archinnov.achilles.schemabuilder.Create.Options.ClusteringOrder

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.