Commit Graph

213 Commits

Author SHA1 Message Date
Christoph Strobl
4b2ccbecb9 DATAREDIS-271 - Add support for 'pSetEx'.
Support for 'pSetEx' has been added for 'jedis' & 'srp'.
For 'lettuce' the command is emulated using 'eval'.

There is no support for 'pSetEx' when using 'jredis'.

'DefaultValueOperations.set' used with 'TimeUnit.MILLISECONDS' will fallback to 'setEx' in case 'pSetEx' is not supported by the driver in use.

Original pull request: #46.
2014-03-20 12:36:09 +01:00
Christoph Strobl
a3ac8d0899 DATAREDIS-285 - LettuceConnection.execute should fully read response.
'LettuceConnection' used 'ByteArrayOutput' as default for execute which did not fully read all values that might be included in the response.

To overcome this issue 'TypeHints' have been added which map a given 'CommandType' to the most recent 'CommandOutput'.  As not all commands could be mapped that way due to the result depending on input parameters in some cases, it might be required to manually provide the type hint when calling execute.

Additional tests have been added to assert 'execute' works properly for 'jedis', 'jredis' and 'srp'.

Original Pull Request: #49
2014-03-19 11:26:19 +01:00
Thomas Darimont
9cf484d25a DATAREDIS-283 - RedisCacheManager.loadCaches overrides already defined cache names in afterPropertiesSet().
We now retain the potentially already configured caches during the initialisation of the RedisCacheManager bean. Previously we discarded the already configured caches which was an undesired side-effect.

Original pull request: #45.
2014-03-13 06:33:37 +01:00
Thomas Darimont
0f8c68c251 DATAREDIS-282 - PubSubResubscribeTests should use jedis without pool.
Disabled jedis pooling in PubSubResubscribeTests since all the other tests also don't use a pool.

Original pull request #43.
2014-03-03 14:36:06 +01:00
Christoph Strobl
e003ef6ca3 DATAREDIS-206 - Add support for TIME operation.
Enhanced RedisServerCommands to reflect time operation and added empty implementation to recent RedisConnection abstractions.
Added implementation of time() for Srp, Jedis, Lettuce (emulated via eval).
Added UnsupportedOperation of time() JRedis since it doesn't support time command or sending scripts or sending raw commands via the underlying connection.
Added implementation for DefaultStringRedisConnection to delegate time() operation to native connection.
Added integration test to abstract base class. Ignored the test for those connections not supporting time command.

Original pull request: #34
2014-02-18 10:14:46 +01:00
Christoph Strobl
82578066e8 DATAREDIS-246 - RedisCacheManager.getCache() does not match the logical of CompositeCacheManager.
By default RedisCacheManager lazily initializes RedisCaches when requested. To put it into static mode a defined set of cache names has to be passed to the CacheManager.

We changed the implementation so it  makes use of AbstractTransactionalCache introduced in Spring 3.2 which properly registers caches. Additionally the loadRemoteCachesOnStartup switch allows to retrieve and initialize existing caches by loading keys form redis server.

Further on RedisCacheManager can be set in transaction aware mode so that values are only put into cache after successful commit of surrounding transaction.

Original pull request: #33
2014-02-17 13:39:18 +01:00
Christoph Strobl
5466a70034 DATAREDIS-260 - Upgrade to jedis 2.3.1.
Jedis upgraded from commons-pool to commons-pool2. Required changes have been introduced. Currently there are both commons-pool and commons-pool2 in class-path which is no problem as those dependencies are optional.

