Package info.archinnov.achilles.test.integration.entity

Examples of info.archinnov.achilles.test.integration.entity.ClusteredEntity$ClusteredKey


                .forIteration()
                .withPartitionComponents(partitionKey)
                .iterator();

        assertThat(iter.hasNext()).isTrue();
        ClusteredEntity next = iter.next();
        assertThat(next.getId().getCount()).isEqualTo(1);
        assertThat(next.getId().getName()).isEqualTo("name11");
        assertThat(next.getValue()).isEqualTo("value11");

        assertThat(iter.hasNext()).isTrue();
        next = iter.next();
        assertThat(next.getId().getCount()).isEqualTo(1);
        assertThat(next.getId().getName()).isEqualTo("name12");
        assertThat(next.getValue()).isEqualTo("value12");

        assertThat(iter.hasNext()).isTrue();
        next = iter.next();
        assertThat(next.getId().getCount()).isEqualTo(1);
        assertThat(next.getId().getName()).isEqualTo("name13");
        assertThat(next.getValue()).isEqualTo("value13");

        assertThat(iter.hasNext()).isTrue();
        next = iter.next();
        assertThat(next.getId().getCount()).isEqualTo(1);
        assertThat(next.getId().getName()).isEqualTo("name14");
        assertThat(next.getValue()).isEqualTo("value14");

        assertThat(iter.hasNext()).isTrue();
        next = iter.next();
        assertThat(next.getId().getCount()).isEqualTo(1);
        assertThat(next.getId().getName()).isEqualTo("name15");
        assertThat(next.getValue()).isEqualTo("value15");

        assertThat(iter.hasNext()).isFalse();
    }
View Full Code Here


                .forIteration()
                .withPartitionComponents(partitionKey)
                .iterator();

        iter.hasNext();
        ClusteredEntity clusteredEntity = iter.next();

        // Check for update
        clusteredEntity.setValue("dirty");
        manager.update(clusteredEntity);

        ClusteredEntity check = manager.find(ClusteredEntity.class, clusteredEntity.getId());
        assertThat(check.getValue()).isEqualTo("dirty");

        // Check for refresh
        check.setValue("dirty_again");
        manager.update(check);

        manager.refresh(clusteredEntity);
        assertThat(clusteredEntity.getValue()).isEqualTo("dirty_again");
View Full Code Here

        assertThat(iter.hasNext()).isTrue();
        assertThat(iter.next().getValue()).isEqualTo("value15");

        assertThat(iter.hasNext()).isTrue();
        final ClusteredEntity next = iter.next();
        assertThat(next.getId().getName()).isEqualTo("name21");
        assertThat(next.getValue()).isEqualTo("value11");

        assertThat(iter.hasNext()).isFalse();
    }
View Full Code Here

                .limit(100)
                .iterator(2);

        //Then
        assertThat(iterator.hasNext()).isTrue();
        ClusteredEntity next = iterator.next();
        assertThat(next.getId().getName()).isEqualTo("name11");
        assertThat(next.getValue()).isEqualTo("value11");

        assertThat(iterator.hasNext()).isTrue();
        next = iterator.next();
        assertThat(next.getId().getName()).isEqualTo("name12");
        assertThat(next.getValue()).isEqualTo("value12");

        assertThat(iterator.hasNext()).isTrue();
        next = iterator.next();
        assertThat(next.getId().getName()).isEqualTo("name13");
        assertThat(next.getValue()).isEqualTo("value13");

        assertThat(iterator.hasNext()).isTrue();
        next = iterator.next();
        assertThat(next.getId().getName()).isEqualTo("name41");
        assertThat(next.getValue()).isEqualTo("value11");

        assertThat(iterator.hasNext()).isFalse();
    }
