Feature - Support CLIENT LIST command for Spring Data #6108

Signed-off-by: xuxiaolei <seakider@gmail.com>
pull/6372/head
seakider 4 weeks ago committed by xuxiaolei
parent 8e325a95f4
commit ec684623be

@ -1711,7 +1711,7 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public List<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
return read(null,StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
}
@Override

@ -3,6 +3,9 @@ package org.redisson.spring.data.connection;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test;
import org.springframework.data.redis.core.types.RedisClientInfo;
import java.util.List;
public class RedissonConnectionTest extends BaseConnectionTest {
@ -22,5 +25,11 @@ public class RedissonConnectionTest extends BaseConnectionTest {
assertThat(connection.hSet("key".getBytes(), "field".getBytes(), "value".getBytes())).isTrue();
assertThat(connection.hGet("key".getBytes(), "field".getBytes())).isEqualTo("value".getBytes());
}
@Test
public void testGetClientList() {
List<RedisClientInfo> info = connection.getClientList();
assertThat(info.size()).isGreaterThan(10);
}
}

@ -1738,7 +1738,7 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public List<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
return read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
}
@Override

@ -3,6 +3,9 @@ package org.redisson.spring.data.connection;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test;
import org.springframework.data.redis.core.types.RedisClientInfo;
import java.util.List;
public class RedissonConnectionTest extends BaseConnectionTest {
@ -22,5 +25,11 @@ public class RedissonConnectionTest extends BaseConnectionTest {
assertThat(connection.hSet("key".getBytes(), "field".getBytes(), "value".getBytes())).isTrue();
assertThat(connection.hGet("key".getBytes(), "field".getBytes())).isEqualTo("value".getBytes());
}
@Test
public void testGetClientList() {
List<RedisClientInfo> info = connection.getClientList();
assertThat(info.size()).isGreaterThan(10);
}
}

@ -1767,7 +1767,7 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public List<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
return read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
}
@Override

@ -5,6 +5,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test;
import org.springframework.data.geo.*;
import org.springframework.data.redis.connection.RedisGeoCommands;
import org.springframework.data.redis.core.types.RedisClientInfo;
import java.util.List;
@ -74,5 +75,11 @@ public class RedissonConnectionTest extends BaseConnectionTest {
assertThat(connection.hSet("key".getBytes(), "field".getBytes(), "value".getBytes())).isTrue();
assertThat(connection.hGet("key".getBytes(), "field".getBytes())).isEqualTo("value".getBytes());
}
@Test
public void testGetClientList() {
List<RedisClientInfo> info = connection.getClientList();
assertThat(info.size()).isGreaterThan(10);
}
}

@ -1771,7 +1771,7 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public List<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
return read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
}
@Override

@ -29,6 +29,7 @@ import org.redisson.client.protocol.decoder.TimeLongObjectDecoder;
import org.redisson.misc.CompletableFutureWrapper;
import org.redisson.reactive.CommandReactiveExecutor;
import org.springframework.data.redis.connection.ReactiveServerCommands;
import org.springframework.data.redis.connection.convert.StringToRedisClientInfoConverter;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
@ -157,9 +158,12 @@ public class RedissonReactiveServerCommands extends RedissonBaseReactive impleme
throw new UnsupportedOperationException();
}
private static final StringToRedisClientInfoConverter CONVERTER = new StringToRedisClientInfoConverter();
@Override
public Flux<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
Mono<List<String>> m = read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
return m.flatMapMany(s -> Flux.fromIterable(CONVERTER.convert(s.toArray(new String[s.size()]))));
}
}

@ -3,6 +3,9 @@ package org.redisson.spring.data.connection;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Test;
import org.springframework.data.redis.core.types.RedisClientInfo;
import java.util.List;
public class RedissonConnectionTest extends BaseConnectionTest {
@ -22,5 +25,11 @@ public class RedissonConnectionTest extends BaseConnectionTest {
assertThat(connection.hSet("key".getBytes(), "field".getBytes(), "value".getBytes())).isTrue();
assertThat(connection.hGet("key".getBytes(), "field".getBytes())).isEqualTo("value".getBytes());
}
@Test
public void testGetClientList() {
List<RedisClientInfo> info = connection.getClientList();
assertThat(info.size()).isGreaterThan(10);
}
}

