DATAREDIS-549 - Polishing.
Replace some AtTest(expected = …) and ExpectedException with the corresponding AssertJ assertThatExceptionOfType(…) and assertThatIllegalArgumentException().isThrownBy(…).
This commit is contained in:
@@ -2289,11 +2289,11 @@ public abstract class AbstractConnectionIntegrationTests {
|
||||
assertThat(results.get(2)).isEqualTo(6L);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-308
|
||||
@Test // DATAREDIS-308
|
||||
@IfProfileValue(name = "redisVersion", value = "2.8.9+")
|
||||
@WithRedisDriver({ RedisDriver.JEDIS, RedisDriver.LETTUCE })
|
||||
public void pfCountWithNullKeysShouldThrowIllegalArgumentException() {
|
||||
actual.add(connection.pfCount((String[]) null));
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> actual.add(connection.pfCount((String[]) null)));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -56,55 +56,53 @@ abstract public class AbstractConnectionPipelineIntegrationTests extends Abstrac
|
||||
@Ignore("Pub/Sub not supported while pipelining")
|
||||
public void testPubSubWithPatterns() throws Exception {}
|
||||
|
||||
@Test(expected = RedisPipelineException.class)
|
||||
@Test
|
||||
public void testExecWithoutMulti() {
|
||||
super.testExecWithoutMulti();
|
||||
assertThatExceptionOfType(RedisPipelineException.class).isThrownBy(super::testExecWithoutMulti);
|
||||
}
|
||||
|
||||
@Test(expected = RedisPipelineException.class)
|
||||
@Test
|
||||
public void testErrorInTx() {
|
||||
super.testErrorInTx();
|
||||
assertThatExceptionOfType(RedisPipelineException.class).isThrownBy(super::testErrorInTx);
|
||||
}
|
||||
|
||||
@Test(expected = RedisPipelineException.class)
|
||||
public void exceptionExecuteNative() throws Exception {
|
||||
super.exceptionExecuteNative();
|
||||
@Test
|
||||
public void exceptionExecuteNative() {
|
||||
assertThatExceptionOfType(RedisPipelineException.class).isThrownBy(super::exceptionExecuteNative);
|
||||
}
|
||||
|
||||
@Test(expected = RedisPipelineException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalShaNotFound() {
|
||||
super.testEvalShaNotFound();
|
||||
assertThatExceptionOfType(RedisPipelineException.class).isThrownBy(super::testEvalShaNotFound);
|
||||
}
|
||||
|
||||
@Test(expected = RedisPipelineException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnSingleError() {
|
||||
super.testEvalReturnSingleError();
|
||||
assertThatExceptionOfType(RedisPipelineException.class).isThrownBy(super::testEvalReturnSingleError);
|
||||
}
|
||||
|
||||
@Test(expected = RedisPipelineException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testRestoreBadData() {
|
||||
super.testRestoreBadData();
|
||||
assertThatExceptionOfType(RedisPipelineException.class).isThrownBy(super::testRestoreBadData);
|
||||
}
|
||||
|
||||
@Test(expected = RedisPipelineException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testRestoreExistingKey() {
|
||||
super.testRestoreExistingKey();
|
||||
assertThatExceptionOfType(RedisPipelineException.class).isThrownBy(super::testRestoreExistingKey);
|
||||
}
|
||||
|
||||
@Test(expected = RedisPipelineException.class)
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalArrayScriptError() {
|
||||
super.testEvalArrayScriptError();
|
||||
}
|
||||
@Test
|
||||
@Ignore
|
||||
public void testEvalArrayScriptError() {}
|
||||
|
||||
@Test(expected = RedisPipelineException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalShaArrayError() {
|
||||
super.testEvalShaArrayError();
|
||||
assertThatExceptionOfType(RedisPipelineException.class).isThrownBy(super::testEvalShaArrayError);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -94,9 +94,9 @@ abstract public class AbstractConnectionTransactionIntegrationTests extends Abst
|
||||
@Ignore
|
||||
public void testHashNullValue() throws Exception {}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
public void testWatchWhileInTx() {
|
||||
connection.watch("foo".getBytes());
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> connection.watch("foo".getBytes()));
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
|
||||
@@ -134,19 +134,20 @@ public class ClusterCommandExecutorUnitTests {
|
||||
verify(con2, times(1)).theWheelWeavesAsTheWheelWills();
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void executeCommandOnSingleNodeShouldThrowExceptionWhenNodeIsNull() {
|
||||
executor.executeCommandOnSingleNode(COMMAND_CALLBACK, null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> executor.executeCommandOnSingleNode(COMMAND_CALLBACK, null));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void executeCommandOnSingleNodeShouldThrowExceptionWhenCommandCallbackIsNull() {
|
||||
executor.executeCommandOnSingleNode(null, CLUSTER_NODE_1);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> executor.executeCommandOnSingleNode(null, CLUSTER_NODE_1));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void executeCommandOnSingleNodeShouldThrowExceptionWhenNodeIsUnknown() {
|
||||
executor.executeCommandOnSingleNode(COMMAND_CALLBACK, UNKNOWN_CLUSTER_NODE);
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> executor.executeCommandOnSingleNode(COMMAND_CALLBACK, UNKNOWN_CLUSTER_NODE));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
|
||||
@@ -60,14 +60,16 @@ public class RedisClusterConfigurationUnitTests {
|
||||
new RedisNode("localhost", 789));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void shouldThrowExecptionOnInvalidHostAndPortString() {
|
||||
new RedisClusterConfiguration(Collections.singleton(HOST_AND_NO_PORT));
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> new RedisClusterConfiguration(Collections.singleton(HOST_AND_NO_PORT)));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void shouldThrowExceptionWhenListOfHostAndPortIsNull() {
|
||||
new RedisClusterConfiguration(Collections.<String> singleton(null));
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> new RedisClusterConfiguration(Collections.<String> singleton(null)));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -78,9 +80,9 @@ public class RedisClusterConfigurationUnitTests {
|
||||
assertThat(config.getClusterNodes().size()).isEqualTo(0);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void shouldThrowExceptionGivenNullPropertySource() {
|
||||
new RedisClusterConfiguration((PropertySource<?>) null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> new RedisClusterConfiguration((PropertySource<?>) null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
|
||||
@@ -59,14 +59,16 @@ public class RedisSentinelConfigurationUnitTests {
|
||||
new RedisNode("localhost", 789));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-372
|
||||
@Test // DATAREDIS-372
|
||||
public void shouldThrowExecptionOnInvalidHostAndPortString() {
|
||||
new RedisSentinelConfiguration("mymaster", Collections.singleton(HOST_AND_NO_PORT));
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> new RedisSentinelConfiguration("mymaster", Collections.singleton(HOST_AND_NO_PORT)));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-372
|
||||
@Test // DATAREDIS-372
|
||||
public void shouldThrowExceptionWhenListOfHostAndPortIsNull() {
|
||||
new RedisSentinelConfiguration("mymaster", Collections.<String> singleton(null));
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> new RedisSentinelConfiguration("mymaster", Collections.<String> singleton(null)));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-372
|
||||
@@ -77,9 +79,9 @@ public class RedisSentinelConfigurationUnitTests {
|
||||
assertThat(config.getSentinels().size()).isEqualTo(0);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-372
|
||||
@Test // DATAREDIS-372
|
||||
public void shouldThrowExceptionGivenNullPropertySource() {
|
||||
new RedisSentinelConfiguration((PropertySource<?>) null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> new RedisSentinelConfiguration((PropertySource<?>) null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-372
|
||||
|
||||
@@ -184,9 +184,10 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
|
||||
assertThat(clusterConnection.bitCount(KEY_1_BYTES, 0, 3)).isEqualTo(3L);
|
||||
}
|
||||
|
||||
@Test(expected = DataAccessException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void bitOpShouldThrowExceptionWhenKeysDoNotMapToSameSlot() {
|
||||
clusterConnection.bitOp(BitOperation.AND, KEY_1_BYTES, KEY_2_BYTES, KEY_3_BYTES);
|
||||
assertThatExceptionOfType(DataAccessException.class)
|
||||
.isThrownBy(() -> clusterConnection.bitOp(BitOperation.AND, KEY_1_BYTES, KEY_2_BYTES, KEY_3_BYTES));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -344,9 +345,9 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
|
||||
assertThat(nativeConnection.get(KEY_1)).isNull();
|
||||
}
|
||||
|
||||
@Test(expected = DataAccessException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void discardShouldThrowException() {
|
||||
clusterConnection.discard();
|
||||
assertThatExceptionOfType(DataAccessException.class).isThrownBy(() -> clusterConnection.discard());
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -379,9 +380,9 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
|
||||
assertThat(clusterConnection.echo(VALUE_1_BYTES)).isEqualTo(VALUE_1_BYTES);
|
||||
}
|
||||
|
||||
@Test(expected = DataAccessException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void execShouldThrowException() {
|
||||
clusterConnection.exec();
|
||||
assertThatExceptionOfType(DataAccessException.class).isThrownBy(() -> clusterConnection.exec());
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-689
|
||||
@@ -401,9 +402,10 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
|
||||
assertThat(nativeConnection.get(KEY_1)).isEqualTo(VALUE_1);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-689
|
||||
@Test // DATAREDIS-689
|
||||
public void executeWithNoKeyAndArgsThrowsException() {
|
||||
clusterConnection.execute("KEYS", (byte[]) null, Collections.singletonList("*".getBytes()));
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> clusterConnection.execute("KEYS", (byte[]) null, Collections.singletonList("*".getBytes())));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-529
|
||||
@@ -1209,14 +1211,15 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
|
||||
assertThat(nativeConnection.get(SAME_SLOT_KEY_2)).isEqualTo(VALUE_2);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void moveShouldNotBeSupported() {
|
||||
clusterConnection.move(KEY_1_BYTES, 3);
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class)
|
||||
.isThrownBy(() -> clusterConnection.move(KEY_1_BYTES, 3));
|
||||
}
|
||||
|
||||
@Test(expected = DataAccessException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void multiShouldThrowException() {
|
||||
clusterConnection.multi();
|
||||
assertThatExceptionOfType(DataAccessException.class).isThrownBy(() -> clusterConnection.multi());
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -1318,9 +1321,10 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
|
||||
clusterConnection.pfCount(KEY_1_BYTES, KEY_2_BYTES);
|
||||
}
|
||||
|
||||
@Test(expected = DataAccessException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void pfMergeShouldThrowErrorOnDifferentSlotKeys() {
|
||||
clusterConnection.pfMerge(KEY_3_BYTES, KEY_1_BYTES, KEY_2_BYTES);
|
||||
assertThatExceptionOfType(DataAccessException.class)
|
||||
.isThrownBy(() -> clusterConnection.pfMerge(KEY_3_BYTES, KEY_1_BYTES, KEY_2_BYTES));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -1344,9 +1348,10 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
|
||||
assertThat(clusterConnection.ping(new RedisClusterNode("127.0.0.1", 7379, SlotRange.empty()))).isEqualTo("PONG");
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void pingShouldThrowExceptionWhenNodeNotKnownToCluster() {
|
||||
clusterConnection.ping(new RedisClusterNode("127.0.0.1", 1234, null));
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> clusterConnection.ping(new RedisClusterNode("127.0.0.1", 1234, null)));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -1697,9 +1702,9 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
|
||||
clusterConnection.select(0);
|
||||
}
|
||||
|
||||
@Test(expected = DataAccessException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void selectShouldThrowExceptionWhenSelectingNonZeroDbIndex() {
|
||||
clusterConnection.select(1);
|
||||
assertThatExceptionOfType(DataAccessException.class).isThrownBy(() -> clusterConnection.select(1));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -1926,14 +1931,14 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
|
||||
assertThat(clusterConnection.type(KEY_3_BYTES)).isEqualTo(DataType.HASH);
|
||||
}
|
||||
|
||||
@Test(expected = DataAccessException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void unwatchShouldThrowException() {
|
||||
clusterConnection.unwatch();
|
||||
assertThatExceptionOfType(DataAccessException.class).isThrownBy(() -> clusterConnection.unwatch());
|
||||
}
|
||||
|
||||
@Test(expected = DataAccessException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void watchShouldThrowException() {
|
||||
clusterConnection.watch();
|
||||
assertThatExceptionOfType(DataAccessException.class).isThrownBy(() -> clusterConnection.watch());
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-674
|
||||
@@ -1988,9 +1993,10 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
|
||||
assertThat(nativeConnection.zrank(KEY_1_BYTES, VALUE_1_BYTES)).isEqualTo(1L);
|
||||
}
|
||||
|
||||
@Test(expected = DataAccessException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void zInterStoreShouldThrowExceptionWhenKeysDoNotMapToSameSlots() {
|
||||
clusterConnection.zInterStore(KEY_3_BYTES, KEY_1_BYTES, KEY_2_BYTES);
|
||||
assertThatExceptionOfType(DataAccessException.class)
|
||||
.isThrownBy(() -> clusterConnection.zInterStore(KEY_3_BYTES, KEY_1_BYTES, KEY_2_BYTES));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -2251,9 +2257,10 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
|
||||
assertThat(clusterConnection.zScore(KEY_1_BYTES, VALUE_2_BYTES)).isEqualTo(20D);
|
||||
}
|
||||
|
||||
@Test(expected = DataAccessException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void zUnionStoreShouldThrowExceptionWhenKeysDoNotMapToSameSlots() {
|
||||
clusterConnection.zUnionStore(KEY_3_BYTES, KEY_1_BYTES, KEY_2_BYTES);
|
||||
assertThatExceptionOfType(DataAccessException.class)
|
||||
.isThrownBy(() -> clusterConnection.zUnionStore(KEY_3_BYTES, KEY_1_BYTES, KEY_2_BYTES));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -2395,9 +2402,10 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
|
||||
assertThat(clusterConnection.stringCommands().bitField(JedisConverters.toBytes(KEY_1),
|
||||
create().incr(unsigned(2)).valueAt(BitFieldSubCommands.Offset.offset(102L)).overflow(FAIL).by(1L)))
|
||||
.containsExactly(3L);
|
||||
assertThat(clusterConnection.stringCommands().bitField(JedisConverters.toBytes(KEY_1),
|
||||
create().incr(unsigned(2)).valueAt(BitFieldSubCommands.Offset.offset(102L)).overflow(FAIL).by(1L)).get(0))
|
||||
.isNull();
|
||||
assertThat(clusterConnection.stringCommands()
|
||||
.bitField(JedisConverters.toBytes(KEY_1),
|
||||
create().incr(unsigned(2)).valueAt(BitFieldSubCommands.Offset.offset(102L)).overflow(FAIL).by(1L))
|
||||
.get(0)).isNull();
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-562
|
||||
@@ -2413,9 +2421,11 @@ public class JedisClusterConnectionTests implements ClusterConnectionTests {
|
||||
@IfProfileValue(name = "redisVersion", value = "3.2+")
|
||||
public void bitfieldShouldWorkUsingNonZeroBasedOffset() {
|
||||
|
||||
assertThat(clusterConnection.stringCommands().bitField(JedisConverters.toBytes(KEY_1),
|
||||
create().set(INT_8).valueAt(BitFieldSubCommands.Offset.offset(0L).multipliedByTypeLength()).to(100L).set(INT_8)
|
||||
.valueAt(BitFieldSubCommands.Offset.offset(1L).multipliedByTypeLength()).to(200L))).containsExactly(0L, 0L);
|
||||
assertThat(
|
||||
clusterConnection.stringCommands().bitField(JedisConverters.toBytes(KEY_1),
|
||||
create().set(INT_8).valueAt(BitFieldSubCommands.Offset.offset(0L).multipliedByTypeLength()).to(100L)
|
||||
.set(INT_8).valueAt(BitFieldSubCommands.Offset.offset(1L).multipliedByTypeLength()).to(200L)))
|
||||
.containsExactly(0L, 0L);
|
||||
assertThat(
|
||||
clusterConnection.stringCommands()
|
||||
.bitField(JedisConverters.toBytes(KEY_1),
|
||||
|
||||
@@ -227,9 +227,9 @@ public class JedisClusterConnectionUnitTests {
|
||||
verify(con2Mock, times(1)).clusterSetSlotImporting(eq(100), eq(CLUSTER_NODE_2.getId()));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void clusterSetSlotShouldThrowExceptionWhenModeIsNull() {
|
||||
connection.clusterSetSlot(CLUSTER_NODE_1, 100, null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.clusterSetSlot(CLUSTER_NODE_1, 100, null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -241,9 +241,9 @@ public class JedisClusterConnectionUnitTests {
|
||||
verify(con2Mock, times(1)).clusterDelSlots((int[]) anyVararg());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void clusterDeleteSlotShouldThrowExceptionWhenNodeIsNull() {
|
||||
connection.clusterDeleteSlots(null, new int[] { 1 });
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.clusterDeleteSlots(null, new int[] { 1 }));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
|
||||
@@ -152,50 +152,54 @@ public class JedisConnectionIntegrationTests extends AbstractConnectionIntegrati
|
||||
assertThat(added.longValue()).isEqualTo(2L);
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnSingleError() {
|
||||
connection.eval("return redis.call('expire','foo')", ReturnType.BOOLEAN, 0);
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class)
|
||||
.isThrownBy(() -> connection.eval("return redis.call('expire','foo')", ReturnType.BOOLEAN, 0));
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalArrayScriptError() {
|
||||
super.testEvalArrayScriptError();
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class)
|
||||
.isThrownBy(() -> super.testEvalArrayScriptError());
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalShaNotFound() {
|
||||
connection.evalSha("somefakesha", ReturnType.VALUE, 2, "key1", "key2");
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class)
|
||||
.isThrownBy(() -> connection.evalSha("somefakesha", ReturnType.VALUE, 2, "key1", "key2"));
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalShaArrayError() {
|
||||
super.testEvalShaArrayError();
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy(() -> super.testEvalShaArrayError());
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testRestoreBadData() {
|
||||
super.testRestoreBadData();
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy(() -> super.testRestoreBadData());
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testRestoreExistingKey() {
|
||||
super.testRestoreExistingKey();
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class)
|
||||
.isThrownBy(() -> super.testRestoreExistingKey());
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test
|
||||
public void testExecWithoutMulti() {
|
||||
super.testExecWithoutMulti();
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy(() -> super.testExecWithoutMulti());
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test
|
||||
public void testErrorInTx() {
|
||||
super.testErrorInTx();
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy(() -> super.testErrorInTx());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,7 +27,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
import org.springframework.data.redis.SettingsUtils;
|
||||
import org.springframework.data.redis.connection.AbstractConnectionPipelineIntegrationTests;
|
||||
import org.springframework.data.redis.connection.DefaultStringRedisConnection;
|
||||
@@ -126,145 +125,133 @@ public class JedisConnectionPipelineIntegrationTests extends AbstractConnectionP
|
||||
}
|
||||
|
||||
// Unsupported Ops
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testScriptLoadEvalSha() {
|
||||
super.testScriptLoadEvalSha();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testScriptLoadEvalSha);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalShaArrayStrings() {
|
||||
super.testEvalShaArrayStrings();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalShaArrayStrings);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalShaArrayBytes() {
|
||||
super.testEvalShaArrayBytes();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalShaArrayBytes);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalShaNotFound() {
|
||||
super.testEvalShaNotFound();
|
||||
}
|
||||
@Test
|
||||
@Ignore
|
||||
public void testEvalShaNotFound() {}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalShaArrayError() {
|
||||
super.testEvalShaArrayError();
|
||||
}
|
||||
@Test
|
||||
@Ignore
|
||||
public void testEvalShaArrayError() {}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalArrayScriptError() {
|
||||
super.testEvalArrayScriptError();
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnString() {
|
||||
super.testEvalReturnString();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalReturnString);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnNumber() {
|
||||
super.testEvalReturnNumber();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalReturnNumber);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnSingleOK() {
|
||||
super.testEvalReturnSingleOK();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalReturnSingleOK);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
@Test
|
||||
@Ignore
|
||||
public void testEvalReturnSingleError() {
|
||||
super.testEvalReturnSingleError();
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnFalse() {
|
||||
super.testEvalReturnFalse();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalReturnFalse);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnTrue() {
|
||||
super.testEvalReturnTrue();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalReturnTrue);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnArrayStrings() {
|
||||
super.testEvalReturnArrayStrings();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalReturnArrayStrings);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnArrayNumbers() {
|
||||
super.testEvalReturnArrayNumbers();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalReturnArrayNumbers);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnArrayOKs() {
|
||||
super.testEvalReturnArrayOKs();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalReturnArrayOKs);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnArrayFalses() {
|
||||
super.testEvalReturnArrayFalses();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalReturnArrayFalses);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnArrayTrues() {
|
||||
super.testEvalReturnArrayTrues();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalReturnArrayTrues);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testScriptExists() {
|
||||
super.testScriptExists();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testScriptExists);
|
||||
}
|
||||
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void testScriptKill() throws Exception {
|
||||
connection.scriptKill();
|
||||
public void testScriptKill() {
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> connection.scriptKill());
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@Ignore
|
||||
public void testScriptFlush() {}
|
||||
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testScriptFlush() {
|
||||
connection.scriptFlush();
|
||||
public void testInfoBySection() {
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testInfoBySection);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testInfoBySection() throws Exception {
|
||||
super.testInfoBySection();
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-269
|
||||
@Test // DATAREDIS-269
|
||||
public void clientSetNameWorksCorrectly() {
|
||||
super.clientSetNameWorksCorrectly();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::clientSetNameWorksCorrectly);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-268
|
||||
// DATAREDIS-268
|
||||
public void testListClientsContainsAtLeastOneElement() {
|
||||
super.testListClientsContainsAtLeastOneElement();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class)
|
||||
.isThrownBy(super::testListClientsContainsAtLeastOneElement);
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class) // DATAREDIS-296
|
||||
public void testExecWithoutMulti() {
|
||||
super.testExecWithoutMulti();
|
||||
}
|
||||
@Test // DATAREDIS-296
|
||||
@Ignore
|
||||
public void testExecWithoutMulti() {}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.data.redis.connection.RedisPipelineException;
|
||||
import org.springframework.test.annotation.IfProfileValue;
|
||||
|
||||
/**
|
||||
* @author Jennifer Hickey
|
||||
@@ -42,17 +41,13 @@ public class JedisConnectionPipelineTxIntegrationTests extends JedisConnectionTr
|
||||
getResults();
|
||||
}
|
||||
|
||||
@Test(expected = RedisPipelineException.class)
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testRestoreBadData() {
|
||||
super.testRestoreBadData();
|
||||
}
|
||||
@Test
|
||||
@Ignore
|
||||
public void testRestoreBadData() {}
|
||||
|
||||
@Test(expected = RedisPipelineException.class)
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testRestoreExistingKey() {
|
||||
super.testRestoreExistingKey();
|
||||
}
|
||||
@Test
|
||||
@Ignore
|
||||
public void testRestoreExistingKey() {}
|
||||
|
||||
protected void initConnection() {
|
||||
connection.openPipeline();
|
||||
@@ -70,9 +65,7 @@ public class JedisConnectionPipelineTxIntegrationTests extends JedisConnectionTr
|
||||
return txResults;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-268
|
||||
public void testListClientsContainsAtLeastOneElement() {
|
||||
super.testListClientsContainsAtLeastOneElement();
|
||||
}
|
||||
@Test
|
||||
@Ignore
|
||||
public void testListClientsContainsAtLeastOneElement() {}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.jedis;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
@@ -57,152 +59,154 @@ public class JedisConnectionTransactionIntegrationTests extends AbstractConnecti
|
||||
public void testGetConfig() {}
|
||||
|
||||
// Unsupported Ops
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testScriptLoadEvalSha() {
|
||||
super.testScriptLoadEvalSha();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testScriptLoadEvalSha);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalShaArrayStrings() {
|
||||
super.testEvalShaArrayStrings();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalShaArrayStrings);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalShaArrayBytes() {
|
||||
super.testEvalShaArrayBytes();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalShaArrayBytes);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalShaNotFound() {
|
||||
super.testEvalShaNotFound();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalShaNotFound);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalShaArrayError() {
|
||||
super.testEvalShaArrayError();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalShaArrayError);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalArrayScriptError() {
|
||||
super.testEvalArrayScriptError();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalArrayScriptError);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnString() {
|
||||
super.testEvalReturnString();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalReturnString);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnNumber() {
|
||||
super.testEvalReturnNumber();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalReturnNumber);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnSingleOK() {
|
||||
super.testEvalReturnSingleOK();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalReturnSingleOK);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnSingleError() {
|
||||
super.testEvalReturnSingleError();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalReturnSingleError);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnFalse() {
|
||||
super.testEvalReturnFalse();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalReturnFalse);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnTrue() {
|
||||
super.testEvalReturnTrue();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalReturnTrue);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnArrayStrings() {
|
||||
super.testEvalReturnArrayStrings();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalReturnArrayStrings);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnArrayNumbers() {
|
||||
super.testEvalReturnArrayNumbers();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalReturnArrayNumbers);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnArrayOKs() {
|
||||
super.testEvalReturnArrayOKs();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalReturnArrayOKs);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnArrayFalses() {
|
||||
super.testEvalReturnArrayFalses();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalReturnArrayFalses);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnArrayTrues() {
|
||||
super.testEvalReturnArrayTrues();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testEvalReturnArrayTrues);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testScriptExists() {
|
||||
super.testScriptExists();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testScriptExists);
|
||||
}
|
||||
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void testScriptKill() {
|
||||
connection.scriptKill();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> connection.scriptKill());
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testScriptFlush() {
|
||||
connection.scriptFlush();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> connection.scriptFlush());
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testInfoBySection() throws Exception {
|
||||
super.testInfoBySection();
|
||||
public void testInfoBySection() {
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::testInfoBySection);
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testRestoreBadData() {
|
||||
super.testRestoreBadData();
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy(super::testRestoreBadData);
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testRestoreExistingKey() {
|
||||
super.testRestoreExistingKey();
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy(super::testRestoreExistingKey);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-269
|
||||
@Test // DATAREDIS-269
|
||||
public void clientSetNameWorksCorrectly() {
|
||||
super.clientSetNameWorksCorrectly();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(super::clientSetNameWorksCorrectly);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-268
|
||||
// DATAREDIS-268
|
||||
public void testListClientsContainsAtLeastOneElement() {
|
||||
super.testListClientsContainsAtLeastOneElement();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class)
|
||||
.isThrownBy(super::testListClientsContainsAtLeastOneElement);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,9 +105,9 @@ public class JedisConnectionUnitTestSuite {
|
||||
verifyNativeConnectionInvocation().clientGetname();
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-277
|
||||
@Test // DATAREDIS-277
|
||||
public void slaveOfShouldThrowExectpionWhenCalledForNullHost() {
|
||||
connection.slaveOf(null, 0);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.slaveOf(null, 0));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-277
|
||||
@@ -124,34 +124,40 @@ public class JedisConnectionUnitTestSuite {
|
||||
verifyNativeConnectionInvocation().slaveofNoOne();
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessResourceUsageException.class) // DATAREDIS-330
|
||||
@Test // DATAREDIS-330
|
||||
public void shouldThrowExceptionWhenAccessingRedisSentinelsCommandsWhenNoSentinelsConfigured() {
|
||||
connection.getSentinelConnection();
|
||||
assertThatExceptionOfType(InvalidDataAccessResourceUsageException.class)
|
||||
.isThrownBy(() -> connection.getSentinelConnection());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-472
|
||||
@Test // DATAREDIS-472
|
||||
public void restoreShouldThrowExceptionWhenTtlInMillisExceedsIntegerRange() {
|
||||
connection.restore("foo".getBytes(), (long) Integer.MAX_VALUE + 1L, "bar".getBytes());
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> connection.restore("foo".getBytes(), (long) Integer.MAX_VALUE + 1L, "bar".getBytes()));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-472
|
||||
@Test // DATAREDIS-472
|
||||
public void setExShouldThrowExceptionWhenTimeExceedsIntegerRange() {
|
||||
connection.setEx("foo".getBytes(), (long) Integer.MAX_VALUE + 1L, "bar".getBytes());
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> connection.setEx("foo".getBytes(), (long) Integer.MAX_VALUE + 1L, "bar".getBytes()));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-472
|
||||
@Test // DATAREDIS-472
|
||||
public void sRandMemberShouldThrowExceptionWhenCountExceedsIntegerRange() {
|
||||
connection.sRandMember("foo".getBytes(), (long) Integer.MAX_VALUE + 1L);
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> connection.sRandMember("foo".getBytes(), (long) Integer.MAX_VALUE + 1L));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-472
|
||||
@Test // DATAREDIS-472
|
||||
public void zRangeByScoreShouldThrowExceptionWhenOffsetExceedsIntegerRange() {
|
||||
connection.zRangeByScore("foo".getBytes(), "foo", "bar", (long) Integer.MAX_VALUE + 1L, Integer.MAX_VALUE);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.zRangeByScore("foo".getBytes(), "foo", "bar",
|
||||
(long) Integer.MAX_VALUE + 1L, Integer.MAX_VALUE));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-472
|
||||
@Test // DATAREDIS-472
|
||||
public void zRangeByScoreShouldThrowExceptionWhenCountExceedsIntegerRange() {
|
||||
connection.zRangeByScore("foo".getBytes(), "foo", "bar", Integer.MAX_VALUE, (long) Integer.MAX_VALUE + 1L);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.zRangeByScore("foo".getBytes(), "foo", "bar",
|
||||
Integer.MAX_VALUE, (long) Integer.MAX_VALUE + 1L));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-531
|
||||
@@ -275,78 +281,96 @@ public class JedisConnectionUnitTestSuite {
|
||||
connection.openPipeline();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-184
|
||||
// DATAREDIS-184
|
||||
public void shutdownNosaveShouldBeSentCorrectlyUsingLuaScript() {
|
||||
super.shutdownNosaveShouldBeSentCorrectlyUsingLuaScript();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class)
|
||||
.isThrownBy(() -> super.shutdownNosaveShouldBeSentCorrectlyUsingLuaScript());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-184
|
||||
// DATAREDIS-184
|
||||
public void shutdownSaveShouldBeSentCorrectlyUsingLuaScript() {
|
||||
super.shutdownSaveShouldBeSentCorrectlyUsingLuaScript();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class)
|
||||
.isThrownBy(() -> super.shutdownSaveShouldBeSentCorrectlyUsingLuaScript());
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-267
|
||||
@Test // DATAREDIS-267
|
||||
public void killClientShouldDelegateCallCorrectly() {
|
||||
super.killClientShouldDelegateCallCorrectly();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class)
|
||||
.isThrownBy(() -> super.killClientShouldDelegateCallCorrectly());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-270
|
||||
// DATAREDIS-270
|
||||
public void getClientNameShouldSendRequestCorrectly() {
|
||||
super.getClientNameShouldSendRequestCorrectly();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class)
|
||||
.isThrownBy(() -> super.getClientNameShouldSendRequestCorrectly());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-277
|
||||
// DATAREDIS-277
|
||||
public void slaveOfShouldBeSentCorrectly() {
|
||||
super.slaveOfShouldBeSentCorrectly();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class)
|
||||
.isThrownBy(() -> super.slaveOfShouldBeSentCorrectly());
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-277
|
||||
@Test // DATAREDIS-277
|
||||
public void slaveOfNoOneShouldBeSentCorrectly() {
|
||||
super.slaveOfNoOneShouldBeSentCorrectly();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class)
|
||||
.isThrownBy(() -> super.slaveOfNoOneShouldBeSentCorrectly());
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-531
|
||||
@Test // DATAREDIS-531
|
||||
public void scanShouldKeepTheConnectionOpen() {
|
||||
super.scanShouldKeepTheConnectionOpen();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class)
|
||||
.isThrownBy(() -> super.scanShouldKeepTheConnectionOpen());
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-531
|
||||
public void scanShouldCloseTheConnectionWhenCursorIsClosed() throws IOException {
|
||||
super.scanShouldCloseTheConnectionWhenCursorIsClosed();
|
||||
@Test // DATAREDIS-531
|
||||
public void scanShouldCloseTheConnectionWhenCursorIsClosed() {
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class)
|
||||
.isThrownBy(() -> super.scanShouldCloseTheConnectionWhenCursorIsClosed());
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-531
|
||||
@Test // DATAREDIS-531
|
||||
public void sScanShouldKeepTheConnectionOpen() {
|
||||
super.sScanShouldKeepTheConnectionOpen();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class)
|
||||
.isThrownBy(() -> super.sScanShouldKeepTheConnectionOpen());
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-531
|
||||
public void sScanShouldCloseTheConnectionWhenCursorIsClosed() throws IOException {
|
||||
super.sScanShouldCloseTheConnectionWhenCursorIsClosed();
|
||||
@Test // DATAREDIS-531
|
||||
public void sScanShouldCloseTheConnectionWhenCursorIsClosed() {
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class)
|
||||
.isThrownBy(() -> super.sScanShouldCloseTheConnectionWhenCursorIsClosed());
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-531
|
||||
@Test // DATAREDIS-531
|
||||
public void zScanShouldKeepTheConnectionOpen() {
|
||||
super.zScanShouldKeepTheConnectionOpen();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class)
|
||||
.isThrownBy(() -> super.zScanShouldKeepTheConnectionOpen());
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-531
|
||||
public void zScanShouldCloseTheConnectionWhenCursorIsClosed() throws IOException {
|
||||
super.zScanShouldCloseTheConnectionWhenCursorIsClosed();
|
||||
@Test // DATAREDIS-531
|
||||
public void zScanShouldCloseTheConnectionWhenCursorIsClosed() {
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class)
|
||||
.isThrownBy(() -> super.zScanShouldCloseTheConnectionWhenCursorIsClosed());
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-531
|
||||
@Test // DATAREDIS-531
|
||||
public void hScanShouldKeepTheConnectionOpen() {
|
||||
super.hScanShouldKeepTheConnectionOpen();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class)
|
||||
.isThrownBy(() -> super.hScanShouldKeepTheConnectionOpen());
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-531
|
||||
public void hScanShouldCloseTheConnectionWhenCursorIsClosed() throws IOException {
|
||||
super.hScanShouldCloseTheConnectionWhenCursorIsClosed();
|
||||
@Test // DATAREDIS-531
|
||||
public void hScanShouldCloseTheConnectionWhenCursorIsClosed() {
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class)
|
||||
.isThrownBy(() -> super.hScanShouldCloseTheConnectionWhenCursorIsClosed());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -145,9 +145,10 @@ public class JedisConvertersUnitTests {
|
||||
.isEqualTo(JedisConverters.toBytes("(1"));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-378
|
||||
@Test // DATAREDIS-378
|
||||
public void boundaryToBytesForZRangeByLexShouldThrowExceptionWhenBoundaryHoldsUnknownType() {
|
||||
JedisConverters.boundaryToBytesForZRangeByLex(Range.range().gt(new Date()).getMin(), null);
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> JedisConverters.boundaryToBytesForZRangeByLex(Range.range().gt(new Date()).getMin(), null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-352
|
||||
@@ -195,9 +196,10 @@ public class JedisConvertersUnitTests {
|
||||
.isEqualTo(JedisConverters.toBytes("(1"));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-352
|
||||
@Test // DATAREDIS-352
|
||||
public void boundaryToBytesForZRangeByShouldThrowExceptionWhenBoundaryHoldsUnknownType() {
|
||||
JedisConverters.boundaryToBytesForZRange(Range.range().gt(new Date()).getMin(), null);
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> JedisConverters.boundaryToBytesForZRange(Range.range().gt(new Date()).getMin(), null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-316, DATAREDIS-749
|
||||
|
||||
@@ -15,19 +15,21 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.jedis;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import redis.clients.jedis.Jedis;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
import org.springframework.data.redis.connection.RedisNode;
|
||||
import org.springframework.data.redis.connection.RedisNode.RedisNodeBuilder;
|
||||
import org.springframework.data.redis.connection.RedisServer;
|
||||
|
||||
import redis.clients.jedis.Jedis;
|
||||
|
||||
/**
|
||||
* @author Christoph Strobl
|
||||
*/
|
||||
@@ -67,14 +69,14 @@ public class JedisSentinelConnectionUnitTests {
|
||||
verify(jedisMock, times(1)).sentinelFailover(eq("mymaster"));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-330
|
||||
@Test // DATAREDIS-330
|
||||
public void failoverShouldThrowExceptionIfMasterNodeIsNull() {
|
||||
connection.failover(null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.failover(null));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-330
|
||||
@Test // DATAREDIS-330
|
||||
public void failoverShouldThrowExceptionIfMasterNodeNameIsEmpty() {
|
||||
connection.failover(new RedisNodeBuilder().build());
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.failover(new RedisNodeBuilder().build()));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-330
|
||||
@@ -98,19 +100,19 @@ public class JedisSentinelConnectionUnitTests {
|
||||
verify(jedisMock, times(1)).sentinelSlaves(eq("mymaster"));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-330
|
||||
@Test // DATAREDIS-330
|
||||
public void readSlavesShouldThrowExceptionWhenGivenEmptyMasterName() {
|
||||
connection.slaves("");
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.slaves(""));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-330
|
||||
@Test // DATAREDIS-330
|
||||
public void readSlavesShouldThrowExceptionWhenGivenNull() {
|
||||
connection.slaves((RedisNode) null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.slaves((RedisNode) null));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-330
|
||||
@Test // DATAREDIS-330
|
||||
public void readSlavesShouldThrowExceptionWhenNodeWithoutName() {
|
||||
connection.slaves(new RedisNodeBuilder().build());
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.slaves(new RedisNodeBuilder().build()));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-330
|
||||
@@ -120,19 +122,19 @@ public class JedisSentinelConnectionUnitTests {
|
||||
verify(jedisMock, times(1)).sentinelRemove(eq("mymaster"));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-330
|
||||
@Test // DATAREDIS-330
|
||||
public void removeShouldThrowExceptionWhenGivenEmptyMasterName() {
|
||||
connection.remove("");
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.remove(""));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-330
|
||||
@Test // DATAREDIS-330
|
||||
public void removeShouldThrowExceptionWhenGivenNull() {
|
||||
connection.remove((RedisNode) null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.remove((RedisNode) null));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-330
|
||||
@Test // DATAREDIS-330
|
||||
public void removeShouldThrowExceptionWhenNodeWithoutName() {
|
||||
connection.remove(new RedisNodeBuilder().build());
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.remove(new RedisNodeBuilder().build()));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-330
|
||||
|
||||
@@ -86,50 +86,54 @@ public class JedisSentinelIntegrationTests extends AbstractConnectionIntegration
|
||||
super.testScriptKill();
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnSingleError() {
|
||||
connection.eval("return redis.call('expire','foo')", ReturnType.BOOLEAN, 0);
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class)
|
||||
.isThrownBy(() -> connection.eval("return redis.call('expire','foo')", ReturnType.BOOLEAN, 0));
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalArrayScriptError() {
|
||||
super.testEvalArrayScriptError();
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class)
|
||||
.isThrownBy(() -> super.testEvalArrayScriptError());
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalShaNotFound() {
|
||||
connection.evalSha("somefakesha", ReturnType.VALUE, 2, "key1", "key2");
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class)
|
||||
.isThrownBy(() -> connection.evalSha("somefakesha", ReturnType.VALUE, 2, "key1", "key2"));
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalShaArrayError() {
|
||||
super.testEvalShaArrayError();
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy(() -> super.testEvalShaArrayError());
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testRestoreBadData() {
|
||||
super.testRestoreBadData();
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy(() -> super.testRestoreBadData());
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testRestoreExistingKey() {
|
||||
super.testRestoreExistingKey();
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class)
|
||||
.isThrownBy(() -> super.testRestoreExistingKey());
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test
|
||||
public void testExecWithoutMulti() {
|
||||
super.testExecWithoutMulti();
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy(() -> super.testExecWithoutMulti());
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test
|
||||
public void testErrorInTx() {
|
||||
super.testErrorInTx();
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy(() -> super.testErrorInTx());
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-330
|
||||
|
||||
@@ -94,13 +94,13 @@ public class LettuceClientConfigurationUnitTests {
|
||||
assertThat(configuration.getShutdownQuietPeriod()).isEqualTo(Duration.ofSeconds(42));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-576
|
||||
@Test // DATAREDIS-576
|
||||
public void clientConfigurationThrowsExceptionForNullClientName() {
|
||||
LettuceClientConfiguration.builder().clientName(null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> LettuceClientConfiguration.builder().clientName(null));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-576
|
||||
@Test // DATAREDIS-576
|
||||
public void clientConfigurationThrowsExceptionForEmptyClientName() {
|
||||
LettuceClientConfiguration.builder().clientName(" ");
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> LettuceClientConfiguration.builder().clientName(" "));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,9 +216,10 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
|
||||
assertThat(clusterConnection.bitCount(KEY_1_BYTES, 0, 3)).isEqualTo(3L);
|
||||
}
|
||||
|
||||
@Test(expected = DataAccessException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void bitOpShouldThrowExceptionWhenKeysDoNotMapToSameSlot() {
|
||||
clusterConnection.bitOp(BitOperation.AND, KEY_1_BYTES, KEY_2_BYTES, KEY_3_BYTES);
|
||||
assertThatExceptionOfType(DataAccessException.class)
|
||||
.isThrownBy(() -> clusterConnection.bitOp(BitOperation.AND, KEY_1_BYTES, KEY_2_BYTES, KEY_3_BYTES));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -377,9 +378,9 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
|
||||
assertThat(nativeConnection.get(KEY_1)).isNull();
|
||||
}
|
||||
|
||||
@Test(expected = DataAccessException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void discardShouldThrowException() {
|
||||
clusterConnection.discard();
|
||||
assertThatExceptionOfType(DataAccessException.class).isThrownBy(() -> clusterConnection.discard());
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -412,9 +413,9 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
|
||||
assertThat(clusterConnection.echo(VALUE_1_BYTES)).isEqualTo(VALUE_1_BYTES);
|
||||
}
|
||||
|
||||
@Test(expected = DataAccessException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void execShouldThrowException() {
|
||||
clusterConnection.exec();
|
||||
assertThatExceptionOfType(DataAccessException.class).isThrownBy(() -> clusterConnection.exec());
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-529
|
||||
@@ -1226,14 +1227,15 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
|
||||
assertThat(nativeConnection.get(SAME_SLOT_KEY_2)).isEqualTo(VALUE_2);
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void moveShouldNotBeSupported() {
|
||||
clusterConnection.move(KEY_1_BYTES, 3);
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class)
|
||||
.isThrownBy(() -> clusterConnection.move(KEY_1_BYTES, 3));
|
||||
}
|
||||
|
||||
@Test(expected = DataAccessException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void multiShouldThrowException() {
|
||||
clusterConnection.multi();
|
||||
assertThatExceptionOfType(DataAccessException.class).isThrownBy(() -> clusterConnection.multi());
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -1335,9 +1337,10 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
|
||||
clusterConnection.pfCount(KEY_1_BYTES, KEY_2_BYTES);
|
||||
}
|
||||
|
||||
@Test(expected = DataAccessException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void pfMergeShouldThrowErrorOnDifferentSlotKeys() {
|
||||
clusterConnection.pfMerge(KEY_3_BYTES, KEY_1_BYTES, KEY_2_BYTES);
|
||||
assertThatExceptionOfType(DataAccessException.class)
|
||||
.isThrownBy(() -> clusterConnection.pfMerge(KEY_3_BYTES, KEY_1_BYTES, KEY_2_BYTES));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -1361,9 +1364,10 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
|
||||
assertThat(clusterConnection.ping(new RedisClusterNode("127.0.0.1", 7379, SlotRange.empty()))).isEqualTo("PONG");
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void pingShouldThrowExceptionWhenNodeNotKnownToCluster() {
|
||||
clusterConnection.ping(new RedisClusterNode("127.0.0.1", 1234, SlotRange.empty()));
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> clusterConnection.ping(new RedisClusterNode("127.0.0.1", 1234, SlotRange.empty())));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -1714,9 +1718,9 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
|
||||
clusterConnection.select(0);
|
||||
}
|
||||
|
||||
@Test(expected = DataAccessException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void selectShouldThrowExceptionWhenSelectingNonZeroDbIndex() {
|
||||
clusterConnection.select(1);
|
||||
assertThatExceptionOfType(DataAccessException.class).isThrownBy(() -> clusterConnection.select(1));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -1953,14 +1957,14 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
|
||||
assertThat(clusterConnection.type(KEY_3_BYTES)).isEqualTo(DataType.HASH);
|
||||
}
|
||||
|
||||
@Test(expected = DataAccessException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void unwatchShouldThrowException() {
|
||||
clusterConnection.unwatch();
|
||||
assertThatExceptionOfType(DataAccessException.class).isThrownBy(() -> clusterConnection.unwatch());
|
||||
}
|
||||
|
||||
@Test(expected = DataAccessException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void watchShouldThrowException() {
|
||||
clusterConnection.watch();
|
||||
assertThatExceptionOfType(DataAccessException.class).isThrownBy(() -> clusterConnection.watch());
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-674
|
||||
@@ -2015,9 +2019,10 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
|
||||
assertThat(nativeConnection.zrank(KEY_1, VALUE_1)).isEqualTo(1L);
|
||||
}
|
||||
|
||||
@Test(expected = DataAccessException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void zInterStoreShouldThrowExceptionWhenKeysDoNotMapToSameSlots() {
|
||||
clusterConnection.zInterStore(KEY_3_BYTES, KEY_1_BYTES, KEY_2_BYTES);
|
||||
assertThatExceptionOfType(DataAccessException.class)
|
||||
.isThrownBy(() -> clusterConnection.zInterStore(KEY_3_BYTES, KEY_1_BYTES, KEY_2_BYTES));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -2278,9 +2283,10 @@ public class LettuceClusterConnectionTests implements ClusterConnectionTests {
|
||||
assertThat(clusterConnection.zScore(KEY_1_BYTES, VALUE_2_BYTES)).isEqualTo(20D);
|
||||
}
|
||||
|
||||
@Test(expected = DataAccessException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void zUnionStoreShouldThrowExceptionWhenKeysDoNotMapToSameSlots() {
|
||||
clusterConnection.zUnionStore(KEY_3_BYTES, KEY_1_BYTES, KEY_2_BYTES);
|
||||
assertThatExceptionOfType(DataAccessException.class)
|
||||
.isThrownBy(() -> clusterConnection.zUnionStore(KEY_3_BYTES, KEY_1_BYTES, KEY_2_BYTES));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
|
||||
@@ -130,9 +130,9 @@ public class LettuceClusterConnectionUnitTests {
|
||||
};
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void thowsExceptionWhenClusterCommandExecturorIsNull() {
|
||||
new LettuceClusterConnection(clusterMock, null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> new LettuceClusterConnection(clusterMock, null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -148,9 +148,9 @@ public class LettuceClusterConnectionUnitTests {
|
||||
UNKNOWN_CLUSTER_NODE.getPort());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void clusterMeetShouldThrowExceptionWhenNodeIsNull() {
|
||||
connection.clusterMeet(null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.clusterMeet(null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -292,9 +292,9 @@ public class LettuceClusterConnectionUnitTests {
|
||||
verify(clusterConnection2Mock, times(1)).clusterSetSlotImporting(eq(100), eq(CLUSTER_NODE_2.getId()));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void clusterSetSlotShouldThrowExceptionWhenModeIsNull() {
|
||||
connection.clusterSetSlot(CLUSTER_NODE_1, 100, null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.clusterSetSlot(CLUSTER_NODE_1, 100, null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -306,9 +306,9 @@ public class LettuceClusterConnectionUnitTests {
|
||||
verify(clusterConnection2Mock, times(1)).clusterDelSlots((int[]) any());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void clusterDeleteSlotShouldThrowExceptionWhenNodeIsNull() {
|
||||
connection.clusterDeleteSlots(null, new int[] { 1 });
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.clusterDeleteSlots(null, new int[] { 1 }));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
|
||||
@@ -38,7 +38,6 @@ import io.lettuce.core.resource.ClientResources;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.time.Duration;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -47,6 +46,7 @@ import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.ArgumentMatchers;
|
||||
|
||||
import org.springframework.beans.DirectFieldAccessor;
|
||||
import org.springframework.data.redis.ConnectionFactoryTracker;
|
||||
import org.springframework.data.redis.connection.RedisClusterConfiguration;
|
||||
@@ -658,13 +658,13 @@ public class LettuceConnectionFactoryUnitTests {
|
||||
assertThat(connectionFactory.getClusterConfiguration()).isEqualTo(configuration);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class) // DATAREDIS-574
|
||||
public void shouldDenyChangesToImmutableClientConfiguration() throws NoSuchAlgorithmException {
|
||||
@Test // DATAREDIS-574
|
||||
public void shouldDenyChangesToImmutableClientConfiguration() {
|
||||
|
||||
LettuceConnectionFactory connectionFactory = new LettuceConnectionFactory(new RedisStandaloneConfiguration(),
|
||||
LettuceClientConfiguration.defaultConfiguration());
|
||||
|
||||
connectionFactory.setUseSsl(false);
|
||||
assertThatIllegalStateException().isThrownBy(() -> connectionFactory.setUseSsl(false));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-676
|
||||
|
||||
@@ -229,9 +229,9 @@ public class LettuceConnectionIntegrationTests extends AbstractConnectionIntegra
|
||||
pool.destroy();
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
public void testSelect() {
|
||||
super.testSelect();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> super.testSelect());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -48,9 +48,9 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
@ContextConfiguration("LettuceConnectionIntegrationTests-context.xml")
|
||||
public class LettuceConnectionPipelineIntegrationTests extends AbstractConnectionPipelineIntegrationTests {
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
public void testSelect() {
|
||||
super.testSelect();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> super.testSelect());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -105,9 +105,11 @@ public class LettuceConnectionPipelineIntegrationTests extends AbstractConnectio
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-268
|
||||
// DATAREDIS-268
|
||||
public void testListClientsContainsAtLeastOneElement() {
|
||||
super.testListClientsContainsAtLeastOneElement();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class)
|
||||
.isThrownBy(() -> super.testListClientsContainsAtLeastOneElement());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,40 +32,40 @@ import org.springframework.test.annotation.IfProfileValue;
|
||||
*/
|
||||
public class LettuceConnectionPipelineTxIntegrationTests extends LettuceConnectionTransactionIntegrationTests {
|
||||
|
||||
@Test(expected = RedisPipelineException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalShaNotFound() {
|
||||
super.testEvalShaNotFound();
|
||||
assertThatExceptionOfType(RedisPipelineException.class).isThrownBy(() -> super.testEvalShaNotFound());
|
||||
}
|
||||
|
||||
@Test(expected = RedisPipelineException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalReturnSingleError() {
|
||||
super.testEvalReturnSingleError();
|
||||
assertThatExceptionOfType(RedisPipelineException.class).isThrownBy(() -> super.testEvalReturnSingleError());
|
||||
}
|
||||
|
||||
@Test(expected = RedisPipelineException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testRestoreBadData() {
|
||||
super.testRestoreBadData();
|
||||
assertThatExceptionOfType(RedisPipelineException.class).isThrownBy(() -> super.testRestoreBadData());
|
||||
}
|
||||
|
||||
@Test(expected = RedisPipelineException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testRestoreExistingKey() {
|
||||
super.testRestoreExistingKey();
|
||||
assertThatExceptionOfType(RedisPipelineException.class).isThrownBy(() -> super.testRestoreExistingKey());
|
||||
}
|
||||
|
||||
@Test(expected = RedisPipelineException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalArrayScriptError() {
|
||||
super.testEvalArrayScriptError();
|
||||
assertThatExceptionOfType(RedisPipelineException.class).isThrownBy(() -> super.testEvalArrayScriptError());
|
||||
}
|
||||
|
||||
@Test(expected = RedisPipelineException.class)
|
||||
@Test
|
||||
@IfProfileValue(name = "redisVersion", value = "2.6+")
|
||||
public void testEvalShaArrayError() {
|
||||
super.testEvalShaArrayError();
|
||||
assertThatExceptionOfType(RedisPipelineException.class).isThrownBy(() -> super.testEvalShaArrayError());
|
||||
}
|
||||
|
||||
protected void initConnection() {
|
||||
@@ -84,10 +84,12 @@ public class LettuceConnectionPipelineTxIntegrationTests extends LettuceConnecti
|
||||
return txResults;
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
@Test(expected = UnsupportedOperationException.class) // DATAREDIS-268
|
||||
// DATAREDIS-268
|
||||
public void testListClientsContainsAtLeastOneElement() {
|
||||
super.testListClientsContainsAtLeastOneElement();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class)
|
||||
.isThrownBy(() -> super.testListClientsContainsAtLeastOneElement());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class LettuceConnectionTransactionIntegrationTests extends AbstractConnec
|
||||
|
||||
actual.add(connection.set("foo", "bar"));
|
||||
actual.add(connection.move("foo", 1));
|
||||
verifyResults(Arrays.asList(true, true ));
|
||||
verifyResults(Arrays.asList(true, true));
|
||||
|
||||
// Lettuce does not support select when using shared conn, use a new conn factory
|
||||
LettuceConnectionFactory factory2 = new LettuceConnectionFactory();
|
||||
@@ -65,8 +65,8 @@ public class LettuceConnectionTransactionIntegrationTests extends AbstractConnec
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
@Test
|
||||
public void testSelect() {
|
||||
super.testSelect();
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> super.testSelect());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,9 +106,9 @@ public class LettuceConnectionUnitTestSuite {
|
||||
verify(syncCommandsMock, times(1)).clientGetname();
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-277
|
||||
@Test // DATAREDIS-277
|
||||
public void slaveOfShouldThrowExectpionWhenCalledForNullHost() {
|
||||
connection.slaveOf(null, 0);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.slaveOf(null, 0));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-277
|
||||
@@ -125,9 +125,10 @@ public class LettuceConnectionUnitTestSuite {
|
||||
verify(syncCommandsMock, times(1)).slaveofNoOne();
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessResourceUsageException.class) // DATAREDIS-348
|
||||
@Test // DATAREDIS-348
|
||||
public void shouldThrowExceptionWhenAccessingRedisSentinelsCommandsWhenNoSentinelsConfigured() {
|
||||
connection.getSentinelConnection();
|
||||
assertThatExceptionOfType(InvalidDataAccessResourceUsageException.class)
|
||||
.isThrownBy(() -> connection.getSentinelConnection());
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-431
|
||||
|
||||
@@ -83,11 +83,11 @@ public class LettuceReactiveClusterStringCommandsTests extends LettuceReactiveCl
|
||||
assertThat(nativeCommands.get(SAME_SLOT_KEY_3)).isEqualTo(VALUE_3);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-525
|
||||
@Test // DATAREDIS-525
|
||||
public void bitNotShouldThrowExceptionWhenMoreThanOnSourceKeyAndKeysMapToSameSlot() {
|
||||
|
||||
connection.stringCommands().bitOp(Arrays.asList(SAME_SLOT_KEY_1_BBUFFER, SAME_SLOT_KEY_2_BBUFFER),
|
||||
RedisStringCommands.BitOperation.NOT, SAME_SLOT_KEY_3_BBUFFER).block();
|
||||
assertThatIllegalArgumentException().isThrownBy(
|
||||
() -> connection.stringCommands().bitOp(Arrays.asList(SAME_SLOT_KEY_1_BBUFFER, SAME_SLOT_KEY_2_BBUFFER),
|
||||
RedisStringCommands.BitOperation.NOT, SAME_SLOT_KEY_3_BBUFFER).block());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -82,13 +82,12 @@ public class LettuceReactiveListCommandTests extends LettuceReactiveCommandsTest
|
||||
assertThat(nativeCommands.lrange(KEY_1, 0, -1)).containsExactly(VALUE_2, VALUE_1);
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class) // DATAREDIS-525
|
||||
@Test // DATAREDIS-525
|
||||
public void pushShouldThrowErrorForMoreThanOneValueWhenUsingExistsOption() {
|
||||
|
||||
connection.listCommands()
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy(() -> connection.listCommands()
|
||||
.push(Mono.just(
|
||||
PushCommand.right().values(Arrays.asList(VALUE_1_BBUFFER, VALUE_2_BBUFFER)).to(KEY_1_BBUFFER).ifExists()))
|
||||
.blockFirst();
|
||||
.blockFirst());
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-525
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.redis.connection.lettuce;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import io.lettuce.core.RedisClient;
|
||||
@@ -73,14 +74,14 @@ public class LettuceSentinelConnectionUnitTests {
|
||||
verify(sentinelCommandsMock, times(1)).failover(eq(MASTER_ID));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-348
|
||||
@Test // DATAREDIS-348
|
||||
public void failoverShouldThrowExceptionIfMasterNodeIsNull() {
|
||||
connection.failover(null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.failover(null));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-348
|
||||
@Test // DATAREDIS-348
|
||||
public void failoverShouldThrowExceptionIfMasterNodeNameIsEmpty() {
|
||||
connection.failover(new RedisNodeBuilder().build());
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.failover(new RedisNodeBuilder().build()));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-348
|
||||
@@ -107,19 +108,19 @@ public class LettuceSentinelConnectionUnitTests {
|
||||
verify(sentinelCommandsMock, times(1)).slaves(eq(MASTER_ID));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-348
|
||||
@Test // DATAREDIS-348
|
||||
public void readSlavesShouldThrowExceptionWhenGivenEmptyMasterName() {
|
||||
connection.slaves("");
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.slaves(""));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-348
|
||||
@Test // DATAREDIS-348
|
||||
public void readSlavesShouldThrowExceptionWhenGivenNull() {
|
||||
connection.slaves((RedisNode) null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.slaves((RedisNode) null));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-348
|
||||
@Test // DATAREDIS-348
|
||||
public void readSlavesShouldThrowExceptionWhenNodeWithoutName() {
|
||||
connection.slaves(new RedisNodeBuilder().build());
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.slaves(new RedisNodeBuilder().build()));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-348
|
||||
@@ -129,19 +130,19 @@ public class LettuceSentinelConnectionUnitTests {
|
||||
verify(sentinelCommandsMock, times(1)).remove(eq(MASTER_ID));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-348
|
||||
@Test // DATAREDIS-348
|
||||
public void removeShouldThrowExceptionWhenGivenEmptyMasterName() {
|
||||
connection.remove("");
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.remove(""));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-348
|
||||
@Test // DATAREDIS-348
|
||||
public void removeShouldThrowExceptionWhenGivenNull() {
|
||||
connection.remove((RedisNode) null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.remove((RedisNode) null));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-348
|
||||
@Test // DATAREDIS-348
|
||||
public void removeShouldThrowExceptionWhenNodeWithoutName() {
|
||||
connection.remove(new RedisNodeBuilder().build());
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> connection.remove(new RedisNodeBuilder().build()));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-348
|
||||
|
||||
@@ -85,9 +85,9 @@ public class DefaultClusterOperationsUnitTests {
|
||||
assertThat(clusterOps.keys(NODE_1, "*")).contains("key-1", "key-2");
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void keysShouldThrowExceptionWhenNodeIsNull() {
|
||||
clusterOps.keys(null, "*");
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> clusterOps.keys(null, "*"));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -106,9 +106,9 @@ public class DefaultClusterOperationsUnitTests {
|
||||
assertThat(clusterOps.randomKey(NODE_1)).isEqualTo("key-1");
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void randomKeyShouldThrowExceptionWhenNodeIsNull() {
|
||||
clusterOps.randomKey(null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> clusterOps.randomKey(null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -127,9 +127,9 @@ public class DefaultClusterOperationsUnitTests {
|
||||
assertThat(clusterOps.ping(NODE_1)).isEqualTo("PONG");
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void pingShouldThrowExceptionWhenNodeIsNull() {
|
||||
clusterOps.ping(null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> clusterOps.ping(null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -140,9 +140,9 @@ public class DefaultClusterOperationsUnitTests {
|
||||
verify(connection, times(1)).clusterAddSlots(eq(NODE_1), Mockito.<int[]> any());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void addSlotsShouldThrowExceptionWhenNodeIsNull() {
|
||||
clusterOps.addSlots(null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> clusterOps.addSlots(null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -153,9 +153,9 @@ public class DefaultClusterOperationsUnitTests {
|
||||
verify(connection, times(1)).clusterAddSlots(eq(NODE_1), Mockito.<int[]> any());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void addSlotsWithRangeShouldThrowExceptionWhenRangeIsNull() {
|
||||
clusterOps.addSlots(NODE_1, (SlotRange) null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> clusterOps.addSlots(NODE_1, (SlotRange) null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -166,9 +166,9 @@ public class DefaultClusterOperationsUnitTests {
|
||||
verify(connection, times(1)).bgSave(eq(NODE_1));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void bgSaveShouldThrowExceptionWhenNodeIsNull() {
|
||||
clusterOps.bgSave(null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> clusterOps.bgSave(null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -179,9 +179,9 @@ public class DefaultClusterOperationsUnitTests {
|
||||
verify(connection, times(1)).clusterMeet(eq(NODE_1));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void meetShouldThrowExceptionWhenNodeIsNull() {
|
||||
clusterOps.meet(null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> clusterOps.meet(null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -192,9 +192,9 @@ public class DefaultClusterOperationsUnitTests {
|
||||
verify(connection, times(1)).clusterForget(eq(NODE_1));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void forgetShouldThrowExceptionWhenNodeIsNull() {
|
||||
clusterOps.forget(null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> clusterOps.forget(null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -205,9 +205,9 @@ public class DefaultClusterOperationsUnitTests {
|
||||
verify(connection, times(1)).flushDb(eq(NODE_1));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void flushDbShouldThrowExceptionWhenNodeIsNull() {
|
||||
clusterOps.flushDb(null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> clusterOps.flushDb(null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -218,9 +218,9 @@ public class DefaultClusterOperationsUnitTests {
|
||||
verify(connection, times(1)).clusterGetSlaves(eq(NODE_1));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void getSlavesShouldThrowExceptionWhenNodeIsNull() {
|
||||
clusterOps.getSlaves(null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> clusterOps.getSlaves(null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -231,9 +231,9 @@ public class DefaultClusterOperationsUnitTests {
|
||||
verify(connection, times(1)).save(eq(NODE_1));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void saveShouldThrowExceptionWhenNodeIsNull() {
|
||||
clusterOps.save(null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> clusterOps.save(null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -244,9 +244,9 @@ public class DefaultClusterOperationsUnitTests {
|
||||
verify(connection, times(1)).shutdown(eq(NODE_1));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void shutdownShouldThrowExceptionWhenNodeIsNull() {
|
||||
clusterOps.shutdown(null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> clusterOps.shutdown(null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
@@ -258,9 +258,9 @@ public class DefaultClusterOperationsUnitTests {
|
||||
verify(connection, times(1)).get(eq(key));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-315
|
||||
@Test // DATAREDIS-315
|
||||
public void executeShouldThrowExceptionWhenCallbackIsNull() {
|
||||
clusterOps.execute(null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> clusterOps.execute(null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-315
|
||||
|
||||
@@ -210,20 +210,24 @@ public class DefaultListOperationsTests<K, V> {
|
||||
assertThat(listOps.range(key, 0, -1)).containsSequence(v1, v2, v3);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-288
|
||||
@Test // DATAREDIS-288
|
||||
public void rightPushAllShouldThrowExceptionWhenCalledWithEmptyCollection() {
|
||||
listOps.rightPushAll(keyFactory.instance(), Collections.<V> emptyList());
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> listOps.rightPushAll(keyFactory.instance(), Collections.<V> emptyList()));
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-288
|
||||
// DATAREDIS-288
|
||||
public void rightPushAllShouldThrowExceptionWhenCollectionContainsNullValue() {
|
||||
listOps.rightPushAll(keyFactory.instance(), Arrays.asList(valueFactory.instance(), null));
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> listOps.rightPushAll(keyFactory.instance(), Arrays.asList(valueFactory.instance(), null)));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-288
|
||||
@Test // DATAREDIS-288
|
||||
public void rightPushAllShouldThrowExceptionWhenCalledWithNull() {
|
||||
listOps.rightPushAll(keyFactory.instance(), (Collection<V>) null);
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> listOps.rightPushAll(keyFactory.instance(), (Collection<V>) null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-288
|
||||
@@ -240,18 +244,21 @@ public class DefaultListOperationsTests<K, V> {
|
||||
assertThat(listOps.range(key, 0, -1)).containsSequence(v3, v2, v1);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-288
|
||||
@Test // DATAREDIS-288
|
||||
public void leftPushAllShouldThrowExceptionWhenCalledWithEmptyCollection() {
|
||||
listOps.leftPushAll(keyFactory.instance(), Collections.<V> emptyList());
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> listOps.leftPushAll(keyFactory.instance(), Collections.<V> emptyList()));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-288
|
||||
@Test // DATAREDIS-288
|
||||
public void leftPushAllShouldThrowExceptionWhenCollectionContainsNullValue() {
|
||||
listOps.leftPushAll(keyFactory.instance(), Arrays.asList(valueFactory.instance(), null));
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> listOps.leftPushAll(keyFactory.instance(), Arrays.asList(valueFactory.instance(), null)));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-288
|
||||
@Test // DATAREDIS-288
|
||||
public void leftPushAllShouldThrowExceptionWhenCalledWithNull() {
|
||||
listOps.leftPushAll(keyFactory.instance(), (Collection<V>) null);
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> listOps.leftPushAll(keyFactory.instance(), (Collection<V>) null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,9 +79,9 @@ public class IndexWriterUnitTests {
|
||||
eq("persons:firstname:Rand".getBytes(CHARSET)));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-425
|
||||
@Test // DATAREDIS-425
|
||||
public void addKeyToIndexShouldThrowErrorWhenIndexedDataIsNull() {
|
||||
writer.addKeyToIndex(KEY_BIN, null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> writer.addKeyToIndex(KEY_BIN, null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-425
|
||||
@@ -108,9 +108,9 @@ public class IndexWriterUnitTests {
|
||||
verify(connectionMock).sRem(indexKey2, KEY_BIN);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-425
|
||||
@Test // DATAREDIS-425
|
||||
public void removeKeyFromExistingIndexesShouldThrowExecptionForNullIndexedData() {
|
||||
writer.removeKeyFromExistingIndexes(KEY_BIN, null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> writer.removeKeyFromExistingIndexes(KEY_BIN, null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-425
|
||||
@@ -130,10 +130,10 @@ public class IndexWriterUnitTests {
|
||||
assertThat(captor.getAllValues()).contains(indexKey1, indexKey2);
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class) // DATAREDIS-425
|
||||
@Test // DATAREDIS-425
|
||||
public void addToIndexShouldThrowDataAccessExceptionWhenAddingDataThatConnotBeConverted() {
|
||||
writer.addKeyToIndex(KEY_BIN, new SimpleIndexedPropertyValue(KEYSPACE, "firstname", new DummyObject()));
|
||||
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class).isThrownBy(
|
||||
() -> writer.addKeyToIndex(KEY_BIN, new SimpleIndexedPropertyValue(KEYSPACE, "firstname", new DummyObject())));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-425
|
||||
@@ -144,11 +144,11 @@ public class IndexWriterUnitTests {
|
||||
|
||||
((GenericConversionService) converter.getConversionService()).addConverter(new Converter<DummyObject, byte[]>() {
|
||||
|
||||
@Override
|
||||
public byte[] convert(DummyObject source) {
|
||||
return identityHexString.getBytes(CHARSET);
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public byte[] convert(DummyObject source) {
|
||||
return identityHexString.getBytes(CHARSET);
|
||||
}
|
||||
});
|
||||
|
||||
writer.addKeyToIndex(KEY_BIN, new SimpleIndexedPropertyValue(KEYSPACE, "firstname", value));
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.springframework.data.redis.core;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -58,10 +60,11 @@ public class RedisClusterTemplateTests<K, V> extends RedisTemplateTests<K, V> {
|
||||
|
||||
public static @ClassRule RedisClusterRule clusterAvailable = new RedisClusterRule();
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test
|
||||
@Ignore("Pipeline not supported in cluster mode")
|
||||
public void testExecutePipelinedNonNullRedisCallback() {
|
||||
super.testExecutePipelinedNonNullRedisCallback();
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class)
|
||||
.isThrownBy(super::testExecutePipelinedNonNullRedisCallback);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -88,10 +91,11 @@ public class RedisClusterTemplateTests<K, V> extends RedisTemplateTests<K, V> {
|
||||
super.testExec();
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test
|
||||
@Ignore("Pipeline not supported in cluster mode")
|
||||
public void testExecutePipelinedNonNullSessionCallback() {
|
||||
super.testExecutePipelinedNonNullSessionCallback();
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class)
|
||||
.isThrownBy(super::testExecutePipelinedNonNullSessionCallback);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -327,9 +327,10 @@ public class RedisTemplateTests<K, V> {
|
||||
assertThat(person).isEqualTo(((Map) results.get(0)).get(1L));
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test
|
||||
public void testExecutePipelinedNonNullRedisCallback() {
|
||||
redisTemplate.executePipelined((RedisCallback<String>) connection -> "Hey There");
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class)
|
||||
.isThrownBy(() -> redisTemplate.executePipelined((RedisCallback<String>) connection -> "Hey There"));
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@@ -345,15 +346,15 @@ public class RedisTemplateTests<K, V> {
|
||||
operations.opsForList().size(key1);
|
||||
operations.exec();
|
||||
|
||||
try {
|
||||
// Await EXEC completion as it's executed on a dedicated connection.
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) {}
|
||||
operations.opsForValue().set(key1, value1);
|
||||
operations.opsForValue().get(key1);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
try {
|
||||
// Await EXEC completion as it's executed on a dedicated connection.
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) {}
|
||||
operations.opsForValue().set(key1, value1);
|
||||
operations.opsForValue().get(key1);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
// Should contain the List of deserialized exec results and the result of the last call to get()
|
||||
assertThat(pipelinedResults).usingElementComparator(CollectionAwareComparator.INSTANCE)
|
||||
.containsExactly(Arrays.asList(1L, value1, 0L), true, value1);
|
||||
@@ -379,14 +380,15 @@ public class RedisTemplateTests<K, V> {
|
||||
assertThat(pipelinedResults).isEqualTo(Arrays.asList(Arrays.asList(1L, 5L, 0L), true, 2L));
|
||||
}
|
||||
|
||||
@Test(expected = InvalidDataAccessApiUsageException.class)
|
||||
@Test
|
||||
public void testExecutePipelinedNonNullSessionCallback() {
|
||||
redisTemplate.executePipelined(new SessionCallback<String>() {
|
||||
@SuppressWarnings("rawtypes")
|
||||
public String execute(RedisOperations operations) throws DataAccessException {
|
||||
return "Whatup";
|
||||
}
|
||||
});
|
||||
assertThatExceptionOfType(InvalidDataAccessApiUsageException.class)
|
||||
.isThrownBy(() -> redisTemplate.executePipelined(new SessionCallback<String>() {
|
||||
@SuppressWarnings("rawtypes")
|
||||
public String execute(RedisOperations operations) throws DataAccessException {
|
||||
return "Whatup";
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-688
|
||||
@@ -574,16 +576,16 @@ public class RedisTemplateTests<K, V> {
|
||||
K key = keyFactory.instance();
|
||||
List<Object> result = redisTemplate.executePipelined(new SessionCallback<Object>() {
|
||||
|
||||
@Override
|
||||
public Object execute(RedisOperations operations) throws DataAccessException {
|
||||
@Override
|
||||
public Object execute(RedisOperations operations) throws DataAccessException {
|
||||
|
||||
operations.boundValueOps(key).set(valueFactory.instance());
|
||||
operations.expire(key, 1, TimeUnit.DAYS);
|
||||
operations.getExpire(key, TimeUnit.HOURS);
|
||||
operations.boundValueOps(key).set(valueFactory.instance());
|
||||
operations.expire(key, 1, TimeUnit.DAYS);
|
||||
operations.getExpire(key, TimeUnit.HOURS);
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
assertThat(result).hasSize(3);
|
||||
assertThat(((Long) result.get(2))).isGreaterThanOrEqualTo(23L);
|
||||
|
||||
@@ -47,9 +47,9 @@ public class ScanCursorUnitTests {
|
||||
assertThat(cursor.hasNext()).isFalse();
|
||||
}
|
||||
|
||||
@Test(expected = NoSuchElementException.class) // DATAREDIS-290
|
||||
@Test // DATAREDIS-290
|
||||
public void cursorShouldReturnNullWhenNoNextElementAvailable() {
|
||||
initCursor(new LinkedList<>()).next();
|
||||
assertThatExceptionOfType(NoSuchElementException.class).isThrownBy(() -> initCursor(new LinkedList<>()).next());
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-290
|
||||
|
||||
@@ -38,14 +38,15 @@ public class CompositeIndexResolverUnitTests {
|
||||
@Mock IndexResolver resolver2;
|
||||
@Mock TypeInformation<?> typeInfoMock;
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-425
|
||||
@Test // DATAREDIS-425
|
||||
public void shouldRejectNull() {
|
||||
new CompositeIndexResolver(null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> new CompositeIndexResolver(null));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-425
|
||||
@Test // DATAREDIS-425
|
||||
public void shouldRejectCollectionWithNullValues() {
|
||||
new CompositeIndexResolver(Arrays.asList(resolver1, null, resolver2));
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> new CompositeIndexResolver(Arrays.asList(resolver1, null, resolver2)));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-425
|
||||
|
||||
@@ -66,9 +66,9 @@ public class PathIndexResolverUnitTests {
|
||||
new RedisMappingContext(new MappingConfiguration(indexConfig, new KeyspaceConfiguration())));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-425
|
||||
@Test // DATAREDIS-425
|
||||
public void shouldThrowExceptionOnNullMappingContext() {
|
||||
new PathIndexResolver(null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> new PathIndexResolver(null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-425
|
||||
|
||||
@@ -77,9 +77,9 @@ public class SpelIndexResolverUnitTests {
|
||||
new SpelIndexResolver(mappingContext);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-425
|
||||
@Test // DATAREDIS-425
|
||||
public void constructorNullSpelExpressionParser() {
|
||||
new SpelIndexResolver(mappingContext, null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> new SpelIndexResolver(mappingContext, null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-425
|
||||
|
||||
@@ -38,9 +38,9 @@ public class ConfigAwareKeySpaceResolverUnitTests {
|
||||
this.resolver = new ConfigAwareKeySpaceResolver(config);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-425
|
||||
@Test // DATAREDIS-425
|
||||
public void resolveShouldThrowExceptionWhenTypeIsNull() {
|
||||
resolver.resolveKeySpace(null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> resolver.resolveKeySpace(null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-425
|
||||
|
||||
@@ -42,9 +42,9 @@ public class ConfigAwareTimeToLiveAccessorUnitTests {
|
||||
accessor = new ConfigAwareTimeToLiveAccessor(config, new RedisMappingContext());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-425
|
||||
@Test // DATAREDIS-425
|
||||
public void getTimeToLiveShouldThrowExceptionWhenSourceObjectIsNull() {
|
||||
accessor.getTimeToLive(null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> accessor.getTimeToLive(null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-425
|
||||
|
||||
@@ -43,14 +43,14 @@ public class RedisClientInfoUnitTests {
|
||||
assertValues(info, VALUES);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test
|
||||
public void testGetRequiresNonNullKey() {
|
||||
info.get((String) null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> info.get((String) null));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test
|
||||
public void testGetRequiresNonBlankKey() {
|
||||
info.get("");
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> info.get(""));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.BlockingDeque;
|
||||
import java.util.concurrent.LinkedBlockingDeque;
|
||||
import java.util.concurrent.Phaser;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.junit.After;
|
||||
@@ -78,16 +79,27 @@ public class PubSubTests<T> {
|
||||
adapter.setSerializer(template.getValueSerializer());
|
||||
adapter.afterPropertiesSet();
|
||||
|
||||
Phaser phaser = new Phaser(1);
|
||||
|
||||
container = new RedisMessageListenerContainer();
|
||||
container.setConnectionFactory(template.getConnectionFactory());
|
||||
container.setBeanName("container");
|
||||
container.addMessageListener(adapter, Arrays.asList(new ChannelTopic(CHANNEL)));
|
||||
container.setTaskExecutor(new SyncTaskExecutor());
|
||||
container.setSubscriptionExecutor(new SimpleAsyncTaskExecutor());
|
||||
container.setSubscriptionExecutor(new SimpleAsyncTaskExecutor() {
|
||||
@Override
|
||||
protected void doExecute(Runnable task) {
|
||||
super.doExecute(() -> {
|
||||
phaser.arriveAndDeregister();
|
||||
task.run();
|
||||
});
|
||||
}
|
||||
});
|
||||
container.afterPropertiesSet();
|
||||
container.start();
|
||||
|
||||
Thread.sleep(1000);
|
||||
phaser.arriveAndAwaitAdvance();
|
||||
Thread.sleep(50);
|
||||
}
|
||||
|
||||
@After
|
||||
@@ -144,8 +156,9 @@ public class PubSubTests<T> {
|
||||
template.convertAndSend(CHANNEL, getT());
|
||||
}
|
||||
|
||||
Thread.sleep(1000);
|
||||
assertThat(bag.size()).isEqualTo(COUNT);
|
||||
for (int i = 0; i < COUNT; i++) {
|
||||
assertThat(bag.poll(1, TimeUnit.SECONDS)).as("message #" + i).isNotNull();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -157,7 +170,7 @@ public class PubSubTests<T> {
|
||||
template.convertAndSend(CHANNEL, payload1);
|
||||
template.convertAndSend(CHANNEL, payload2);
|
||||
|
||||
assertThat(bag.poll(1, TimeUnit.SECONDS)).isNull();
|
||||
assertThat(bag.poll(200, TimeUnit.MILLISECONDS)).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
package org.springframework.data.redis.mapping;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.data.redis.hash.BeanUtilsHashMapper;
|
||||
|
||||
/**
|
||||
@@ -28,9 +31,9 @@ public class BeanUtilsHashMapperTest extends AbstractHashMapperTest {
|
||||
return new BeanUtilsHashMapper<>(t);
|
||||
}
|
||||
|
||||
@Test(expected = Exception.class)
|
||||
@Test
|
||||
public void testNestedBean() {
|
||||
super.testNestedBean();
|
||||
assertThatExceptionOfType(Exception.class).isThrownBy(super::testNestedBean);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -65,9 +65,9 @@ public class Jackson2JsonRedisSerializerTests {
|
||||
serializer.deserialize(serializedValue);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DTATREDIS-241
|
||||
@Test // DTATREDIS-241
|
||||
public void testJackson2JsonSerilizerThrowsExceptionWhenSettingNullObjectMapper() {
|
||||
serializer.setObjectMapper(null);
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> serializer.setObjectMapper(null));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,44 +29,44 @@ import org.junit.Test;
|
||||
*/
|
||||
public class RedisSerializationContextUnitTests {
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-602
|
||||
@Test // DATAREDIS-602
|
||||
public void shouldRejectBuildIfKeySerializerIsNotSet() {
|
||||
|
||||
RedisSerializationContext.<String, String> newSerializationContext() //
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> RedisSerializationContext.<String, String> newSerializationContext() //
|
||||
.value(StringRedisSerializer.UTF_8) //
|
||||
.hashKey(StringRedisSerializer.UTF_8) //
|
||||
.hashValue(StringRedisSerializer.UTF_8) //
|
||||
.build();
|
||||
.build());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-602
|
||||
@Test // DATAREDIS-602
|
||||
public void shouldRejectBuildIfValueSerializerIsNotSet() {
|
||||
|
||||
RedisSerializationContext.<String, String> newSerializationContext() //
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> RedisSerializationContext.<String, String> newSerializationContext() //
|
||||
.key(StringRedisSerializer.UTF_8) //
|
||||
.hashKey(StringRedisSerializer.UTF_8) //
|
||||
.hashValue(StringRedisSerializer.UTF_8) //
|
||||
.build();
|
||||
.build());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-602
|
||||
@Test // DATAREDIS-602
|
||||
public void shouldRejectBuildIfHashKeySerializerIsNotSet() {
|
||||
|
||||
RedisSerializationContext.<String, String> newSerializationContext() //
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> RedisSerializationContext.<String, String> newSerializationContext() //
|
||||
.key(StringRedisSerializer.UTF_8) //
|
||||
.value(StringRedisSerializer.UTF_8) //
|
||||
.hashValue(StringRedisSerializer.UTF_8) //
|
||||
.build();
|
||||
.build());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class) // DATAREDIS-602
|
||||
@Test // DATAREDIS-602
|
||||
public void shouldRejectBuildIfHashValueSerializerIsNotSet() {
|
||||
|
||||
RedisSerializationContext.<String, String> newSerializationContext() //
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> RedisSerializationContext.<String, String> newSerializationContext() //
|
||||
.key(StringRedisSerializer.UTF_8) //
|
||||
.value(StringRedisSerializer.UTF_8) //
|
||||
.hashKey(StringRedisSerializer.UTF_8) //
|
||||
.build();
|
||||
.build());
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-602
|
||||
|
||||
@@ -431,9 +431,9 @@ public abstract class AbstractRedisMapTests<K, V> {
|
||||
assertThat(map.get(k1)).isNull();
|
||||
}
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
@Test
|
||||
public void testRemoveNullValue() {
|
||||
map.remove(getKey(), null);
|
||||
assertThatExceptionOfType(NullPointerException.class).isThrownBy(() -> map.remove(getKey(), null));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -453,14 +453,14 @@ public abstract class AbstractRedisMapTests<K, V> {
|
||||
assertThat(map.get(k1)).isEqualTo(v2);
|
||||
}
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
@Test
|
||||
public void testReplaceNullOldValue() {
|
||||
map.replace(getKey(), null, getValue());
|
||||
assertThatExceptionOfType(NullPointerException.class).isThrownBy(() -> map.replace(getKey(), null, getValue()));
|
||||
}
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
@Test
|
||||
public void testReplaceNullNewValue() {
|
||||
map.replace(getKey(), getValue(), null);
|
||||
assertThatExceptionOfType(NullPointerException.class).isThrownBy(() -> map.replace(getKey(), getValue(), null));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -477,9 +477,9 @@ public abstract class AbstractRedisMapTests<K, V> {
|
||||
assertThat(map.get(k1)).isEqualTo(v2);
|
||||
}
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
@Test
|
||||
public void testReplaceNullValue() {
|
||||
map.replace(getKey(), null);
|
||||
assertThatExceptionOfType(NullPointerException.class).isThrownBy(() -> map.replace(getKey(), null));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-314
|
||||
|
||||
@@ -132,9 +132,9 @@ public abstract class AbstractRedisZSetTest<T> extends AbstractRedisCollectionTe
|
||||
assertThat(zSet.first()).isEqualTo(t1);
|
||||
}
|
||||
|
||||
@Test(expected = NoSuchElementException.class)
|
||||
public void testFirstException() throws Exception {
|
||||
zSet.first();
|
||||
@Test
|
||||
public void testFirstException() {
|
||||
assertThatExceptionOfType(NoSuchElementException.class).isThrownBy(() -> zSet.first());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -151,9 +151,9 @@ public abstract class AbstractRedisZSetTest<T> extends AbstractRedisCollectionTe
|
||||
assertThat(zSet.last()).isEqualTo(t3);
|
||||
}
|
||||
|
||||
@Test(expected = NoSuchElementException.class)
|
||||
public void testLastException() throws Exception {
|
||||
zSet.last();
|
||||
@Test
|
||||
public void testLastException() {
|
||||
assertThatExceptionOfType(NoSuchElementException.class).isThrownBy(() -> zSet.last());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.springframework.data.redis.support.collections;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
@@ -220,10 +219,10 @@ public class RedisPropertiesTests extends RedisMapTests {
|
||||
assertThat(keys.contains(key3)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
@Test(expected = UnsupportedOperationException.class)
|
||||
public void testScanWorksCorrectly() throws IOException {
|
||||
super.testScanWorksCorrectly();
|
||||
public void testScanWorksCorrectly() {
|
||||
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> super.testScanWorksCorrectly());
|
||||
}
|
||||
|
||||
// DATAREDIS-241
|
||||
@@ -296,15 +295,15 @@ public class RedisPropertiesTests extends RedisMapTests {
|
||||
{ stringFactory, stringFactory, xstreamGenericTemplate }, //
|
||||
{ stringFactory, stringFactory, jackson2JsonPersonTemplate }, //
|
||||
|
||||
// lettuce
|
||||
{ stringFactory, stringFactory, genericTemplateLtc }, //
|
||||
{ stringFactory, stringFactory, genericTemplateLtc }, //
|
||||
{ stringFactory, stringFactory, genericTemplateLtc }, //
|
||||
{ stringFactory, stringFactory, genericTemplateLtc }, //
|
||||
{ stringFactory, doubleFactory, genericTemplateLtc }, //
|
||||
{ stringFactory, longFactory, genericTemplateLtc }, //
|
||||
{ stringFactory, stringFactory, xGenericTemplateLtc }, //
|
||||
{ stringFactory, stringFactory, jackson2JsonPersonTemplateLtc } });
|
||||
// lettuce
|
||||
{ stringFactory, stringFactory, genericTemplateLtc }, //
|
||||
{ stringFactory, stringFactory, genericTemplateLtc }, //
|
||||
{ stringFactory, stringFactory, genericTemplateLtc }, //
|
||||
{ stringFactory, stringFactory, genericTemplateLtc }, //
|
||||
{ stringFactory, doubleFactory, genericTemplateLtc }, //
|
||||
{ stringFactory, longFactory, genericTemplateLtc }, //
|
||||
{ stringFactory, stringFactory, xGenericTemplateLtc }, //
|
||||
{ stringFactory, stringFactory, jackson2JsonPersonTemplateLtc } });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user