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

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


  @Test
  public void should_persist_with_ttl() 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, OptionsBuilder.withTtl(1));

    assertThat(manager.find(ClusteredEntity.class, compoundKey)).isNotNull();
View Full Code Here


  @Test
  public void should_persist_and_get_proxy() 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.getProxy(ClusteredEntity.class, compoundKey);

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

  }

  @Test
  public void should_update_with_ttl() throws Exception {
    compoundKey = new ClusteredKey(RandomUtils.nextLong(0,Long.MAX_VALUE), RandomUtils.nextInt(0,Integer.MAX_VALUE), "name");
    entity = new ClusteredEntity(compoundKey, "clustered_value");
    entity = manager.insert(entity, OptionsBuilder.withTtl(1));

    assertThat(manager.find(ClusteredEntity.class, compoundKey)).isNotNull();

    Thread.sleep(1000);
View Full Code Here

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

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

    entity = manager.insert(entity);

    entity.setValue("new_clustered_value");
    manager.update(entity);
View Full Code Here

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

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

    entity = manager.insert(entity);

    manager.delete(entity);
View Full Code Here

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

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

    entity = manager.insert(entity);

    manager.deleteById(ClusteredEntity.class, entity.getId());
View Full Code Here

    long partitionKey = RandomUtils.nextLong(0,Long.MAX_VALUE);
    int count = RandomUtils.nextInt(0,Integer.MAX_VALUE);
    String name = "name";
    compoundKey = new ClusteredKey(partitionKey, count, name);

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

    entity = manager.insert(entity);

    session.execute("update " + TABLE_NAME + " set value='new_clustered_value' where id=" + partitionKey
        + " and count=" + count + " and name='" + name + "'");
View Full Code Here

    public void should_check_for_common_operation_on_found_clustered_entity() throws Exception {
        long partitionKey = RandomUtils.nextLong(0,Long.MAX_VALUE);

        insertClusteredValues(partitionKey, 1, "name1", 1);

        ClusteredEntity clusteredEntity = manager.sliceQuery(ClusteredEntity.class)
                .forSelect()
                .withPartitionComponents(partitionKey)
                .orderByAscending()
                .getOne();

        // 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

    }

    @Test
    public void should_get_one() throws Exception {
        long partitionKey = RandomUtils.nextLong(0,Long.MAX_VALUE);
        ClusteredEntity entity = manager.sliceQuery(ClusteredEntity.class)
                .forSelect()
                .withPartitionComponents(partitionKey)
                .orderByAscending()
                .getOne();

        assertThat(entity).isNull();

        insertClusteredValues(partitionKey, 1, "name1", 5);

        entity = manager.sliceQuery(ClusteredEntity.class)
                .forSelect()
                .withPartitionComponents(partitionKey)
                .getOne();

        assertThat(entity.getValue()).isEqualTo("value11");

    }
View Full Code Here

    public void should_get_last_matching() throws Exception {
        long partitionKey = RandomUtils.nextLong(0,Long.MAX_VALUE);

        insertClusteredValues(partitionKey, 1, "name1", 5);

        ClusteredEntity entity = manager.sliceQuery(ClusteredEntity.class)
                .forSelect()
                .withPartitionComponents(partitionKey)
                .orderByDescending()
                .getOne();

        assertThat(entity.getValue()).isEqualTo("value15");

        List<ClusteredEntity> entities = manager.sliceQuery(ClusteredEntity.class)
                .forSelect()
                .withPartitionComponents(partitionKey)
                .orderByDescending()
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.