@ -0,0 +1,20 @@
package org.redisson.spring.data.connection;
import org.junit.Test;
import org.springframework.data.redis.connection.ReactiveRedisConnection;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import static org.assertj.core.api.Assertions.assertThat;
public class RedissonReactiveServerCommandsTest extends BaseConnectionTest {
@Test
public void testGetClientList() {
RedissonConnectionFactory factory = new RedissonConnectionFactory(redisson);
ReactiveRedisConnection reactiveConnection = factory.getReactiveConnection();
Flux<RedisClientInfo> flux = reactiveConnection.serverCommands().getClientList();
Mono<Long> count = flux.count();
count.subscribe(s -> assertThat(s).isGreaterThan(10));
}
}

@ -1774,7 +1774,7 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public List<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
return read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
}
@Override

@ -29,6 +29,7 @@ import org.redisson.client.protocol.decoder.TimeLongObjectDecoder;
import org.redisson.misc.CompletableFutureWrapper;
import org.redisson.reactive.CommandReactiveExecutor;
import org.springframework.data.redis.connection.ReactiveServerCommands;
import org.springframework.data.redis.connection.convert.StringToRedisClientInfoConverter;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
@ -157,9 +158,12 @@ public class RedissonReactiveServerCommands extends RedissonBaseReactive impleme
throw new UnsupportedOperationException();
}
private static final StringToRedisClientInfoConverter CONVERTER = new StringToRedisClientInfoConverter();
@Override
public Flux<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
Mono<List<String>> m = read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
return m.flatMapMany(s -> Flux.fromIterable(CONVERTER.convert(s.toArray(new String[s.size()]))));
}
}

@ -10,6 +10,7 @@ import org.springframework.data.redis.connection.RedisZSetCommands;
import org.springframework.data.redis.core.Cursor;
import org.springframework.data.redis.core.ScanOptions;
import org.springframework.data.redis.core.types.Expiration;
import org.springframework.data.redis.core.types.RedisClientInfo;
import java.util.ArrayList;
import java.util.List;
@ -69,5 +70,10 @@ public class RedissonConnectionTest extends BaseConnectionTest {
assertThat(t.next().getValue()).isEqualTo("value2".getBytes());
}
@Test
public void testGetClientList() {
List<RedisClientInfo> info = connection.getClientList();
assertThat(info.size()).isGreaterThan(10);
}
}

@ -0,0 +1,20 @@
package org.redisson.spring.data.connection;
import org.junit.Test;
import org.springframework.data.redis.connection.ReactiveRedisConnection;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import static org.assertj.core.api.Assertions.assertThat;
public class RedissonReactiveServerCommandsTest extends BaseConnectionTest {
@Test
public void testGetClientList() {
RedissonConnectionFactory factory = new RedissonConnectionFactory(redisson);
ReactiveRedisConnection reactiveConnection = factory.getReactiveConnection();
Flux<RedisClientInfo> flux = reactiveConnection.serverCommands().getClientList();
Mono<Long> count = flux.count();
count.subscribe(s -> assertThat(s).isGreaterThan(10));
}
}

@ -1773,7 +1773,7 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public List<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
return read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
}
@Override

@ -29,6 +29,7 @@ import org.redisson.client.protocol.decoder.TimeLongObjectDecoder;
import org.redisson.misc.CompletableFutureWrapper;
import org.redisson.reactive.CommandReactiveExecutor;
import org.springframework.data.redis.connection.ReactiveServerCommands;
import org.springframework.data.redis.connection.convert.StringToRedisClientInfoConverter;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
@ -157,9 +158,12 @@ public class RedissonReactiveServerCommands extends RedissonBaseReactive impleme
throw new UnsupportedOperationException();
}
private static final StringToRedisClientInfoConverter CONVERTER = new StringToRedisClientInfoConverter();
@Override
public Flux<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
Mono<List<String>> m = read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
return m.flatMapMany(s -> Flux.fromIterable(CONVERTER.convert(s.toArray(new String[s.size()]))));
}
}

