DATACMNS-988 - Fix Publisher to RxJava 2 conversion.

And fix some issues in JavaDoc.

Original Pull Request: #194
This commit is contained in:
Mark Paluch
2017-02-08 10:48:01 +01:00
committed by Christoph Strobl
parent 3099125aa3
commit d72e9486be
5 changed files with 23 additions and 6 deletions

View File

@@ -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

View File

@@ -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.

View File

@@ -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
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.

View File

@@ -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 {
@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);
}
}

View File

@@ -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 {
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() {