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

Examples of info.archinnov.achilles.test.integration.entity.CompleteBean


        assertThat(newBean.getName()).isEqualTo("name");
    }

    @Test
    public void should_persist_with_runtime_consistency_level_overriding_predefined_one() throws Exception {
        CompleteBean entity = builder().randomId().name("name zerferg").buid();

        logAsserter.prepareLogLevel();
        manager.insert(entity, withConsistency(EACH_QUORUM));
        CompleteBean found = manager.find(CompleteBean.class, entity.getId());
        assertThat(found.getName()).isEqualTo("name zerferg");
        logAsserter.assertConsistencyLevels(EACH_QUORUM, ONE);
    }
View Full Code Here


        logAsserter.assertConsistencyLevels(EACH_QUORUM, ONE);
    }

    @Test
    public void should_update_with_runtime_consistency_level_overriding_predefined_one() throws Exception {
        CompleteBean entity = builder().randomId().name("name zeruioze").buid();
        entity = manager.insert(entity);
        entity.setName("zeruioze");

        logAsserter.prepareLogLevel();
        manager.update(entity, withConsistency(EACH_QUORUM));

        CompleteBean found = manager.find(CompleteBean.class, entity.getId());
        assertThat(found.getName()).isEqualTo("zeruioze");
        logAsserter.assertConsistencyLevels(EACH_QUORUM, ONE);
    }
View Full Code Here

    }

    @Test
    public void should_find_with_runtime_consistency_level_overriding_predefined_one() throws Exception {
        boolean exceptionCaught = false;
        CompleteBean entity = builder().randomId().name("name rtprt").buid();
        manager.insert(entity);

        try {
            manager.find(CompleteBean.class, entity.getId(), EACH_QUORUM);
        } catch (InvalidQueryException e) {
            assertThat(e).hasMessage("EACH_QUORUM ConsistencyLevel is only supported for writes");
            exceptionCaught = true;
        }

        assertThat(exceptionCaught).isTrue();

        logAsserter.prepareLogLevel();
        CompleteBean found = manager.find(CompleteBean.class, entity.getId(), ALL);
        assertThat(found.getName()).isEqualTo("name rtprt");
        logAsserter.assertConsistencyLevels(ALL);
    }
View Full Code Here

    }

    @Test
    public void should_refresh_with_runtime_consistency_level_overriding_predefined_one() throws Exception {
        boolean exceptionCaught = false;
        CompleteBean entity = builder().randomId().name("name").buid();
        entity = manager.insert(entity);

        try {
            manager.refresh(entity, EACH_QUORUM);
        } catch (InvalidQueryException e) {
View Full Code Here

        logAsserter.assertConsistencyLevels(ALL);
    }

    @Test
    public void should_delete_with_runtime_consistency_level_overriding_predefined_one() throws Exception {
        CompleteBean entity = builder().randomId().name("name").buid();
        entity = manager.insert(entity);

        logAsserter.prepareLogLevel();
        manager.delete(entity, withConsistency(EACH_QUORUM));
        assertThat(manager.find(CompleteBean.class, entity.getId())).isNull();
        logAsserter.assertConsistencyLevels(EACH_QUORUM,ONE);
    }
View Full Code Here

        logAsserter.assertConsistencyLevels(EACH_QUORUM,ONE);
    }

    @Test
    public void should_reinit_consistency_level_after_exception() throws Exception {
        CompleteBean entity = builder().randomId().name("name qzerferf").buid();
        logAsserter.prepareLogLevel();
        manager.insert(entity, withConsistency(EACH_QUORUM));
        CompleteBean found = manager.find(CompleteBean.class, entity.getId());
        assertThat(found.getName()).isEqualTo("name qzerferf");
        logAsserter.assertConsistencyLevels(EACH_QUORUM, ONE);
    }
View Full Code Here

    @Test
    public void should_update_with_cas_conditions_using_cql3_column_name() throws Exception {
        //Given
        final Long primaryKey = RandomUtils.nextLong(0,Long.MAX_VALUE);
        final CompleteBean entity = new CompleteBean();
        entity.setId(primaryKey);
        entity.setAge(32L);
        entity.setName("John");
        List<String> friends = new ArrayList<>();
        friends.add("Paul");
        entity.setFriends(friends);

        final CompleteBean managed = manager.insert(entity);
        managed.setName("Helen");
        managed.getFriends().add("George");

        //When
        manager.update(managed, ifConditions(new CASCondition("age_in_years", 32L)));

        //Then
        final CompleteBean found = manager.find(CompleteBean.class, primaryKey);

        assertThat(found).isNotNull();
        assertThat(found.getName()).isEqualTo("Helen");
    }
View Full Code Here

    }

    @Test
    public void should_update_set_with_cas_condition() throws Exception {
        //Given
        CompleteBean entity = builder().randomId().name("John").addFollowers("Paul", "Andrew").buid();
        final CompleteBean managed = manager.insert(entity);
        managed.getFollowers().add("Helen");
        managed.getFollowers().remove("Paul");

        //When
        manager.update(managed, ifConditions(new CASCondition("name", "John")).withTtl(100));

        //Then
        final CompleteBean actual = manager.find(CompleteBean.class, entity.getId());
        assertThat(actual.getFollowers()).containsOnly("Helen", "Andrew");
    }
View Full Code Here

     */
    @Ignore
    @Test
    public void should_update_list_at_index_with_cas_condition() throws Exception {
        //Given
        CompleteBean entity = builder().randomId().name("John").addFriends("Paul", "Andrew").buid();
        final CompleteBean managed = manager.insert(entity);
        managed.getFriends().set(0, "Helen");
        managed.getFriends().set(1, null);

        //When
        manager.update(managed, ifConditions(new CASCondition("name", "John")).withTtl(100));

        //Then
        final CompleteBean actual = manager.find(CompleteBean.class, entity.getId());
        assertThat(actual.getFriends()).containsExactly("Helen");
    }
View Full Code Here

                atomicCASResult.compareAndSet(null, casResult);
            }
        };
        Map<String, Object> expectedCurrentValues = ImmutableMap.<String, Object>of("[applied]", false, "name", "John");

        CompleteBean entity = builder().randomId().name("John").addFollowers("Paul", "Andrew").buid();
        final CompleteBean managed = manager.insert(entity);
        managed.getFollowers().add("Helen");

        //When
        manager.update(managed, ifConditions(new CASCondition("name", "Helen")).casResultListener(listener));

        //Then
View Full Code Here

TOP

Related Classes of info.archinnov.achilles.test.integration.entity.CompleteBean

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.