@ -6,6 +6,9 @@ import org.springframework.data.redis.connection.RedisZSetCommands;
import org.springframework.data.redis.core.Cursor;
import org.springframework.data.redis.core.ScanOptions;
import org.springframework.data.redis.core.types.Expiration;
import org.springframework.data.redis.core.types.RedisClientInfo;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
@ -64,5 +67,10 @@ public class RedissonConnectionTest extends BaseConnectionTest {
assertThat(t.next().getValue()).isEqualTo("value2".getBytes());
}
@Test
public void testGetClientList() {
List<RedisClientInfo> info = connection.getClientList();
assertThat(info.size()).isGreaterThan(10);
}
}

@ -0,0 +1,20 @@
package org.redisson.spring.data.connection;
import org.junit.Test;
import org.springframework.data.redis.connection.ReactiveRedisConnection;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import static org.assertj.core.api.Assertions.assertThat;
public class RedissonReactiveServerCommandsTest extends BaseConnectionTest {
@Test
public void testGetClientList() {
RedissonConnectionFactory factory = new RedissonConnectionFactory(redisson);
ReactiveRedisConnection reactiveConnection = factory.getReactiveConnection();
Flux<RedisClientInfo> flux = reactiveConnection.serverCommands().getClientList();
Mono<Long> count = flux.count();
count.subscribe(s -> assertThat(s).isGreaterThan(10));
}
}

@ -1774,7 +1774,7 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public List<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
return read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
}
@Override

@ -29,6 +29,7 @@ import org.redisson.client.protocol.decoder.TimeLongObjectDecoder;
import org.redisson.misc.CompletableFutureWrapper;
import org.redisson.reactive.CommandReactiveExecutor;
import org.springframework.data.redis.connection.ReactiveServerCommands;
import org.springframework.data.redis.connection.convert.StringToRedisClientInfoConverter;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
@ -157,9 +158,12 @@ public class RedissonReactiveServerCommands extends RedissonBaseReactive impleme
throw new UnsupportedOperationException();
}
private static final StringToRedisClientInfoConverter CONVERTER = new StringToRedisClientInfoConverter();
@Override
public Flux<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
Mono<List<String>> m = read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
return m.flatMapMany(s -> Flux.fromIterable(CONVERTER.convert(s.toArray(new String[s.size()]))));
}
}

@ -13,6 +13,9 @@ import org.springframework.data.redis.core.Cursor;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ScanOptions;
import org.springframework.data.redis.core.types.Expiration;
import org.springframework.data.redis.core.types.RedisClientInfo;
import java.util.List;
public class RedissonConnectionTest extends BaseConnectionTest {
@ -82,5 +85,10 @@ public class RedissonConnectionTest extends BaseConnectionTest {
assertThat(t.next().getValue()).isEqualTo("value2".getBytes());
}
@Test
public void testGetClientList() {
List<RedisClientInfo> info = connection.getClientList();
assertThat(info.size()).isGreaterThan(10);
}
}

@ -0,0 +1,20 @@
package org.redisson.spring.data.connection;
import org.junit.Test;
import org.springframework.data.redis.connection.ReactiveRedisConnection;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import static org.assertj.core.api.Assertions.assertThat;
public class RedissonReactiveServerCommandsTest extends BaseConnectionTest {
@Test
public void testGetClientList() {
RedissonConnectionFactory factory = new RedissonConnectionFactory(redisson);
ReactiveRedisConnection reactiveConnection = factory.getReactiveConnection();
Flux<RedisClientInfo> flux = reactiveConnection.serverCommands().getClientList();
Mono<Long> count = flux.count();
count.subscribe(s -> assertThat(s).isGreaterThan(10));
}
}

@ -1791,7 +1791,7 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public List<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
return read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
}
@Override

@ -29,6 +29,7 @@ import org.redisson.client.protocol.decoder.TimeLongObjectDecoder;
import org.redisson.misc.CompletableFutureWrapper;
import org.redisson.reactive.CommandReactiveExecutor;
import org.springframework.data.redis.connection.ReactiveServerCommands;
import org.springframework.data.redis.connection.convert.StringToRedisClientInfoConverter;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
@ -157,9 +158,12 @@ public class RedissonReactiveServerCommands extends RedissonBaseReactive impleme
throw new UnsupportedOperationException();
}
private static final StringToRedisClientInfoConverter CONVERTER = new StringToRedisClientInfoConverter();
@Override
public Flux<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
Mono<List<String>> m = read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
return m.flatMapMany(s -> Flux.fromIterable(CONVERTER.convert(s.toArray(new String[s.size()]))));
}
}

