DATAREDIS-267 - Add support for 'CLIENT KILL'.
Killing a client connection can be done via 'RedisConnection' and 'RedisOperations' using 'jedis', 'lettuce' and 'srp'. We use dedicated parameters for host and port building up the redis format (host:port) for connection identification. Original Pull Request: #56
This commit is contained in:
committed by
Thomas Darimont
parent
1c47330ec9
commit
6a6d03eb4c
@@ -113,6 +113,16 @@ public class JedisConnectionUnitTestSuite {
|
||||
connection.pExpire("foo".getBytes(), msec);
|
||||
verifyNativeConnectionInvocation().pexpireAt(any(byte[].class), eq(expected));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREDIS-267
|
||||
*/
|
||||
@Test
|
||||
public void killClientShouldDelegateCallCorrectly() {
|
||||
|
||||
connection.killClient("127.0.0.1", 1001);
|
||||
verifyNativeConnectionInvocation().clientKill(eq("127.0.0.1:1001"));
|
||||
}
|
||||
}
|
||||
|
||||
public static class JedisConnectionPipelineUnitTests extends JedisConnectionUnitTests {
|
||||
@@ -141,6 +151,10 @@ public class JedisConnectionUnitTestSuite {
|
||||
super.shutdownSaveShouldBeSentCorrectlyUsingLuaScript();
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void killClientShouldDelegateCallCorrectly() {
|
||||
super.killClientShouldDelegateCallCorrectly();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -82,6 +82,17 @@ public class LettuceConnectionUnitTestSuite {
|
||||
verifyNativeConnectionInvocation().shutdown(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREDIS-267
|
||||
*/
|
||||
@Test
|
||||
public void killClientShouldDelegateCallCorrectly() {
|
||||
|
||||
String ipPort = "127.0.0.1:1001";
|
||||
connection.killClient("127.0.0.1", 1001);
|
||||
verifyNativeConnectionInvocation().clientKill(eq(ipPort));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class LettucePipelineConnectionUnitTests extends LettuceConnectionUnitTests {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.srp;
|
||||
|
||||
import static org.mockito.Matchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -77,6 +78,17 @@ public class SrpConnectionUnitTestSuite {
|
||||
verifyNativeConnectionInvocation().shutdown("NOSAVE".getBytes(Charsets.UTF_8), null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAREDIS-267
|
||||
*/
|
||||
@Test
|
||||
public void killClientShouldDelegateCallCorrectly() {
|
||||
|
||||
String ipPort = "127.0.0.1:1001";
|
||||
connection.killClient("127.0.0.1", 1001);
|
||||
verifyNativeConnectionInvocation().client_kill(eq(ipPort));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class SrpConnectionPiplineUnitTests extends AbstractConnectionUnitTestBase<Pipeline> {
|
||||
|
||||
Reference in New Issue
Block a user