View Full Code Here

                .orderByDescending()
                .iteratorWithMatching(1);

        //Then
        assertThat(iterator.hasNext()).isTrue();
        ClusteredEntity next = iterator.next();
        assertThat(next.getId().getName()).isEqualTo("name13");
        assertThat(next.getValue()).isEqualTo("value13");

        assertThat(iterator.hasNext()).isTrue();
        next = iterator.next();
        assertThat(next.getId().getName()).isEqualTo("name12");
        assertThat(next.getValue()).isEqualTo("value12");

        assertThat(iterator.hasNext()).isTrue();
        next = iterator.next();
        assertThat(next.getId().getName()).isEqualTo("name11");
        assertThat(next.getValue()).isEqualTo("value11");


        assertThat(iterator.hasNext()).isFalse();
    }
View Full Code Here

        }
    }

    private void insertClusteredEntity(Long partitionKey, int count, String name, String clusteredValue) {
        ClusteredEntity.ClusteredKey embeddedId = new ClusteredEntity.ClusteredKey(partitionKey, count, name);
        ClusteredEntity entity = new ClusteredEntity(embeddedId, clusteredValue);
        manager.insert(entity);
    }
View Full Code Here

    @Test
    public void should_return_first_clustered_entity_for_typed_query_with_select_star() throws Exception {
        Long id = RandomUtils.nextLong(0,Long.MAX_VALUE);

        ClusteredEntity entity = new ClusteredEntity(id, 10, "name", "value");
        manager.insert(entity);

        RegularStatement statement = select().from(TABLE_NAME).limit(3);
        ClusteredEntity actual = manager.typedQuery(ClusteredEntity.class, statement).getFirst();

        assertThat(actual).isNotNull();
        assertThat(actual).isInstanceOf(Factory.class);

        ClusteredKey clusteredKey = actual.getId();

        assertThat(clusteredKey).isNotNull();
        assertThat(clusteredKey.getId()).isEqualTo(id);
        assertThat(clusteredKey.getCount()).isEqualTo(10);
        assertThat(clusteredKey.getName()).isEqualTo("name");
View Full Code Here

    @Test
    public void should_return_first_raw_clustered_entity_for_raw_query_with_simple_select() throws Exception {
        Long id = RandomUtils.nextLong(0,Long.MAX_VALUE);

        ClusteredEntity entity = new ClusteredEntity(id, 10, "name", "value");
        manager.insert(entity);

        RegularStatement statement = select("id","count","name","value").from(TABLE_NAME).limit(3);
        ClusteredEntity actual = manager.rawTypedQuery(ClusteredEntity.class, statement).getFirst();

        assertThat(actual).isNotNull();

        ClusteredKey clusteredKey = actual.getId();

        assertThat(clusteredKey).isNotNull();
        assertThat(clusteredKey.getId()).isEqualTo(id);
        assertThat(clusteredKey.getCount()).isEqualTo(10);
        assertThat(clusteredKey.getName()).isEqualTo("name");
View Full Code Here

        // Given
        Long id = RandomUtils.nextLong(0,Long.MAX_VALUE);
        Integer count = RandomUtils.nextInt(0,Integer.MAX_VALUE);
        String name = RandomStringUtils.randomAlphabetic(10);
        String value = "value_before_load";
        ClusteredEntity entity = new ClusteredEntity(id, count, name, value);

        manager3.insert(entity);

        // When
        final List<ClusteredEntity> clusteredEntities = manager3.sliceQuery(ClusteredEntity.class)
View Full Code Here

  @Test
  public void should_persist_and_find() throws Exception {
    compoundKey = new ClusteredKey(RandomUtils.nextLong(0,Long.MAX_VALUE), RandomUtils.nextInt(0,Integer.MAX_VALUE), "name");

    entity = new ClusteredEntity(compoundKey, "clustered_value");

    manager.insert(entity);

    ClusteredEntity found = manager.find(ClusteredEntity.class, compoundKey);

    assertThat(found.getId()).isEqualTo(compoundKey);
    assertThat(found.getValue()).isEqualTo("clustered_value");
  }
View Full Code Here

TOP

Related Classes of info.archinnov.achilles.test.integration.entity.ClusteredEntity$ClusteredKey

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.