@ -14,7 +14,9 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ScanOptions;
import org.springframework.data.redis.core.SetOperations;
import org.springframework.data.redis.core.types.Expiration;
import org.springframework.data.redis.core.types.RedisClientInfo;
import java.util.List;
import java.util.Set;
public class RedissonConnectionTest extends BaseConnectionTest {
@ -113,5 +115,10 @@ public class RedissonConnectionTest extends BaseConnectionTest {
assertThat(t.next().getValue()).isEqualTo("value2".getBytes());
}
@Test
public void testGetClientList() {
List<RedisClientInfo> info = connection.getClientList();
assertThat(info.size()).isGreaterThan(10);
}
}

@ -0,0 +1,20 @@
package org.redisson.spring.data.connection;
import org.junit.Test;
import org.springframework.data.redis.connection.ReactiveRedisConnection;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import static org.assertj.core.api.Assertions.assertThat;
public class RedissonReactiveServerCommandsTest extends BaseConnectionTest {
@Test
public void testGetClientList() {
RedissonConnectionFactory factory = new RedissonConnectionFactory(redisson);
ReactiveRedisConnection reactiveConnection = factory.getReactiveConnection();
Flux<RedisClientInfo> flux = reactiveConnection.serverCommands().getClientList();
Mono<Long> count = flux.count();
count.subscribe(s -> assertThat(s).isGreaterThan(10));
}
}

@ -1831,7 +1831,7 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public List<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
return read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
}
@Override

@ -31,6 +31,7 @@ import org.redisson.client.protocol.decoder.TimeLongObjectDecoder;
import org.redisson.misc.CompletableFutureWrapper;
import org.redisson.reactive.CommandReactiveExecutor;
import org.springframework.data.redis.connection.ReactiveServerCommands;
import org.springframework.data.redis.connection.convert.StringToRedisClientInfoConverter;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
@ -170,9 +171,12 @@ public class RedissonReactiveServerCommands extends RedissonBaseReactive impleme
throw new UnsupportedOperationException();
}
private static final StringToRedisClientInfoConverter CONVERTER = new StringToRedisClientInfoConverter();
@Override
public Flux<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
Mono<List<String>> m = read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
return m.flatMapMany(s -> Flux.fromIterable(CONVERTER.convert(s.toArray(new String[s.size()]))));
}
}

@ -14,7 +14,9 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ScanOptions;
import org.springframework.data.redis.core.SetOperations;
import org.springframework.data.redis.core.types.Expiration;
import org.springframework.data.redis.core.types.RedisClientInfo;
import java.util.List;
import java.util.Set;
public class RedissonConnectionTest extends BaseConnectionTest {
@ -113,5 +115,10 @@ public class RedissonConnectionTest extends BaseConnectionTest {
assertThat(t.next().getValue()).isEqualTo("value2".getBytes());
}
@Test
public void testGetClientList() {
List<RedisClientInfo> info = connection.getClientList();
assertThat(info.size()).isGreaterThan(10);
}
}

@ -0,0 +1,20 @@
package org.redisson.spring.data.connection;
import org.junit.Test;
import org.springframework.data.redis.connection.ReactiveRedisConnection;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import static org.assertj.core.api.Assertions.assertThat;
public class RedissonReactiveServerCommandsTest extends BaseConnectionTest {
@Test
public void testGetClientList() {
RedissonConnectionFactory factory = new RedissonConnectionFactory(redisson);
ReactiveRedisConnection reactiveConnection = factory.getReactiveConnection();
Flux<RedisClientInfo> flux = reactiveConnection.serverCommands().getClientList();
Mono<Long> count = flux.count();
count.subscribe(s -> assertThat(s).isGreaterThan(10));
}
}

@ -1836,7 +1836,7 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public List<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
return read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
}
@Override

