Package info.archinnov.achilles.test.mapping.entity

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


        // Then
        assertThat(actual).isSameAs(achillesFuturesEntity);
        verify(asyncUtils).maybeAddAsyncListeners(futureEntity, asyncListeners, executorService);

        final CompleteBean actualEntity = rowToEntityCaptor.getValue().apply(row);
        assertThat(actualEntity).isSameAs(entity);

        final List<Function<CompleteBean, CompleteBean>> captured = isoEntityCaptor.getAllValues();
        final CompleteBean applyTriggers = captured.get(0).apply(entity);
        assertThat(applyTriggers).isSameAs(entity);
        verify(meta.forInterception()).intercept(entity, Event.POST_LOAD);

        final CompleteBean proxifiedEntity = captured.get(1).apply(entity);
        assertThat(proxifiedEntity).isSameAs(entity);
    }
View Full Code Here


  public static CompleteBeanTestBuilder builder() {
    return new CompleteBeanTestBuilder();
  }

  public CompleteBean buid() {
    CompleteBean bean = new CompleteBean();

    bean.setId(id);
    bean.setName(name);
    bean.setLabel(label);
    bean.setAge(age);
    bean.setFriends(friends);
    bean.setFollowers(followers);
    bean.setPreferences(preferences);
    return bean;
  }
View Full Code Here

        //Given
        pmf.configContext = configContext;
        ObjectMapper mapper = new ObjectMapper();
        mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
        when(configContext.getMapperFor(CompleteBean.class)).thenReturn(mapper);
        CompleteBean entity = CompleteBeanTestBuilder.builder().id(10L).name("name").buid();

        //When
        final String serialized = pmf.serializeToJSON(entity);

        //Then
View Full Code Here

        ObjectMapper mapper = new ObjectMapper();
        mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
        when(configContext.getMapperFor(CompleteBean.class)).thenReturn(mapper);

        //When
        final CompleteBean actual = pmf.deserializeFromJSON(CompleteBean.class, "{\"id\":10,\"name\":\"name\"}");

        //Then
        assertThat(actual.getId()).isEqualTo(10L);
        assertThat(actual.getName()).isEqualTo("name");
        assertThat(actual.getFriends()).isNull();
        assertThat(actual.getFollowers()).isNull();
        assertThat(actual.getPreferences()).isNull();
    }
View Full Code Here

    @Test
    public void should_exception_when_persist_with_consistency() throws Exception {
        exception.expect(AchillesException.class);
        exception.expectMessage("Runtime custom Consistency Level and/or async listeners cannot be set for batch mode. Please set the Consistency Levels at batch start with 'startBatch(consistencyLevel)' and async listener using endBatch(...)");

        batch.insert(new CompleteBean(), withConsistency(ONE));
    }
View Full Code Here

    @Test
    public void should_exception_when_update_with_consistency() throws Exception {
        exception.expect(AchillesException.class);
        exception.expectMessage("Runtime custom Consistency Level and/or async listeners cannot be set for batch mode. Please set the Consistency Levels at batch start with 'startBatch(consistencyLevel)' and async listener using endBatch(...)");

        batch.update(new CompleteBean(), withConsistency(ONE));
    }
View Full Code Here

    @Test
    public void should_exception_when_delete_with_consistency() throws Exception {
        exception.expect(AchillesException.class);
        exception.expectMessage("Runtime custom Consistency Level and/or async listeners cannot be set for batch mode. Please set the Consistency Levels at batch start with 'startBatch(consistencyLevel)' and async listener using endBatch(...)");

        batch.delete(new CompleteBean(), withConsistency(ONE));
    }
View Full Code Here

    }

    @Test
    public void should_create_new_context_for_entity_with_consistency_and_ttl() throws Exception {
        Long primaryKey = RandomUtils.nextLong(0,Long.MAX_VALUE);
        CompleteBean entity = new CompleteBean(primaryKey);

        when(proxifier.<CompleteBean>deriveBaseClass(entity)).thenReturn(CompleteBean.class);
        when(meta.forOperations().getPrimaryKey(entity)).thenReturn(primaryKey);

        PersistenceContext actual = pmf.newContext(entity, OptionsBuilder.withConsistency(EACH_QUORUM).withTtl(95));
View Full Code Here

    }

    @Test
    public void should_create_new_context_for_entity() throws Exception {
        Long primaryKey = RandomUtils.nextLong(0,Long.MAX_VALUE);
        CompleteBean entity = new CompleteBean(primaryKey);

        when(proxifier.<CompleteBean>deriveBaseClass(entity)).thenReturn(CompleteBean.class);
        when(meta.forOperations().getPrimaryKey(entity)).thenReturn(primaryKey);

        PersistenceContext actual = pmf.newContext(entity);
View Full Code Here

    private Map<Class<?>, EntityMeta> entityMetaMap = new HashMap<>();

    @Test
    public void should_validate_options_for_insert() throws Exception {
        //Given
        CompleteBean entity = new CompleteBean();

        //When
        optionsValidator.validateOptionsForUpsert(entity, entityMetaMap, withTtl(10));

        //Then
View Full Code Here

TOP

Related Classes of info.archinnov.achilles.test.mapping.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.