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

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


        assertThat(meta.config().getWriteConsistencyLevel()).isEqualTo(ConsistencyLevel.ALL);

        assertThat(meta.getAllMetasExceptIdAndCounters()).hasSize(6).containsOnly(name, age, friends, followers, preferences, creator);
        assertThat(meta.getAllMetasExceptCounters()).hasSize(7).containsOnly(id, name, age, friends, followers, preferences, creator);

        assertThat(meta.config().getInsertStrategy()).isEqualTo(InsertStrategy.ALL_FIELDS);
        assertThat(meta.config().isSchemaUpdateEnabled()).isTrue();
    }

    @Test
    public void should_parse_entity_with_embedded_id() throws Exception {
View Full Code Here


        assertThat(meta.getAllMetasExceptIdAndCounters()).hasSize(6).containsOnly(name, age, friends, followers, preferences, creator);
        assertThat(meta.getAllMetasExceptCounters()).hasSize(7).containsOnly(id, name, age, friends, followers, preferences, creator);

        assertThat(meta.config().getInsertStrategy()).isEqualTo(InsertStrategy.ALL_FIELDS);
        assertThat(meta.config().isSchemaUpdateEnabled()).isTrue();
    }

    @Test
    public void should_parse_entity_with_embedded_id() throws Exception {
        initEntityParsingContext(BeanWithClusteredId.class);
View Full Code Here

        initEntityParsingContext(BeanWithKeyspaceAndTableName.class);

        EntityMeta meta = parser.parseEntity(entityContext);

        assertThat(meta).isNotNull();
        assertThat(meta.config().getQualifiedTableName()).isEqualTo("ks.myowntable");
    }

    @Test
    public void should_parse_inherited_bean() throws Exception {
        initEntityParsingContext(ChildBean.class);
View Full Code Here

        //When
        EntityMeta meta = parser.parseEntity(entityContext);

        //Then
        assertThat(meta.config().getInsertStrategy()).isEqualTo(InsertStrategy.NOT_NULL_FIELDS);

    }

    @Test
    public void should_parse_entity_with_scheme_update_enabled() throws Exception {
View Full Code Here

        configContext.setCurrentKeyspace(Optional.fromNullable("ks"));
        configContext.setEnableSchemaUpdate(false);
        configContext.setEnableSchemaUpdateForTables(ImmutableMap.of("ks.bean_with_clustered_id", true));
        EntityMeta meta = parser.parseEntity(entityContext);

        assertThat(meta.config().isSchemaUpdateEnabled()).isTrue();
    }

    private <T> void initEntityParsingContext(Class<T> entityClass) {
        entityContext = new EntityParsingContext(configContext, entityClass);
    }
View Full Code Here

        TableMetadata tableMeta2 = mock(TableMetadata.class, RETURNS_DEEP_STUBS);

        when(meta1.config().getKeyspaceName()).thenReturn("ks1");
        when(meta1.config().getTableName()).thenReturn("table1");
        when(meta1.config().getQualifiedTableName()).thenReturn("ks1.table1");
        when(meta2.config().getKeyspaceName()).thenReturn("ks2");
        when(meta2.config().getTableName()).thenReturn("table2");
        when(meta2.config().getQualifiedTableName()).thenReturn("ks2.table2");

        when(cluster.getMetadata().getKeyspace("ks1")).thenReturn(ks1Meta);
        when(cluster.getMetadata().getKeyspace("ks2")).thenReturn(ks2Meta);
View Full Code Here

        when(meta1.config().getKeyspaceName()).thenReturn("ks1");
        when(meta1.config().getTableName()).thenReturn("table1");
        when(meta1.config().getQualifiedTableName()).thenReturn("ks1.table1");
        when(meta2.config().getKeyspaceName()).thenReturn("ks2");
        when(meta2.config().getTableName()).thenReturn("table2");
        when(meta2.config().getQualifiedTableName()).thenReturn("ks2.table2");

        when(cluster.getMetadata().getKeyspace("ks1")).thenReturn(ks1Meta);
        when(cluster.getMetadata().getKeyspace("ks2")).thenReturn(ks2Meta);
View Full Code Here

        when(meta1.config().getKeyspaceName()).thenReturn("ks1");
        when(meta1.config().getTableName()).thenReturn("table1");
        when(meta1.config().getQualifiedTableName()).thenReturn("ks1.table1");
        when(meta2.config().getKeyspaceName()).thenReturn("ks2");
        when(meta2.config().getTableName()).thenReturn("table2");
        when(meta2.config().getQualifiedTableName()).thenReturn("ks2.table2");

        when(cluster.getMetadata().getKeyspace("ks1")).thenReturn(ks1Meta);
        when(cluster.getMetadata().getKeyspace("ks2")).thenReturn(ks2Meta);

        when(ks1Meta.getTable("table1")).thenReturn(tableMeta1);
View Full Code Here

    @Test
        public void should_exception_when_keyspace_meta_is_not_found() throws Exception {
        //Given
        EntityMeta meta = mock(EntityMeta.class, RETURNS_DEEP_STUBS);
        when(meta.config().getKeyspaceName()).thenReturn("ks");
        when(meta.config().getTableName()).thenReturn("table");

        when(cluster.getMetadata().getKeyspace("ks")).thenReturn(null);

        //When
View Full Code Here

    @Test
        public void should_exception_when_keyspace_meta_is_not_found() throws Exception {
        //Given
        EntityMeta meta = mock(EntityMeta.class, RETURNS_DEEP_STUBS);
        when(meta.config().getKeyspaceName()).thenReturn("ks");
        when(meta.config().getTableName()).thenReturn("table");

        when(cluster.getMetadata().getKeyspace("ks")).thenReturn(null);

        //When
        exception.expect(AchillesInvalidTableException.class);
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.