DATAMONGO-2255 - Polishing.
Add ticket references. Rename allAsFlow() to flow() to simplify naming. Original pull request: #736.
This commit is contained in:
@@ -39,7 +39,7 @@ inline fun <reified T : Any> ExecutableFindOperation.query(): ExecutableFindOper
|
||||
query(T::class.java)
|
||||
|
||||
/**
|
||||
* Extension for [ExecutableFindOperation.FindWithProjection. as] providing a [KClass] based variant.
|
||||
* Extension for [ExecutableFindOperation.FindWithProjection.as] providing a [KClass] based variant.
|
||||
*
|
||||
* @author Sebastien Deleuze
|
||||
* @author Mark Paluch
|
||||
@@ -50,7 +50,7 @@ fun <T : Any> ExecutableFindOperation.FindWithProjection<*>.asType(resultType: K
|
||||
`as`(resultType.java)
|
||||
|
||||
/**
|
||||
* Extension for [ExecutableFindOperation.FindWithProjection. as] leveraging reified type parameters.
|
||||
* Extension for [ExecutableFindOperation.FindWithProjection.as] leveraging reified type parameters.
|
||||
*
|
||||
* @author Sebastien Deleuze
|
||||
* @author Mark Paluch
|
||||
@@ -60,7 +60,7 @@ inline fun <reified T : Any> ExecutableFindOperation.FindWithProjection<*>.asTyp
|
||||
`as`(T::class.java)
|
||||
|
||||
/**
|
||||
* Extension for [ExecutableFindOperation.DistinctWithProjection. as] providing a [KClass] based variant.
|
||||
* Extension for [ExecutableFindOperation.DistinctWithProjection.as] providing a [KClass] based variant.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @since 2.1
|
||||
@@ -70,7 +70,7 @@ fun <T : Any> ExecutableFindOperation.DistinctWithProjection.asType(resultType:
|
||||
`as`(resultType.java);
|
||||
|
||||
/**
|
||||
* Extension for [ExecutableFindOperation.DistinctWithProjection. as] leveraging reified type parameters.
|
||||
* Extension for [ExecutableFindOperation.DistinctWithProjection.as] leveraging reified type parameters.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @since 2.1
|
||||
|
||||
@@ -49,5 +49,5 @@ inline fun <reified T : Any> ReactiveAggregationOperation.aggregateAndReturn():
|
||||
* @since 2.2
|
||||
*/
|
||||
@FlowPreview
|
||||
fun <T : Any> ReactiveAggregationOperation.TerminatingAggregationOperation<T>.allAsFlow(batchSize: Int = 1): Flow<T> =
|
||||
fun <T : Any> ReactiveAggregationOperation.TerminatingAggregationOperation<T>.flow(batchSize: Int = 1): Flow<T> =
|
||||
all().asFlow(batchSize)
|
||||
|
||||
@@ -143,7 +143,7 @@ suspend fun <T : Any> ReactiveFindOperation.TerminatingFind<T>.awaitExists(): Bo
|
||||
* @author Sebastien Deleuze
|
||||
*/
|
||||
@FlowPreview
|
||||
fun <T : Any> ReactiveFindOperation.TerminatingFind<T>.allAsFlow(batchSize: Int = 1): Flow<T> =
|
||||
fun <T : Any> ReactiveFindOperation.TerminatingFind<T>.flow(batchSize: Int = 1): Flow<T> =
|
||||
all().asFlow(batchSize)
|
||||
|
||||
/**
|
||||
@@ -167,7 +167,7 @@ fun <T : Any> ReactiveFindOperation.TerminatingFind<T>.tailAsFlow(batchSize: Int
|
||||
* @author Sebastien Deleuze
|
||||
*/
|
||||
@FlowPreview
|
||||
fun <T : Any> ReactiveFindOperation.TerminatingFindNear<T>.allAsFlow(batchSize: Int = 1): Flow<GeoResult<T>> =
|
||||
fun <T : Any> ReactiveFindOperation.TerminatingFindNear<T>.flow(batchSize: Int = 1): Flow<GeoResult<T>> =
|
||||
all().asFlow(batchSize)
|
||||
|
||||
/**
|
||||
@@ -180,5 +180,5 @@ fun <T : Any> ReactiveFindOperation.TerminatingFindNear<T>.allAsFlow(batchSize:
|
||||
* @since 2.2
|
||||
*/
|
||||
@FlowPreview
|
||||
fun <T : Any> ReactiveFindOperation.TerminatingDistinct<T>.allAsFlow(batchSize: Int = 1): Flow<T> =
|
||||
fun <T : Any> ReactiveFindOperation.TerminatingDistinct<T>.flow(batchSize: Int = 1): Flow<T> =
|
||||
all().asFlow(batchSize)
|
||||
|
||||
@@ -60,5 +60,5 @@ suspend inline fun <reified T: Any> ReactiveInsertOperation.TerminatingInsert<T>
|
||||
* @since 2.2
|
||||
*/
|
||||
@FlowPreview
|
||||
fun <T : Any> ReactiveInsertOperation.TerminatingInsert<T>.allAsFlow(objects: Collection<T>, batchSize: Int = 1): Flow<T> =
|
||||
fun <T : Any> ReactiveInsertOperation.TerminatingInsert<T>.flow(objects: Collection<T>, batchSize: Int = 1): Flow<T> =
|
||||
all(objects).asFlow(batchSize)
|
||||
|
||||
@@ -69,5 +69,5 @@ inline fun <reified T : Any> ReactiveMapReduceOperation.MapReduceWithProjection<
|
||||
* @since 2.2
|
||||
*/
|
||||
@FlowPreview
|
||||
fun <T : Any> ReactiveMapReduceOperation.TerminatingMapReduce<T>.allAsFlow(batchSize: Int = 1): Flow<T> =
|
||||
fun <T : Any> ReactiveMapReduceOperation.TerminatingMapReduce<T>.flow(batchSize: Int = 1): Flow<T> =
|
||||
all().asFlow(batchSize)
|
||||
|
||||
@@ -22,7 +22,7 @@ import io.mockk.verify
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
import kotlinx.coroutines.flow.toList
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.assertj.core.api.Assertions
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.Test
|
||||
import reactor.core.publisher.Flux
|
||||
|
||||
@@ -48,7 +48,7 @@ class ReactiveAggregationOperationExtensionsTests {
|
||||
verify { operation.aggregateAndReturn(First::class.java) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATAMONGO-2255
|
||||
@FlowPreview
|
||||
fun terminatingAggregationOperationAllAsFlow() {
|
||||
|
||||
@@ -56,7 +56,7 @@ class ReactiveAggregationOperationExtensionsTests {
|
||||
every { spec.all() } returns Flux.just("foo", "bar", "baz")
|
||||
|
||||
runBlocking {
|
||||
Assertions.assertThat(spec.allAsFlow().toList()).contains("foo", "bar", "baz")
|
||||
assertThat(spec.flow().toList()).contains("foo", "bar", "baz")
|
||||
}
|
||||
|
||||
verify {
|
||||
|
||||
@@ -20,6 +20,7 @@ import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import io.mockk.verify
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
import kotlinx.coroutines.flow.take
|
||||
import kotlinx.coroutines.flow.toList
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
@@ -34,6 +35,7 @@ import reactor.core.publisher.Mono
|
||||
* @author Mark Paluch
|
||||
* @author Sebastien Deleuze
|
||||
*/
|
||||
@FlowPreview
|
||||
class ReactiveFindOperationExtensionsTests {
|
||||
|
||||
val operation = mockk<ReactiveFindOperation>(relaxed = true)
|
||||
@@ -234,15 +236,14 @@ class ReactiveFindOperationExtensionsTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@FlowPreview
|
||||
@Test // DATAMONGO-2255
|
||||
fun terminatingFindAllAsFlow() {
|
||||
|
||||
val spec = mockk<ReactiveFindOperation.TerminatingFind<String>>()
|
||||
every { spec.all() } returns Flux.just("foo", "bar", "baz")
|
||||
|
||||
runBlocking {
|
||||
assertThat(spec.allAsFlow().toList()).contains("foo", "bar", "baz")
|
||||
assertThat(spec.flow().toList()).contains("foo", "bar", "baz")
|
||||
}
|
||||
|
||||
verify {
|
||||
@@ -250,15 +251,14 @@ class ReactiveFindOperationExtensionsTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@FlowPreview
|
||||
@Test // DATAMONGO-2255
|
||||
fun terminatingFindTailAsFlow() {
|
||||
|
||||
val spec = mockk<ReactiveFindOperation.TerminatingFind<String>>()
|
||||
every { spec.tail() } returns Flux.just("foo", "bar", "baz")
|
||||
every { spec.tail() } returns Flux.just("foo", "bar", "baz").concatWith(Flux.never())
|
||||
|
||||
runBlocking {
|
||||
assertThat(spec.tailAsFlow().toList()).contains("foo", "bar", "baz")
|
||||
assertThat(spec.tailAsFlow().take(3).toList()).contains("foo", "bar", "baz")
|
||||
}
|
||||
|
||||
verify {
|
||||
@@ -266,8 +266,7 @@ class ReactiveFindOperationExtensionsTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@FlowPreview
|
||||
@Test // DATAMONGO-2255
|
||||
fun terminatingFindNearAllAsFlow() {
|
||||
|
||||
val spec = mockk<ReactiveFindOperation.TerminatingFindNear<String>>()
|
||||
@@ -277,7 +276,7 @@ class ReactiveFindOperationExtensionsTests {
|
||||
every { spec.all() } returns Flux.just(foo, bar, baz)
|
||||
|
||||
runBlocking {
|
||||
assertThat(spec.allAsFlow().toList()).contains(foo, bar, baz)
|
||||
assertThat(spec.flow().toList()).contains(foo, bar, baz)
|
||||
}
|
||||
|
||||
verify {
|
||||
@@ -285,15 +284,14 @@ class ReactiveFindOperationExtensionsTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@FlowPreview
|
||||
@Test // DATAMONGO-2255
|
||||
fun terminatingDistinctAllAsFlow() {
|
||||
|
||||
val spec = mockk<ReactiveFindOperation.TerminatingDistinct<String>>()
|
||||
every { spec.all() } returns Flux.just("foo", "bar", "baz")
|
||||
|
||||
runBlocking {
|
||||
assertThat(spec.allAsFlow().toList()).contains("foo", "bar", "baz")
|
||||
assertThat(spec.flow().toList()).contains("foo", "bar", "baz")
|
||||
}
|
||||
|
||||
verify {
|
||||
|
||||
@@ -64,7 +64,7 @@ class ReactiveInsertOperationExtensionsTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATAMONGO-2255
|
||||
@FlowPreview
|
||||
fun terminatingInsertAllAsFlow() {
|
||||
|
||||
@@ -73,7 +73,7 @@ class ReactiveInsertOperationExtensionsTests {
|
||||
every { insert.all(any()) } returns Flux.fromIterable(list)
|
||||
|
||||
runBlocking {
|
||||
assertThat(insert.allAsFlow(list).toList()).containsAll(list)
|
||||
assertThat(insert.flow(list).toList()).containsAll(list)
|
||||
}
|
||||
|
||||
verify {
|
||||
|
||||
@@ -22,7 +22,7 @@ import io.mockk.verify
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
import kotlinx.coroutines.flow.toList
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.assertj.core.api.Assertions
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.Test
|
||||
import reactor.core.publisher.Flux
|
||||
|
||||
@@ -64,7 +64,7 @@ class ReactiveMapReduceOperationExtensionsTests {
|
||||
verify { operationWithProjection.`as`(User::class.java) }
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATAMONGO-2255
|
||||
@FlowPreview
|
||||
fun terminatingMapReduceAllAsFlow() {
|
||||
|
||||
@@ -72,7 +72,7 @@ class ReactiveMapReduceOperationExtensionsTests {
|
||||
every { spec.all() } returns Flux.just("foo", "bar", "baz")
|
||||
|
||||
runBlocking {
|
||||
Assertions.assertThat(spec.allAsFlow().toList()).contains("foo", "bar", "baz")
|
||||
assertThat(spec.flow().toList()).contains("foo", "bar", "baz")
|
||||
}
|
||||
|
||||
verify {
|
||||
|
||||
@@ -66,7 +66,7 @@ class ReactiveRemoveOperationExtensionsTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATAMONGO-2255
|
||||
@FlowPreview
|
||||
fun terminatingRemoveFindAndRemoveAsFlow() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user