@@ -138,6 +138,12 @@ public class DefaultStringRedisConnectionPipelineTests extends DefaultStringRedi
|
||||
super.testDel();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCopy() {
|
||||
doReturn(Collections.singletonList(Boolean.TRUE)).when(nativeConnection).closePipeline();
|
||||
super.testCopy();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEchoBytes() {
|
||||
doReturn(Arrays.asList(new Object[] { barBytes })).when(nativeConnection).closePipeline();
|
||||
|
||||
@@ -142,6 +142,13 @@ public class DefaultStringRedisConnectionPipelineTxTests extends DefaultStringRe
|
||||
super.testDel();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCopy() {
|
||||
doReturn(Collections.singletonList(Collections.singletonList(Boolean.TRUE))).when(nativeConnection).closePipeline();
|
||||
super.testCopy();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testEchoBytes() {
|
||||
doReturn(Collections.singletonList(Arrays.asList(new Object[] { barBytes }))).when(nativeConnection)
|
||||
|
||||
@@ -71,6 +71,7 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
* @author Ninad Divadkar
|
||||
* @author Mark Paluch
|
||||
* @author dengliming
|
||||
* @author ihaohong
|
||||
*/
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@MockitoSettings(strictness = Strictness.LENIENT)
|
||||
@@ -235,6 +236,13 @@ public class DefaultStringRedisConnectionTests {
|
||||
verifyResults(Collections.singletonList(1L));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCopy() {
|
||||
doReturn(Boolean.TRUE).when(nativeConnection).copy(fooBytes, barBytes);
|
||||
actual.add(connection.copy(foo, bar));
|
||||
verifyResults(Collections.singletonList(Boolean.TRUE));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEchoBytes() {
|
||||
doReturn(barBytes).when(nativeConnection).echo(fooBytes);
|
||||
|
||||
@@ -187,6 +187,10 @@ class RedisConnectionUnitTests {
|
||||
return delegate.del(keys);
|
||||
}
|
||||
|
||||
public Boolean copy(byte[] sourceKey, byte[] targetKey) {
|
||||
return delegate.copy(sourceKey, targetKey);
|
||||
}
|
||||
|
||||
public void close() throws DataAccessException {
|
||||
super.close();
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ import org.springframework.data.redis.test.util.CollectionAwareComparator;
|
||||
* @author Anqing Shao
|
||||
* @author Duobiao Ou
|
||||
* @author Mark Paluch
|
||||
* @author ihaohong
|
||||
*/
|
||||
@MethodSource("testParams")
|
||||
public class RedisTemplateIntegrationTests<K, V> {
|
||||
@@ -390,6 +391,20 @@ public class RedisTemplateIntegrationTests<K, V> {
|
||||
assertThat(redisTemplate.hasKey(key1)).isFalse();
|
||||
}
|
||||
|
||||
@ParameterizedRedisTest
|
||||
void testCopy() {
|
||||
K key1 = keyFactory.instance();
|
||||
K key2 = keyFactory.instance();
|
||||
V value1 = valueFactory.instance();
|
||||
|
||||
redisTemplate.opsForValue().set(key1, value1);
|
||||
|
||||
assertThat(redisTemplate.hasKey(key2)).isFalse();
|
||||
redisTemplate.copy(key1, key2);
|
||||
assertThat(redisTemplate.hasKey(key2)).isTrue();
|
||||
assertThat(redisTemplate.opsForValue().get(key2)).isEqualTo(value1);
|
||||
}
|
||||
|
||||
@ParameterizedRedisTest // DATAREDIS-688
|
||||
void testDeleteMultiple() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user