DATAREDIS-1111 - Polishing.

Update author information, issue references and favour non nullable parameter with default value.

Original Pull Request: #514
This commit is contained in:
Christoph Strobl
2020-03-09 14:48:19 +01:00
parent 62042a5d6d
commit 18d4ea1db4
3 changed files with 33 additions and 30 deletions

View File

@@ -102,8 +102,8 @@ fun <K : Any, V : Any> ReactiveZSetOperations<K, V>.rangeWithScoresAsFlow(key: K
* @author Sebastien Deleuze
* @since 2.2
*/
fun <K : Any, V : Any> ReactiveZSetOperations<K, V>.rangeByScoreAsFlow(key: K, range: Range<Double>, limit: Limit? = null): Flow<V> =
(if (limit == null) rangeByScore(key, range) else rangeByScore(key, range, limit)).asFlow()
fun <K : Any, V : Any> ReactiveZSetOperations<K, V>.rangeByScoreAsFlow(key: K, range: Range<Double>, limit: Limit = Limit.unlimited()): Flow<V> =
rangeByScore(key, range, limit).asFlow()
/**
* Coroutines variant of [ReactiveZSetOperations.rangeByScoreWithScores].
@@ -111,8 +111,8 @@ fun <K : Any, V : Any> ReactiveZSetOperations<K, V>.rangeByScoreAsFlow(key: K, r
* @author Sebastien Deleuze
* @since 2.2
*/
fun <K : Any, V : Any> ReactiveZSetOperations<K, V>.rangeByScoreWithScoresAsFlow(key: K, range: Range<Double>, limit: Limit? = null): Flow<TypedTuple<V>> =
(if (limit == null) rangeByScoreWithScores(key, range) else rangeByScoreWithScores(key, range, limit)).asFlow()
fun <K : Any, V : Any> ReactiveZSetOperations<K, V>.rangeByScoreWithScoresAsFlow(key: K, range: Range<Double>, limit: Limit = Limit.unlimited()): Flow<TypedTuple<V>> =
rangeByScoreWithScores(key, range, limit).asFlow()
/**
* Coroutines variant of [ReactiveZSetOperations.reverseRange].
@@ -138,8 +138,8 @@ fun <K : Any, V : Any> ReactiveZSetOperations<K, V>.reverseRangeWithScoresAsFlow
* @author Sebastien Deleuze
* @since 2.2
*/
fun <K : Any, V : Any> ReactiveZSetOperations<K, V>.reverseRangeByScoreAsFlow(key: K, range: Range<Double>, limit: Limit? = null): Flow<V> =
(if (limit == null) reverseRangeByScore(key, range) else reverseRangeByScore(key, range, limit)).asFlow()
fun <K : Any, V : Any> ReactiveZSetOperations<K, V>.reverseRangeByScoreAsFlow(key: K, range: Range<Double>, limit: Limit = Limit.unlimited()): Flow<V> =
reverseRangeByScore(key, range, limit).asFlow()
/**
* Coroutines variant of [ReactiveZSetOperations.reverseRangeByScoreWithScores].
@@ -147,8 +147,8 @@ fun <K : Any, V : Any> ReactiveZSetOperations<K, V>.reverseRangeByScoreAsFlow(ke
* @author Sebastien Deleuze
* @since 2.2
*/
fun <K : Any, V : Any> ReactiveZSetOperations<K, V>.reverseRangeByScoreWithScoresAsFlow(key: K, range: Range<Double>, limit: Limit? = null): Flow<TypedTuple<V>> =
(if (limit == null) reverseRangeByScoreWithScores(key, range) else reverseRangeByScoreWithScores(key, range, limit)).asFlow()
fun <K : Any, V : Any> ReactiveZSetOperations<K, V>.reverseRangeByScoreWithScoresAsFlow(key: K, range: Range<Double>, limit: Limit = Limit.unlimited()): Flow<TypedTuple<V>> =
reverseRangeByScoreWithScores(key, range, limit).asFlow()
/**
* Coroutines variant of [ReactiveZSetOperations.count].
@@ -273,8 +273,8 @@ suspend fun <K : Any, V : Any> ReactiveZSetOperations<K, V>.intersectAndStoreAnd
* @author Wonwoo Lee
* @since 2.3
*/
fun <K : Any, V : Any> ReactiveZSetOperations<K, V>.rangeByLexAndAwait(key: K, range: Range<String>, limit: Limit? = null): Flow<V> =
(if (limit == null) rangeByLex(key, range) else rangeByLex(key, range, limit)).asFlow()
fun <K : Any, V : Any> ReactiveZSetOperations<K, V>.rangeByLexAndAwait(key: K, range: Range<String>, limit: Limit = Limit.unlimited()): Flow<V> =
rangeByLex(key, range, limit).asFlow()
/**
* Coroutines variant of [ReactiveZSetOperations.reverseRangeByLex].
@@ -282,8 +282,8 @@ fun <K : Any, V : Any> ReactiveZSetOperations<K, V>.rangeByLexAndAwait(key: K, r
* @author Wonwoo Lee
* @since 2.3
*/
fun <K : Any, V : Any> ReactiveZSetOperations<K, V>.reverseRangeByLexAndAwait(key: K, range: Range<String>, limit: Limit? = null): Flow<V> =
(if (limit == null) reverseRangeByLex(key, range) else reverseRangeByLex(key, range, limit)).asFlow()
fun <K : Any, V : Any> ReactiveZSetOperations<K, V>.reverseRangeByLexAndAwait(key: K, range: Range<String>, limit: Limit = Limit.unlimited()): Flow<V> =
reverseRangeByLex(key, range, limit).asFlow()
/**
* Coroutines variant of [ReactiveZSetOperations.delete].

View File

@@ -31,6 +31,7 @@ import java.time.Duration
*
* @author Mark Paluch
* @author Sebastien Deleuze
* @author Wonwoo Lee
*/
class ReactiveListOperationsExtensionsUnitTests {
@@ -334,7 +335,7 @@ class ReactiveListOperationsExtensionsUnitTests {
}
}
@Test
@Test // DATAREDIS-1111
fun rightPopAndLeftPush() {
val operations = mockk<ReactiveListOperations<String, String>>()
@@ -349,7 +350,7 @@ class ReactiveListOperationsExtensionsUnitTests {
}
}
@Test
@Test // DATAREDIS-1111
fun blockingRightPopAndLeftPush() {
val operations = mockk<ReactiveListOperations<String, String>>()

View File

@@ -23,6 +23,7 @@ import kotlinx.coroutines.runBlocking
import org.assertj.core.api.Assertions.assertThat
import org.junit.Test
import org.springframework.data.domain.Range
import org.springframework.data.redis.connection.RedisZSetCommands
import org.springframework.data.redis.connection.RedisZSetCommands.Aggregate
import org.springframework.data.redis.connection.RedisZSetCommands.Weights
import org.springframework.data.redis.core.ZSetOperations.*
@@ -34,6 +35,7 @@ import reactor.core.publisher.Mono
*
* @author Mark Paluch
* @author Christoph Strobl
* @author Wonwoo Lee
*/
class ReactiveZSetOperationsExtensionsUnitTests {
@@ -195,14 +197,14 @@ class ReactiveZSetOperationsExtensionsUnitTests {
val range = Range.unbounded<Double>()
val operations = mockk<ReactiveZSetOperations<String, String>>()
every { operations.rangeByScore(any(), any()) } returns Flux.just("bar")
every { operations.rangeByScore(any(), any(), any()) } returns Flux.just("bar")
runBlocking {
assertThat(operations.rangeByScoreAsFlow("foo", range).toList()).contains("bar")
}
verify {
operations.rangeByScore("foo", range)
operations.rangeByScore("foo", range, RedisZSetCommands.Limit.unlimited())
}
}
@@ -212,14 +214,14 @@ class ReactiveZSetOperationsExtensionsUnitTests {
val tuple = mockk<TypedTuple<String>>(relaxed = true)
val range = Range.unbounded<Double>()
val operations = mockk<ReactiveZSetOperations<String, String>>()
every { operations.rangeByScoreWithScores(any(), any()) } returns Flux.just(tuple)
every { operations.rangeByScoreWithScores(any(), any(), any()) } returns Flux.just(tuple)
runBlocking {
assertThat(operations.rangeByScoreWithScoresAsFlow("foo", range).toList()).contains(tuple)
}
verify {
operations.rangeByScoreWithScores("foo", range)
operations.rangeByScoreWithScores("foo", range, RedisZSetCommands.Limit.unlimited())
}
}
@@ -261,14 +263,14 @@ class ReactiveZSetOperationsExtensionsUnitTests {
val range = Range.unbounded<Double>()
val operations = mockk<ReactiveZSetOperations<String, String>>()
every { operations.reverseRangeByScore(any(), any()) } returns Flux.just("bar")
every { operations.reverseRangeByScore(any(), any(), any()) } returns Flux.just("bar")
runBlocking {
assertThat(operations.reverseRangeByScoreAsFlow("foo", range).toList()).contains("bar")
}
verify {
operations.reverseRangeByScore("foo", range)
operations.reverseRangeByScore("foo", range, RedisZSetCommands.Limit.unlimited())
}
}
@@ -278,14 +280,14 @@ class ReactiveZSetOperationsExtensionsUnitTests {
val tuple = mockk<TypedTuple<String>>(relaxed = true)
val range = Range.unbounded<Double>()
val operations = mockk<ReactiveZSetOperations<String, String>>()
every { operations.reverseRangeByScoreWithScores(any(), any()) } returns Flux.just(tuple)
every { operations.reverseRangeByScoreWithScores(any(), any(), any()) } returns Flux.just(tuple)
runBlocking {
assertThat(operations.reverseRangeByScoreWithScoresAsFlow("foo", range).toList()).contains(tuple)
}
verify {
operations.reverseRangeByScoreWithScores("foo", range)
operations.reverseRangeByScoreWithScores("foo", range, RedisZSetCommands.Limit.unlimited())
}
}
@@ -304,7 +306,7 @@ class ReactiveZSetOperationsExtensionsUnitTests {
}
}
@Test
@Test // DATAREDIS-1111
fun size() {
val operations = mockk<ReactiveZSetOperations<String, String>>()
@@ -499,37 +501,37 @@ class ReactiveZSetOperationsExtensionsUnitTests {
}
}
@Test
@Test // DATAREDIS-1111
fun rangeByLex() {
val operations = mockk<ReactiveZSetOperations<String, String>>()
every { operations.rangeByLex(any(), any()) } returns Flux.just("bar")
every { operations.rangeByLex(any(), any(), any()) } returns Flux.just("bar")
runBlocking {
assertThat(operations.rangeByLexAndAwait("foo", Range.just("bar")).toList()).contains("bar")
}
verify {
operations.rangeByLex("foo", Range.just("bar"))
operations.rangeByLex("foo", Range.just("bar"), RedisZSetCommands.Limit.unlimited())
}
}
@Test
@Test // DATAREDIS-1111
fun reverseRangeByLexAndAwait() {
val operations = mockk<ReactiveZSetOperations<String, String>>()
every { operations.reverseRangeByLex(any(), any()) } returns Flux.just("bar")
every { operations.reverseRangeByLex(any(), any(), any()) } returns Flux.just("bar")
runBlocking {
assertThat(operations.reverseRangeByLexAndAwait("foo", Range.just("bar")).toList()).contains("bar")
}
verify {
operations.reverseRangeByLex("foo", Range.just("bar"))
operations.reverseRangeByLex("foo", Range.just("bar"), RedisZSetCommands.Limit.unlimited())
}
}
@Test
@Test // DATAREDIS-1111
fun delete() {
val operations = mockk<ReactiveZSetOperations<String, String>>()