Examples of ClusteredKeyForCounter


Examples of info.archinnov.achilles.test.integration.entity.ClusteredEntityWithStaticCounter.ClusteredKeyForCounter

    public void should_query_static_counter_column() throws Exception {
        //Given
        Long partitionKey = RandomUtils.nextLong(0,Long.MAX_VALUE);
        Counter version = CounterBuilder.incr();

        ClusteredEntityWithStaticCounter count1 = new ClusteredEntityWithStaticCounter(new ClusteredKeyForCounter(partitionKey, "count1"), version, CounterBuilder.incr(11));
        ClusteredEntityWithStaticCounter count2 = new ClusteredEntityWithStaticCounter(new ClusteredKeyForCounter(partitionKey, "count2"), null, CounterBuilder.incr(12));

        //When
        manager.insert(count1);
        manager.insert(count2);

        //Then
        List<ClusteredEntityWithStaticCounter> found = manager.sliceQuery(ClusteredEntityWithStaticCounter.class)
                .forSelect()
                .withPartitionComponents(partitionKey)
                .get(100);

        assertThat(found).hasSize(2);
        final ClusteredEntityWithStaticCounter foundCount1 = found.get(0);
        final ClusteredEntityWithStaticCounter foundCount2 = found.get(1);

        assertThat(foundCount1.getCount().get()).isEqualTo(11L);
        assertThat(foundCount2.getCount().get()).isEqualTo(12L);

        ClusteredEntityWithStaticCounter count3 = new ClusteredEntityWithStaticCounter(new ClusteredKeyForCounter(partitionKey, "count3"), version, CounterBuilder.incr(13));
        manager.insert(count3);

        found = manager.sliceQuery(ClusteredEntityWithStaticCounter.class)
                .forSelect()
                .withPartitionComponents(partitionKey)
View Full Code Here

Examples of info.archinnov.achilles.test.integration.entity.ClusteredEntityWithStaticCounter.ClusteredKeyForCounter

    public void should_update_static_counter_and_non_static_counter_column() throws Exception {
        //Given
        Long partitionKey = RandomUtils.nextLong(0,Long.MAX_VALUE);
        Counter version = CounterBuilder.incr(1L);
        final Counter count = CounterBuilder.incr(11);
        ClusteredEntityWithStaticCounter entity = new ClusteredEntityWithStaticCounter(new ClusteredKeyForCounter(partitionKey, "count1"), version, count);

        //When
        final ClusteredEntityWithStaticCounter managed = manager.insert(entity);
        managed.getCount().incr(2L);
        manager.update(managed);
View Full Code Here

Examples of info.archinnov.achilles.test.integration.entity.ClusteredEntityWithStaticCounter.ClusteredKeyForCounter

    public void should_lazy_load_static_counter_and_non_static_counter_column() throws Exception {
        //Given
        Long partitionKey = RandomUtils.nextLong(0,Long.MAX_VALUE);
        Counter version = CounterBuilder.incr(1L);
        final Counter count = CounterBuilder.incr(11);
        ClusteredEntityWithStaticCounter entity = new ClusteredEntityWithStaticCounter(new ClusteredKeyForCounter(partitionKey, "count1"), version, count);

        manager.insert(entity);
        //When
        ClusteredEntityWithStaticCounter proxy = manager.getProxy(ClusteredEntityWithStaticCounter.class, entity.getId());
        assertThat(proxy.getCount().get()).isEqualTo(11L);
View Full Code Here

Examples of info.archinnov.achilles.test.integration.entity.ClusteredEntityWithStaticCounter.ClusteredKeyForCounter

    public void should_delete_static_counter_and_non_static_counter_column() throws Exception {
        //Given
        Long partitionKey = RandomUtils.nextLong(0,Long.MAX_VALUE);
        Counter version = CounterBuilder.incr(1L);
        final Counter count = CounterBuilder.incr(11);
        ClusteredEntityWithStaticCounter entity = new ClusteredEntityWithStaticCounter(new ClusteredKeyForCounter(partitionKey, "count1"), version, count);
        final ClusteredEntityWithStaticCounter managed = manager.insert(entity);

        //When
        manager.delete(managed);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.