Package info.archinnov.achilles.internal.metadata.holder

Examples of info.archinnov.achilles.internal.metadata.holder.EntityMeta


        assertThat(cacheKey.getFields()).containsOnly("name", "age");
    }

    @Test
    public void should_get_cache_for_fields_update() throws Exception {
        EntityMeta meta = new EntityMeta();
//        meta.setTableName("table");

        PropertyMeta nameMeta = completeBean(Void.class, String.class).propertyName("name").type(SIMPLE).build();
        PropertyMeta ageMeta = completeBean(Void.class, String.class).propertyName("age").type(SIMPLE).build();
View Full Code Here


        assertThat(cacheKey.getFields()).containsOnly("name", "age");
    }

    @Test
    public void should_generate_update_prepared_statement_when_not_found_in_cache() throws Exception {
        EntityMeta meta = new EntityMeta();
//        meta.setTableName("table");

        PropertyMeta nameMeta = completeBean(Void.class, String.class).propertyName("name").type(SIMPLE).build();
        PropertyMeta ageMeta = completeBean(Void.class, String.class).propertyName("age").type(SIMPLE).build();
View Full Code Here

    }

    @Test
    public void should_push_insert() throws Exception {
        //Given
        EntityMeta meta = mock(EntityMeta.class, RETURNS_DEEP_STUBS);
        List<PropertyMeta> pms = new ArrayList<>();
        when(meta.getAllMetasExceptIdAndCounters()).thenReturn(pms);
        context.entityMeta = meta;
        when(configurationContext.getGlobalInsertStrategy()).thenReturn(ALL_FIELDS);

        //When
        facade.pushInsertStatement();
View Full Code Here

    }

    @Test
    public void should_prepare_message_for_collection_and_map_operation() throws Exception {
        //Given
        EntityMeta meta = mock(EntityMeta.class);
        PropertyMeta pm = mock(PropertyMeta.class);
        DirtyCheckChangeSet changeSet = new DirtyCheckChangeSet(pm, ADD_TO_SET);

        when(context.<CompleteBean>getEntityClass()).thenReturn(CompleteBean.class);
        when(context.getEntityMeta()).thenReturn(meta);
View Full Code Here

    }

    @Test
    public void should_get_collection_and_map_operation_from_cache() throws Exception {
        //Given
        EntityMeta meta = mock(EntityMeta.class);
        PropertyMeta pm = mock(PropertyMeta.class);
        DirtyCheckChangeSet changeSet = new DirtyCheckChangeSet(pm, ADD_TO_SET);

        when(context.<CompleteBean>getEntityClass()).thenReturn(CompleteBean.class);
        when(context.getEntityMeta()).thenReturn(meta);
View Full Code Here

        when(propertyMeta.type()).thenReturn(PropertyType.LIST);

        PropertyMeta idMeta = PropertyMetaTestBuilder.completeBean(Void.class, Long.class).propertyName("id")
                .type(PropertyType.SIMPLE).accessors().build();

        entityMeta = new EntityMeta();
//        entityMeta.setIdMeta(idMeta);
        dirtyMap = new HashMap<>();
    }
View Full Code Here

    @Test
    public void should_parse_entity_with_embedded_id() throws Exception {
        initEntityParsingContext(BeanWithClusteredId.class);

        EntityMeta meta = parser.parseEntity(entityContext);

        assertThat(meta).isNotNull();

        assertThat(meta.<EmbeddedKey>getIdClass()).isEqualTo(EmbeddedKey.class);
        PropertyMeta idMeta = meta.getIdMeta();

        assertThat(idMeta.structure().isEmbeddedId()).isTrue();

        assertThat(meta.getPropertyMetas().get("firstName").structure().isStaticColumn()).isTrue();
    }
View Full Code Here

    @Test
    public void should_parse_entity_with_table_name() throws Exception {

        initEntityParsingContext(BeanWithKeyspaceAndTableName.class);

        EntityMeta meta = parser.parseEntity(entityContext);

        assertThat(meta).isNotNull();
        assertThat(meta.config().getQualifiedTableName()).isEqualTo("ks.myowntable");
    }
View Full Code Here

    }

    @Test
    public void should_parse_inherited_bean() throws Exception {
        initEntityParsingContext(ChildBean.class);
        EntityMeta meta = parser.parseEntity(entityContext);

        assertThat(meta).isNotNull();
        assertThat(meta.getIdMeta().getPropertyName()).isEqualTo("id");
        assertThat(meta.getPropertyMetas().get("name").getPropertyName()).isEqualTo("name");
        assertThat(meta.getPropertyMetas().get("address").getPropertyName()).isEqualTo("address");
        assertThat(meta.getPropertyMetas().get("nickname").getPropertyName()).isEqualTo("nickname");
    }
View Full Code Here

    }

    @Test
    public void should_parse_bean_with_simple_counter_field() throws Exception {
        initEntityParsingContext(BeanWithSimpleCounter.class);
        EntityMeta meta = parser.parseEntity(entityContext);

        assertThat(meta).isNotNull();
        assertThat(entityContext.hasSimpleCounter()).isTrue();
        PropertyMeta idMeta = meta.getIdMeta();
        assertThat(idMeta).isNotNull();
        PropertyMeta counterMeta = meta.getPropertyMetas().get("counter");
        assertThat(counterMeta).isNotNull();

        CounterProperties counterProperties = meta.getAllCounterMetas().get(0).getCounterProperties();

        assertThat(counterProperties).isNotNull();
        assertThat(counterProperties.getFqcn()).isEqualTo(BeanWithSimpleCounter.class.getCanonicalName());
        assertThat(counterProperties.getIdMeta()).isSameAs(idMeta);
    }
View Full Code Here

TOP

Related Classes of info.archinnov.achilles.internal.metadata.holder.EntityMeta

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.