DATAMONGO-2358 - Upgrade to Coroutines 1.3.0 and fix warnings.

Original pull request: #785.
This commit is contained in:
Sebastien Deleuze
2019-09-04 10:50:35 +02:00
committed by Mark Paluch
parent c23c5ae6c6
commit 8fb9d9e5f4
23 changed files with 137 additions and 86 deletions

View File

@@ -24,8 +24,6 @@ import org.springframework.data.mongodb.core.BulkOperations.BulkMode
import org.springframework.data.mongodb.core.aggregation.Aggregation
import org.springframework.data.mongodb.core.aggregation.AggregationResults
import org.springframework.data.mongodb.core.index.IndexOperations
import org.springframework.data.mongodb.core.mapreduce.GroupBy
import org.springframework.data.mongodb.core.mapreduce.GroupByResults
import org.springframework.data.mongodb.core.mapreduce.MapReduceOptions
import org.springframework.data.mongodb.core.mapreduce.MapReduceResults
import org.springframework.data.mongodb.core.query.Criteria
@@ -200,7 +198,9 @@ inline fun <reified T : Any> MongoOperations.findAll(collectionName: String? = n
* @author Sebastien Deleuze
* @since 2.0
*/
inline fun <reified T : Any> MongoOperations.group(inputCollectionName: String, groupBy: GroupBy): GroupByResults<T> =
@Suppress("DEPRECATION")
@Deprecated("since 2.2, the `group` command has been removed in MongoDB Server 4.2.0.", replaceWith = ReplaceWith("aggregate<T>()"))
inline fun <reified T : Any> MongoOperations.group(inputCollectionName: String, groupBy: org.springframework.data.mongodb.core.mapreduce.GroupBy): org.springframework.data.mongodb.core.mapreduce.GroupByResults<T> =
group(inputCollectionName, groupBy, T::class.java)
/**
@@ -209,7 +209,9 @@ inline fun <reified T : Any> MongoOperations.group(inputCollectionName: String,
* @author Sebastien Deleuze
* @since 2.0
*/
inline fun <reified T : Any> MongoOperations.group(criteria: Criteria, inputCollectionName: String, groupBy: GroupBy): GroupByResults<T> =
@Suppress("DEPRECATION")
@Deprecated("since 2.2, the `group` command has been removed in MongoDB Server 4.2.0.", replaceWith = ReplaceWith("aggregate<T>()"))
inline fun <reified T : Any> MongoOperations.group(criteria: Criteria, inputCollectionName: String, groupBy: org.springframework.data.mongodb.core.mapreduce.GroupBy): org.springframework.data.mongodb.core.mapreduce.GroupByResults<T> =
group(criteria, inputCollectionName, groupBy, T::class.java)
/**
@@ -276,6 +278,8 @@ inline fun <reified T : Any> MongoOperations.mapReduce(query: Query, collectionN
* @author Sebastien Deleuze
* @since 2.0
*/
@Suppress("DEPRECATION")
@Deprecated("Since 2.2, the `geoNear` command has been removed in MongoDB Server 4.2.0. Use Aggregations with `Aggregation.geoNear(NearQuery, String)` instead.", replaceWith = ReplaceWith("aggregate<T>()"))
inline fun <reified T : Any> MongoOperations.geoNear(near: NearQuery, collectionName: String? = null): GeoResults<T> =
if (collectionName != null) geoNear(near, T::class.java, collectionName)
else geoNear(near, T::class.java)
@@ -339,7 +343,7 @@ inline fun <reified T : Any> MongoOperations.findById(id: Any, collectionName: S
*/
@Deprecated("Since 2.2, use the reified variant", replaceWith = ReplaceWith("findDistinct<T, E>(field)"))
inline fun <reified T : Any> MongoOperations.findDistinct(field: String, entityClass: KClass<*>): List<T> =
findDistinct(field, entityClass.java, T::class.java);
findDistinct(field, entityClass.java, T::class.java)
/**
* Extension for [MongoOperations.findDistinct] leveraging reified type parameters.

View File

@@ -15,9 +15,9 @@
*/
package org.springframework.data.mongodb.core
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.flow.asFlow
import kotlinx.coroutines.reactive.asFlow
import kotlin.reflect.KClass
/**
@@ -42,12 +42,9 @@ inline fun <reified T : Any> ReactiveAggregationOperation.aggregateAndReturn():
/**
* Coroutines [Flow] variant of [ReactiveAggregationOperation.TerminatingAggregationOperation.all].
*
* Backpressure is controlled by [batchSize] parameter that controls the size of in-flight elements
* and [org.reactivestreams.Subscription.request] size.
*
* @author Sebastien Deleuze
* @since 2.2
*/
@FlowPreview
fun <T : Any> ReactiveAggregationOperation.TerminatingAggregationOperation<T>.flow(batchSize: Int = 1): Flow<T> =
all().asFlow(batchSize)
@ExperimentalCoroutinesApi
fun <T : Any> ReactiveAggregationOperation.TerminatingAggregationOperation<T>.flow(): Flow<T> =
all().asFlow()

View File

@@ -15,9 +15,9 @@
*/
package org.springframework.data.mongodb.core
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.flow.asFlow
import kotlinx.coroutines.reactive.asFlow
/**
* Extension for [RactiveChangeStreamOperation.changeStream] leveraging reified type parameters.
@@ -40,13 +40,11 @@ inline fun <reified T : Any> ReactiveChangeStreamOperation.ChangeStreamWithFilte
/**
* Coroutines [Flow] variant of [ReactiveChangeStreamOperation.TerminatingChangeStream.listen].
*
* Backpressure is controlled by [batchSize] parameter that controls the size of in-flight elements
* and [org.reactivestreams.Subscription.request] size.
*
* @author Christoph Strobl
* @author Sebastien Deleuze
* @since 2.2
*/
@FlowPreview
fun <T : Any> ReactiveChangeStreamOperation.TerminatingChangeStream<T>.flow(batchSize: Int = 1): Flow<ChangeStreamEvent<T>> =
listen().asFlow(batchSize)
@ExperimentalCoroutinesApi
fun <T : Any> ReactiveChangeStreamOperation.TerminatingChangeStream<T>.flow(): Flow<ChangeStreamEvent<T>> =
listen().asFlow()

View File

@@ -15,11 +15,11 @@
*/
package org.springframework.data.mongodb.core
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.asFlow
import kotlinx.coroutines.reactive.awaitFirstOrNull
import kotlinx.coroutines.reactive.awaitSingle
import kotlinx.coroutines.reactive.flow.asFlow
import org.springframework.data.geo.GeoResult
import kotlin.reflect.KClass
@@ -137,48 +137,36 @@ suspend fun <T : Any> ReactiveFindOperation.TerminatingFind<T>.awaitExists(): Bo
/**
* Coroutines [Flow] variant of [ReactiveFindOperation.TerminatingFind.all].
*
* Backpressure is controlled by [batchSize] parameter that controls the size of in-flight elements
* and [org.reactivestreams.Subscription.request] size.
*
* @author Sebastien Deleuze
*/
@FlowPreview
fun <T : Any> ReactiveFindOperation.TerminatingFind<T>.flow(batchSize: Int = 1): Flow<T> =
all().asFlow(batchSize)
@ExperimentalCoroutinesApi
fun <T : Any> ReactiveFindOperation.TerminatingFind<T>.flow(): Flow<T> =
all().asFlow()
/**
* Coroutines [Flow] variant of [ReactiveFindOperation.TerminatingFind.tail].
*
* Backpressure is controlled by [batchSize] parameter that controls the size of in-flight elements
* and [org.reactivestreams.Subscription.request] size.
*
* @author Sebastien Deleuze
*/
@FlowPreview
fun <T : Any> ReactiveFindOperation.TerminatingFind<T>.tailAsFlow(batchSize: Int = 1): Flow<T> =
tail().asFlow(batchSize)
@ExperimentalCoroutinesApi
fun <T : Any> ReactiveFindOperation.TerminatingFind<T>.tailAsFlow(): Flow<T> =
tail().asFlow()
/**
* Coroutines [Flow] variant of [ReactiveFindOperation.TerminatingFindNear.all].
*
* Backpressure is controlled by [batchSize] parameter that controls the size of in-flight elements
* and [org.reactivestreams.Subscription.request] size.
*
* @author Sebastien Deleuze
*/
@FlowPreview
fun <T : Any> ReactiveFindOperation.TerminatingFindNear<T>.flow(batchSize: Int = 1): Flow<GeoResult<T>> =
all().asFlow(batchSize)
@ExperimentalCoroutinesApi
fun <T : Any> ReactiveFindOperation.TerminatingFindNear<T>.flow(): Flow<GeoResult<T>> =
all().asFlow()
/**
* Coroutines [Flow] variant of [ReactiveFindOperation.TerminatingDistinct.all].
*
* Backpressure is controlled by [batchSize] parameter that controls the size of in-flight elements
* and [org.reactivestreams.Subscription.request] size.
*
* @author Sebastien Deleuze
* @since 2.2
*/
@FlowPreview
fun <T : Any> ReactiveFindOperation.TerminatingDistinct<T>.flow(batchSize: Int = 1): Flow<T> =
all().asFlow(batchSize)
@ExperimentalCoroutinesApi
fun <T : Any> ReactiveFindOperation.TerminatingDistinct<T>.flow(): Flow<T> =
all().asFlow()

View File

@@ -15,10 +15,10 @@
*/
package org.springframework.data.mongodb.core
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.asFlow
import kotlinx.coroutines.reactive.awaitSingle
import kotlinx.coroutines.reactive.flow.asFlow
import kotlin.reflect.KClass
/**
@@ -53,12 +53,9 @@ suspend inline fun <reified T: Any> ReactiveInsertOperation.TerminatingInsert<T>
/**
* Coroutines [Flow] variant of [ReactiveInsertOperation.TerminatingInsert.all].
*
* Backpressure is controlled by [batchSize] parameter that controls the size of in-flight elements
* and [org.reactivestreams.Subscription.request] size.
*
* @author Sebastien Deleuze
* @since 2.2
*/
@FlowPreview
fun <T : Any> ReactiveInsertOperation.TerminatingInsert<T>.flow(objects: Collection<T>, batchSize: Int = 1): Flow<T> =
all(objects).asFlow(batchSize)
@ExperimentalCoroutinesApi
fun <T : Any> ReactiveInsertOperation.TerminatingInsert<T>.flow(objects: Collection<T>): Flow<T> =
all(objects).asFlow()

View File

@@ -15,9 +15,9 @@
*/
package org.springframework.data.mongodb.core
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.flow.asFlow
import kotlinx.coroutines.reactive.asFlow
import kotlin.reflect.KClass
/**
@@ -62,12 +62,9 @@ inline fun <reified T : Any> ReactiveMapReduceOperation.MapReduceWithProjection<
/**
* Coroutines [Flow] variant of [ReactiveMapReduceOperation.TerminatingMapReduce.all].
*
* Backpressure is controlled by [batchSize] parameter that controls the size of in-flight elements
* and [org.reactivestreams.Subscription.request] size.
*
* @author Sebastien Deleuze
* @since 2.2
*/
@FlowPreview
fun <T : Any> ReactiveMapReduceOperation.TerminatingMapReduce<T>.flow(batchSize: Int = 1): Flow<T> =
all().asFlow(batchSize)
@ExperimentalCoroutinesApi
fun <T : Any> ReactiveMapReduceOperation.TerminatingMapReduce<T>.flow(): Flow<T> =
all().asFlow()

View File

@@ -216,6 +216,8 @@ inline fun <reified T : Any, reified E : Any> ReactiveMongoOperations.findDistin
* @author Sebastien Deleuze
* @since 2.0
*/
@Suppress("DEPRECATION")
@Deprecated("Since 2.2, the `geoNear` command has been removed in MongoDB Server 4.2.0. Use Aggregations with `Aggregation.geoNear(NearQuery, String)` instead.", replaceWith = ReplaceWith("aggregate<T>()"))
inline fun <reified T : Any> ReactiveMongoOperations.geoNear(near: NearQuery, collectionName: String? = null): Flux<GeoResult<T>> =
if (collectionName != null) geoNear(near, T::class.java, collectionName) else geoNear(near, T::class.java)

View File

@@ -16,10 +16,10 @@
package org.springframework.data.mongodb.core
import com.mongodb.client.result.DeleteResult
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.asFlow
import kotlinx.coroutines.reactive.awaitSingle
import kotlinx.coroutines.reactive.flow.asFlow
import kotlin.reflect.KClass
/**
@@ -54,12 +54,9 @@ suspend fun <T : Any> ReactiveRemoveOperation.TerminatingRemove<T>.allAndAwait()
/**
* Coroutines [Flow] variant of [ReactiveRemoveOperation.TerminatingRemove.findAndRemove].
*
* Backpressure is controlled by [batchSize] parameter that controls the size of in-flight elements
* and [org.reactivestreams.Subscription.request] size.
*
* @author Sebastien Deleuze
* @since 2.2
*/
@FlowPreview
fun <T : Any> ReactiveRemoveOperation.TerminatingRemove<T>.findAndRemoveAsFlow(batchSize: Int = 1): Flow<T> =
findAndRemove().asFlow(batchSize)
@ExperimentalCoroutinesApi
fun <T : Any> ReactiveRemoveOperation.TerminatingRemove<T>.findAndRemoveAsFlow(): Flow<T> =
findAndRemove().asFlow()

View File

@@ -29,6 +29,7 @@ class ExecutableAggregationOperationExtensionsTests {
val operation = mockk<ExecutableAggregationOperation>(relaxed = true)
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `aggregateAndReturn(KClass) extension should call its Java counterpart`() {
operation.aggregateAndReturn(First::class)

View File

@@ -33,6 +33,7 @@ class ExecutableFindOperationExtensionsTests {
val distinctWithProjection = mockk<ExecutableFindOperation.DistinctWithProjection>(relaxed = true)
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `ExecutableFindOperation#query(KClass) extension should call its Java counterpart`() {
operation.query(First::class)
@@ -47,6 +48,7 @@ class ExecutableFindOperationExtensionsTests {
}
@Test // DATAMONGO-1689, DATAMONGO-2086
@Suppress("DEPRECATION")
fun `ExecutableFindOperation#FindOperationWithProjection#asType(KClass) extension should call its Java counterpart`() {
operationWithProjection.asType(User::class)
@@ -61,6 +63,7 @@ class ExecutableFindOperationExtensionsTests {
}
@Test // DATAMONGO-1761, DATAMONGO-2086
@Suppress("DEPRECATION")
fun `ExecutableFindOperation#DistinctWithProjection#asType(KClass) extension should call its Java counterpart`() {
distinctWithProjection.asType(User::class)

View File

@@ -29,6 +29,7 @@ class ExecutableInsertOperationExtensionsTests {
val operation = mockk<ExecutableInsertOperation>(relaxed = true)
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `insert(KClass) extension should call its Java counterpart`() {
operation.insert(First::class)

View File

@@ -31,6 +31,7 @@ class ExecutableMapReduceOperationExtensionsTests {
val operationWithProjection = mockk<ExecutableMapReduceOperation.MapReduceWithProjection<First>>(relaxed = true)
@Test // DATAMONGO-1929
@Suppress("DEPRECATION")
fun `ExecutableMapReduceOperation#mapReduce(KClass) extension should call its Java counterpart`() {
operation.mapReduce(First::class)
@@ -45,6 +46,7 @@ class ExecutableMapReduceOperationExtensionsTests {
}
@Test // DATAMONGO-1929, DATAMONGO-2086
@Suppress("DEPRECATION")
fun `ExecutableMapReduceOperation#MapReduceWithProjection#asType(KClass) extension should call its Java counterpart`() {
operationWithProjection.asType(User::class)

View File

@@ -29,6 +29,7 @@ class ExecutableRemoveOperationExtensionsTests {
val operation = mockk<ExecutableRemoveOperation>(relaxed = true)
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `remove(KClass) extension should call its Java counterpart`() {
operation.remove(First::class)

View File

@@ -31,6 +31,7 @@ class ExecutableUpdateOperationExtensionsTests {
val operation = mockk<ExecutableUpdateOperation>(relaxed = true)
@Test // DATAMONGO-1719
@Suppress("DEPRECATION")
fun `update(KClass) extension should call its Java counterpart`() {
operation.update(First::class)

View File

@@ -22,7 +22,6 @@ import io.mockk.verify
import org.junit.Test
import org.springframework.data.mongodb.core.BulkOperations.BulkMode
import org.springframework.data.mongodb.core.aggregation.Aggregation
import org.springframework.data.mongodb.core.mapreduce.GroupBy
import org.springframework.data.mongodb.core.mapreduce.MapReduceOptions
import org.springframework.data.mongodb.core.query.Criteria
import org.springframework.data.mongodb.core.query.NearQuery
@@ -39,6 +38,7 @@ class MongoOperationsExtensionsTests {
val operations = mockk<MongoOperations>(relaxed = true)
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `getCollectionName(KClass) extension should call its Java counterpart`() {
operations.getCollectionName(First::class)
@@ -78,6 +78,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `createCollection(KClass) extension should call its Java counterpart`() {
operations.createCollection(First::class)
@@ -85,6 +86,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `createCollection(KClass, CollectionOptions) extension should call its Java counterpart`() {
val collectionOptions = mockk<CollectionOptions>()
@@ -109,6 +111,7 @@ class MongoOperationsExtensionsTests {
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `collectionExists(KClass) extension should call its Java counterpart`() {
operations.collectionExists(First::class)
@@ -123,6 +126,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `dropCollection(KClass) extension should call its Java counterpart`() {
operations.dropCollection(First::class)
@@ -137,6 +141,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `indexOps(KClass) extension should call its Java counterpart`() {
operations.indexOps(First::class)
@@ -151,6 +156,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `bulkOps(BulkMode, KClass) extension should call its Java counterpart`() {
val bulkMode = BulkMode.ORDERED
@@ -160,6 +166,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `bulkOps(BulkMode, KClass, String) extension should call its Java counterpart`() {
val bulkMode = BulkMode.ORDERED
@@ -205,27 +212,30 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `group(String, GroupBy) with reified type parameter extension should call its Java counterpart`() {
val collectionName = "foo"
val groupBy = mockk<GroupBy>()
val groupBy = mockk<org.springframework.data.mongodb.core.mapreduce.GroupBy>()
operations.group<First>(collectionName, groupBy)
verify { operations.group(collectionName, groupBy, First::class.java) }
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `group(Criteria, String, GroupBy) with reified type parameter extension should call its Java counterpart`() {
val criteria = mockk<Criteria>()
val collectionName = "foo"
val groupBy = mockk<GroupBy>()
val groupBy = mockk<org.springframework.data.mongodb.core.mapreduce.GroupBy>()
operations.group<First>(criteria, collectionName, groupBy)
verify { operations.group(criteria, collectionName, groupBy, First::class.java) }
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `aggregate(Aggregation, KClass) with reified type parameter extension should call its Java counterpart`() {
val aggregation = mockk<Aggregation>()
@@ -245,6 +255,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `aggregateStream(Aggregation, KClass) with reified type parameter extension should call its Java counterpart`() {
val aggregation = mockk<Aggregation>()
@@ -312,6 +323,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `geoNear(Query) with reified type parameter extension should call its Java counterpart`() {
val query = NearQuery.near(0.0, 0.0)
@@ -321,6 +333,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `geoNear(Query, String) with reified type parameter extension should call its Java counterpart`() {
val collectionName = "foo"
@@ -350,6 +363,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `exists(Query, KClass) extension should call its Java counterpart`() {
val query = mockk<Query>()
@@ -474,6 +488,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `count(Query, KClass) with reified type parameter extension should call its Java counterpart`() {
val query = mockk<Query>()
@@ -483,6 +498,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `count(Query, KClass, String) with reified type parameter extension should call its Java counterpart`() {
val query = mockk<Query>()
@@ -493,6 +509,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `insert(Collection, KClass) extension should call its Java counterpart`() {
val collection = listOf(First(), First())
@@ -511,6 +528,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `upsert(Query, Update, KClass) extension should call its Java counterpart`() {
val query = mockk<Query>()
@@ -521,6 +539,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `upsert(Query, Update, KClass, String) extension should call its Java counterpart`() {
val query = mockk<Query>()
@@ -553,6 +572,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `updateFirst(Query, Update, KClass) extension should call its Java counterpart`() {
val query = mockk<Query>()
@@ -563,6 +583,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `updateFirst(Query, Update, KClass, String) extension should call its Java counterpart`() {
val query = mockk<Query>()
@@ -595,6 +616,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `updateMulti(Query, Update, KClass) extension should call its Java counterpart`() {
val query = mockk<Query>()
@@ -605,6 +627,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `updateMulti(Query, Update, KClass, String) extension should call its Java counterpart`() {
val query = mockk<Query>()
@@ -637,6 +660,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `remove(Query, KClass) extension should call its Java counterpart`() {
val query = mockk<Query>()
@@ -646,6 +670,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `remove(Query, KClass, String) extension should call its Java counterpart`() {
val query = mockk<Query>()
@@ -684,6 +709,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1761
@Suppress("DEPRECATION")
fun `findDistinct(String, KClass) should call java counterpart`() {
operations.findDistinct<String>("field", First::class)
@@ -691,6 +717,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1761
@Suppress("DEPRECATION")
fun `findDistinct(Query, String, KClass) should call java counterpart`() {
val query = mockk<Query>()
@@ -700,6 +727,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1761
@Suppress("DEPRECATION")
fun `findDistinct(Query, String, String, KClass) should call java counterpart`() {
val query = mockk<Query>()
@@ -727,6 +755,7 @@ class MongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1761
@Suppress("DEPRECATION")
fun `findDistinct(Query, String, KClass) should call java counterpart`() {
val query = mockk<Query>()

View File

@@ -19,7 +19,7 @@ import example.first.First
import io.mockk.every
import io.mockk.mockk
import io.mockk.verify
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.runBlocking
import org.assertj.core.api.Assertions.assertThat
@@ -35,6 +35,7 @@ class ReactiveAggregationOperationExtensionsTests {
val operation = mockk<ReactiveAggregationOperation>(relaxed = true)
@Test // DATAMONGO-1719
@Suppress("DEPRECATION")
fun `aggregateAndReturn(KClass) extension should call its Java counterpart`() {
operation.aggregateAndReturn(First::class)
@@ -49,7 +50,7 @@ class ReactiveAggregationOperationExtensionsTests {
}
@Test // DATAMONGO-2255
@FlowPreview
@ExperimentalCoroutinesApi
fun terminatingAggregationOperationAllAsFlow() {
val spec = mockk<ReactiveAggregationOperation.TerminatingAggregationOperation<String>>()

View File

@@ -19,7 +19,7 @@ import example.first.First
import io.mockk.every
import io.mockk.mockk
import io.mockk.verify
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.runBlocking
import org.assertj.core.api.Assertions.assertThat
@@ -44,7 +44,7 @@ class ReactiveChangeStreamOperationExtensionsTests {
}
@Test // DATAMONGO-2089
@FlowPreview
@ExperimentalCoroutinesApi
fun `TerminatingChangeStream#listen() flow extension`() {
val doc1 = mockk<ChangeStreamEvent<Document>>()

View File

@@ -19,7 +19,7 @@ import example.first.First
import io.mockk.every
import io.mockk.mockk
import io.mockk.verify
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.take
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.runBlocking
@@ -35,7 +35,7 @@ import reactor.core.publisher.Mono
* @author Mark Paluch
* @author Sebastien Deleuze
*/
@FlowPreview
@ExperimentalCoroutinesApi
class ReactiveFindOperationExtensionsTests {
val operation = mockk<ReactiveFindOperation>(relaxed = true)
@@ -45,6 +45,7 @@ class ReactiveFindOperationExtensionsTests {
val distinctWithProjection = mockk<ReactiveFindOperation.DistinctWithProjection>(relaxed = true)
@Test // DATAMONGO-1719
@Suppress("DEPRECATION")
fun `ReactiveFind#query(KClass) extension should call its Java counterpart`() {
operation.query(First::class)
@@ -59,6 +60,7 @@ class ReactiveFindOperationExtensionsTests {
}
@Test // DATAMONGO-1719, DATAMONGO-2086
@Suppress("DEPRECATION")
fun `ReactiveFind#FindOperatorWithProjection#asType(KClass) extension should call its Java counterpart`() {
operationWithProjection.asType(User::class)
@@ -73,6 +75,7 @@ class ReactiveFindOperationExtensionsTests {
}
@Test // DATAMONGO-1761, DATAMONGO-2086
@Suppress("DEPRECATION")
fun `ReactiveFind#DistinctWithProjection#asType(KClass) extension should call its Java counterpart`() {
distinctWithProjection.asType(User::class)

View File

@@ -19,7 +19,7 @@ import example.first.First
import io.mockk.every
import io.mockk.mockk
import io.mockk.verify
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.runBlocking
import org.assertj.core.api.Assertions.assertThat
@@ -36,6 +36,7 @@ class ReactiveInsertOperationExtensionsTests {
val operation = mockk<ReactiveInsertOperation>(relaxed = true)
@Test // DATAMONGO-1719
@Suppress("DEPRECATION")
fun `insert(KClass) extension should call its Java counterpart`() {
operation.insert(First::class)
@@ -65,7 +66,7 @@ class ReactiveInsertOperationExtensionsTests {
}
@Test // DATAMONGO-2255
@FlowPreview
@ExperimentalCoroutinesApi
fun terminatingInsertAllAsFlow() {
val insert = mockk<ReactiveInsertOperation.TerminatingInsert<String>>()

View File

@@ -19,7 +19,7 @@ import example.first.First
import io.mockk.every
import io.mockk.mockk
import io.mockk.verify
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.runBlocking
import org.assertj.core.api.Assertions.assertThat
@@ -37,6 +37,7 @@ class ReactiveMapReduceOperationExtensionsTests {
val operationWithProjection = mockk<ReactiveMapReduceOperation.MapReduceWithProjection<First>>(relaxed = true)
@Test // DATAMONGO-1929
@Suppress("DEPRECATION")
fun `ReactiveMapReduceOperation#mapReduce(KClass) extension should call its Java counterpart`() {
operation.mapReduce(First::class)
@@ -51,6 +52,7 @@ class ReactiveMapReduceOperationExtensionsTests {
}
@Test // DATAMONGO-1929, DATAMONGO-2086
@Suppress("DEPRECATION")
fun `ReactiveMapReduceOperation#MapReduceWithProjection#asType(KClass) extension should call its Java counterpart`() {
operationWithProjection.asType(User::class)
@@ -65,7 +67,7 @@ class ReactiveMapReduceOperationExtensionsTests {
}
@Test // DATAMONGO-2255
@FlowPreview
@ExperimentalCoroutinesApi
fun terminatingMapReduceAllAsFlow() {
val spec = mockk<ReactiveMapReduceOperation.TerminatingMapReduce<String>>()

View File

@@ -34,6 +34,7 @@ class ReactiveMongoOperationsExtensionsTests {
val operations = mockk<ReactiveMongoOperations>(relaxed = true)
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `indexOps(KClass) extension should call its Java counterpart`() {
operations.indexOps(First::class)
@@ -57,6 +58,7 @@ class ReactiveMongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `createCollection(KClass) extension should call its Java counterpart`() {
operations.createCollection(First::class)
@@ -64,6 +66,7 @@ class ReactiveMongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `createCollection(KClass, CollectionOptions) extension should call its Java counterpart`() {
val collectionOptions = mockk<CollectionOptions>()
@@ -89,6 +92,7 @@ class ReactiveMongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `collectionExists(KClass) extension should call its Java counterpart`() {
operations.collectionExists(First::class)
@@ -103,6 +107,7 @@ class ReactiveMongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `dropCollection(KClass) extension should call its Java counterpart`() {
operations.dropCollection(First::class)
@@ -152,6 +157,7 @@ class ReactiveMongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `exists(Query, KClass) extension should call its Java counterpart`() {
val query = mockk<Query>()
@@ -208,6 +214,7 @@ class ReactiveMongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `geoNear(Query) with reified type parameter extension should call its Java counterpart`() {
val query = NearQuery.near(0.0, 0.0)
@@ -217,6 +224,7 @@ class ReactiveMongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `geoNear(Query, String) with reified type parameter extension should call its Java counterpart`() {
val collectionName = "foo"
@@ -295,6 +303,7 @@ class ReactiveMongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `count(Query, KClass) with reified type parameter extension should call its Java counterpart`() {
val query = mockk<Query>()
@@ -304,6 +313,7 @@ class ReactiveMongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `count(Query, KClass, String) with reified type parameter extension should call its Java counterpart`() {
val query = mockk<Query>()
@@ -314,6 +324,7 @@ class ReactiveMongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `insert(Collection, KClass) extension should call its Java counterpart`() {
val collection = listOf(First(), First())
@@ -332,6 +343,7 @@ class ReactiveMongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `insertAll(Mono, KClass) extension should call its Java counterpart`() {
val collection = Mono.just(listOf(First(), First()))
@@ -341,6 +353,7 @@ class ReactiveMongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `upsert(Query, Update, KClass) extension should call its Java counterpart`() {
val query = mockk<Query>()
@@ -351,6 +364,7 @@ class ReactiveMongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `upsert(Query, Update, KClass, String) extension should call its Java counterpart`() {
val query = mockk<Query>()
@@ -383,6 +397,7 @@ class ReactiveMongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `updateFirst(Query, Update, KClass) extension should call its Java counterpart`() {
val query = mockk<Query>()
@@ -393,6 +408,7 @@ class ReactiveMongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `updateFirst(Query, Update, KClass, String) extension should call its Java counterpart`() {
val query = mockk<Query>()
@@ -425,6 +441,7 @@ class ReactiveMongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `updateMulti(Query, Update, KClass) extension should call its Java counterpart`() {
val query = mockk<Query>()
@@ -435,6 +452,7 @@ class ReactiveMongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `updateMulti(Query, Update, KClass, String) extension should call its Java counterpart`() {
val query = mockk<Query>()
@@ -467,6 +485,7 @@ class ReactiveMongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `remove(Query, KClass) extension should call its Java counterpart`() {
val query = mockk<Query>()
@@ -476,6 +495,7 @@ class ReactiveMongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1689
@Suppress("DEPRECATION")
fun `remove(Query, KClass, String) extension should call its Java counterpart`() {
val query = mockk<Query>()
@@ -533,6 +553,7 @@ class ReactiveMongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1761
@Suppress("DEPRECATION")
fun `findDistinct(String, KClass) should call java counterpart`() {
operations.findDistinct<String>("field", First::class)
@@ -540,6 +561,7 @@ class ReactiveMongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1761
@Suppress("DEPRECATION")
fun `findDistinct(Query, String, KClass) should call java counterpart`() {
val query = mockk<Query>()
@@ -549,6 +571,7 @@ class ReactiveMongoOperationsExtensionsTests {
}
@Test // DATAMONGO-1761
@Suppress("DEPRECATION")
fun `findDistinct(Query, String, String, KClass) should call java counterpart`() {
val query = mockk<Query>()
@@ -577,6 +600,7 @@ class ReactiveMongoOperationsExtensionsTests {
@Test // DATAMONGO-1761
@Suppress("DEPRECATION")
fun `findDistinct(Query, String, KClass) should call java counterpart`() {
val query = mockk<Query>()

View File

@@ -20,7 +20,7 @@ import example.first.First
import io.mockk.every
import io.mockk.mockk
import io.mockk.verify
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.runBlocking
import org.assertj.core.api.Assertions.assertThat
@@ -37,6 +37,7 @@ class ReactiveRemoveOperationExtensionsTests {
val operation = mockk<ReactiveRemoveOperation>(relaxed = true)
@Test // DATAMONGO-1719
@Suppress("DEPRECATION")
fun `remove(KClass) extension should call its Java counterpart`() {
operation.remove(First::class)
@@ -67,7 +68,7 @@ class ReactiveRemoveOperationExtensionsTests {
}
@Test // DATAMONGO-2255
@FlowPreview
@ExperimentalCoroutinesApi
fun terminatingRemoveFindAndRemoveAsFlow() {
val spec = mockk<ReactiveRemoveOperation.TerminatingRemove<String>>()

View File

@@ -37,6 +37,7 @@ class ReactiveUpdateOperationExtensionsTests {
val operation = mockk<ReactiveUpdateOperation>(relaxed = true)
@Test // DATAMONGO-1719
@Suppress("DEPRECATION")
fun `update(KClass) extension should call its Java counterpart`() {
operation.update(First::class)