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