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

Examples of info.archinnov.achilles.test.integration.entity.ValuelessClusteredEntity$CompoundKey


  @Test
  public void should_persist_and_find() throws Exception {
    Long id = RandomUtils.nextLong(0,Long.MAX_VALUE);
    String name = "name";
    CompoundKey compoundKey = new CompoundKey(id, name);
    ValuelessClusteredEntity entity = new ValuelessClusteredEntity(compoundKey);

    manager.insert(entity);

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

    assertThat(found).isNotNull();
  }
View Full Code Here


  @Test
  public void should_persist_and_get_proxy() throws Exception {
    Long id = RandomUtils.nextLong(0,Long.MAX_VALUE);
    String name = "name";
    CompoundKey compoundKey = new CompoundKey(id, name);
    ValuelessClusteredEntity entity = new ValuelessClusteredEntity(compoundKey);

    manager.insert(entity);

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

    assertThat(found).isNotNull();
  }
View Full Code Here

  @Test
  public void should_persist_with_ttl() throws Exception {
    Long id = RandomUtils.nextLong(0,Long.MAX_VALUE);
    String name = "name";
    CompoundKey compoundKey = new CompoundKey(id, name);
    ValuelessClusteredEntity entity = new ValuelessClusteredEntity(compoundKey);

    manager.insert(entity, OptionsBuilder.withTtl(1));

    Thread.sleep(1000);
View Full Code Here

    String name2 = "name2";
    String name3 = "name3";
    String name4 = "name4";
    String name5 = "name5";

    manager.insert(new ValuelessClusteredEntity(new CompoundKey(id, name1)));
    manager.insert(new ValuelessClusteredEntity(new CompoundKey(id, name2)));
    manager.insert(new ValuelessClusteredEntity(new CompoundKey(id, name3)));
    manager.insert(new ValuelessClusteredEntity(new CompoundKey(id, name4)));
    manager.insert(new ValuelessClusteredEntity(new CompoundKey(id, name5)));

    List<ValuelessClusteredEntity> result = manager.sliceQuery(ValuelessClusteredEntity.class)
                .forSelect()
                .withPartitionComponents(id)
        .fromClusterings(name2)
View Full Code Here

    String name2 = "name2";
    String name3 = "name3";
    String name4 = "name4";
    String name5 = "name5";

    manager.insert(new ValuelessClusteredEntity(new CompoundKey(id, name1)));
    manager.insert(new ValuelessClusteredEntity(new CompoundKey(id, name2)));
    manager.insert(new ValuelessClusteredEntity(new CompoundKey(id, name3)));
    manager.insert(new ValuelessClusteredEntity(new CompoundKey(id, name4)));
    manager.insert(new ValuelessClusteredEntity(new CompoundKey(id, name5)));

    Iterator<ValuelessClusteredEntity> iterator = manager.sliceQuery(ValuelessClusteredEntity.class)
                .forIteration()
        .withPartitionComponents(id)
                .fromClusterings(name2)
View Full Code Here

    Long id = RandomUtils.nextLong(0,Long.MAX_VALUE);
    String name1 = "name1";
    String name2 = "name2";
    String name3 = "name3";

    manager.insert(new ValuelessClusteredEntity(new CompoundKey(id, name1)));
    manager.insert(new ValuelessClusteredEntity(new CompoundKey(id, name2)));
    manager.insert(new ValuelessClusteredEntity(new CompoundKey(id, name3)));

    manager.sliceQuery(ValuelessClusteredEntity.class)
                .forDelete()
                .withPartitionComponents(id)
        .deleteMatching(name2);
View Full Code Here

            @Override
            public void processEntry(Database sourceDatabase, Database targetDatabase, Transaction transaction,
                    DatabaseEntry key, DatabaseEntry value)
            {
                CompoundKeyBinding binding = new CompoundKeyBinding();
                CompoundKey originalCompoundKey = binding.entryToObject(key);
                int corruptedOffset = originalCompoundKey.getOffset() + 2;
                CompoundKey corruptedCompoundKey = new CompoundKey(originalCompoundKey.getMessageId(), corruptedOffset);
                DatabaseEntry newKey = new DatabaseEntry();
                binding.objectToEntry(corruptedCompoundKey, newKey);

                _logger.info("Deliberately corrupted message id " + originalCompoundKey.getMessageId()
                        + ", changed offset from " + originalCompoundKey.getOffset() + " to "
                        + corruptedCompoundKey.getOffset());

                deleteCurrent();
                sourceDatabase.put(transaction, newKey, value);

                abort();
View Full Code Here

            @Override
            public void processEntry(Database sourceDatabase, Database targetDatabase, Transaction transaction,
                    DatabaseEntry key, DatabaseEntry value)
            {
                CompoundKeyBinding binding = new CompoundKeyBinding();
                CompoundKey originalCompoundKey = binding.entryToObject(key);
                int corruptedOffset = originalCompoundKey.getOffset() + 2;
                CompoundKey corruptedCompoundKey = new CompoundKey(originalCompoundKey.getMessageId(), corruptedOffset);
                DatabaseEntry newKey = new DatabaseEntry();
                binding.objectToEntry(corruptedCompoundKey, newKey);

                _logger.info("Deliberately corrupted message id " + originalCompoundKey.getMessageId()
                        + ", changed offset from " + originalCompoundKey.getOffset() + " to "
                        + corruptedCompoundKey.getOffset());

                deleteCurrent();
                sourceDatabase.put(transaction, newKey, value);

                abort();
View Full Code Here

            @Override
            public void processEntry(Database sourceDatabase, Database targetDatabase, Transaction transaction,
                    DatabaseEntry key, DatabaseEntry value)
            {
                CompoundKeyBinding binding = new CompoundKeyBinding();
                CompoundKey originalCompoundKey = binding.entryToObject(key);
                int corruptedOffset = originalCompoundKey.getOffset() + 2;
                CompoundKey corruptedCompoundKey = new CompoundKey(originalCompoundKey.getMessageId(), corruptedOffset);
                DatabaseEntry newKey = new DatabaseEntry();
                binding.objectToEntry(corruptedCompoundKey, newKey);

                _logger.info("Deliberately corrupted message id " + originalCompoundKey.getMessageId()
                        + ", changed offset from " + originalCompoundKey.getOffset() + " to "
                        + corruptedCompoundKey.getOffset());

                deleteCurrent();
                sourceDatabase.put(transaction, newKey, value);

                abort();
View Full Code Here

            @Override
            public void processEntry(Database sourceDatabase, Database targetDatabase, Transaction transaction,
                    DatabaseEntry key, DatabaseEntry value)
            {
                CompoundKeyBinding binding = new CompoundKeyBinding();
                CompoundKey originalCompoundKey = binding.entryToObject(key);
                int corruptedOffset = originalCompoundKey.getOffset() + 2;
                CompoundKey corruptedCompoundKey = new CompoundKey(originalCompoundKey.getMessageId(), corruptedOffset);
                DatabaseEntry newKey = new DatabaseEntry();
                binding.objectToEntry(corruptedCompoundKey, newKey);

                _logger.info("Deliberately corrupted message id " + originalCompoundKey.getMessageId()
                        + ", changed offset from " + originalCompoundKey.getOffset() + " to "
                        + corruptedCompoundKey.getOffset());

                deleteCurrent();
                sourceDatabase.put(transaction, newKey, value);

                abort();
View Full Code Here

TOP

Related Classes of info.archinnov.achilles.test.integration.entity.ValuelessClusteredEntity$CompoundKey

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.