Search in sources :

Example 1 with SchemaAction

use of org.springframework.data.cassandra.config.SchemaAction in project spring-boot by spring-projects.

the class CassandraDataAutoConfiguration method session.

@Bean
@ConditionalOnMissingBean(Session.class)
public CassandraSessionFactoryBean session(CassandraConverter converter) throws Exception {
    CassandraSessionFactoryBean session = new CassandraSessionFactoryBean();
    session.setCluster(this.cluster);
    session.setConverter(converter);
    session.setKeyspaceName(this.properties.getKeyspaceName());
    SchemaAction schemaAction = this.propertyResolver.getProperty("schemaAction", SchemaAction.class, SchemaAction.NONE);
    session.setSchemaAction(schemaAction);
    return session;
}
Also used : CassandraSessionFactoryBean(org.springframework.data.cassandra.config.CassandraSessionFactoryBean) SchemaAction(org.springframework.data.cassandra.config.SchemaAction) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) CassandraSessionFactoryBean(org.springframework.data.cassandra.config.CassandraSessionFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with SchemaAction

use of org.springframework.data.cassandra.config.SchemaAction in project todos by ssimmie.

the class CassandraConfigTest method shouldProvideSchemaActionAsSet.

@Test
public void shouldProvideSchemaActionAsSet() {
    final SchemaAction expectedSchemaAction = SchemaAction.CREATE;
    final CassandraConfig cassandraConfig = new CassandraConfig();
    setField(cassandraConfig, "schemaAction", expectedSchemaAction.name());
    assertThat(cassandraConfig.getSchemaAction()).isEqualTo(expectedSchemaAction);
}
Also used : SchemaAction(org.springframework.data.cassandra.config.SchemaAction) Test(org.junit.jupiter.api.Test)

Example 3 with SchemaAction

use of org.springframework.data.cassandra.config.SchemaAction in project todos by ssimmie.

the class CassandraConfigTest method shouldProvideSchemaActionAsSetInLowerCase.

@Test
public void shouldProvideSchemaActionAsSetInLowerCase() {
    final SchemaAction expectedSchemaAction = SchemaAction.CREATE;
    final CassandraConfig cassandraConfig = new CassandraConfig();
    setField(cassandraConfig, "schemaAction", expectedSchemaAction.name().toLowerCase(Locale.ROOT));
    assertThat(cassandraConfig.getSchemaAction()).isEqualTo(expectedSchemaAction);
}
Also used : SchemaAction(org.springframework.data.cassandra.config.SchemaAction) Test(org.junit.jupiter.api.Test)

Aggregations

SchemaAction (org.springframework.data.cassandra.config.SchemaAction)3 Test (org.junit.jupiter.api.Test)2 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 Bean (org.springframework.context.annotation.Bean)1 CassandraSessionFactoryBean (org.springframework.data.cassandra.config.CassandraSessionFactoryBean)1