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

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


  @Test
  public void should_persist_and_find() throws Exception {
    compoundKey = new ClusteredKey(RandomUtils.nextLong(0,Long.MAX_VALUE), "name");
    Holder holder = new Holder("content");
    entity = new ClusteredEntityWithObjectValue(compoundKey, holder);

    manager.insert(entity);

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

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


  @Test
  public void should_persist_and_get_proxy() throws Exception {
    compoundKey = new ClusteredKey(RandomUtils.nextLong(0,Long.MAX_VALUE), "name");
    Holder holder = new Holder("content");
    entity = new ClusteredEntityWithObjectValue(compoundKey, holder);

    manager.insert(entity);

    ClusteredEntityWithObjectValue found = manager.getProxy(ClusteredEntityWithObjectValue.class, compoundKey);

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

  public void should_merge_modifications() throws Exception {

    compoundKey = new ClusteredKey(RandomUtils.nextLong(0,Long.MAX_VALUE), "name");
    Holder holder = new Holder("content");
    Holder newHolder = new Holder("new_content");
    entity = new ClusteredEntityWithObjectValue(compoundKey, holder);

    entity = manager.insert(entity);

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

  @Test
  public void should_delete() throws Exception {
    compoundKey = new ClusteredKey(RandomUtils.nextLong(0,Long.MAX_VALUE), "name");
    Holder holder = new Holder("content");
    entity = new ClusteredEntityWithObjectValue(compoundKey, holder);

    entity = manager.insert(entity);

    manager.delete(entity);
View Full Code Here

    long partitionKey = RandomUtils.nextLong(0,Long.MAX_VALUE);
    compoundKey = new ClusteredKey(partitionKey, "name");
    Holder holder = new Holder("content");
    Holder newHolder = new Holder("new_content");

    entity = new ClusteredEntityWithObjectValue(compoundKey, holder);

    entity = manager.insert(entity);

    session.execute("UPDATE " + TABLE_NAME + " SET value='" + mapper.writeValueAsString(newHolder) + "' where id="
        + partitionKey + " and name='name'");
View Full Code Here

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

    assertThat(iter.hasNext()).isTrue();
    ClusteredEntityWithObjectValue next = iter.next();
    assertThat(next.getId().getId()).isEqualTo(partitionKey);
    assertThat(next.getId().getName()).isEqualTo("name1");
    assertThat(next.getValue().getContent()).isEqualTo("name1");
    assertThat(iter.hasNext()).isTrue();

    assertThat(iter.hasNext()).isTrue();
    next = iter.next();
    assertThat(next.getId().getId()).isEqualTo(partitionKey);
    assertThat(next.getId().getName()).isEqualTo("name2");
    assertThat(next.getValue().getContent()).isEqualTo("name2");

    assertThat(iter.hasNext()).isTrue();
    next = iter.next();
    assertThat(next.getId().getId()).isEqualTo(partitionKey);
    assertThat(next.getId().getName()).isEqualTo("name3");
    assertThat(next.getValue().getContent()).isEqualTo("name3");

    assertThat(iter.hasNext()).isTrue();
    next = iter.next();
    assertThat(next.getId().getId()).isEqualTo(partitionKey);
    assertThat(next.getId().getName()).isEqualTo("name4");
    assertThat(next.getValue().getContent()).isEqualTo("name4");

    assertThat(iter.hasNext()).isTrue();
    next = iter.next();
    assertThat(next.getId().getId()).isEqualTo(partitionKey);
    assertThat(next.getId().getName()).isEqualTo("name5");
    assertThat(next.getValue().getContent()).isEqualTo("name5");
    assertThat(iter.hasNext()).isFalse();
  }
View Full Code Here

    assertThat(entities.get(1).getValue().getContent()).isEqualTo("name3");
  }

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

TOP

Related Classes of info.archinnov.achilles.test.integration.entity.ClusteredEntityWithObjectValue$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.