Original pull request: #31
2014-02-06 18:26:05 +01:00
Christoph Strobl
dea6403c24 DATAREDIS-166 - Corrupted i/o streams subscribing to both patterns and channels.
The issue has already been fixed in DATAREDIS-242 (see PR: #25), which now allows to reenable the previously failing test.
Additionally the tests now run against all supported client libraries except JRedis which does not support 'publish'.

Original pull request: #30
2014-02-06 09:54:24 +01:00
Christoph Strobl
d4c5990831 DATAREDIS-170 - Cancel SubscriptionTask can leave connection open.
RedisMessageListenerContainer did not properly close connections if the subscription was canceled immediately after staring the container. Since DARAREDIS-242 the container waits for the subscription to complete and therefor no more connections remain open.

Additionally added missing parameters to run tests with JRedis.

Original pull request: #29
2014-02-05 18:22:27 +01:00
Thomas Darimont
eaf249af90 DATAREDIS-188 - Infinite loop renaming a non-existent Collection when using Lettuce.
We run into an infinite loop in org.springframework.data.redis.support.collections.CollectionUtils.rename(K, K, RedisOperations<K, ?>) if no value was associated with the key which leads to operations.hasKey(...) always returning false which prevents the actual renaming. RedisCollections will only send rename command if values are present as empty collections cannot be stored and therefor cannot be renamed.

Original pull request: #28
2014-02-05 09:50:32 +01:00
Christoph Strobl
e0524379d6 DATAREDIS-254 - Clean up codebase to match spring-data conventions
format code with spring data formatter
2014-01-28 10:55:00 +01:00
Thomas Darimont
b5adde7430 DATAREDIS-242 - Listener Container start() Returns Before Container is Really Started.
We now wait for the subscription to be present in the connection in case of async connections by periodically checking whether the subscription is available in 100ms intervals. The max time to wait for the async subscription can be configured and is set to 2 seconds by default.

Moved SpinBarrier and TestCondition from test packages as static inner classes into RedisMessageListenerContainer. Included ConnectionUtils from tests into official API.
2014-01-20 14:23:18 +01:00
Thomas Darimont
c6d2d7f9c9 DATAREDIS-241 - Add a Jackson2 based RedisSerializer.
Introduced Jackson2JsonRedisSerializer and added optional dependency for Jackson2 core/databind (fasterxml) library.
Added additional parameterised test cases. Needed to increase the max active connections limit for the connection pools used in RedisMapTests.
2014-01-17 12:04:05 +01:00
Jennifer Hickey
e1b421f942 DATAREDIS-237 - Upgrade to Jedis 2.2.1.
Update to Jedis 2.2.1 and Implement newly supported Operations.
Handle removed BinaryTransaction class.
Handle some Jedis return types changed from String to bytes.
Handle some Jedis arg types changed from int to long by removing casting.
Remove ignored tests for issues fixed in Jedis 2.2.1
Throw UnsupportedOpException on multi-arg bitOp NOT
Ensure consistent results across all drivers when bitOp is called with NOT and more than one arg.
2014-01-16 14:34:02 +01:00
Thomas Darimont
2870df0cdc DATAREDIS-251 - Fix tests to work against Redis 2.8.x.
Since Redis 2.8.x keyOps#getExpire() returns -2 for empty collections (RedisList/RedisSet/RedisMap). 
We're now adding a dummy entry to keep the test version agnostic. Previously getExpire() returned -1.
We also have to set the RedisAtomic(Integer|Long) to a value other than 0 to get  the value stored appropriately.

For reference see the discussion in http://redis.io/commands/ttl
2014-01-16 13:43:36 +01:00
Thomas Darimont
168713aae1 DATAREDIS-253 - Avoid usage of deprecated API.
Changed usage of TypeFactory to the recommended API.
2014-01-16 10:39:52 +01:00
Thomas Darimont
b5137e6dd4 DATAREDIS-245 - Prevent Excessive Thread creation in tests.
Rewritten testPubSubWithPatterns in order to make it pass reliably by keeping the original test semantics.
2014-01-16 09:31:17 +01:00
Thomas Darimont
2af23692f3 DATAREDIS-251 - Fix tests to work against Redis 2.8.x.
Since Redis 2.8.x keyOps#getExpire() now returns -2 for empty collections (RedisList/RedisSet/RedisMap) we add a dummy entry to keep the test version agnostic. Previously getExpire() returned -1.

For reference see the discussion in http://redis.io/commands/ttl
2014-01-15 19:36:22 +01:00
Thomas Darimont
2c9e34330b DATAREDIS-245 - Prevent Excessive Thread creation in tests.
Rewritten testPubSubWithNamedChannels in order to make it pass reliably by keeping the original test semantics.
2014-01-15 19:22:25 +01:00
Thomas Darimont
14bf8f13b1 DATAREDIS-243 - Ensure compatibility with Spring Framework 4.0.
Updated dependency of XStream since Spring framework 4.0 requires a newer version.
Spring 4 added another method to get cached object to the Cache interface. The method has been added to RedisCache in order to provide compatibility, while calling get internally and casting values to required type.
2014-01-15 10:45:37 +01:00
Thomas Darimont
44584b235d DATAREDIS-245 - Prevent Excessive Thread creation in tests.
Due to some missing cleanup procedures excessive thread creation lead to JVM crashes during a full test run on some machines.
Improved test harness in order to properly shutdown unused threads.

Added idea artefacts to .gitignore.
2014-01-15 10:38:32 +01:00
Thomas Darimont
e21c81c746 DATAREDIS-247 - locale independent test execution.
Original pull request #17.
2014-01-13 17:24:11 +01:00
Jennifer Hickey
5d00542741 Revert "Temp revert "Lazily instantiate shared Lettuce connection""
This reverts commit c6a2a4f7da.
2013-08-21 12:38:02 -07:00
Jennifer Hickey
b106f03bd7 Do not return Jedis conns to pool after NPE
DATAREDIS-153

- Return conn to pool as broken resource if NPE
occurs (for example if a null key or value is given),
preventing later flush of OutputStream with incomplete
data

- Workaround Jedis issue in pub/sub tests that prevents
subscribing with a pooled connection

- Continue not using pool in conn tests, as they
are too brittle with potentially unclosed pipelines,
unexecuted txs, etc
2013-08-21 12:30:42 -07:00
Jennifer Hickey
e1f54d6c68 Implement RedisMap concurrent remove and replace
DATAREDIS-37
2013-08-20 16:57:49 -07:00
Jennifer Hickey
c6a2a4f7da Temp revert "Lazily instantiate shared Lettuce connection"
This reverts commit f9cdad751c.
2013-08-19 12:34:49 -07:00
Jennifer Hickey
e94fa9a35a Throw translated Exception on SRP conn failure
DATAREDIS-234
2013-08-16 15:21:25 -07:00
Jennifer Hickey
6290cbad06 Add password to SrpConnectionFactory
DATAREDIS-203
2013-08-16 15:15:33 -07:00
Jennifer Hickey
f9cdad751c Lazily instantiate shared Lettuce connection
Allow app context to start if Redis is down

DATAREDIS-209
2013-08-16 14:20:30 -07:00
Jennifer Hickey
500a94d83d Reduce test execution time when runLongTests not set 2013-08-16 13:37:29 -07:00
Jennifer Hickey
aa46fdf0a6 Make RedisTemplate use millisecond precision
DATAREDIS-195

- Make expire and expireAt use pExpire and pExpireAt,
falling back to expire and expireAt if not available
(driver does not support or using Redis 2.4)

- Add new getExpire method that will return mills
if requested, using pTTL if supported
2013-08-16 13:14:08 -07:00
Jennifer Hickey
ac851c816b Fix MessageListenerAdapter sending msg instead of body
when no Serializer is specified

DATAREDIS-233
2013-08-15 13:13:41 -07:00
Jennifer Hickey
4b3ff6582c Fix ambiguous constructors in DefaultRedisScript
Can't specify a resource location for script as a
String in Spring app context, as it would get
injected as script text instead. Switched to property
injection for clarity.
2013-08-05 10:54:36 -07:00
Jennifer Hickey
a28a4f1412 Add RedisAtomicDouble
DATAREDIS-198
2013-08-04 18:27:27 -07:00
Jennifer Hickey
7d387ab529 Add RedisTemplate methods for executing Redis scripts
DATAREDIS-199
2013-08-04 16:43:00 -07:00
Jennifer Hickey
faa78cdfaa Fix Lettuce eval suppressing Exceptions in List return
DATAREDIS-232
2013-08-04 16:37:26 -07:00
Jennifer Hickey
c318f24c13 Support zRem with multiple values
DATAREDIS-99
2013-08-01 18:32:15 -07:00
Jennifer Hickey
44460dfdee Support zAdd with multiple values
DATAREDIS-99
2013-08-01 18:32:15 -07:00
Jennifer Hickey
628cc175bc Verify order of elements in LinkedHashSets 2013-08-01 18:32:14 -07:00
Jennifer Hickey
4020f9d97d Support sRem with multiple values
DATAREDIS-99
2013-08-01 18:32:14 -07:00
Jennifer Hickey
d4377b4d17 Support sAdd with multiple values
DATAREDIS-99
2013-08-01 18:32:14 -07:00
Jennifer Hickey
6ad3bcf688 Ignore intermittently failing test until fixed
Should be fixed in DATAREDIS-108
2013-08-01 18:32:13 -07:00
Jennifer Hickey
dae047f9c5 Support rPush with multiple values
DATAREDIS-99
2013-08-01 18:32:13 -07:00
Jennifer Hickey
36780d14a1 Support lPush with multiple values
DATAREDIS-99
2013-08-01 18:32:13 -07:00
Jennifer Hickey
8f362b481c Support hDel with multiple hash keys
DATAREDIS-99
2013-08-01 18:32:13 -07:00
Jennifer Hickey
ce76ad1841 Make Long and Double test factories return unique vals
Random was returning the same value multiple times,
causing issues with Set tests
2013-08-01 18:32:12 -07:00
Jennifer Hickey
28c8dca650 Fix failing test 2013-07-31 13:25:26 -07:00
Jennifer Hickey
5aad4378f5 Fix test failures 2013-07-31 13:11:24 -07:00
Jennifer Hickey
04eee8c0c8 Add tests of RedisTemplate with binary key/values
DATAREDIS-227
2013-07-31 09:18:55 -07:00
Jennifer Hickey
c1cda95baa Allow usage of RedisTemplate without serialization
DATAREDIS-227

Add "enableDefaultSerializer" property on
RedisTemplate. If false, serializers can be null
and no serialization will be performed if they are.
2013-07-30 18:31:27 -07:00