use of org.springframework.data.cassandra.core.cql.session.DefaultBridgedReactiveSession 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);
}
use of org.springframework.data.cassandra.core.cql.session.DefaultBridgedReactiveSession in project spring-data-cassandra by spring-projects.
the class ReactiveCassandraApplication method main.
public static void main(String[] args) {
CqlSession cqlSession = CqlSession.builder().withKeyspace("mykeyspace").build();
ReactiveCassandraOperations template = new ReactiveCassandraTemplate(new DefaultBridgedReactiveSession(cqlSession));
Mono<Person> jonDoe = template.insert(newPerson("Jon Doe", 40));
jonDoe.flatMap(it -> template.selectOne(Query.query(Criteria.where("id").is(it.getId())), Person.class)).doOnNext(it -> LOG.info(it.toString())).then(template.truncate(Person.class)).block();
cqlSession.close();
}
use of org.springframework.data.cassandra.core.cql.session.DefaultBridgedReactiveSession in project spring-data-cassandra by spring-projects.
the class ReactiveCqlTemplateIntegrationTests method before.
@BeforeEach
void before() {
reactiveSession = new DefaultBridgedReactiveSession(getSession());
if (initialized.compareAndSet(false, true)) {
getSession().execute("CREATE TABLE IF NOT EXISTS user (id text PRIMARY KEY, username text);");
}
getSession().execute("TRUNCATE user;");
getSession().execute("INSERT INTO user (id, username) VALUES ('WHITE', 'Walter');");
template = new ReactiveCqlTemplate(new DefaultReactiveSessionFactory(reactiveSession));
cassandraVersion = CassandraVersion.get(getSession());
}
use of org.springframework.data.cassandra.core.cql.session.DefaultBridgedReactiveSession in project spring-data-cassandra by spring-projects.
the class ReactiveCassandraBatchTemplateIntegrationTests 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);
SchemaTestUtils.potentiallyCreateTableFor(Group.class, cassandraTemplate);
SchemaTestUtils.potentiallyCreateTableFor(FlatGroup.class, cassandraTemplate);
SchemaTestUtils.truncate(Group.class, cassandraTemplate);
SchemaTestUtils.truncate(FlatGroup.class, cassandraTemplate);
//
this.template.insert(walter).then(this.template.insert(mike)).as(//
StepVerifier::create).expectNextCount(//
1).verifyComplete();
}
use of org.springframework.data.cassandra.core.cql.session.DefaultBridgedReactiveSession in project spring-data-cassandra by spring-projects.
the class ReactiveOptimisticLockingIntegrationTests method setUp.
@BeforeEach
void setUp() {
MappingCassandraConverter converter = new MappingCassandraConverter();
converter.afterPropertiesSet();
template = new ReactiveCassandraTemplate(new DefaultBridgedReactiveSession(session), converter);
CassandraTemplate syncTemplate = new CassandraTemplate(new CqlTemplate(session), converter);
SchemaTestUtils.potentiallyCreateTableFor(VersionedEntity.class, syncTemplate);
SchemaTestUtils.truncate(VersionedEntity.class, syncTemplate);
}
Aggregations