From b527cbf1d65fb1bfb0c416551ef9dc655dc71c6f Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Thu, 24 Aug 2017 11:04:19 +0200 Subject: [PATCH] #291 - Upgraded to Spring Boot 1.5.6. Upgraded to Boot 1.5.6. Updated dependencies of reactive projects to latest versions to make sure the APIs of Boot work with the changes in Spring Data Kay RC1. Upgraded all other dependencies to match and got both the Redis and the Cassandra examples to compile again. Disabled Cassandra reactive samples for now as they fail at runtime. --- cassandra/pom.xml | 2 +- cassandra/reactive/pom.xml | 17 +++------ .../people/ApplicationConfiguration.java | 4 +- .../springdata/cassandra/people/Person.java | 8 ++-- ...tory.java => RxJava2PersonRepository.java} | 10 ++--- ...ctiveCassandraTemplateIntegrationTest.java | 4 +- ...activePersonRepositoryIntegrationTest.java | 8 ++-- ...Java2PersonRepositoryIntegrationTest.java} | 37 +++++++++---------- pom.xml | 2 +- redis/reactive/pom.xml | 12 +++--- .../redis/commands/KeyOperationsTests.java | 17 +++++---- web/projection/pom.xml | 2 +- .../src/main/resources/application.properties | 1 - 13 files changed, 58 insertions(+), 66 deletions(-) rename cassandra/reactive/src/main/java/example/springdata/cassandra/people/{RxJava1PersonRepository.java => RxJava2PersonRepository.java} (88%) rename cassandra/reactive/src/test/java/example/springdata/cassandra/people/{RxJava1PersonRepositoryIntegrationTest.java => RxJava2PersonRepositoryIntegrationTest.java} (84%) diff --git a/cassandra/pom.xml b/cassandra/pom.xml index 60afd4a8..1f698a0c 100644 --- a/cassandra/pom.xml +++ b/cassandra/pom.xml @@ -20,7 +20,7 @@ util example java8 - reactive + diff --git a/cassandra/reactive/pom.xml b/cassandra/reactive/pom.xml index 678f6cfb..e3bcf226 100644 --- a/cassandra/reactive/pom.xml +++ b/cassandra/reactive/pom.xml @@ -12,11 +12,11 @@ Spring Data Cassandra - Reactive features - Kay-M1 - 5.0.0.M3 - 3.0.3.RELEASE - 1.2.1 - 1.2.0 + Kay-RC2 + 5.0.0.RC3 + 3.1.0.M3 + 2.1.3 + 1.2.1 @@ -26,11 +26,6 @@ spring-data-commons - - org.springframework.data - spring-cql - - org.springframework.data spring-data-cassandra @@ -42,7 +37,7 @@ - io.reactivex + io.reactivex.rxjava2 rxjava ${rxjava.version} diff --git a/cassandra/reactive/src/main/java/example/springdata/cassandra/people/ApplicationConfiguration.java b/cassandra/reactive/src/main/java/example/springdata/cassandra/people/ApplicationConfiguration.java index 6bb15377..d3d023a3 100644 --- a/cassandra/reactive/src/main/java/example/springdata/cassandra/people/ApplicationConfiguration.java +++ b/cassandra/reactive/src/main/java/example/springdata/cassandra/people/ApplicationConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,8 @@ package example.springdata.cassandra.people; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.data.cassandra.config.AbstractReactiveCassandraConfiguration; import org.springframework.data.cassandra.config.SchemaAction; -import org.springframework.data.cassandra.config.java.AbstractReactiveCassandraConfiguration; import org.springframework.data.cassandra.repository.config.EnableReactiveCassandraRepositories; /** diff --git a/cassandra/reactive/src/main/java/example/springdata/cassandra/people/Person.java b/cassandra/reactive/src/main/java/example/springdata/cassandra/people/Person.java index db8a92df..7573efa7 100644 --- a/cassandra/reactive/src/main/java/example/springdata/cassandra/people/Person.java +++ b/cassandra/reactive/src/main/java/example/springdata/cassandra/people/Person.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,9 +19,9 @@ import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; -import org.springframework.cassandra.core.PrimaryKeyType; -import org.springframework.data.cassandra.mapping.PrimaryKeyColumn; -import org.springframework.data.cassandra.mapping.Table; +import org.springframework.data.cassandra.core.cql.PrimaryKeyType; +import org.springframework.data.cassandra.core.mapping.PrimaryKeyColumn; +import org.springframework.data.cassandra.core.mapping.Table; /** * An entity to represent a Person. diff --git a/cassandra/reactive/src/main/java/example/springdata/cassandra/people/RxJava1PersonRepository.java b/cassandra/reactive/src/main/java/example/springdata/cassandra/people/RxJava2PersonRepository.java similarity index 88% rename from cassandra/reactive/src/main/java/example/springdata/cassandra/people/RxJava1PersonRepository.java rename to cassandra/reactive/src/main/java/example/springdata/cassandra/people/RxJava2PersonRepository.java index 6c9ad53c..401e0e33 100644 --- a/cassandra/reactive/src/main/java/example/springdata/cassandra/people/RxJava1PersonRepository.java +++ b/cassandra/reactive/src/main/java/example/springdata/cassandra/people/RxJava2PersonRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,18 +15,18 @@ */ package example.springdata.cassandra.people; -import rx.Observable; -import rx.Single; +import io.reactivex.Observable; +import io.reactivex.Single; import org.springframework.data.cassandra.repository.Query; -import org.springframework.data.repository.reactive.RxJava1CrudRepository; +import org.springframework.data.repository.reactive.RxJava2CrudRepository; /** * Repository interface to manage {@link Person} instances. * * @author Mark Paluch */ -public interface RxJava1PersonRepository extends RxJava1CrudRepository { +public interface RxJava2PersonRepository extends RxJava2CrudRepository { /** * Derived query selecting by {@code lastname}. diff --git a/cassandra/reactive/src/test/java/example/springdata/cassandra/people/ReactiveCassandraTemplateIntegrationTest.java b/cassandra/reactive/src/test/java/example/springdata/cassandra/people/ReactiveCassandraTemplateIntegrationTest.java index 52c58d35..dd0383a2 100644 --- a/cassandra/reactive/src/test/java/example/springdata/cassandra/people/ReactiveCassandraTemplateIntegrationTest.java +++ b/cassandra/reactive/src/test/java/example/springdata/cassandra/people/ReactiveCassandraTemplateIntegrationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -77,7 +77,7 @@ public class ReactiveCassandraTemplateIntegrationTest { .last() // .flatMap(v -> template.count(Person.class)) // .doOnNext(System.out::println) // - .doOnComplete(countDownLatch::countDown) // + .doOnSuccess(it -> countDownLatch.countDown()) // .doOnError(throwable -> countDownLatch.countDown()) // .subscribe(); diff --git a/cassandra/reactive/src/test/java/example/springdata/cassandra/people/ReactivePersonRepositoryIntegrationTest.java b/cassandra/reactive/src/test/java/example/springdata/cassandra/people/ReactivePersonRepositoryIntegrationTest.java index 1e863578..6869cd25 100644 --- a/cassandra/reactive/src/test/java/example/springdata/cassandra/people/ReactivePersonRepositoryIntegrationTest.java +++ b/cassandra/reactive/src/test/java/example/springdata/cassandra/people/ReactivePersonRepositoryIntegrationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,7 +52,7 @@ public class ReactivePersonRepositoryIntegrationTest { public void setUp() { repository.deleteAll() // - .thenMany(repository.save(Flux.just(new Person("Walter", "White", 50), // + .thenMany(repository.saveAll(Flux.just(new Person("Walter", "White", 50), // new Person("Skyler", "White", 45), // new Person("Saul", "Goodman", 42), // new Person("Jesse", "Pinkman", 27)))) @@ -70,12 +70,12 @@ public class ReactivePersonRepositoryIntegrationTest { repository.count() // .doOnNext(System.out::println) // - .thenMany(repository.save(Flux.just(new Person("Hank", "Schrader", 43), // + .thenMany(repository.saveAll(Flux.just(new Person("Hank", "Schrader", 43), // new Person("Mike", "Ehrmantraut", 62)))) // .last() // .flatMap(v -> repository.count()) // .doOnNext(System.out::println) // - .doOnComplete(countDownLatch::countDown) // + .doOnSuccess(it -> countDownLatch.countDown()) // .doOnError(throwable -> countDownLatch.countDown()) // .subscribe(); diff --git a/cassandra/reactive/src/test/java/example/springdata/cassandra/people/RxJava1PersonRepositoryIntegrationTest.java b/cassandra/reactive/src/test/java/example/springdata/cassandra/people/RxJava2PersonRepositoryIntegrationTest.java similarity index 84% rename from cassandra/reactive/src/test/java/example/springdata/cassandra/people/RxJava1PersonRepositoryIntegrationTest.java rename to cassandra/reactive/src/test/java/example/springdata/cassandra/people/RxJava2PersonRepositoryIntegrationTest.java index 343de838..a62d95bb 100644 --- a/cassandra/reactive/src/test/java/example/springdata/cassandra/people/RxJava1PersonRepositoryIntegrationTest.java +++ b/cassandra/reactive/src/test/java/example/springdata/cassandra/people/RxJava2PersonRepositoryIntegrationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,9 @@ package example.springdata.cassandra.people; import static org.assertj.core.api.Assertions.*; import example.springdata.cassandra.util.CassandraKeyspace; -import rx.Completable; -import rx.Observable; -import rx.Single; +import io.reactivex.Completable; +import io.reactivex.Flowable; +import io.reactivex.Single; import java.util.List; import java.util.concurrent.CountDownLatch; @@ -35,7 +35,7 @@ import org.springframework.data.cassandra.core.ReactiveCassandraOperations; import org.springframework.test.context.junit4.SpringRunner; /** - * Integration test for {@link RxJava1PersonRepository} using RxJava1 types. Note that + * Integration test for {@link RxJava2PersonRepository} using RxJava1 types. Note that * {@link ReactiveCassandraOperations} is only available using Project Reactor types as the native Template API * implementation does not come in multiple reactive flavors. * @@ -43,11 +43,11 @@ import org.springframework.test.context.junit4.SpringRunner; */ @RunWith(SpringRunner.class) @SpringBootTest -public class RxJava1PersonRepositoryIntegrationTest { +public class RxJava2PersonRepositoryIntegrationTest { @ClassRule public final static CassandraKeyspace CASSANDRA_KEYSPACE = CassandraKeyspace.onLocalhost(); - @Autowired RxJava1PersonRepository repository; + @Autowired RxJava2PersonRepository repository; @Autowired ReactiveCassandraOperations operations; @Before @@ -55,12 +55,12 @@ public class RxJava1PersonRepositoryIntegrationTest { Completable deleteAll = repository.deleteAll(); - Observable save = repository.save(Observable.just(new Person("Walter", "White", 50), // + Flowable save = repository.saveAll(Flowable.just(new Person("Walter", "White", 50), // new Person("Skyler", "White", 45), // new Person("Saul", "Goodman", 42), // new Person("Jesse", "Pinkman", 27))); - deleteAll.andThen(save).toBlocking().last(); + deleteAll.andThen(save).blockingLast(); } /** @@ -73,10 +73,10 @@ public class RxJava1PersonRepositoryIntegrationTest { repository.count() // .doOnSuccess(System.out::println) // - .toObservable() // - .switchMap(count -> repository.save(Observable.just(new Person("Hank", "Schrader", 43), // + .toFlowable() // + .switchMap(count -> repository.saveAll(Flowable.just(new Person("Hank", "Schrader", 43), // new Person("Mike", "Ehrmantraut", 62)))) // - .last() // + .lastElement() // .toSingle() // .flatMap(v -> repository.count()) // .doOnSuccess(System.out::println) // @@ -98,7 +98,7 @@ public class RxJava1PersonRepositoryIntegrationTest { repository.findAll() // .doOnNext(System.out::println) // - .doOnCompleted(countDownLatch::countDown) // + .doOnEach(it -> countDownLatch.countDown()) // .doOnError(throwable -> countDownLatch.countDown()) // .subscribe(); @@ -113,8 +113,7 @@ public class RxJava1PersonRepositoryIntegrationTest { List whites = repository.findByLastname("White") // .toList() // - .toBlocking() // - .last(); + .blockingGet(); assertThat(whites).hasSize(2); } @@ -126,8 +125,7 @@ public class RxJava1PersonRepositoryIntegrationTest { public void shouldQueryDataWithStringQuery() { Person heisenberg = repository.findByFirstnameAndLastname("Walter", "White") // - .toBlocking() // - .value(); + .blockingGet(); assertThat(heisenberg).isNotNull(); } @@ -140,8 +138,7 @@ public class RxJava1PersonRepositoryIntegrationTest { List whites = repository.findByLastname(Single.just("White")) // .toList() // - .toBlocking() // - .single(); + .blockingGet(); assertThat(whites).hasSize(2); } @@ -153,7 +150,7 @@ public class RxJava1PersonRepositoryIntegrationTest { public void shouldQueryDataWithMixedDeferredQueryDerivation() { Person heisenberg = repository.findByFirstnameAndLastname(Single.just("Walter"), "White") // - .toBlocking().value(); + .blockingGet(); assertThat(heisenberg).isNotNull(); } diff --git a/pom.xml b/pom.xml index afacd347..abc824ba 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ org.springframework.boot spring-boot-starter-parent - 1.5.4.RELEASE + 1.5.6.RELEASE diff --git a/redis/reactive/pom.xml b/redis/reactive/pom.xml index bb1e60e8..3684906e 100644 --- a/redis/reactive/pom.xml +++ b/redis/reactive/pom.xml @@ -13,10 +13,10 @@ - Kay-M1 - 5.0.0.M3 - 3.0.3.RELEASE - 5.0.0.Beta1 + Kay-RC2 + 5.0.0.RC3 + 3.1.0.M3 + 5.0.0.RC1 @@ -32,8 +32,8 @@ - biz.paluch.redis - lettuce + io.lettuce + lettuce-core ${lettuce.version} diff --git a/redis/reactive/src/test/java/example/springdata/redis/commands/KeyOperationsTests.java b/redis/reactive/src/test/java/example/springdata/redis/commands/KeyOperationsTests.java index 3f124ab1..52bf3d81 100644 --- a/redis/reactive/src/test/java/example/springdata/redis/commands/KeyOperationsTests.java +++ b/redis/reactive/src/test/java/example/springdata/redis/commands/KeyOperationsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 the original author or authors. + * Copyright 2016-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,11 @@ */ package example.springdata.redis.commands; +import example.springdata.redis.RedisTestConfiguration; +import example.springdata.redis.test.util.RequiresRedisServer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + import java.nio.ByteBuffer; import java.time.Duration; import java.util.Collections; @@ -28,17 +33,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.redis.connection.ReactiveListCommands.PopResult; import org.springframework.data.redis.connection.ReactiveRedisConnection; +import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory; import org.springframework.data.redis.connection.ReactiveStringCommands.SetCommand; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.serializer.RedisSerializer; import org.springframework.data.redis.serializer.StringRedisSerializer; import org.springframework.test.context.junit4.SpringRunner; -import example.springdata.redis.RedisTestConfiguration; -import example.springdata.redis.test.util.RequiresRedisServer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - /** * Show usage of reactive operations on Redis keys using low level API provided by {@link RedisConnectionFactory}. * @@ -54,7 +55,7 @@ public class KeyOperationsTests { private static final String PREFIX = KeyOperationsTests.class.getSimpleName(); private static final String KEY_PATTERN = PREFIX + "*"; - @Autowired RedisConnectionFactory connectionFactory; + @Autowired ReactiveRedisConnectionFactory connectionFactory; private ReactiveRedisConnection connection; private RedisSerializer serializer = new StringRedisSerializer(); @@ -76,7 +77,7 @@ public class KeyOperationsTests { this.connection.keyCommands() // .keys(ByteBuffer.wrap(serializer.serialize(KEY_PATTERN))) // - .flatMap(Flux::fromIterable) // + .flatMapMany(Flux::fromIterable) // .doOnNext(byteBuffer -> System.out.println(toString(byteBuffer))) // .count() // .doOnSuccess(count -> System.out.println(String.format("Total No. found: %s", count))) // diff --git a/web/projection/pom.xml b/web/projection/pom.xml index 61ec3739..60dff247 100644 --- a/web/projection/pom.xml +++ b/web/projection/pom.xml @@ -32,7 +32,7 @@ org.xmlbeam xmlprojector - 1.4.8 + 1.4.13 diff --git a/web/projection/src/main/resources/application.properties b/web/projection/src/main/resources/application.properties index 7ea71449..bae39292 100644 --- a/web/projection/src/main/resources/application.properties +++ b/web/projection/src/main/resources/application.properties @@ -1,2 +1 @@ logging.level.org.springframework.web=DEBUG -logging.level.org.springframework.boot=DEBUG