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

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


    }

    @Test
    public void should_apply_right_interceptor_on_right_event() throws Exception {

        CompleteBean bean = CompleteBeanTestBuilder.builder().id(12L).buid();
        EntityMeta entityMeta = new EntityMeta();
        PropertyMeta idMeta = PropertyMetaTestBuilder.completeBean(Void.class, Long.class).propertyName("id")
                .type(PropertyType.EMBEDDED_ID).accessors().build();
//        idMeta.setInvoker(new ReflectionInvoker());
        entityMeta.setIdMeta(idMeta);
        entityMeta.forInterception().addInterceptor(createInterceptorForCompleteBean(PRE_INSERT, 30L));
        entityMeta.forInterception().addInterceptor(createInterceptorForCompleteBean(POST_INSERT, 35L));

        entityMeta.forInterception().intercept(bean, PRE_INSERT);
        Assertions.assertThat(bean.getAge()).isEqualTo(30L);
        entityMeta.forInterception().intercept(bean, POST_INSERT);
        Assertions.assertThat(bean.getAge()).isEqualTo(35L);
    }
View Full Code Here


        List<PropertyMeta> pms = new ArrayList<>();
        entityMeta.setAllMetasExceptIdAndCounters(pms);
        entityMeta.setInsertStrategy(ALL_FIELDS);

        //When
        final List<PropertyMeta> propertyMetas = entityMeta.forOperations().retrievePropertyMetasForInsert(new CompleteBean());

        //Then
        assertThat(propertyMetas).isSameAs(pms);
    }
View Full Code Here

        // When
        AchillesFuture<CompleteBean> actual = loader.loadClusteredCounters(context);

        // Then
        assertThat(actual).isSameAs(achillesFutureEntity);
        final CompleteBean actualEntity = rowToEntityCaptor.getValue().apply(row);
        assertThat(actualEntity).isSameAs(entity);

        verify(idMeta.forValues()).setValueToField(entity, primaryKey);
        verify(mapper).setCounterToEntity(counterMeta, entity, row);
    }
View Full Code Here

        // When
        AchillesFuture<CompleteBean> actual = loader.loadClusteredCounters(context);

        // Then
        assertThat(actual).isSameAs(achillesFutureEntity);
        final CompleteBean actualEntity = rowToEntityCaptor.getValue().apply(null);
        assertThat(actualEntity).isNull();

        verify(meta.forOperations(), never()).instanciate();
        verifyZeroInteractions(idMeta, mapper);
    }
View Full Code Here

    public void should_decode_from_pk_components() throws Exception {
        //Given
        Long id = 10L;
        Date date = new Date();

        CompleteBean pk = new CompleteBean();

        when(meta.type()).thenReturn(EMBEDDED_ID);
        when(meta.forValues().instantiate()).thenReturn(pk);

        PropertyMeta idMeta = mock(PropertyMeta.class, RETURNS_DEEP_STUBS);
View Full Code Here

    @Test
    public void should_encode_pk_to_components() throws Exception {
        Long id = 10L;
        Date date = new Date();

        CompleteBean pk = new CompleteBean();

        when(meta.type()).thenReturn(EMBEDDED_ID);

        PropertyMeta idMeta = mock(PropertyMeta.class, RETURNS_DEEP_STUBS);
        PropertyMeta dateMeta = mock(PropertyMeta.class, RETURNS_DEEP_STUBS);
View Full Code Here

    @Test
    public void should_encode_only_partition_component_from_pk() throws Exception {
        Long id = 10L;

        CompleteBean pk = new CompleteBean();

        when(meta.type()).thenReturn(EMBEDDED_ID);

        PropertyMeta idMeta = mock(PropertyMeta.class, RETURNS_DEEP_STUBS);
View Full Code Here

    @Test
    public void should_force_encode_to_JSON() throws Exception {
        //Given
        view = new PropertyMetaTranscoder(new PropertyMeta());
        CompleteBean entity = new CompleteBean();
        entity.setId(10L);

        //When
        final String json = view.forceEncodeToJSONForCounter(entity);

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