@ -31,6 +31,7 @@ import org.redisson.client.protocol.decoder.TimeLongObjectDecoder;
import org.redisson.misc.CompletableFutureWrapper;
import org.redisson.reactive.CommandReactiveExecutor;
import org.springframework.data.redis.connection.ReactiveServerCommands;
import org.springframework.data.redis.connection.convert.StringToRedisClientInfoConverter;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
@ -170,9 +171,12 @@ public class RedissonReactiveServerCommands extends RedissonBaseReactive impleme
throw new UnsupportedOperationException();
}
private static final StringToRedisClientInfoConverter CONVERTER = new StringToRedisClientInfoConverter();
@Override
public Flux<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
Mono<List<String>> m = read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
return m.flatMapMany(s -> Flux.fromIterable(CONVERTER.convert(s.toArray(new String[s.size()]))));
}
}

@ -14,7 +14,9 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ScanOptions;
import org.springframework.data.redis.core.SetOperations;
import org.springframework.data.redis.core.types.Expiration;
import org.springframework.data.redis.core.types.RedisClientInfo;
import java.util.List;
import java.util.Set;
public class RedissonConnectionTest extends BaseConnectionTest {
@ -132,5 +134,11 @@ public class RedissonConnectionTest extends BaseConnectionTest {
assertThat(r.getValue()).isEqualTo("value1".getBytes());
assertThat(r.getScore()).isEqualTo(1);
}
@Test
public void testGetClientList() {
List<RedisClientInfo> info = connection.getClientList();
assertThat(info.size()).isGreaterThan(10);
}
}

@ -0,0 +1,20 @@
package org.redisson.spring.data.connection;
import org.junit.Test;
import org.springframework.data.redis.connection.ReactiveRedisConnection;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import static org.assertj.core.api.Assertions.assertThat;
public class RedissonReactiveServerCommandsTest extends BaseConnectionTest {
@Test
public void testGetClientList() {
RedissonConnectionFactory factory = new RedissonConnectionFactory(redisson);
ReactiveRedisConnection reactiveConnection = factory.getReactiveConnection();
Flux<RedisClientInfo> flux = reactiveConnection.serverCommands().getClientList();
Mono<Long> count = flux.count();
count.subscribe(s -> assertThat(s).isGreaterThan(10));
}
}

@ -1836,7 +1836,7 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public List<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
return read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
}
@Override

@ -32,6 +32,7 @@ import org.redisson.misc.CompletableFutureWrapper;
import org.redisson.reactive.CommandReactiveExecutor;
import org.springframework.data.redis.connection.ReactiveServerCommands;
import org.springframework.data.redis.connection.RedisServerCommands;
import org.springframework.data.redis.connection.convert.StringToRedisClientInfoConverter;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
@ -193,9 +194,12 @@ public class RedissonReactiveServerCommands extends RedissonBaseReactive impleme
throw new UnsupportedOperationException();
}
private static final StringToRedisClientInfoConverter CONVERTER = new StringToRedisClientInfoConverter();
@Override
public Flux<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
Mono<List<String>> m = read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
return m.flatMapMany(s -> Flux.fromIterable(CONVERTER.convert(s.toArray(new String[s.size()]))));
}
}

@ -14,7 +14,9 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ScanOptions;
import org.springframework.data.redis.core.SetOperations;
import org.springframework.data.redis.core.types.Expiration;
import org.springframework.data.redis.core.types.RedisClientInfo;
import java.util.List;
import java.util.Set;
public class RedissonConnectionTest extends BaseConnectionTest {
@ -120,5 +122,10 @@ public class RedissonConnectionTest extends BaseConnectionTest {
assertThat(t.next().getValue()).isEqualTo("value2".getBytes());
}
@Test
public void testGetClientList() {
List<RedisClientInfo> info = connection.getClientList();
assertThat(info.size()).isGreaterThan(10);
}
}

@ -0,0 +1,20 @@
package org.redisson.spring.data.connection;
import org.junit.Test;
import org.springframework.data.redis.connection.ReactiveRedisConnection;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import static org.assertj.core.api.Assertions.assertThat;
public class RedissonReactiveServerCommandsTest extends BaseConnectionTest {
@Test
public void testGetClientList() {
RedissonConnectionFactory factory = new RedissonConnectionFactory(redisson);
ReactiveRedisConnection reactiveConnection = factory.getReactiveConnection();
Flux<RedisClientInfo> flux = reactiveConnection.serverCommands().getClientList();
Mono<Long> count = flux.count();
count.subscribe(s -> assertThat(s).isGreaterThan(10));
}
}

