Browse Source

DATACMNS-988 - Fix Publisher to RxJava 2 conversion.

And fix some issues in JavaDoc.

Original Pull Request: #194
pull/207/head
Mark Paluch 9 years ago committed by Christoph Strobl
parent
commit
d72e9486be
  1. 2
      src/main/java/org/springframework/data/repository/reactive/ReactiveCrudRepository.java
  2. 2
      src/main/java/org/springframework/data/repository/reactive/RxJava1CrudRepository.java
  3. 3
      src/main/java/org/springframework/data/repository/reactive/RxJava2CrudRepository.java
  4. 4
      src/main/java/org/springframework/data/repository/util/ReactiveWrapperConverters.java
  5. 18
      src/test/java/org/springframework/data/repository/util/ReactiveWrapperConvertersUnitTests.java

2
src/main/java/org/springframework/data/repository/reactive/ReactiveCrudRepository.java

@ -91,7 +91,7 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo @@ -91,7 +91,7 @@ public interface ReactiveCrudRepository<T, ID extends Serializable> extends Repo
Mono<Boolean> exists(ID id);
/**
* Returns whether an entity with the given id exists supplied by a {@link Mono}.
* Returns whether an entity with the given id, supplied by a {@link Mono}, exists.
*
* @param id must not be {@literal null}.
* @return {@literal true} if an entity with the given id exists, {@literal false} otherwise

2
src/main/java/org/springframework/data/repository/reactive/RxJava1CrudRepository.java

@ -91,7 +91,7 @@ public interface RxJava1CrudRepository<T, ID extends Serializable> extends Repos @@ -91,7 +91,7 @@ public interface RxJava1CrudRepository<T, ID extends Serializable> extends Repos
Single<Boolean> exists(ID id);
/**
* Returns whether an entity with the given id exists supplied by a {@link Single}.
* Returns whether an entity with the given id, supplied by a {@link Single}, exists.
*
* @param id must not be {@literal null}.
* @return {@literal true} if an entity with the given id exists, {@literal false} otherwise.

3
src/main/java/org/springframework/data/repository/reactive/RxJava2CrudRepository.java

@ -31,6 +31,7 @@ import org.springframework.data.repository.Repository; @@ -31,6 +31,7 @@ import org.springframework.data.repository.Repository;
*
* @author Mark Paluch
* @since 2.0
* @see Maybe
* @see Single
* @see Flowable
* @see Completable
@ -93,7 +94,7 @@ public interface RxJava2CrudRepository<T, ID extends Serializable> extends Repos @@ -93,7 +94,7 @@ public interface RxJava2CrudRepository<T, ID extends Serializable> extends Repos
Single<Boolean> exists(ID id);
/**
* Returns whether an entity with the given id exists supplied by a {@link Single}.
* Returns whether an entity with the given id, supplied by a {@link Single}, exists.
*
* @param id must not be {@literal null}.
* @return {@literal true} if an entity with the given id exists, {@literal false} otherwise.

4
src/main/java/org/springframework/data/repository/util/ReactiveWrapperConverters.java

@ -1,5 +1,5 @@ @@ -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.
@ -722,7 +722,7 @@ public class ReactiveWrapperConverters { @@ -722,7 +722,7 @@ public class ReactiveWrapperConverters {
@Override
public io.reactivex.Observable<?> convert(Publisher<?> source) {
return (io.reactivex.Observable<?>) REACTIVE_ADAPTER_REGISTRY.getAdapter(io.reactivex.Single.class)
return (io.reactivex.Observable<?>) REACTIVE_ADAPTER_REGISTRY.getAdapter(io.reactivex.Observable.class)
.fromPublisher(source);
}
}

18
src/test/java/org/springframework/data/repository/util/ReactiveWrapperConvertersUnitTests.java

@ -1,5 +1,5 @@ @@ -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.
@ -175,6 +175,22 @@ public class ReactiveWrapperConvertersUnitTests { @@ -175,6 +175,22 @@ public class ReactiveWrapperConvertersUnitTests {
assertThat(ReactiveWrapperConverters.toWrapper(foo, Publisher.class)).isInstanceOf(Publisher.class);
}
@Test // DATACMNS-988
public void toWrapperShouldConvertPublisherToRxJava2Observable() {
Flux<String> foo = Flux.just("foo");
assertThat(ReactiveWrapperConverters.toWrapper(foo, io.reactivex.Observable.class))
.isInstanceOf(io.reactivex.Observable.class);
}
@Test // DATACMNS-988
public void toWrapperShouldConvertPublisherToRxJava2Flowable() {
Flux<String> foo = Flux.just("foo");
assertThat(ReactiveWrapperConverters.toWrapper(foo, io.reactivex.Flowable.class))
.isInstanceOf(io.reactivex.Flowable.class);
}
@Test // DATACMNS-836
public void toWrapperShouldConvertMonoToFlux() {

Loading…
Cancel
Save