Examples of structure()


Examples of info.archinnov.achilles.internal.metadata.holder.EntityMeta.structure()

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

        assertThat(meta.structure().isClusteredEntity()).isTrue();

        assertThat(meta.getIdMeta().getPropertyName()).isEqualTo("id");
        assertThat(meta.getIdMeta().<EmbeddedKey>getValueClass()).isEqualTo(EmbeddedKey.class);

        assertThat(meta.getPropertyMetas()).hasSize(2);
View Full Code Here

Examples of info.archinnov.achilles.internal.metadata.holder.PropertyMeta.structure()

        Assignments assignments = null;
        boolean onlyStaticColumns = true;
        for (int i = 0; i < pms.size(); i++) {
            PropertyMeta pm = pms.get(i);

            if (!pm.structure().isStaticColumn()) {
                onlyStaticColumns = false;
            }
            if (i == 0) {
                assignments = pm.forStatementGeneration().prepareUpdateField(updateConditions);
            } else {
View Full Code Here

Examples of info.archinnov.achilles.internal.metadata.holder.PropertyMeta.structure()

                    Object value = pm.forRowExtraction().invokeOnRowForFields(row);
                    pm.forValues().setValueToField(entity, value);
                }
            }
            PropertyMeta idMeta = meta.getIdMeta();
            if (idMeta.structure().isEmbeddedId()) {
                Object compoundKey = idMeta.forRowExtraction().extractCompoundPrimaryKeyFromRow(row, meta, entityState);
                idMeta.forValues().setValueToField(entity, compoundKey);
            }
        }
        return entity;
View Full Code Here

Examples of info.archinnov.achilles.internal.metadata.holder.PropertyMeta.structure()

    public void should_map_row_to_entity_with_primary_key() throws Exception {
        ClusteredEntity entity = new ClusteredEntity();
        EmbeddedKey embeddedKey = new EmbeddedKey();
        PropertyMeta idMeta = mock(PropertyMeta.class, RETURNS_DEEP_STUBS);

        when(idMeta.structure().isEmbeddedId()).thenReturn(true);

        Map<String, PropertyMeta> propertiesMap = new HashMap<>();

        when(row.getColumnDefinitions()).thenReturn(columnDefs);
        when(columnDefs.iterator()).thenReturn(Arrays.<Definition>asList().iterator());
View Full Code Here

Examples of info.archinnov.achilles.internal.metadata.holder.PropertyMeta.structure()

        //Given
        PropertyMeta idMeta = mock(PropertyMeta.class, RETURNS_DEEP_STUBS);
        PropertyMeta pm = mock(PropertyMeta.class, RETURNS_DEEP_STUBS);
        EntityMeta entityMeta = mock(EntityMeta.class, RETURNS_DEEP_STUBS);
        when(entityMeta.getPropertyMetas().values()).thenReturn(Arrays.asList(pm));
        when(pm.structure().isStaticColumn()).thenReturn(true);
        when(entityMeta.getClassName()).thenReturn("myEntity");
        when(idMeta.structure().isClustered()).thenReturn(false);

        //When //Then
        exception.expect(AchillesBeanMappingException.class);
View Full Code Here

Examples of info.archinnov.achilles.internal.metadata.holder.PropertyMeta.structure()

        when(entityMeta.getAllMetasExceptId().size()).thenReturn(2);
        when(entityMeta.getClassName()).thenReturn("myEntity");
        when(entityMeta.structure().isClusteredCounter()).thenReturn(true);
        when(idMeta.structure().isClustered()).thenReturn(true);
        when(pm1.structure().isStaticColumn()).thenReturn(true);
        when(pm2.structure().isStaticColumn()).thenReturn(true);
        when(pm1.structure().isCounter()).thenReturn(true);
        when(pm2.structure().isCounter()).thenReturn(true);

        //When //Then
        exception.expect(AchillesBeanMappingException.class);
View Full Code Here

Examples of info.archinnov.achilles.internal.metadata.holder.PropertyMeta.structure()

        when(entityMeta.structure().isClusteredCounter()).thenReturn(true);
        when(idMeta.structure().isClustered()).thenReturn(true);
        when(pm1.structure().isStaticColumn()).thenReturn(true);
        when(pm2.structure().isStaticColumn()).thenReturn(true);
        when(pm1.structure().isCounter()).thenReturn(true);
        when(pm2.structure().isCounter()).thenReturn(true);

        //When //Then
        exception.expect(AchillesBeanMappingException.class);
        exception.expectMessage("The entity class 'myEntity' is a clustered counter and thus cannot have only static counter column");
View Full Code Here

Examples of info.archinnov.achilles.internal.metadata.holder.PropertyMeta.structure()

        when(entityMeta.forOperations().getPrimaryKey(entity)).thenReturn(primaryKey);
        when(idMeta.structure().isEmbeddedId()).thenReturn(false);
        when(idMeta.forTranscoding().encodeToCassandra(primaryKey)).thenReturn(primaryKey);
        when(nameMeta.structure().isStaticColumn()).thenReturn(false);
        when(ageMeta.structure().isStaticColumn()).thenReturn(false);
        when(nameMeta.forTranscoding().getAndEncodeValueForCassandra(entity)).thenReturn(name);
        when(ageMeta.forTranscoding().getAndEncodeValueForCassandra(entity)).thenReturn(age);

        when(ps.bind(Matchers.anyVararg())).thenReturn(bs);
View Full Code Here

Examples of info.archinnov.achilles.internal.metadata.holder.PropertyMeta.structure()

        PropertyMeta pm = mock(PropertyMeta.class, RETURNS_DEEP_STUBS);

        Row row = mock(Row.class);

        when(cacheManager.getCacheForFieldSelect(session, dynamicPSCache, context, pm)).thenReturn(ps);
        when(pm.structure().isStaticColumn()).thenReturn(true);
        when(overrider.getReadLevel(context)).thenReturn(EACH_QUORUM);
        when(binder.bindStatementWithOnlyPKInWhereClause(context, ps, true, EACH_QUORUM)).thenReturn(bsWrapper);
        when(context.executeImmediate(bsWrapper)).thenReturn(futureResultSet);
        when(asyncUtils.transformFuture(futureResultSet, RESULTSET_TO_ROW, executorService)).thenReturn(futureRow);
        when(asyncUtils.buildInterruptible(futureRow).getImmediately()).thenReturn(row);
View Full Code Here

Examples of info.archinnov.achilles.internal.metadata.holder.PropertyMeta.structure()

    @Test
    public void should_get_clustered_counter_column() throws Exception {
        // Given
        PropertyMeta counterMeta = mock(PropertyMeta.class, RETURNS_DEEP_STUBS);
        when(counterMeta.getCQL3ColumnName()).thenReturn("counter");
        when(counterMeta.structure().isStaticColumn()).thenReturn(true);
        Row row = mock(Row.class);

        clusteredCounterQueryMap.put(CompleteBean.class, ImmutableMap.<CQLQueryType, Map<String, PreparedStatement>>of(SELECT, of("counter", ps)));
        when(overrider.getReadLevel(context, counterMeta)).thenReturn(EACH_QUORUM);
        when(binder.bindForClusteredCounterSelect(context, ps, true, EACH_QUORUM)).thenReturn(bsWrapper);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.