@ -1763,7 +1763,7 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public List<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
return read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
}
// @Override

@ -32,6 +32,7 @@ import org.redisson.misc.CompletableFutureWrapper;
import org.redisson.reactive.CommandReactiveExecutor;
import org.springframework.data.redis.connection.ReactiveServerCommands;
import org.springframework.data.redis.connection.RedisServerCommands;
import org.springframework.data.redis.connection.convert.StringToRedisClientInfoConverter;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
@ -193,9 +194,12 @@ public class RedissonReactiveServerCommands extends RedissonBaseReactive impleme
throw new UnsupportedOperationException();
}
private static final StringToRedisClientInfoConverter CONVERTER = new StringToRedisClientInfoConverter();
@Override
public Flux<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
Mono<List<String>> m = read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
return m.flatMapMany(s -> Flux.fromIterable(CONVERTER.convert(s.toArray(new String[s.size()]))));
}
}

@ -15,6 +15,7 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ScanOptions;
import org.springframework.data.redis.core.SetOperations;
import org.springframework.data.redis.core.types.Expiration;
import org.springframework.data.redis.core.types.RedisClientInfo;
import java.util.List;
import java.util.Map;
@ -138,5 +139,11 @@ public class RedissonConnectionTest extends BaseConnectionTest {
byte[] f = connection.hRandField("map".getBytes());
assertThat((Object) f).isIn("key1".getBytes(), "key2".getBytes(), "key3".getBytes());
}
@Test
public void testGetClientList() {
List<RedisClientInfo> info = connection.getClientList();
assertThat(info.size()).isGreaterThan(10);
}
}

@ -0,0 +1,20 @@
package org.redisson.spring.data.connection;
import org.junit.Test;
import org.springframework.data.redis.connection.ReactiveRedisConnection;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import static org.assertj.core.api.Assertions.assertThat;
public class RedissonReactiveServerCommandsTest extends BaseConnectionTest {
@Test
public void testGetClientList() {
RedissonConnectionFactory factory = new RedissonConnectionFactory(redisson);
ReactiveRedisConnection reactiveConnection = factory.getReactiveConnection();
Flux<RedisClientInfo> flux = reactiveConnection.serverCommands().getClientList();
Mono<Long> count = flux.count();
count.subscribe(s -> assertThat(s).isGreaterThan(10));
}
}

@ -1763,7 +1763,7 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public List<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
return read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
}
// @Override

@ -32,6 +32,7 @@ import org.redisson.misc.CompletableFutureWrapper;
import org.redisson.reactive.CommandReactiveExecutor;
import org.springframework.data.redis.connection.ReactiveServerCommands;
import org.springframework.data.redis.connection.RedisServerCommands;
import org.springframework.data.redis.connection.convert.StringToRedisClientInfoConverter;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
@ -193,9 +194,12 @@ public class RedissonReactiveServerCommands extends RedissonBaseReactive impleme
throw new UnsupportedOperationException();
}
private static final StringToRedisClientInfoConverter CONVERTER = new StringToRedisClientInfoConverter();
@Override
public Flux<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
Mono<List<String>> m = read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
return m.flatMapMany(s -> Flux.fromIterable(CONVERTER.convert(s.toArray(new String[s.size()]))));
}
}

@ -13,6 +13,7 @@ import org.springframework.data.redis.connection.RedisZSetCommands;
import org.springframework.data.redis.connection.zset.Tuple;
import org.springframework.data.redis.core.*;
import org.springframework.data.redis.core.types.Expiration;
import org.springframework.data.redis.core.types.RedisClientInfo;
import java.nio.ByteBuffer;
import java.time.Duration;
@ -283,5 +284,11 @@ public class RedissonConnectionTest extends BaseConnectionTest {
byte[] f = connection.hRandField("map".getBytes());
assertThat((Object) f).isIn("key1".getBytes(), "key2".getBytes(), "key3".getBytes());
}
@Test
public void testGetClientList() {
List<RedisClientInfo> info = connection.getClientList();
assertThat(info.size()).isGreaterThan(10);
}
}

