Search in sources :

Example 1 with MappingCassandraConverter

use of org.springframework.data.cassandra.core.convert.MappingCassandraConverter in project spring-data-cassandra by spring-projects.

the class CassandraTemplate method newConverter.

private static MappingCassandraConverter newConverter(CqlSession session) {
    MappingCassandraConverter converter = new MappingCassandraConverter();
    converter.setUserTypeResolver(new SimpleUserTypeResolver(session));
    converter.setCodecRegistry(session.getContext().getCodecRegistry());
    converter.afterPropertiesSet();
    return converter;
}
Also used : SimpleUserTypeResolver(org.springframework.data.cassandra.core.mapping.SimpleUserTypeResolver) MappingCassandraConverter(org.springframework.data.cassandra.core.convert.MappingCassandraConverter)

Example 2 with MappingCassandraConverter

use of org.springframework.data.cassandra.core.convert.MappingCassandraConverter in project spring-data-cassandra by spring-projects.

the class ReactiveCassandraTemplateIntegrationTests method setUp.

@BeforeEach
void setUp() {
    MappingCassandraConverter converter = new MappingCassandraConverter();
    CassandraTemplate cassandraTemplate = new CassandraTemplate(this.session, converter);
    DefaultBridgedReactiveSession session = new DefaultBridgedReactiveSession(this.session);
    template = new ReactiveCassandraTemplate(new ReactiveCqlTemplate(session), converter);
    prepareTemplate(template);
    SchemaTestUtils.potentiallyCreateTableFor(User.class, cassandraTemplate);
    SchemaTestUtils.potentiallyCreateTableFor(UserToken.class, cassandraTemplate);
    SchemaTestUtils.truncate(User.class, cassandraTemplate);
    SchemaTestUtils.truncate(UserToken.class, cassandraTemplate);
}
Also used : DefaultBridgedReactiveSession(org.springframework.data.cassandra.core.cql.session.DefaultBridgedReactiveSession) MappingCassandraConverter(org.springframework.data.cassandra.core.convert.MappingCassandraConverter) ReactiveCqlTemplate(org.springframework.data.cassandra.core.cql.ReactiveCqlTemplate) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with MappingCassandraConverter

use of org.springframework.data.cassandra.core.convert.MappingCassandraConverter in project spring-data-cassandra by spring-projects.

the class OptimisticLockingIntegrationTests method setUp.

@BeforeEach
void setUp() {
    MappingCassandraConverter converter = new MappingCassandraConverter();
    converter.afterPropertiesSet();
    template = new CassandraTemplate(session, converter);
    SchemaTestUtils.potentiallyCreateTableFor(VersionedEntity.class, template);
    SchemaTestUtils.truncate(VersionedEntity.class, template);
}
Also used : MappingCassandraConverter(org.springframework.data.cassandra.core.convert.MappingCassandraConverter) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 4 with MappingCassandraConverter

use of org.springframework.data.cassandra.core.convert.MappingCassandraConverter in project spring-data-cassandra by spring-projects.

the class CassandraQueryCreatorUnitTests method setUp.

@BeforeEach
void setUp() {
    context = new CassandraMappingContext();
    context.setUserTypeResolver(mock(UserTypeResolver.class));
    converter = new MappingCassandraConverter(context);
}
Also used : UserTypeResolver(org.springframework.data.cassandra.core.mapping.UserTypeResolver) CassandraMappingContext(org.springframework.data.cassandra.core.mapping.CassandraMappingContext) MappingCassandraConverter(org.springframework.data.cassandra.core.convert.MappingCassandraConverter) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with MappingCassandraConverter

use of org.springframework.data.cassandra.core.convert.MappingCassandraConverter in project spring-data-cassandra by spring-projects.

the class StringBasedCassandraQueryUnitTests method setUp.

@BeforeEach
void setUp() {
    CassandraMappingContext mappingContext = new CassandraMappingContext();
    mappingContext.setUserTypeResolver(userTypeResolver);
    this.metadata = AbstractRepositoryMetadata.getMetadata(SampleRepository.class);
    this.converter = new MappingCassandraConverter(mappingContext);
    this.factory = new SpelAwareProxyProjectionFactory();
    this.converter.afterPropertiesSet();
    when(operations.getConverter()).thenReturn(converter);
}
Also used : SpelAwareProxyProjectionFactory(org.springframework.data.projection.SpelAwareProxyProjectionFactory) CassandraMappingContext(org.springframework.data.cassandra.core.mapping.CassandraMappingContext) MappingCassandraConverter(org.springframework.data.cassandra.core.convert.MappingCassandraConverter) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

MappingCassandraConverter (org.springframework.data.cassandra.core.convert.MappingCassandraConverter)21 BeforeEach (org.junit.jupiter.api.BeforeEach)14 CassandraMappingContext (org.springframework.data.cassandra.core.mapping.CassandraMappingContext)8 SimpleUserTypeResolver (org.springframework.data.cassandra.core.mapping.SimpleUserTypeResolver)8 CqlTemplate (org.springframework.data.cassandra.core.cql.CqlTemplate)3 DefaultBridgedReactiveSession (org.springframework.data.cassandra.core.cql.session.DefaultBridgedReactiveSession)3 ApplicationScoped (javax.enterprise.context.ApplicationScoped)2 Produces (javax.enterprise.inject.Produces)2 Bean (org.springframework.context.annotation.Bean)2 CassandraAdminTemplate (org.springframework.data.cassandra.core.CassandraAdminTemplate)2 ReactiveCqlTemplate (org.springframework.data.cassandra.core.cql.ReactiveCqlTemplate)2 UserTypeResolver (org.springframework.data.cassandra.core.mapping.UserTypeResolver)2 SpelAwareProxyProjectionFactory (org.springframework.data.projection.SpelAwareProxyProjectionFactory)2 CqlIdentifier (com.datastax.oss.driver.api.core.CqlIdentifier)1 CqlSession (com.datastax.oss.driver.api.core.CqlSession)1 KeyspaceMetadata (com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata)1 TableMetadata (com.datastax.oss.driver.api.core.metadata.schema.TableMetadata)1 DefaultUdtValue (com.datastax.oss.driver.internal.core.data.DefaultUdtValue)1 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1