#90 - Polishing.

Original pull request: #90.
This commit is contained in:
Jens Schauder
2019-04-17 12:59:15 +02:00
parent cca38b4480
commit 2f5d11bd56
3 changed files with 7 additions and 11 deletions

View File

@@ -88,10 +88,7 @@ public class SimpleR2dbcRepository<T, ID> implements ReactiveCrudRepository<T, I
GenericExecuteSpec exec = databaseClient.execute().sql(update);
BindSpecAdapter<GenericExecuteSpec> wrapper = BindSpecAdapter.create(exec);
columns.forEach((k, v) -> {
update.bind(wrapper, k, v);
});
columns.forEach((k, v) -> update.bind(wrapper, k, v));
update.bindId(wrapper, id);
return wrapper.getBoundOperation().as(entity.getJavaType()) //

View File

@@ -188,16 +188,16 @@ public abstract class AbstractR2dbcRepositoryIntegrationTests extends R2dbcInteg
Flux<Map<String, Object>> transactional = client.inTransaction(db -> {
return transactionalRepository.save(legoSet1) //
.map(it -> jdbc.queryForMap("SELECT count(*) as count FROM legoset"));
.map(it -> jdbc.queryForMap("SELECT count(*) AS count FROM legoset"));
});
Mono<Map<String, Object>> nonTransactional = transactionalRepository.save(legoSet2) //
.map(it -> jdbc.queryForMap("SELECT count(*) as count FROM legoset"));
.map(it -> jdbc.queryForMap("SELECT count(*) AS count FROM legoset"));
transactional.as(StepVerifier::create).expectNext(Collections.singletonMap("count", 0L)).verifyComplete();
nonTransactional.as(StepVerifier::create).expectNext(Collections.singletonMap("count", 2L)).verifyComplete();
Map<String, Object> count = jdbc.queryForMap("SELECT count(*) as count FROM legoset");
Map<String, Object> count = jdbc.queryForMap("SELECT count(*) AS count FROM legoset");
assertThat(count).containsEntry("count", 2L);
}

View File

@@ -75,10 +75,9 @@ public class H2SimpleR2dbcRepositoryIntegrationTests extends AbstractSimpleR2dbc
repository.save(legoSet) //
.as(StepVerifier::create) //
.consumeNextWith(actual -> {
assertThat(actual.getId()).isEqualTo(9999);
}).verifyComplete();
.consumeNextWith( //
actual -> assertThat(actual.getId()).isEqualTo(9999) //
).verifyComplete();
Map<String, Object> map = jdbc.queryForMap("SELECT * FROM legoset");
assertThat(map).containsEntry("name", "SCHAUFELRADBAGGER").containsEntry("manual", 12).containsKey("id");