use of org.springframework.data.cassandra.domain.FlatGroup in project spring-data-cassandra by spring-projects.
the class CassandraBatchTemplateIntegrationTests method shouldUpdatesCollectionOfEntities.
// DATACASS-288
@Test
void shouldUpdatesCollectionOfEntities() {
FlatGroup walter = new FlatGroup("users", "0x1", "walter");
FlatGroup mike = new FlatGroup("users", "0x1", "mike");
template.insert(walter);
template.insert(mike);
walter.setEmail("walter@white.com");
mike.setEmail("mike@sauls.com");
CassandraBatchOperations batchOperations = new CassandraBatchTemplate(template, BatchType.LOGGED);
batchOperations.update(Arrays.asList(walter, mike)).execute();
FlatGroup loaded = template.selectOneById(walter, FlatGroup.class);
assertThat(loaded.getEmail()).isEqualTo(walter.getEmail());
}
use of org.springframework.data.cassandra.domain.FlatGroup in project spring-data-cassandra by spring-projects.
the class ReactiveCassandraBatchTemplateIntegrationTests method shouldUpdateMonoCollectionOfEntities.
// DATACASS-574
@Test
void shouldUpdateMonoCollectionOfEntities() {
FlatGroup walter = new FlatGroup("users", "0x1", "walter");
FlatGroup mike = new FlatGroup("users", "0x1", "mike");
ReactiveCassandraBatchOperations batchOperations = new ReactiveCassandraBatchTemplate(template, BatchType.LOGGED);
Mono<FlatGroup> loadedMono = template.insert(walter).then(template.insert(mike)).then(Mono.fromRunnable(() -> {
walter.setEmail("walter@white.com");
mike.setEmail("mike@sauls.com");
})).then(Mono.defer(() -> batchOperations.update(Collections.singletonList(walter)).update(Mono.just(Collections.singletonList(mike))).execute())).then(template.selectOneById(walter, FlatGroup.class));
//
loadedMono.as(//
StepVerifier::create).assertNext(loaded -> assertThat(loaded.getEmail()).isEqualTo(walter.getEmail())).verifyComplete();
}
use of org.springframework.data.cassandra.domain.FlatGroup in project spring-data-cassandra by spring-projects.
the class ReactiveCassandraBatchTemplateIntegrationTests method shouldUpdateMonoOfEntities.
// DATACASS-574
@Test
void shouldUpdateMonoOfEntities() {
FlatGroup walter = new FlatGroup("users", "0x1", "walter");
FlatGroup mike = new FlatGroup("users", "0x1", "mike");
ReactiveCassandraBatchOperations batchOperations = new ReactiveCassandraBatchTemplate(template, BatchType.LOGGED);
Mono<FlatGroup> loadedMono = template.insert(walter).then(template.insert(mike)).then(Mono.fromRunnable(() -> {
walter.setEmail("walter@white.com");
mike.setEmail("mike@sauls.com");
})).then(Mono.defer(() -> batchOperations.update(Arrays.asList(walter, mike)).execute())).then(template.selectOneById(walter, FlatGroup.class));
//
loadedMono.as(//
StepVerifier::create).assertNext(loaded -> assertThat(loaded.getEmail()).isEqualTo(walter.getEmail())).verifyComplete();
}
Aggregations