@ -0,0 +1,20 @@
package org.redisson.spring.data.connection;
import org.junit.Test;
import org.springframework.data.redis.connection.ReactiveRedisConnection;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import static org.assertj.core.api.Assertions.assertThat;
public class RedissonReactiveServerCommandsTest extends BaseConnectionTest {
@Test
public void testGetClientList() {
RedissonConnectionFactory factory = new RedissonConnectionFactory(redisson);
ReactiveRedisConnection reactiveConnection = factory.getReactiveConnection();
Flux<RedisClientInfo> flux = reactiveConnection.serverCommands().getClientList();
Mono<Long> count = flux.count();
count.subscribe(s -> assertThat(s).isGreaterThan(10));
}
}

@ -1763,7 +1763,7 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public List<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
return read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
}
// @Override

@ -32,6 +32,7 @@ import org.redisson.misc.CompletableFutureWrapper;
import org.redisson.reactive.CommandReactiveExecutor;
import org.springframework.data.redis.connection.ReactiveServerCommands;
import org.springframework.data.redis.connection.RedisServerCommands;
import org.springframework.data.redis.connection.convert.StringToRedisClientInfoConverter;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
@ -193,9 +194,12 @@ public class RedissonReactiveServerCommands extends RedissonBaseReactive impleme
throw new UnsupportedOperationException();
}
private static final StringToRedisClientInfoConverter CONVERTER = new StringToRedisClientInfoConverter();
@Override
public Flux<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
Mono<List<String>> m = read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
return m.flatMapMany(s -> Flux.fromIterable(CONVERTER.convert(s.toArray(new String[s.size()]))));
}
}

@ -13,6 +13,7 @@ import org.springframework.data.redis.connection.RedisZSetCommands;
import org.springframework.data.redis.connection.zset.Tuple;
import org.springframework.data.redis.core.*;
import org.springframework.data.redis.core.types.Expiration;
import org.springframework.data.redis.core.types.RedisClientInfo;
import java.nio.ByteBuffer;
import java.time.Duration;
@ -283,5 +284,11 @@ public class RedissonConnectionTest extends BaseConnectionTest {
byte[] f = connection.hRandField("map".getBytes());
assertThat((Object) f).isIn("key1".getBytes(), "key2".getBytes(), "key3".getBytes());
}
@Test
public void testGetClientList() {
List<RedisClientInfo> info = connection.getClientList();
assertThat(info.size()).isGreaterThan(10);
}
}

@ -0,0 +1,20 @@
package org.redisson.spring.data.connection;
import org.junit.Test;
import org.springframework.data.redis.connection.ReactiveRedisConnection;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import static org.assertj.core.api.Assertions.assertThat;
public class RedissonReactiveServerCommandsTest extends BaseConnectionTest {
@Test
public void testGetClientList() {
RedissonConnectionFactory factory = new RedissonConnectionFactory(redisson);
ReactiveRedisConnection reactiveConnection = factory.getReactiveConnection();
Flux<RedisClientInfo> flux = reactiveConnection.serverCommands().getClientList();
Mono<Long> count = flux.count();
count.subscribe(s -> assertThat(s).isGreaterThan(10));
}
}

@ -1763,7 +1763,7 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public List<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
return read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
}
// @Override

@ -32,6 +32,7 @@ import org.redisson.misc.CompletableFutureWrapper;
import org.redisson.reactive.CommandReactiveExecutor;
import org.springframework.data.redis.connection.ReactiveServerCommands;
import org.springframework.data.redis.connection.RedisServerCommands;
import org.springframework.data.redis.connection.convert.StringToRedisClientInfoConverter;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
@ -193,9 +194,12 @@ public class RedissonReactiveServerCommands extends RedissonBaseReactive impleme
throw new UnsupportedOperationException();
}
private static final StringToRedisClientInfoConverter CONVERTER = new StringToRedisClientInfoConverter();
@Override
public Flux<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
Mono<List<String>> m = read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
return m.flatMapMany(s -> Flux.fromIterable(CONVERTER.convert(s.toArray(new String[s.size()]))));
}
}

