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

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


    }

    @Test
    public void should_get_cache_for_clustered_id() throws Exception {
        EntityMeta meta = new EntityMeta();
        PropertyMeta pm = mock(PropertyMeta.class, RETURNS_DEEP_STUBS);

        when(context.<CompleteBean>getEntityClass()).thenReturn(CompleteBean.class);
        when(context.getEntityMeta()).thenReturn(meta);
        when(pm.forCache().extractClusteredFieldsIfNecessary()).thenReturn(Sets.newLinkedHashSet("id", "a", "b"));
        when(cache.getIfPresent(cacheKeyCaptor.capture())).thenReturn(ps);

        PreparedStatement actual = manager.getCacheForFieldSelect(session, cache, context, pm);

        assertThat(actual).isSameAs(ps);
View Full Code Here


        verify(daoContext).bindForSimpleCounterIncrement(context.daoFacade, counterMeta, 11L);
    }

    @Test
    public void should_get_simple_counter() throws Exception {
        PropertyMeta counterMeta = new PropertyMeta();

        when(daoContext.getSimpleCounter(context.daoFacade, counterMeta, LOCAL_QUORUM)).thenReturn(11L);

        Long counterValue = facade.getSimpleCounter(counterMeta, LOCAL_QUORUM);
View Full Code Here

        assertThat(counterValue).isEqualTo(11L);
    }

    @Test
    public void should_return_null_when_no_simple_counter_value() throws Exception {
        PropertyMeta counterMeta = new PropertyMeta();

        when(daoContext.getSimpleCounter(context.daoFacade, counterMeta, LOCAL_QUORUM)).thenReturn(null);

        assertThat(facade.getSimpleCounter(counterMeta, LOCAL_QUORUM)).isNull();
    }
View Full Code Here

            }

        }
        PropertyParsingContext context = newContext(Test.class, Test.class.getDeclaredField("counter"));

        PropertyMeta meta = parser.parse(context);

        assertThat(meta.type()).isEqualTo(PropertyType.COUNTER);
        assertThat(meta.getCounterProperties()).isNotNull();
        assertThat(meta.getCounterProperties().getFqcn()).isEqualTo(Test.class.getCanonicalName());
        assertThat(context.getCounterMetas().get(0)).isSameAs(meta);
    }
View Full Code Here

        assertThat(facade.getSimpleCounter(counterMeta, LOCAL_QUORUM)).isNull();
    }

    @Test
    public void should_bind_for_simple_counter_deletion() throws Exception {
        PropertyMeta counterMeta = new PropertyMeta();

        facade.bindForSimpleCounterDeletion(counterMeta);

        verify(daoContext).bindForSimpleCounterDelete(context.daoFacade, counterMeta);
    }
View Full Code Here

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

        PropertyMeta pm = PropertyMetaTestBuilder.valueClass(String.class).propertyName("name").type(SIMPLE)
                .build();

        when(context.<CompleteBean>getEntityClass()).thenReturn(CompleteBean.class);
        when(context.getEntityMeta()).thenReturn(meta);
        when(cache.getIfPresent(cacheKeyCaptor.capture())).thenReturn(null);
View Full Code Here

    }

    // Clustered counter
    @Test
    public void should_push_clustered_counter_increment() throws Exception {
        PropertyMeta counterMeta = new PropertyMeta();

        facade.pushClusteredCounterIncrementStatement(counterMeta, 11L);

        verify(daoContext).pushClusteredCounterIncrementStatement(context.daoFacade, counterMeta, 11L);
    }
View Full Code Here

    @Test
    public void should_get_cache_for_entity_insert() 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();

        when(context.<CompleteBean>getEntityClass()).thenReturn(CompleteBean.class);
        when(context.getEntityMeta()).thenReturn(meta);
        when(cache.getIfPresent(cacheKeyCaptor.capture())).thenReturn(ps);
View Full Code Here

    }


    @Test
    public void should_get_clustered_counter() throws Exception {
        PropertyMeta counterMeta = new PropertyMeta();
        counterMeta.setPropertyName("count");
        Long counterValue = 11L;

        when(daoContext.getClusteredCounterColumn(context.daoFacade, counterMeta)).thenReturn(counterValue);

        Long actual = facade.getClusteredCounterColumn(counterMeta);
View Full Code Here

    @Test
    public void should_generate_insert_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();

        List<PropertyMeta> pms = asList(nameMeta, ageMeta);

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

TOP

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

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.