|
49 | 49 | import org.springframework.data.redis.connection.DataType;
|
50 | 50 | import org.springframework.data.redis.connection.RedisConnection;
|
51 | 51 | import org.springframework.data.redis.connection.StringRedisConnection;
|
| 52 | +import org.springframework.data.redis.connection.jedis.JedisClusterConnection; |
52 | 53 | import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
53 | 54 | import org.springframework.data.redis.connection.jredis.JredisConnectionFactory;
|
54 | 55 | import org.springframework.data.redis.connection.srp.SrpConnectionFactory;
|
@@ -305,6 +306,22 @@ public Object doInRedis(RedisConnection connection) throws DataAccessException {
|
305 | 306 | assertEquals(Arrays.asList(new Object[] { 5l, 1l, 2l, Arrays.asList(new Long[] { 10l, 11l }) }), results);
|
306 | 307 | }
|
307 | 308 |
|
| 309 | + @Test |
| 310 | + public void testExecutePipelinedWidthDifferentHashKeySerializerAndHashValueSerializer() { |
| 311 | + assumeTrue(redisTemplate instanceof StringRedisTemplate); |
| 312 | + redisTemplate.setKeySerializer(new StringRedisSerializer()); |
| 313 | + redisTemplate.setHashKeySerializer(new StringRedisSerializer()); |
| 314 | + redisTemplate.setHashValueSerializer(new GenericToStringSerializer<Long>(Long.class)); |
| 315 | + redisTemplate.opsForHash().put((K) "foo", "key", 1L); |
| 316 | + List<Object> results = redisTemplate.executePipelined(new RedisCallback() { |
| 317 | + public Object doInRedis(RedisConnection connection) throws DataAccessException { |
| 318 | + connection.hGetAll(((StringRedisSerializer) redisTemplate.getKeySerializer()).serialize("foo")); |
| 319 | + return null; |
| 320 | + } |
| 321 | + }); |
| 322 | + assertEquals(((Map) results.get(0)).get("key"), 1L); |
| 323 | + } |
| 324 | + |
308 | 325 | @Test(expected = InvalidDataAccessApiUsageException.class)
|
309 | 326 | public void testExecutePipelinedNonNullRedisCallback() {
|
310 | 327 | redisTemplate.executePipelined(new RedisCallback<String>() {
|
|
0 commit comments