@ -13,6 +13,7 @@ import org.springframework.data.redis.connection.RedisZSetCommands;
import org.springframework.data.redis.connection.zset.Tuple;
import org.springframework.data.redis.core.*;
import org.springframework.data.redis.core.types.Expiration;
import org.springframework.data.redis.core.types.RedisClientInfo;
import java.nio.ByteBuffer;
import java.time.Duration;
@ -264,5 +265,11 @@ public class RedissonConnectionTest extends BaseConnectionTest {
byte[] f = connection.hRandField("map".getBytes());
assertThat((Object) f).isIn("key1".getBytes(), "key2".getBytes(), "key3".getBytes());
}
@Test
public void testGetClientList() {
List<RedisClientInfo> info = connection.getClientList();
assertThat(info.size()).isGreaterThan(10);
}
}

@ -0,0 +1,20 @@
package org.redisson.spring.data.connection;
import org.junit.Test;
import org.springframework.data.redis.connection.ReactiveRedisConnection;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import static org.assertj.core.api.Assertions.assertThat;
public class RedissonReactiveServerCommandsTest extends BaseConnectionTest {
@Test
public void testGetClientList() {
RedissonConnectionFactory factory = new RedissonConnectionFactory(redisson);
ReactiveRedisConnection reactiveConnection = factory.getReactiveConnection();
Flux<RedisClientInfo> flux = reactiveConnection.serverCommands().getClientList();
Mono<Long> count = flux.count();
count.subscribe(s -> assertThat(s).isGreaterThan(10));
}
}

@ -1763,7 +1763,7 @@ public class RedissonConnection extends AbstractRedisConnection {
@Override
public List<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
return read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
}
// @Override

@ -32,6 +32,7 @@ import org.redisson.misc.CompletableFutureWrapper;
import org.redisson.reactive.CommandReactiveExecutor;
import org.springframework.data.redis.connection.ReactiveServerCommands;
import org.springframework.data.redis.connection.RedisServerCommands;
import org.springframework.data.redis.connection.convert.StringToRedisClientInfoConverter;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
@ -193,9 +194,12 @@ public class RedissonReactiveServerCommands extends RedissonBaseReactive impleme
throw new UnsupportedOperationException();
}
private static final StringToRedisClientInfoConverter CONVERTER = new StringToRedisClientInfoConverter();
@Override
public Flux<RedisClientInfo> getClientList() {
throw new UnsupportedOperationException();
Mono<List<String>> m = read(null, StringCodec.INSTANCE, RedisCommands.CLIENT_LIST);
return m.flatMapMany(s -> Flux.fromIterable(CONVERTER.convert(s.toArray(new String[s.size()]))));
}
}

@ -13,6 +13,7 @@ import org.springframework.data.redis.connection.RedisZSetCommands;
import org.springframework.data.redis.connection.zset.Tuple;
import org.springframework.data.redis.core.*;
import org.springframework.data.redis.core.types.Expiration;
import org.springframework.data.redis.core.types.RedisClientInfo;
import java.nio.ByteBuffer;
import java.time.Duration;
@ -264,5 +265,11 @@ public class RedissonConnectionTest extends BaseConnectionTest {
byte[] f = connection.hRandField("map".getBytes());
assertThat((Object) f).isIn("key1".getBytes(), "key2".getBytes(), "key3".getBytes());
}
@Test
public void testGetClientList() {
List<RedisClientInfo> info = connection.getClientList();
assertThat(info.size()).isGreaterThan(10);
}
}

@ -0,0 +1,21 @@
package org.redisson.spring.data.connection;
import org.junit.Test;
import org.springframework.data.redis.connection.ReactiveRedisConnection;
import org.springframework.data.redis.core.types.RedisClientInfo;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import static org.assertj.core.api.Assertions.assertThat;
public class RedissonReactiveServerCommandsTest extends BaseConnectionTest {
@Test
public void testGetClientList() {
RedissonConnectionFactory factory = new RedissonConnectionFactory(redisson);
ReactiveRedisConnection reactiveConnection = factory.getReactiveConnection();
Flux<RedisClientInfo> flux = reactiveConnection.serverCommands().getClientList();
Mono<Long> count = flux.count();
count.subscribe(s -> assertThat(s).isGreaterThan(10));
}
}
Loading…
Cancel
Save