DATAREDIS-1085 - Support approximate trimming using XTRIM.
Original pull request: #561.
This commit is contained in:
@@ -1726,6 +1726,13 @@ public class DefaultStringRedisConnectionPipelineTests extends DefaultStringRedi
|
||||
super.xTrimShouldDelegateAndConvertCorrectly();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void xTrimApproximateShouldDelegateAndConvertCorrectly() {
|
||||
|
||||
doReturn(Arrays.asList(1L)).when(nativeConnection).closePipeline();
|
||||
super.xTrimApproximateShouldDelegateAndConvertCorrectly();
|
||||
}
|
||||
|
||||
protected List<Object> getResults() {
|
||||
return connection.closePipeline();
|
||||
}
|
||||
|
||||
@@ -1846,6 +1846,13 @@ public class DefaultStringRedisConnectionPipelineTxTests extends DefaultStringRe
|
||||
super.xTrimShouldDelegateAndConvertCorrectly();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void xTrimApproximateShouldDelegateAndConvertCorrectly() {
|
||||
|
||||
doReturn(Arrays.asList(Arrays.asList(1L))).when(nativeConnection).closePipeline();
|
||||
super.xTrimApproximateShouldDelegateAndConvertCorrectly();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected List<Object> getResults() {
|
||||
connection.exec();
|
||||
|
||||
@@ -2169,6 +2169,15 @@ public class DefaultStringRedisConnectionTests {
|
||||
Assertions.assertThat(getResults()).containsExactly(1L);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void xTrimApproximateShouldDelegateAndConvertCorrectly() {
|
||||
|
||||
doReturn(1L).when(nativeConnection).xTrim(any(), anyLong(), anyBoolean());
|
||||
|
||||
actual.add(connection.xTrim("key", 2L, true));
|
||||
Assertions.assertThat(getResults()).containsExactly(1L);
|
||||
}
|
||||
|
||||
protected List<Object> getResults() {
|
||||
return actual;
|
||||
}
|
||||
|
||||
@@ -1733,6 +1733,13 @@ public class DefaultStringRedisConnectionTxTests extends DefaultStringRedisConne
|
||||
super.xTrimShouldDelegateAndConvertCorrectly();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void xTrimApproximateShouldDelegateAndConvertCorrectly() {
|
||||
|
||||
doReturn(Arrays.asList(1L)).when(nativeConnection).exec();
|
||||
super.xTrimApproximateShouldDelegateAndConvertCorrectly();
|
||||
}
|
||||
|
||||
protected List<Object> getResults() {
|
||||
return connection.exec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user