diff --git a/build.gradle b/build.gradle index 14b6938b1..7baab7a62 100644 --- a/build.gradle +++ b/build.gradle @@ -45,7 +45,6 @@ dependencies { compile "redis.clients:jedis:$jedisVersion" compile("com.github.spullara.redis:client:$srpVersion", optional) compile("org.jredis:jredis-anthonylauzon:$jredisVersion", optional) - compile("org.idevlab:rjc:$rjcVersion", optional) compile("com.lambdaworks:lettuce:$lettuceVersion", optional) // Mappers @@ -80,7 +79,7 @@ javadoc { ] links = [ - "http://static.springframework.org/spring/docs/3.0.x/javadoc-api", + "http://static.springframework.org/spring/docs/3.1.x/javadoc-api", "http://download.oracle.com/javase/6/docs/api", "http://jackson.codehaus.org/1.8.2/javadoc" ] diff --git a/docs/src/reference/docbook/reference/redis-messaging.xml b/docs/src/reference/docbook/reference/redis-messaging.xml index 1ed3a448b..9ee8c48f0 100644 --- a/docs/src/reference/docbook/reference/redis-messaging.xml +++ b/docs/src/reference/docbook/reference/redis-messaging.xml @@ -55,7 +55,7 @@ template.convertAndSend("hello!", "world");]]> whether it is listening or not, RedisConnection provides getSubscription and isSubscribed method. - When using Jedis, JRedis or RJC connectors, subscribing commands are synchronous and thus blocking. That is, calling subscribe on a connection will cause + When using Jedis or JRedis connectors, subscribing commands are synchronous and thus blocking. That is, calling subscribe on a connection will cause the current thread to block as it will start waiting for messages - the thread will be released only if the subscription is canceled, that is an additional thread invokes unsubscribe or pUnsubscribe on the same connection. See message listener container below diff --git a/docs/src/reference/docbook/reference/redis.xml b/docs/src/reference/docbook/reference/redis.xml index f9f7554d9..e250815bb 100644 --- a/docs/src/reference/docbook/reference/redis.xml +++ b/docs/src/reference/docbook/reference/redis.xml @@ -18,9 +18,9 @@ Redis Requirements Spring Redis requires Redis 2.2 or above and Java SE 6.0 or above . In terms of language bindings (or connectors), Spring Redis integrates with Jedis, - JRedis, RJC, + JRedis, SRP and - Lettuce, five popular open source Java libraries for Redis. + Lettuce, four popular open source Java libraries for Redis. If you are aware of any other connector that we should be integrating with, please send us feedback. @@ -145,36 +145,6 @@ This issue is currently being addressed in the JRedis project and once fixed, will be incorporated by Spring Data Redis. - - -
- Configuring RJC connector - - RJC is the third, open-source connector supported by Spring Data Redis through the - org.springframework.data.redis.connection.rjc package. - - Similar to the other connectors, a typical RJC configuration can look like this: - - - - - -]]> - - As one can note, the configuration is quite similar to the Jredis or Jedis one. - - Currently, RJC does not have support for binary keys. This forces the RjcConnection to perform encoding internally - (through base64 schema). In practice, this means it's safe to read/write arbitrary data however - the Redis key stored values will differ from the decoded ones, even in the simplest cases, since everything (no matter the format) is encoded. This will not be - the case for Redis values. - This issue is currently being addressed in the RJC project and once fixed, will be incorporated by Spring Data Redis. - -
diff --git a/gradle.properties b/gradle.properties index 45d8cb8a9..e2db81a9f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,3 @@ -rjcVersion=0.6.4 slf4jVersion=1.6.6 junitVersion=4.8.1 jredisVersion=03122010 diff --git a/src/main/java/org/springframework/data/redis/connection/rjc/CloseSuppressingRjcConnection.java b/src/main/java/org/springframework/data/redis/connection/rjc/CloseSuppressingRjcConnection.java deleted file mode 100644 index fce692b72..000000000 --- a/src/main/java/org/springframework/data/redis/connection/rjc/CloseSuppressingRjcConnection.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2011-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.data.redis.connection.rjc; - -import java.io.IOException; -import java.net.UnknownHostException; -import java.util.List; - -import org.idevlab.rjc.ds.RedisConnection; -import org.idevlab.rjc.message.RedisNodeSubscriber; -import org.idevlab.rjc.protocol.Protocol.Command; - -/** - * Basic decorator suppressing close() calls to the underlying connection. - * Used for reusing arbitrary connections with {@link RedisNodeSubscriber} without - * resorting to connection pooling. - * - * @author Costin Leau - */ -class CloseSuppressingRjcConnection implements RedisConnection { - - private final RedisConnection delegate; - - /** - * Constructs a new CloseSuppressingRjcConnection instance. - * - * @param delegate - */ - CloseSuppressingRjcConnection(RedisConnection delegate) { - this.delegate = delegate; - } - - public void close() { - // no-op - } - - public void connect() throws UnknownHostException, IOException { - delegate.connect(); - } - - public List getAll() { - return delegate.getAll(); - } - - public String getBulkReply() { - return delegate.getBulkReply(); - } - - public String getHost() { - return delegate.getHost(); - } - - public Long getIntegerReply() { - return delegate.getIntegerReply(); - } - - public List getMultiBulkReply() { - return delegate.getMultiBulkReply(); - } - - public List getObjectMultiBulkReply() { - return delegate.getObjectMultiBulkReply(); - } - - public Object getOne() { - return delegate.getOne(); - } - - public int getPort() { - return delegate.getPort(); - } - - public String getStatusCodeReply() { - return delegate.getStatusCodeReply(); - } - - public int getTimeout() { - return delegate.getTimeout(); - } - - public boolean isConnected() { - return delegate.isConnected(); - } - - public void rollbackTimeout() { - delegate.rollbackTimeout(); - } - - public void sendCommand(Command arg0, byte[]... arg1) { - delegate.sendCommand(arg0, arg1); - } - - public void sendCommand(Command arg0, String... arg1) { - delegate.sendCommand(arg0, arg1); - } - - public void sendCommand(Command arg0) { - delegate.sendCommand(arg0); - } - - public void setTimeoutInfinite() { - delegate.setTimeoutInfinite(); - } -} \ No newline at end of file diff --git a/src/main/java/org/springframework/data/redis/connection/rjc/RjcConnection.java b/src/main/java/org/springframework/data/redis/connection/rjc/RjcConnection.java deleted file mode 100644 index 6cacac2dc..000000000 --- a/src/main/java/org/springframework/data/redis/connection/rjc/RjcConnection.java +++ /dev/null @@ -1,2183 +0,0 @@ -/* - * Copyright 2011-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.data.redis.connection.rjc; - -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.idevlab.rjc.Client; -import org.idevlab.rjc.RedisException; -import org.idevlab.rjc.Session; -import org.idevlab.rjc.SessionFactoryImpl; -import org.idevlab.rjc.SortingParams; -import org.idevlab.rjc.ZParams; -import org.idevlab.rjc.message.RedisNodeSubscriber; -import org.idevlab.rjc.protocol.Protocol.Command; -import org.springframework.dao.DataAccessException; -import org.springframework.data.redis.RedisSystemException; -import org.springframework.data.redis.connection.DataType; -import org.springframework.data.redis.connection.MessageListener; -import org.springframework.data.redis.connection.RedisConnection; -import org.springframework.data.redis.connection.RedisPipelineException; -import org.springframework.data.redis.connection.RedisSubscribedConnectionException; -import org.springframework.data.redis.connection.SortParameters; -import org.springframework.data.redis.connection.Subscription; -import org.springframework.util.Assert; -import org.springframework.util.ObjectUtils; - -/** - * {@code RedisConnection} implementation on top of rjc library. - * - * @author Costin Leau - */ -public class RjcConnection implements RedisConnection { - - private final int dbIndex; - private boolean isClosed = false; - - private final Client client; - private final Session session; - private final org.idevlab.rjc.ds.RedisConnection connection; - private volatile Client pipeline; - - private volatile RjcSubscription subscription; - private volatile RedisNodeSubscriber subscriber; - - /** - * Constructs a new RjcConnection with a {@link RedisNodeSubscriber} that - * re-uses the passed connection. Not recommended for pooled connections, as - * {@link RedisNodeSubscriber} may leave the Reply InputStream in an - * inconsistent state due to extra unsubscribe calls in close() - * - * @param connection - * The connection to use - * @param dbIndex - * The index of the database to use - */ - public RjcConnection(org.idevlab.rjc.ds.RedisConnection connection, int dbIndex) { - this(connection, dbIndex, new RedisNodeSubscriber(new SingleDataSource( - new CloseSuppressingRjcConnection(connection)))); - } - - /** - * Constructs a new RjcConnection with a dedicated - * {@link RedisNodeSubscriber} - * - * @param connection - * The connection to use - * @param dbIndex - * The index of the database to use - * @param subscriber - * The connection to use for subscribe calls - */ - public RjcConnection(org.idevlab.rjc.ds.RedisConnection connection, int dbIndex, - RedisNodeSubscriber subscriber) { - SingleDataSource connectionDataSource = new SingleDataSource(connection); - session = new SessionFactoryImpl(connectionDataSource).create(); - this.subscriber = subscriber; - client = new Client(connection); - this.connection = connection; - - this.dbIndex = dbIndex; - - // select the db - if (dbIndex > 0) { - select(dbIndex); - } - } - - protected DataAccessException convertRjcAccessException(Exception ex) { - if (ex instanceof RedisException) { - return RjcUtils.convertRjcAccessException((RedisException) ex); - } - return new RedisSystemException("Unknown rjc exception", ex); - } - - public Object execute(String command, byte[]... args) { - Assert.hasText(command, "a valid command needs to be specified"); - try { - connection.sendCommand(Command.valueOf(command.trim().toUpperCase()), - (ObjectUtils.isEmpty(args) ? new byte[0][] : args)); - if (!isPipelined()) { - return connection.getAll(); - } - return null; - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - public void close() throws DataAccessException { - isClosed = true; - - // reset the connection (in case a pool is being used) - if (dbIndex > 0) { - select(0); - } - - try { - subscriber.close(); - session.close(); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - - public boolean isClosed() { - return isClosed; - } - - - public Session getNativeConnection() { - return session; - } - - - public boolean isQueueing() { - return client.isInMulti(); - } - - - public boolean isPipelined() { - return (pipeline != null); - } - - - public void openPipeline() { - if (pipeline == null) { - pipeline = client; - } - } - - public List closePipeline() { - if (pipeline != null) { - pipeline = null; - try { - return RjcUtils.maybeConvert(client.getAll()); - } catch (Exception ex) { - throw new RedisPipelineException(convertRjcAccessException(ex)); - } - } - return Collections.emptyList(); - } - - - public List sort(byte[] key, SortParameters params) { - - SortingParams sortParams = RjcUtils.convertSortParams(params); - final String stringKey = RjcUtils.decode(key); - - try { - if (isPipelined()) { - if (sortParams != null) { - pipeline.sort(stringKey, sortParams); - } - else { - pipeline.sort(stringKey); - } - - return null; - } - return RjcUtils.convertToList((sortParams != null ? session.sort(stringKey, sortParams) - : session.sort(stringKey))); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long sort(byte[] key, SortParameters params, byte[] sortKey) { - - SortingParams sortParams = RjcUtils.convertSortParams(params); - final String stringKey = RjcUtils.decode(key); - final String stringSortKey = RjcUtils.decode(sortKey); - - try { - if (isPipelined()) { - if (sortParams != null) { - pipeline.sort(stringKey, sortParams, stringSortKey); - } - else { - pipeline.sort(stringKey, stringSortKey); - } - - return null; - } - return (sortParams != null ? session.sort(stringKey, sortParams, stringSortKey) : session.sort(stringKey, - stringSortKey)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long dbSize() { - try { - if (isPipelined()) { - pipeline.dbSize(); - return null; - } - return session.dbSize(); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - - public void flushDb() { - try { - if (isPipelined()) { - pipeline.flushDB(); - return; - } - session.flushDB(); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public void flushAll() { - try { - if (isPipelined()) { - pipeline.flushAll(); - return; - } - session.flushAll(); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public void bgSave() { - try { - if (isPipelined()) { - pipeline.bgsave(); - return; - } - session.bgsave(); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public void bgWriteAof() { - try { - if (isPipelined()) { - pipeline.bgrewriteaof(); - return; - } - session.bgrewriteaof(); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public void save() { - try { - if (isPipelined()) { - pipeline.save(); - return; - } - session.save(); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public List getConfig(String param) { - try { - if (isPipelined()) { - pipeline.configGet(param); - return null; - } - return session.configGet(param); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Properties info() { - try { - if (isPipelined()) { - pipeline.info(); - return null; - } - return RjcUtils.info(session.info()); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long lastSave() { - try { - if (isPipelined()) { - pipeline.lastsave(); - return null; - } - return session.lastsave(); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public void setConfig(String param, String value) { - try { - if (isPipelined()) { - pipeline.configSet(param, value); - return; - } - session.configSet(param, value); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - - public void resetConfigStats() { - try { - if (isPipelined()) { - pipeline.configResetStat(); - return; - } - client.configResetStat(); - client.getStatusCodeReply(); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public void shutdown() { - try { - if (isPipelined()) { - pipeline.shutdown(); - return; - } - session.shutdown(); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public byte[] echo(byte[] message) { - String stringMsg = RjcUtils.decode(message); - try { - if (isPipelined()) { - pipeline.echo(stringMsg); - return null; - } - return RjcUtils.encode(session.echo(stringMsg)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public String ping() { - try { - if (isPipelined()) { - pipeline.ping(); - return null; - } - return session.ping(); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long del(byte[]... keys) { - String[] stringKeys = RjcUtils.decodeMultiple(keys); - - try { - if (isPipelined()) { - pipeline.del(stringKeys); - return null; - } - return session.del(stringKeys); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public void discard() { - try { - if (isPipelined()) { - pipeline.discard(); - return; - } - - session.discard(); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public List exec() { - try { - if (isPipelined()) { - pipeline.exec(); - return null; - } - return session.exec(); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Boolean exists(byte[] key) { - String stringKey = RjcUtils.decode(key); - - try { - if (isPipelined()) { - pipeline.exists(stringKey); - return null; - } - return session.exists(stringKey); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Boolean expire(byte[] key, long seconds) { - String stringKey = RjcUtils.decode(key); - - try { - if (isPipelined()) { - pipeline.expire(stringKey, (int) seconds); - return null; - } - return session.expire(stringKey, (int) seconds); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Boolean expireAt(byte[] key, long unixTime) { - String stringKey = RjcUtils.decode(key); - - try { - if (isPipelined()) { - pipeline.expireAt(stringKey, unixTime); - return null; - } - return session.expireAt(stringKey, unixTime); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Set keys(byte[] pattern) { - String stringKey = RjcUtils.decode(pattern); - - try { - if (isPipelined()) { - pipeline.keys(stringKey); - return null; - } - return RjcUtils.convertToSet(session.keys(stringKey)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public void multi() { - if (isQueueing()) { - return; - } - try { - if (isPipelined()) { - pipeline.multi(); - return; - } - session.multi(); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Boolean persist(byte[] key) { - String stringKey = RjcUtils.decode(key); - - try { - if (isPipelined()) { - pipeline.persist(stringKey); - return null; - } - return session.persist(stringKey); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Boolean move(byte[] key, int dbIndex) { - String stringKey = RjcUtils.decode(key); - - try { - if (isPipelined()) { - pipeline.move(stringKey, dbIndex); - return null; - } - return session.move(stringKey, dbIndex); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public byte[] randomKey() { - try { - if (isPipelined()) { - pipeline.randomKey(); - return null; - } - return RjcUtils.encode(session.randomKey()); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public void rename(byte[] oldName, byte[] newName) { - String stringOldKey = RjcUtils.decode(oldName); - String stringNewKey = RjcUtils.decode(newName); - - try { - if (isPipelined()) { - pipeline.rename(stringOldKey, stringNewKey); - return; - } - session.rename(stringOldKey, stringNewKey); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Boolean renameNX(byte[] oldName, byte[] newName) { - String stringOldKey = RjcUtils.decode(oldName); - String stringNewKey = RjcUtils.decode(newName); - - try { - if (isPipelined()) { - pipeline.renamenx(stringOldKey, stringNewKey); - return null; - } - return session.renamenx(stringOldKey, stringNewKey); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public void select(int dbIndex) { - try { - if (isPipelined()) { - pipeline.select(dbIndex); - return; - } - session.select(dbIndex); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long ttl(byte[] key) { - String stringKey = RjcUtils.decode(key); - - try { - if (isPipelined()) { - pipeline.ttl(stringKey); - return null; - } - return session.ttl(stringKey); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public DataType type(byte[] key) { - String stringKey = RjcUtils.decode(key); - - try { - if (isPipelined()) { - pipeline.type(stringKey); - return null; - } - return DataType.fromCode(session.type(stringKey)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public void unwatch() { - try { - if (isPipelined()) { - pipeline.unwatch(); - return; - } - - session.unwatch(); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public void watch(byte[]... keys) { - String[] stringKeys = RjcUtils.decodeMultiple(keys); - - if (isQueueing()) { - return; - } - try { - if (isPipelined()) { - pipeline.watch(stringKeys); - return; - } - else { - session.watch(stringKeys); - } - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - // - // String commands - // - - - public byte[] get(byte[] key) { - String stringKey = RjcUtils.decode(key); - - try { - if (isPipelined()) { - pipeline.get(stringKey); - return null; - } - - return RjcUtils.encode(session.get(stringKey)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public void set(byte[] key, byte[] value) { - String stringKey = RjcUtils.decode(key); - String stringValue = RjcUtils.decode(value); - - try { - if (isPipelined()) { - pipeline.set(stringKey, stringValue); - return; - } - session.set(stringKey, stringValue); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - - public byte[] getSet(byte[] key, byte[] value) { - String stringKey = RjcUtils.decode(key); - String stringValue = RjcUtils.decode(value); - - try { - if (isPipelined()) { - pipeline.getSet(stringKey, stringValue); - return null; - } - return RjcUtils.encode(session.getSet(stringKey, stringValue)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long append(byte[] key, byte[] value) { - String stringKey = RjcUtils.decode(key); - String stringValue = RjcUtils.decode(value); - - try { - if (isPipelined()) { - pipeline.append(stringKey, stringValue); - return null; - } - return session.append(stringKey, stringValue); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public List mGet(byte[]... keys) { - String[] stringKeys = RjcUtils.decodeMultiple(keys); - - try { - if (isPipelined()) { - pipeline.mget(stringKeys); - return null; - } - return RjcUtils.convertToList(session.mget(stringKeys)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public void mSet(Map tuples) { - String[] decodeMap = RjcUtils.flatten(tuples); - - try { - if (isPipelined()) { - pipeline.mset(decodeMap); - return; - } - session.mset(decodeMap); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public void mSetNX(Map tuples) { - String[] decodeMap = RjcUtils.flatten(tuples); - - try { - - if (isPipelined()) { - pipeline.msetnx(decodeMap); - return; - } - session.msetnx(decodeMap); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public void setEx(byte[] key, long time, byte[] value) { - String stringKey = RjcUtils.decode(key); - String stringValue = RjcUtils.decode(value); - - try { - if (isPipelined()) { - pipeline.setex(stringKey, (int) time, stringValue); - return; - } - session.setex(stringKey, (int) time, stringValue); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Boolean setNX(byte[] key, byte[] value) { - String stringKey = RjcUtils.decode(key); - String stringValue = RjcUtils.decode(value); - - try { - if (isPipelined()) { - pipeline.setnx(stringKey, stringValue); - return null; - } - return session.setnx(stringKey, stringValue); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public byte[] getRange(byte[] key, long start, long end) { - String stringKey = RjcUtils.decode(key); - - try { - if (isPipelined()) { - pipeline.getRange(stringKey, (int) start, (int) end); - return null; - } - return RjcUtils.encode(session.getRange(stringKey, (int) start, (int) end)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long decr(byte[] key) { - String stringKey = RjcUtils.decode(key); - try { - - if (isPipelined()) { - pipeline.decr(stringKey); - return null; - } - return session.decr(stringKey); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long decrBy(byte[] key, long value) { - String stringKey = RjcUtils.decode(key); - try { - - if (isPipelined()) { - pipeline.decrBy(stringKey, (int) value); - return null; - } - return session.decrBy(stringKey, (int) value); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long incr(byte[] key) { - String stringKey = RjcUtils.decode(key); - - try { - - if (isPipelined()) { - pipeline.incr(stringKey); - return null; - } - return session.incr(stringKey); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long incrBy(byte[] key, long value) { - String stringKey = RjcUtils.decode(key); - - - try { - if (isPipelined()) { - pipeline.incrBy(stringKey, (int) value); - return null; - } - return session.incrBy(stringKey, (int) value); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Boolean getBit(byte[] key, long offset) { - String stringKey = RjcUtils.decode(key); - - try { - if (isPipelined()) { - pipeline.getbit(stringKey, (int) offset); - return null; - } - return (session.getBit(stringKey, (int) offset) == 0 ? Boolean.FALSE : Boolean.TRUE); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public void setBit(byte[] key, long offset, boolean value) { - String stringKey = RjcUtils.decode(key); - - try { - if (isPipelined()) { - pipeline.setbit(stringKey, (int) offset, RjcUtils.asBit(value)); - return; - } - session.setBit(stringKey, (int) offset, RjcUtils.asBit(value)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public void setRange(byte[] key, byte[] value, long offset) { - String stringKey = RjcUtils.decode(key); - String stringValue = RjcUtils.decode(value); - - try { - if (isPipelined()) { - pipeline.setRange(stringKey, (int) offset, stringValue); - return; - } - session.setRange(stringKey, (int) offset, stringValue); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long strLen(byte[] key) { - String stringKey = RjcUtils.decode(key); - - try { - if (isPipelined()) { - pipeline.strlen(stringKey); - return null; - } - return session.strlen(stringKey); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - // - // List commands - // - - - public Long lPush(byte[] key, byte[] value) { - String stringKey = RjcUtils.decode(key); - String stringValue = RjcUtils.decode(value); - - try { - if (isPipelined()) { - pipeline.lpush(stringKey, stringValue); - return null; - } - return session.lpush(stringKey, stringValue); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long rPush(byte[] key, byte[] value) { - String stringKey = RjcUtils.decode(key); - String stringValue = RjcUtils.decode(value); - - try { - - if (isPipelined()) { - pipeline.rpush(stringKey, stringValue); - return null; - } - return session.rpush(stringKey, stringValue); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public List bLPop(int timeout, byte[]... keys) { - String[] stringKeys = RjcUtils.decodeMultiple(keys); - - try { - if (isPipelined()) { - pipeline.blpop(stringKeys); - return null; - } - return RjcUtils.convertToList(session.blpop(timeout, stringKeys)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public List bRPop(int timeout, byte[]... keys) { - String[] stringKeys = RjcUtils.decodeMultiple(keys); - - try { - if (isPipelined()) { - pipeline.brpop(stringKeys); - return null; - } - return RjcUtils.convertToList(session.brpop(timeout, stringKeys)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public byte[] lIndex(byte[] key, long index) { - String stringKey = RjcUtils.decode(key); - - - try { - if (isPipelined()) { - pipeline.lindex(stringKey, (int) index); - return null; - } - return RjcUtils.encode(session.lindex(stringKey, (int) index)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long lInsert(byte[] key, Position where, byte[] pivot, byte[] value) { - String stringKey = RjcUtils.decode(key); - String stringValue = RjcUtils.decode(value); - String stringPivot = RjcUtils.decode(pivot); - Client.LIST_POSITION position = RjcUtils.convertPosition(where); - - try { - if (isPipelined()) { - pipeline.linsert(stringKey, position, stringPivot, stringValue); - return null; - } - return session.linsert(stringKey, position, stringPivot, stringValue); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long lLen(byte[] key) { - String stringKey = RjcUtils.decode(key); - - try { - - if (isPipelined()) { - pipeline.llen(stringKey); - return null; - } - return session.llen(stringKey); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public byte[] lPop(byte[] key) { - String stringKey = RjcUtils.decode(key); - - try { - - if (isPipelined()) { - pipeline.lpop(stringKey); - return null; - } - return RjcUtils.encode(session.lpop(stringKey)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public List lRange(byte[] key, long start, long end) { - String stringKey = RjcUtils.decode(key); - - try { - - if (isPipelined()) { - pipeline.lrange(stringKey, (int) start, (int) end); - return null; - } - return RjcUtils.convertToList(session.lrange(stringKey, (int) start, (int) end)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long lRem(byte[] key, long count, byte[] value) { - String stringKey = RjcUtils.decode(key); - String stringValue = RjcUtils.decode(value); - - try { - - if (isPipelined()) { - pipeline.lrem(stringKey, (int) count, stringValue); - return null; - } - return session.lrem(stringKey, (int) count, stringValue); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public void lSet(byte[] key, long index, byte[] value) { - String stringKey = RjcUtils.decode(key); - String stringValue = RjcUtils.decode(value); - try { - - if (isPipelined()) { - pipeline.lset(stringKey, (int) index, stringValue); - return; - } - session.lset(stringKey, (int) index, stringValue); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public void lTrim(byte[] key, long start, long end) { - String stringKey = RjcUtils.decode(key); - - try { - - if (isPipelined()) { - pipeline.ltrim(stringKey, (int) start, (int) end); - return; - } - session.ltrim(stringKey, (int) start, (int) end); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public byte[] rPop(byte[] key) { - String stringKey = RjcUtils.decode(key); - - try { - - if (isPipelined()) { - pipeline.rpop(stringKey); - return null; - } - return RjcUtils.encode(session.rpop(stringKey)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public byte[] rPopLPush(byte[] srcKey, byte[] dstKey) { - String stringKey = RjcUtils.decode(srcKey); - String stringDest = RjcUtils.decode(dstKey); - - try { - - if (isPipelined()) { - pipeline.rpoplpush(stringKey, stringDest); - return null; - } - return RjcUtils.encode(session.rpoplpush(stringKey, stringDest)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public byte[] bRPopLPush(int timeout, byte[] srcKey, byte[] dstKey) { - String stringKey = RjcUtils.decode(srcKey); - String stringDest = RjcUtils.decode(dstKey); - - try { - if (isPipelined()) { - pipeline.brpoplpush(stringKey, stringDest, timeout); - return null; - } - return RjcUtils.encode(session.brpoplpush(stringKey, stringDest, timeout)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long lPushX(byte[] key, byte[] value) { - String stringKey = RjcUtils.decode(key); - String stringValue = RjcUtils.decode(value); - try { - if (isPipelined()) { - pipeline.lpushx(stringKey, stringValue); - return null; - } - return session.lpushx(stringKey, stringValue); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long rPushX(byte[] key, byte[] value) { - String stringKey = RjcUtils.decode(key); - String stringValue = RjcUtils.decode(value); - try { - if (isPipelined()) { - pipeline.rpushx(stringKey, stringValue); - return null; - } - return session.rpushx(stringKey, stringValue); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - // - // Set commands - // - - - public Boolean sAdd(byte[] key, byte[] value) { - String stringKey = RjcUtils.decode(key); - String stringValue = RjcUtils.decode(value); - - try { - - if (isPipelined()) { - pipeline.sadd(stringKey, stringValue); - return null; - } - return session.sadd(stringKey, stringValue); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long sCard(byte[] key) { - String stringKey = RjcUtils.decode(key); - - try { - - if (isPipelined()) { - pipeline.scard(stringKey); - return null; - } - return session.scard(stringKey); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Set sDiff(byte[]... keys) { - String[] stringKeys = RjcUtils.decodeMultiple(keys); - - try { - - if (isPipelined()) { - pipeline.sdiff(stringKeys); - return null; - } - return RjcUtils.convertToSet(session.sdiff(stringKeys)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long sDiffStore(byte[] destKey, byte[]... keys) { - String stringKey = RjcUtils.decode(destKey); - String[] stringKeys = RjcUtils.decodeMultiple(keys); - - try { - - if (isPipelined()) { - pipeline.sdiffstore(stringKey, stringKeys); - return null; - } - return session.sdiffstore(stringKey, stringKeys); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Set sInter(byte[]... keys) { - String[] stringKeys = RjcUtils.decodeMultiple(keys); - try { - - if (isPipelined()) { - pipeline.sinter(stringKeys); - return null; - } - return RjcUtils.convertToSet(session.sinter(stringKeys)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long sInterStore(byte[] destKey, byte[]... keys) { - String stringKey = RjcUtils.decode(destKey); - String[] stringKeys = RjcUtils.decodeMultiple(keys); - try { - - if (isPipelined()) { - pipeline.sinterstore(stringKey, stringKeys); - return null; - } - return session.sinterstore(stringKey, stringKeys); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Boolean sIsMember(byte[] key, byte[] value) { - String stringKey = RjcUtils.decode(key); - String stringValue = RjcUtils.decode(value); - - try { - - if (isPipelined()) { - pipeline.sismember(stringKey, stringValue); - return null; - } - return session.sismember(stringKey, stringValue); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Set sMembers(byte[] key) { - String stringKey = RjcUtils.decode(key); - try { - - if (isPipelined()) { - pipeline.smembers(stringKey); - return null; - } - return RjcUtils.convertToSet(session.smembers(stringKey)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Boolean sMove(byte[] srcKey, byte[] destKey, byte[] value) { - String stringSrc = RjcUtils.decode(srcKey); - String stringDest = RjcUtils.decode(destKey); - String stringValue = RjcUtils.decode(value); - - try { - - if (isPipelined()) { - pipeline.smove(stringSrc, stringDest, stringValue); - return null; - } - return session.smove(stringSrc, stringDest, stringValue); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public byte[] sPop(byte[] key) { - String stringKey = RjcUtils.decode(key); - try { - - if (isPipelined()) { - pipeline.spop(stringKey); - return null; - } - return RjcUtils.encode(session.spop(stringKey)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public byte[] sRandMember(byte[] key) { - String stringKey = RjcUtils.decode(key); - try { - - if (isPipelined()) { - pipeline.srandmember(stringKey); - return null; - } - return RjcUtils.encode(session.srandmember(stringKey)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Boolean sRem(byte[] key, byte[] value) { - String stringKey = RjcUtils.decode(key); - String stringValue = RjcUtils.decode(value); - - try { - - if (isPipelined()) { - pipeline.srem(stringKey, stringValue); - return null; - } - return session.srem(stringKey, stringValue); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Set sUnion(byte[]... keys) { - String[] stringKeys = RjcUtils.decodeMultiple(keys); - - try { - - if (isPipelined()) { - pipeline.sunion(stringKeys); - return null; - } - return RjcUtils.convertToSet(session.sunion(stringKeys)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long sUnionStore(byte[] destKey, byte[]... keys) { - String stringKey = RjcUtils.decode(destKey); - String[] stringKeys = RjcUtils.decodeMultiple(keys); - - try { - - if (isPipelined()) { - pipeline.sunionstore(stringKey, stringKeys); - return null; - } - return session.sunionstore(stringKey, stringKeys); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - // - // ZSet commands - // - - - public Boolean zAdd(byte[] key, double score, byte[] value) { - String stringKey = RjcUtils.decode(key); - String stringValue = RjcUtils.decode(value); - - try { - if (isPipelined()) { - pipeline.zadd(stringKey, score, stringValue); - return null; - } - return session.zadd(stringKey, score, stringValue); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long zCard(byte[] key) { - String stringKey = RjcUtils.decode(key); - - try { - if (isPipelined()) { - pipeline.zcard(stringKey); - return null; - } - return session.zcard(stringKey); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long zCount(byte[] key, double min, double max) { - String stringKey = RjcUtils.decode(key); - try { - if (isPipelined()) { - pipeline.zcount(stringKey, min, max); - return null; - } - - return session.zcount(stringKey, min, max); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Double zIncrBy(byte[] key, double increment, byte[] value) { - String stringKey = RjcUtils.decode(key); - String stringValue = RjcUtils.decode(value); - - try { - if (isPipelined()) { - pipeline.zincrby(stringKey, increment, stringValue); - return null; - } - return Double.valueOf(session.zincrby(stringKey, increment, stringValue)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long zInterStore(byte[] destKey, Aggregate aggregate, int[] weights, byte[]... sets) { - String stringKey = RjcUtils.decode(destKey); - String[] stringKeys = RjcUtils.decodeMultiple(sets); - - ZParams zparams = RjcUtils.toZParams(aggregate, weights); - - try { - if (isPipelined()) { - pipeline.zinterstore(stringKey, zparams, stringKeys); - return null; - } - return session.zinterstore(stringKey, zparams, stringKeys); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long zInterStore(byte[] destKey, byte[]... sets) { - String stringKey = RjcUtils.decode(destKey); - String[] stringKeys = RjcUtils.decodeMultiple(sets); - try { - if (isPipelined()) { - pipeline.zinterstore(stringKey, stringKeys); - return null; - } - - return session.zinterstore(stringKey, stringKeys); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Set zRange(byte[] key, long start, long end) { - String stringKey = RjcUtils.decode(key); - try { - - if (isPipelined()) { - pipeline.zrange(stringKey, (int) start, (int) end); - return null; - } - return RjcUtils.convertToSet(session.zrange(stringKey, (int) start, (int) end)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Set zRangeWithScores(byte[] key, long start, long end) { - String stringKey = RjcUtils.decode(key); - try { - - if (isPipelined()) { - pipeline.zrangeWithScores(stringKey, (int) start, (int) end); - return null; - } - return RjcUtils.convertElementScore(session.zrangeWithScores(stringKey, (int) start, (int) end)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Set zRangeByScore(byte[] key, double min, double max) { - String stringKey = RjcUtils.decode(key); - String minString = Double.toString(min); - String maxString = Double.toString(max); - - try { - if (isPipelined()) { - pipeline.zrangeByScore(stringKey, minString, maxString); - return null; - } - return RjcUtils.convertToSet(session.zrangeByScore(stringKey, minString, maxString)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Set zRangeByScore(byte[] key, double min, double max, long offset, long count) { - String stringKey = RjcUtils.decode(key); - String minString = Double.toString(min); - String maxString = Double.toString(max); - - try { - if (isPipelined()) { - pipeline.zrangeByScore(stringKey, minString, maxString, (int) offset, (int) count); - return null; - } - return RjcUtils.convertToSet(session.zrangeByScore(stringKey, minString, maxString, (int) offset, - (int) count)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - - public Set zRevRangeByScore(byte[] key, double min, double max, long offset, long count) { - String stringKey = RjcUtils.decode(key); - String minString = Double.toString(min); - String maxString = Double.toString(max); - - try { - if (isPipelined()) { - pipeline.zrevrangeByScore(stringKey, maxString, minString, (int) offset, (int) count); - return null; - } - return RjcUtils.convertToSet(session.zrevrangeByScore(stringKey, maxString, minString, (int) offset, - (int) count)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Set zRevRangeByScore(byte[] key, double min, double max) { - String stringKey = RjcUtils.decode(key); - String minString = Double.toString(min); - String maxString = Double.toString(max); - - try { - if (isPipelined()) { - pipeline.zrevrangeByScore(stringKey, maxString, minString); - return null; - } - return RjcUtils.convertToSet(session.zrevrangeByScore(stringKey, maxString, minString)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Set zRangeByScoreWithScores(byte[] key, double min, double max) { - String stringKey = RjcUtils.decode(key); - String minString = Double.toString(min); - String maxString = Double.toString(max); - - try { - if (isPipelined()) { - pipeline.zrangeByScoreWithScores(stringKey, minString, maxString); - return null; - } - return RjcUtils.convertElementScore(session.zrangeByScoreWithScores(stringKey, minString, maxString)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Set zRevRangeWithScores(byte[] key, long start, long end) { - String stringKey = RjcUtils.decode(key); - - try { - - if (isPipelined()) { - pipeline.zrevrangeWithScores(stringKey, (int) start, (int) end); - return null; - } - return RjcUtils.convertElementScore(session.zrevrangeWithScores(stringKey, (int) start, (int) end)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Set zRangeByScoreWithScores(byte[] key, double min, double max, long offset, long count) { - String stringKey = RjcUtils.decode(key); - String minString = Double.toString(min); - String maxString = Double.toString(max); - - try { - if (isPipelined()) { - pipeline.zrangeByScoreWithScores(stringKey, minString, maxString, (int) offset, (int) count); - return null; - } - return RjcUtils.convertElementScore(session.zrangeByScoreWithScores(stringKey, minString, maxString, - (int) offset, (int) count)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - - public Set zRevRangeByScoreWithScores(byte[] key, double min, double max, long offset, long count) { - String stringKey = RjcUtils.decode(key); - String minString = Double.toString(min); - String maxString = Double.toString(max); - - try { - - if (isPipelined()) { - pipeline.zrevrangeByScoreWithScores(stringKey, maxString, minString, (int) offset, (int) count); - return null; - } - return RjcUtils.convertElementScore(session.zrevrangeByScoreWithScores(stringKey, maxString, minString, - (int) offset, (int) count)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Set zRevRangeByScoreWithScores(byte[] key, double min, double max) { - String stringKey = RjcUtils.decode(key); - String minString = Double.toString(min); - String maxString = Double.toString(max); - - try { - - if (isPipelined()) { - pipeline.zrevrangeByScoreWithScores(stringKey, maxString, minString); - return null; - } - return RjcUtils.convertElementScore(session.zrevrangeByScoreWithScores(stringKey, maxString, minString)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long zRank(byte[] key, byte[] value) { - String stringKey = RjcUtils.decode(key); - String stringValue = RjcUtils.decode(value); - - try { - if (isPipelined()) { - pipeline.zrank(stringKey, stringValue); - return null; - } - return session.zrank(stringKey, stringValue); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Boolean zRem(byte[] key, byte[] value) { - String stringKey = RjcUtils.decode(key); - String stringValue = RjcUtils.decode(value); - - try { - if (isPipelined()) { - pipeline.zrem(stringKey, stringValue); - return null; - } - return session.zrem(stringKey, stringValue); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long zRemRange(byte[] key, long start, long end) { - String stringKey = RjcUtils.decode(key); - try { - if (isPipelined()) { - pipeline.zremrangeByRank(stringKey, (int) start, (int) end); - return null; - } - return session.zremrangeByRank(stringKey, (int) start, (int) end); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long zRemRangeByScore(byte[] key, double min, double max) { - String stringKey = RjcUtils.decode(key); - String minString = Double.toString(min); - String maxString = Double.toString(max); - - try { - if (isPipelined()) { - pipeline.zremrangeByScore(stringKey, minString, maxString); - return null; - } - return session.zremrangeByScore(stringKey, minString, maxString); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Set zRevRange(byte[] key, long start, long end) { - String stringKey = RjcUtils.decode(key); - try { - - if (isPipelined()) { - pipeline.zrevrange(stringKey, (int) start, (int) end); - return null; - } - return RjcUtils.convertToSet(session.zrevrange(stringKey, (int) start, (int) end)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long zRevRank(byte[] key, byte[] value) { - String stringKey = RjcUtils.decode(key); - String stringValue = RjcUtils.decode(value); - - try { - if (isPipelined()) { - pipeline.zrevrank(stringKey, stringValue); - return null; - } - return session.zrevrank(stringKey, stringValue); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Double zScore(byte[] key, byte[] value) { - String stringKey = RjcUtils.decode(key); - String stringValue = RjcUtils.decode(value); - - try { - if (isPipelined()) { - pipeline.zscore(stringKey, stringValue); - return null; - } - return RjcUtils.convert(session.zscore(stringKey, stringValue)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long zUnionStore(byte[] destKey, Aggregate aggregate, int[] weights, byte[]... sets) { - String stringKey = RjcUtils.decode(destKey); - String[] stringKeys = RjcUtils.decodeMultiple(destKey); - - ZParams zparams = RjcUtils.toZParams(aggregate, weights); - - try { - if (isPipelined()) { - pipeline.zunionstore(stringKey, zparams, stringKeys); - return null; - } - return session.zunionstore(stringKey, zparams, stringKeys); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long zUnionStore(byte[] destKey, byte[]... sets) { - String stringKey = RjcUtils.decode(destKey); - String[] stringKeys = RjcUtils.decodeMultiple(sets); - - try { - if (isPipelined()) { - pipeline.zunionstore(stringKey, stringKeys); - return null; - } - return session.zunionstore(stringKey, stringKeys); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - // - // Hash commands - // - - - public Boolean hSet(byte[] key, byte[] field, byte[] value) { - String stringKey = RjcUtils.decode(key); - String stringField = RjcUtils.decode(field); - String stringValue = RjcUtils.decode(value); - - try { - if (isPipelined()) { - pipeline.hset(stringKey, stringField, stringValue); - return null; - } - return session.hset(stringKey, stringField, stringValue); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Boolean hSetNX(byte[] key, byte[] field, byte[] value) { - String stringKey = RjcUtils.decode(key); - String stringField = RjcUtils.decode(field); - String stringValue = RjcUtils.decode(value); - - try { - if (isPipelined()) { - pipeline.hsetnx(stringKey, stringField, stringValue); - return null; - } - return session.hsetnx(stringKey, stringField, stringValue); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Boolean hDel(byte[] key, byte[] field) { - String stringKey = RjcUtils.decode(key); - String stringField = RjcUtils.decode(field); - - try { - if (isPipelined()) { - pipeline.hdel(stringKey, stringField); - return null; - } - return session.hdel(stringKey, stringField); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Boolean hExists(byte[] key, byte[] field) { - String stringKey = RjcUtils.decode(key); - String stringField = RjcUtils.decode(field); - - try { - if (isPipelined()) { - pipeline.hexists(stringKey, stringField); - return null; - } - return session.hexists(stringKey, stringField); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public byte[] hGet(byte[] key, byte[] field) { - String stringKey = RjcUtils.decode(key); - String stringField = RjcUtils.decode(field); - - try { - if (isPipelined()) { - pipeline.hget(stringKey, stringField); - return null; - } - return RjcUtils.encode(session.hget(stringKey, stringField)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Map hGetAll(byte[] key) { - String stringKey = RjcUtils.decode(key); - - try { - if (isPipelined()) { - pipeline.hgetAll(stringKey); - return null; - } - return RjcUtils.encodeMap(session.hgetAll(stringKey)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long hIncrBy(byte[] key, byte[] field, long delta) { - String stringKey = RjcUtils.decode(key); - String stringField = RjcUtils.decode(field); - - try { - if (isPipelined()) { - pipeline.hincrBy(stringKey, stringField, (int) delta); - return null; - } - return session.hincrBy(stringKey, stringField, (int) delta); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Set hKeys(byte[] key) { - String stringKey = RjcUtils.decode(key); - try { - if (isPipelined()) { - pipeline.hkeys(stringKey); - return null; - } - return RjcUtils.convertToSet(session.hkeys(stringKey)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Long hLen(byte[] key) { - String stringKey = RjcUtils.decode(key); - try { - if (isPipelined()) { - pipeline.hlen(stringKey); - return null; - } - return session.hlen(stringKey); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public List hMGet(byte[] key, byte[]... fields) { - String stringKey = RjcUtils.decode(key); - String[] stringKeys = RjcUtils.decodeMultiple(fields); - - try { - if (isPipelined()) { - pipeline.hmget(stringKey, stringKeys); - return null; - } - return RjcUtils.convertToList(session.hmget(stringKey, stringKeys)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public void hMSet(byte[] key, Map tuple) { - String stringKey = RjcUtils.decode(key); - Map stringTuple = RjcUtils.decodeMap(tuple); - - try { - if (isPipelined()) { - pipeline.hmset(stringKey, stringTuple); - return; - } - session.hmset(stringKey, stringTuple); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public List hVals(byte[] key) { - String stringKey = RjcUtils.decode(key); - try { - - if (isPipelined()) { - pipeline.hvals(stringKey); - return null; - } - return RjcUtils.convertToList(session.hvals(stringKey)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - // - // Pub/Sub functionality - // - - public Long publish(byte[] channel, byte[] message) { - try { - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - if (isPipelined()) { - throw new UnsupportedOperationException(); - } - return session.publish(RjcUtils.decode(channel), RjcUtils.decode(message)); - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public Subscription getSubscription() { - return subscription; - } - - - public boolean isSubscribed() { - return (subscription != null && subscription.isAlive()); - } - - - public void pSubscribe(MessageListener listener, byte[]... patterns) { - if (isSubscribed()) { - throw new RedisSubscribedConnectionException( - "Connection already subscribed; use the connection Subscription to cancel or add new channels"); - } - - try { - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - if (isPipelined()) { - throw new UnsupportedOperationException(); - } - - subscription = new RjcSubscription(listener, subscriber); - subscription.pSubscribe(patterns); - subscriber.runSubscription(); - - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } - - - public void subscribe(MessageListener listener, byte[]... channels) { - if (isSubscribed()) { - throw new RedisSubscribedConnectionException( - "Connection already subscribed; use the connection Subscription to cancel or add new channels"); - } - - try { - if (isQueueing()) { - throw new UnsupportedOperationException(); - } - if (isPipelined()) { - throw new UnsupportedOperationException(); - } - - subscription = new RjcSubscription(listener, subscriber); - subscription.subscribe(channels); - subscriber.runSubscription(); - - } catch (Exception ex) { - throw convertRjcAccessException(ex); - } - } -} \ No newline at end of file diff --git a/src/main/java/org/springframework/data/redis/connection/rjc/RjcConnectionFactory.java b/src/main/java/org/springframework/data/redis/connection/rjc/RjcConnectionFactory.java deleted file mode 100644 index a85ca2df0..000000000 --- a/src/main/java/org/springframework/data/redis/connection/rjc/RjcConnectionFactory.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright 2011-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.data.redis.connection.rjc; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.idevlab.rjc.ds.DataSource; -import org.idevlab.rjc.ds.PoolableDataSource; -import org.idevlab.rjc.ds.SimpleDataSource; -import org.idevlab.rjc.message.RedisNodeSubscriber; -import org.idevlab.rjc.protocol.Protocol; -import org.springframework.beans.factory.DisposableBean; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.dao.DataAccessException; -import org.springframework.data.redis.connection.RedisConnection; -import org.springframework.data.redis.connection.RedisConnectionFactory; -import org.springframework.util.Assert; - -/** - * Connection factory creating rjc based connections. - * - * @author Costin Leau - */ -public class RjcConnectionFactory implements InitializingBean, DisposableBean, RedisConnectionFactory { - - private final static Log log = LogFactory.getLog(RjcConnectionFactory.class); - - private String hostName = "localhost"; - private int port = Protocol.DEFAULT_PORT; - private int timeout = Protocol.DEFAULT_TIMEOUT; - private String password; - - private boolean usePool = true; - private int dbIndex = 0; - private DataSource dataSource; - private DataSource subscriptionDataSource; - - - /** - * Constructs a new RjcConnectionFactory instance - * with default settings (default connection pooling, no shard information). - */ - public RjcConnectionFactory() { - } - - - public void afterPropertiesSet() { - if (usePool) { - PoolableDataSource pool = new PoolableDataSource(); - pool.setHost(hostName); - pool.setPort(port); - pool.setPassword(password); - pool.setTimeout(timeout); - - pool.init(); - - dataSource = pool; - - } - else { - dataSource = new SimpleDataSource(hostName, port, timeout, password); - } - subscriptionDataSource = new SimpleDataSource(hostName, port, timeout, password); - } - - public void destroy() { - if (usePool && dataSource != null) { - try { - ((PoolableDataSource) dataSource).close(); - } catch (Exception ex) { - log.warn("Cannot properly close Rjc pool", ex); - } - dataSource = null; - } - } - - - public RedisConnection getConnection() { - return postProcessConnection(new RjcConnection(dataSource.getConnection(), dbIndex, - new RedisNodeSubscriber(subscriptionDataSource))); - } - - /** - * Post process a newly retrieved connection. Useful for decorating or executing - * initialization commands on a new connection. - * This implementation simply returns the connection. - * - * @param connection - * @return processed connection - */ - protected RjcConnection postProcessConnection(RjcConnection connection) { - return connection; - } - - - public DataAccessException translateExceptionIfPossible(RuntimeException ex) { - return RjcUtils.convertRjcAccessException(ex); - } - - - /** - * Returns the Redis hostName. - * - * @return Returns the hostName - */ - public String getHostName() { - return hostName; - } - - /** - * Sets the Redis hostName. - * - * @param hostName The hostName to set. - */ - public void setHostName(String hostName) { - this.hostName = hostName; - } - - /** - * Returns the password used for authenticating with the Redis server. - * - * @return password for authentication - */ - public String getPassword() { - return password; - } - - /** - * Sets the password used for authenticating with the Redis server. - * - * @param password the password to set - */ - public void setPassword(String password) { - this.password = password; - } - - /** - * Returns the port used to connect to the Redis instance. - * - * @return Redis port. - */ - public int getPort() { - return port; - - } - - /** - * Sets the port used to connect to the Redis instance. - * - * @param port Redis port - */ - public void setPort(int port) { - this.port = port; - } - /** - * Returns the timeout. - * - * @return Returns the timeout - */ - public int getTimeout() { - return timeout; - } - - /** - * @param timeout The timeout to set. - */ - public void setTimeout(int timeout) { - this.timeout = timeout; - } - - /** - * Indicates the use of a connection pool. - * - * @return Returns the use of connection pooling. - */ - public boolean getUsePool() { - return usePool; - } - - /** - * Turns on or off the use of connection pooling. - * - * @param usePool The usePool to set. - */ - public void setUsePool(boolean usePool) { - this.usePool = usePool; - } - - /** - * Returns the index of the database. - * - * @return Returns the database index - */ - public int getDatabase() { - return dbIndex; - } - - /** - * Sets the index of the database used by this connection factory. - * Can be between 0 (default) and 15. - * - * @param index database index - */ - public void setDatabase(int index) { - Assert.isTrue(index >= 0, "invalid DB index (a positive index required)"); - this.dbIndex = index; - } -} \ No newline at end of file diff --git a/src/main/java/org/springframework/data/redis/connection/rjc/RjcMessageListener.java b/src/main/java/org/springframework/data/redis/connection/rjc/RjcMessageListener.java deleted file mode 100644 index 00091ac57..000000000 --- a/src/main/java/org/springframework/data/redis/connection/rjc/RjcMessageListener.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2011-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.data.redis.connection.rjc; - -import org.idevlab.rjc.message.MessageListener; -import org.idevlab.rjc.message.PMessageListener; -import org.springframework.data.redis.connection.DefaultMessage; - -/** - * Message listener adapter for RJC library. - * - * @author Costin Leau - */ -class RjcMessageListener implements MessageListener, PMessageListener { - - private final org.springframework.data.redis.connection.MessageListener listener; - - RjcMessageListener(org.springframework.data.redis.connection.MessageListener messageListener) { - this.listener = messageListener; - } - - - public void onMessage(String channel, String message) { - listener.onMessage(new DefaultMessage(RjcUtils.encode(channel), RjcUtils.encode(message)), null); - } - - - public void onMessage(String pattern, String channel, String message) { - listener.onMessage(new DefaultMessage(RjcUtils.encode(channel), RjcUtils.encode(message)), - RjcUtils.encode(pattern)); - } -} \ No newline at end of file diff --git a/src/main/java/org/springframework/data/redis/connection/rjc/RjcSubscription.java b/src/main/java/org/springframework/data/redis/connection/rjc/RjcSubscription.java deleted file mode 100644 index b212ac29a..000000000 --- a/src/main/java/org/springframework/data/redis/connection/rjc/RjcSubscription.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2011-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.data.redis.connection.rjc; - -import org.idevlab.rjc.message.RedisNodeSubscriber; -import org.springframework.data.redis.connection.MessageListener; -import org.springframework.data.redis.connection.util.AbstractSubscription; - -/** - * Message subscription on top of RJC. - * - * @author Costin Leau - */ -class RjcSubscription extends AbstractSubscription { - - private final RedisNodeSubscriber subscriber; - - RjcSubscription(MessageListener listener, RedisNodeSubscriber subscriber) { - super(listener); - this.subscriber = subscriber; - subscriber.setMessageListener(new RjcMessageListener(listener)); - subscriber.setPMessageListener(new RjcMessageListener(listener)); - } - - - protected void doClose() { - if(!getChannels().isEmpty() || !getPatterns().isEmpty()) { - subscriber.close(); - } - } - - - protected void doPsubscribe(byte[]... patterns) { - subscriber.psubscribe(RjcUtils.decodeMultiple(patterns)); - } - - - protected void doPUnsubscribe(boolean all, byte[]... patterns) { - subscriber.punsubscribe(RjcUtils.decodeMultiple(patterns)); - } - - - protected void doSubscribe(byte[]... channels) { - subscriber.subscribe(RjcUtils.decodeMultiple(channels)); - } - - - protected void doUnsubscribe(boolean all, byte[]... channels) { - subscriber.unsubscribe(RjcUtils.decodeMultiple(channels)); - } -} \ No newline at end of file diff --git a/src/main/java/org/springframework/data/redis/connection/rjc/RjcUtils.java b/src/main/java/org/springframework/data/redis/connection/rjc/RjcUtils.java deleted file mode 100644 index 7c8dbe108..000000000 --- a/src/main/java/org/springframework/data/redis/connection/rjc/RjcUtils.java +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright 2011-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.data.redis.connection.rjc; - -import java.io.StringReader; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.idevlab.rjc.Client.LIST_POSITION; -import org.idevlab.rjc.ElementScore; -import org.idevlab.rjc.RedisException; -import org.idevlab.rjc.SortingParams; -import org.idevlab.rjc.ZParams; -import org.springframework.dao.DataAccessException; -import org.springframework.dao.InvalidDataAccessApiUsageException; -import org.springframework.data.redis.RedisSystemException; -import org.springframework.data.redis.connection.DataType; -import org.springframework.data.redis.connection.DefaultTuple; -import org.springframework.data.redis.connection.RedisListCommands.Position; -import org.springframework.data.redis.connection.RedisZSetCommands.Aggregate; -import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; -import org.springframework.data.redis.connection.SortParameters; -import org.springframework.data.redis.connection.SortParameters.Order; -import org.springframework.data.redis.connection.SortParameters.Range; -import org.springframework.data.redis.connection.util.DecodeUtils; -import org.springframework.util.ObjectUtils; - - -/** - * Helper class featuring methods for RJC connection handling, providing support for exception translation. - * - * @author Costin Leau - */ -public abstract class RjcUtils { - - private static final String ONE = "1"; - private static final String ZERO = "0"; - - - public static DataAccessException convertRjcAccessException(RuntimeException ex) { - if (ex instanceof RedisException) { - return convertRjcAccessException((RedisException) ex); - } - - return new RedisSystemException("Unknown exception", ex); - } - - public static DataAccessException convertRjcAccessException(RedisException ex) { - return new InvalidDataAccessApiUsageException(ex.getMessage(), ex); - } - - static DataType convertDataType(String type) { - if ("string".equals(type)) { - return DataType.STRING; - } - else if ("list".equals(type)) { - return DataType.LIST; - } - else if ("set".equals(type)) { - return DataType.SET; - } - else if ("zset".equals(type)) { - return DataType.ZSET; - } - else if ("hash".equals(type)) { - return DataType.HASH; - } - else if ("none".equals(type)) { - return DataType.NONE; - } - - return null; - } - - static String decode(byte[] bytes) { - return DecodeUtils.decode(bytes); - } - - static byte[] encode(String string) { - return DecodeUtils.encode(string); - } - - static String[] decodeMultiple(byte[]... bytes) { - return DecodeUtils.decodeMultiple(bytes); - } - - static String[] flatten(Map tuple) { - String[] result = new String[tuple.size() * 2]; - int index = 0; - for (Map.Entry entry : tuple.entrySet()) { - result[index++] = decode(entry.getKey()); - result[index++] = decode(entry.getValue()); - } - return result; - - } - - static Set convertToSet(Collection keys) { - if (keys == null) { - return null; - } - - return DecodeUtils.convertToSet(keys); - } - - static List convertToList(Collection keys) { - if (keys == null) { - return null; - } - return DecodeUtils.convertToList(keys); - } - - static SortingParams convertSortParams(SortParameters params) { - SortingParams rjcSort = null; - - if (params != null) { - rjcSort = new SortingParams(); - - byte[] byPattern = params.getByPattern(); - if (byPattern != null) { - rjcSort.by(DecodeUtils.decode(byPattern)); - } - byte[][] getPattern = params.getGetPattern(); - - if (getPattern != null && getPattern.length > 0) { - for (byte[] bs : getPattern) { - rjcSort.get(DecodeUtils.decode(bs)); - } - } - Range limit = params.getLimit(); - if (limit != null) { - rjcSort.limit((int) limit.getStart(), (int) limit.getCount()); - } - Order order = params.getOrder(); - if (order != null && order.equals(Order.DESC)) { - rjcSort.desc(); - } - Boolean isAlpha = params.isAlphabetic(); - if (isAlpha != null && isAlpha) { - rjcSort.alpha(); - } - } - return rjcSort; - } - - static Properties info(String string) { - Properties info = new Properties(); - StringReader stringReader = new StringReader(string); - try { - info.load(stringReader); - } catch (Exception ex) { - throw new RedisSystemException("Cannot read Redis info", ex); - } finally { - stringReader.close(); - } - return info; - } - - static String asBit(boolean value) { - return (value ? ONE : ZERO); - } - - static LIST_POSITION convertPosition(Position where) { - switch (where) { - case BEFORE: - return LIST_POSITION.BEFORE; - - case AFTER: - return LIST_POSITION.AFTER; - } - return null; - } - - static ZParams toZParams(Aggregate aggregate, int[] weights) { - return new ZParams().weights(weights).aggregate(ZParams.Aggregate.valueOf(aggregate.name())); - } - - static Set convertElementScore(List tuples) { - Set value = new LinkedHashSet(tuples.size()); - for (ElementScore tuple : tuples) { - value.add(new DefaultTuple(encode(tuple.getElement()), Double.valueOf(tuple.getScore()))); - } - - return value; - } - - static Map encodeMap(Map map) { - Map result = new LinkedHashMap(map.size()); - for (Map.Entry entry : map.entrySet()) { - result.put(encode(entry.getKey()), encode(entry.getValue())); - } - return result; - } - - static Map decodeMap(Map map) { - Map result = new LinkedHashMap(map.size()); - for (Map.Entry entry : map.entrySet()) { - result.put(decode(entry.getKey()), decode(entry.getValue())); - } - return result; - } - - static Double convert(String zscore) { - return (zscore == null ? null : Double.valueOf(zscore)); - } - - - static String[] addArray(String[] one, String[] two) { - if (ObjectUtils.isEmpty(one)) { - return two; - } - if (ObjectUtils.isEmpty(two)) { - return one; - } - - String[] result = Arrays.copyOf(one, one.length + two.length); - System.arraycopy(two, 0, result, one.length, two.length); - return result; - } - - static List maybeConvert(List result) { - for (int i = 0; i < result.size(); i++) { - Object obj = result.get(i); - if (obj instanceof String) { - result.set(i, encode((String) obj)); - } - } - return result; - } -} \ No newline at end of file diff --git a/src/main/java/org/springframework/data/redis/connection/rjc/SingleDataSource.java b/src/main/java/org/springframework/data/redis/connection/rjc/SingleDataSource.java deleted file mode 100644 index 501aa7fb8..000000000 --- a/src/main/java/org/springframework/data/redis/connection/rjc/SingleDataSource.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2011-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.data.redis.connection.rjc; - -import org.idevlab.rjc.ds.DataSource; -import org.idevlab.rjc.ds.RedisConnection; - -/** - * Basic data source that always returns the same connection. - * - * @author Costin Leau - */ -class SingleDataSource implements DataSource { - - private final RedisConnection connection; - - SingleDataSource(RedisConnection connection) { - this.connection = connection; - } - - - public RedisConnection getConnection() { - return connection; - } -} diff --git a/src/main/java/org/springframework/data/redis/connection/rjc/package-info.java b/src/main/java/org/springframework/data/redis/connection/rjc/package-info.java deleted file mode 100644 index f53b7c985..000000000 --- a/src/main/java/org/springframework/data/redis/connection/rjc/package-info.java +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Connection package for RJC library. - */ -package org.springframework.data.redis.connection.rjc; - diff --git a/src/test/java/org/springframework/data/redis/connection/ConnectionUtils.java b/src/test/java/org/springframework/data/redis/connection/ConnectionUtils.java index 17347eb6c..94a779b4d 100644 --- a/src/test/java/org/springframework/data/redis/connection/ConnectionUtils.java +++ b/src/test/java/org/springframework/data/redis/connection/ConnectionUtils.java @@ -18,7 +18,6 @@ package org.springframework.data.redis.connection; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; import org.springframework.data.redis.connection.jredis.JredisConnectionFactory; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; -import org.springframework.data.redis.connection.rjc.RjcConnectionFactory; import org.springframework.data.redis.connection.srp.SrpConnectionFactory; /** @@ -34,10 +33,6 @@ public abstract class ConnectionUtils { || (connectionFactory instanceof SrpConnectionFactory); } - public static boolean isRjc(RedisConnectionFactory connectionFactory) { - return connectionFactory instanceof RjcConnectionFactory; - } - public static boolean isSrp(RedisConnectionFactory connectionFactory) { return connectionFactory instanceof SrpConnectionFactory; } diff --git a/src/test/java/org/springframework/data/redis/connection/rjc/RjcConnectionIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/rjc/RjcConnectionIntegrationTests.java deleted file mode 100644 index 4df05f5d9..000000000 --- a/src/test/java/org/springframework/data/redis/connection/rjc/RjcConnectionIntegrationTests.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2011-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.data.redis.connection.rjc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import java.util.Arrays; -import java.util.List; - -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.data.redis.connection.AbstractConnectionIntegrationTests; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -/** - * Integration test of {@link RjcConnection} - * - * @author Costin Leau - * @author Jennifer Hickey - * - */ -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration -public class RjcConnectionIntegrationTests extends AbstractConnectionIntegrationTests { - - @Ignore("nulls are encoded to empty strings") - public void testNullKey() throws Exception { - } - - @Ignore("nulls are encoded to empty strings") - public void testNullValue() throws Exception { - } - - @Ignore("nulls are encoded to empty strings") - public void testHashNullKey() throws Exception { - } - - @Ignore("nulls are encoded to empty strings") - public void testHashNullValue() throws Exception { - } - - @Ignore("DATAREDIS-133 Key search does not work with regex") - public void testKeys() throws Exception { - } - - @Ignore("DATAREDIS-121 incr/decr does not work with encoded values") - public void testDecrByIncrBy() { - } - - @Ignore("DATAREDIS-121 incr/decr does not work with encoded values") - public void testIncDecr() { - } - - @Ignore("DATAREDIS-121 incr/decr does not work with encoded values") - public void testHIncrBy() { - } - - @Ignore("DATAREDIS-134 string ops do not work with encoded values") - public void testSort() { - } - - @Ignore("DATAREDIS-134 string ops do not work with encoded values") - public void testSortStore() { - } - - @Ignore("DATAREDIS-134 string ops do not work with encoded values") - public void testGetRangeSetRange() { - } - - @Ignore("DATAREDIS-134 string ops do not work with encoded values") - public void testStrLen() { - } - - @Ignore("DATAREDIS-120 Pattern matching currently broken") - public void testPubSubWithPatterns() { - } - - @Ignore("DATAREDIS-148 Syntax error on RJC zUnionStore") - public void testZUnionStoreAggWeights() { - } - - @Test - public void testMultiExec() throws Exception { - byte[] key = "key".getBytes(); - byte[] value = "value".getBytes(); - - connection.multi(); - connection.set(key, value); - assertNull(connection.get(key)); - List results = connection.exec(); - assertEquals(2, results.size()); - assertEquals("OK", (String) results.get(0)); - assertEquals(new String(value), new String(RjcUtils.encode((String) results.get(1)))); - } - - @SuppressWarnings("rawtypes") - @Test - public void testExecute() { - connection.set("foo", "bar"); - assertEquals(Arrays.asList(new Object[] { RjcUtils.decode("bar".getBytes()) }), - (List) connection.execute("GET", RjcUtils.decode("foo".getBytes()))); - } -} diff --git a/src/test/java/org/springframework/data/redis/connection/rjc/RjcConnectionPipelineIntegrationTests.java b/src/test/java/org/springframework/data/redis/connection/rjc/RjcConnectionPipelineIntegrationTests.java deleted file mode 100644 index 2313b68f9..000000000 --- a/src/test/java/org/springframework/data/redis/connection/rjc/RjcConnectionPipelineIntegrationTests.java +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Copyright 2011-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.data.redis.connection.rjc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.data.redis.connection.AbstractConnectionPipelineIntegrationTests; -import org.springframework.data.redis.connection.DefaultStringRedisConnection; -import org.springframework.data.redis.connection.DefaultStringTuple; -import org.springframework.data.redis.connection.StringRedisConnection.StringTuple; -import org.springframework.data.redis.serializer.SerializationUtils; -import org.springframework.test.annotation.IfProfileValue; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -/** - * Integration test of {@link RjcConnection} pipeline functionality - * - * @author Jennifer Hickey - * - */ -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration -public class RjcConnectionPipelineIntegrationTests extends - AbstractConnectionPipelineIntegrationTests { - - @Ignore("DATAREDIS-134 string ops do not work with encoded values") - public void testGetRangeSetRange() { - } - - @Ignore("DATAREDIS-133 Key search does not work with regex") - public void testKeys() throws Exception { - } - - @Ignore("DATAREDIS-121 incr/decr does not work with encoded values") - public void testDecrByIncrBy() { - } - - @Ignore("DATAREDIS-121 incr/decr does not work with encoded values") - public void testIncDecr() { - } - - @Ignore("DATAREDIS-121 incr/decr does not work with encoded values") - public void testHIncrBy() { - } - - @Ignore("DATAREDIS-134 string ops do not work with encoded values") - public void testSort() { - } - - @Ignore("DATAREDIS-134 string ops do not work with encoded values") - public void testSortStore() { - } - - @Ignore("DATAREDIS-134 string ops do not work with encoded values") - public void testStrLen() { - } - - @Ignore("DATAREDIS-148 Syntax error on RJC zUnionStore") - public void testZUnionStoreAggWeights() { - } - - @Ignore("DATAREDIS-149 Wrong number of args on RJC brPop when pipelining") - public void testBRPop() { - } - - @Ignore("DATAREDIS-149 Wrong number of args on RJC brPop when pipelining") - public void testBLPop() { - } - - @Ignore("DATAREDIS-149 Wrong number of args on RJC brPop when pipelining") - public void testBRPopTimeout() { - } - - @Ignore("DATAREDIS-149 Wrong number of args on RJC brPop when pipelining") - public void testBLPopTimeout() { - } - - @Ignore("DATAREDIS-150 the 6 from zIncrBy improperly decoded") - public void testZIncrBy() { - } - - @Ignore("DATAREDIS-150 the 3 from zScore improperly decoded") - public void testZScore() { - } - - @Ignore("DATAREDIS-150 the results of info improperly decoded") - public void testInfo() throws Exception { - } - - @Ignore("DATAREDIS-150 the results of ping improperly decoded") - public void testPingPong() throws Exception { - } - - @Ignore("DATAREDIS-150 the results of type improperly decoded") - public void testType() { - } - - @Test - @Ignore("DATAREDIS-161 Syntax error in pipelined RJC op causes SocketTimeouts on subsequent calls") - public void exceptionExecuteNative() throws Exception { - } - - // Overrides, usually due to return values being Long vs Boolean or Set vs - // List - - @Test - public void testSIsMember() { - convertResultToSet = true; - actual.add(connection.sAdd("myset", "foo")); - actual.add(connection.sAdd("myset", "bar")); - actual.add(connection.sIsMember("myset", "foo")); - actual.add(connection.sIsMember("myset", "baz")); - verifyResults(Arrays.asList(new Object[] { 1l, 1l, 1l, 0l }), actual); - } - - @Test - public void testRename() { - connection.set("renametest", "testit"); - connection.rename("renametest", "newrenametest"); - actual.add(connection.get("newrenametest")); - actual.add(connection.exists("renametest")); - verifyResults(Arrays.asList(new Object[] { "testit", 0l }), actual); - } - - @Test - public void testExists() { - connection.set("existent", "true"); - actual.add(connection.exists("existent")); - actual.add(connection.exists("nonexistent")); - verifyResults(Arrays.asList(new Object[] { 1l, 0l }), actual); - } - - @Test - public void testMultiExec() throws Exception { - connection.multi(); - connection.set("key", "value"); - assertNull(connection.get("key")); - assertNull(connection.exec()); - List convertedResults = convertResults(); - // "OK" will be decoded to null - assertEquals(Arrays.asList(new Object[] { Arrays.asList(new String[] { null, "value" }) }), - convertedResults); - } - - @Test - public void testWatch() throws Exception { - connection.set("testitnow", "willdo"); - connection.watch("testitnow".getBytes()); - //Give some time for watch to be asynch executed - Thread.sleep(500); - DefaultStringRedisConnection conn2 = new DefaultStringRedisConnection( - connectionFactory.getConnection()); - conn2.set("testitnow", "something"); - conn2.close(); - connection.multi(); - connection.set("testitnow", "somethingelse"); - actual.add(connection.exec()); - actual.add(connection.get("testitnow")); - List convertedResults = convertResults(); - // The null returned from exec will be filtered out - assertEquals(Arrays.asList(new String[] { "something" }), convertedResults); - } - - @Test - public void testUnwatch() throws Exception { - connection.set("testitnow", "willdo"); - connection.watch("testitnow".getBytes()); - connection.unwatch(); - //Give some time for unwatch to be asynch executed - Thread.sleep(500); - connection.multi(); - DefaultStringRedisConnection conn2 = new DefaultStringRedisConnection( - connectionFactory.getConnection()); - conn2.set("testitnow", "something"); - connection.set("testitnow", "somethingelse"); - connection.get("testitnow"); - connection.exec(); - List convertedResults = convertResults(); - // "OK" will be decoded to null - assertEquals(Arrays.asList(new Object[] { Arrays.asList(new String[] { null, - "somethingelse" }) }), convertedResults); - } - - @Test - public void testExecute() { - connection.set("foo", "bar"); - actual.add(connection.execute("GET", RjcUtils.decode("foo".getBytes()))); - verifyResults(Arrays.asList(new Object[] { "bar" }), actual); - } - - @Test - @IfProfileValue(name = "runLongTests", value = "true") - public void testBRPopLPushTimeout() throws Exception { - connection.bRPopLPush(1, "alist", "foo"); - Thread.sleep(1500l); - List results = connection.closePipeline(); - assertEquals(Arrays.asList(new Object[] { null }), results); - } - - protected List convertResults() { - List serializedResults = new ArrayList(); - List pipelinedResults = getResults(); - for (Object result : pipelinedResults) { - Object convertedResult = convertResult(result); - // closePipeline attempts to decode "OK" and "QUEUED" which turn - // them into null - // Filter them out here - if (convertedResult != null && !"OK".equals(convertedResult) - && !"QUEUED".equals(convertedResult)) { - serializedResults.add(convertedResult); - } - } - return serializedResults; - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - protected Object convertResult(Object result) { - if (result instanceof List && !(((List) result).isEmpty()) - && ((List) result).get(0) instanceof String) { - if (convertResultToSet) { - return SerializationUtils.deserialize(RjcUtils.convertToSet((List) result), - stringSerializer); - } else if (convertResultToTuples) { - List resultList = (List) result; - List stringTuples = new ArrayList(); - for (int i = 0; i < resultList.size(); i += 2) { - String value = stringSerializer.deserialize(RjcUtils.encode((String) resultList - .get(i))); - stringTuples.add(new DefaultStringTuple(value.getBytes(), value, Double - .valueOf((String) resultList.get(i + 1)))); - } - return stringTuples; - } else { - return SerializationUtils.deserialize(RjcUtils.convertToList((List) result), - stringSerializer); - } - } else if (result instanceof byte[]) { - return stringSerializer.deserialize((byte[]) result); - } else if (result instanceof Map - && ((Map) result).keySet().iterator().next() instanceof byte[]) { - return (SerializationUtils.deserialize((Map) result, stringSerializer)); - } else if (result instanceof Set && !(((Set) result).isEmpty()) - && ((Set) result).iterator().next() instanceof byte[]) { - return (SerializationUtils.deserialize((Set) result, stringSerializer)); - } - return result; - } -} diff --git a/src/test/java/org/springframework/data/redis/connection/rjc/RjcSubscriptionTests.java b/src/test/java/org/springframework/data/redis/connection/rjc/RjcSubscriptionTests.java deleted file mode 100644 index c394591aa..000000000 --- a/src/test/java/org/springframework/data/redis/connection/rjc/RjcSubscriptionTests.java +++ /dev/null @@ -1,310 +0,0 @@ -/* - * Copyright 2011-2013 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.data.redis.connection.rjc; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -import java.util.Collection; - -import org.idevlab.rjc.message.RedisNodeSubscriber; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mockito; -import org.springframework.data.redis.connection.MessageListener; -import org.springframework.data.redis.connection.RedisInvalidSubscriptionException; - -/** - * Unit test of {@link RjcSubscription} - * - * @author Jennifer Hickey - * - */ -public class RjcSubscriptionTests { - - private RjcSubscription subscription; - - private RedisNodeSubscriber subscriber; - - private MessageListener listener; - - @Before - public void setUp() { - subscriber = Mockito.mock(RedisNodeSubscriber.class); - listener = Mockito.mock(MessageListener.class); - subscription = new RjcSubscription(listener, subscriber); - } - - @Test - public void testUnsubscribeAllAndClose() { - byte[][] channel = new byte[][] { "a".getBytes() }; - subscription.subscribe(channel); - subscription.unsubscribe(); - verify(subscriber, never()).close(); - verify(subscriber, times(1)).unsubscribe(RjcUtils.decodeMultiple(channel)); - assertFalse(subscription.isAlive()); - assertTrue(subscription.getChannels().isEmpty()); - assertTrue(subscription.getPatterns().isEmpty()); - } - - @Test - public void testUnsubscribeAllChannelsWithPatterns() { - byte[][] channel = new byte[][] { "a".getBytes() }; - subscription.subscribe(channel); - subscription.pSubscribe(new byte[][] { "s*".getBytes() }); - subscription.unsubscribe(); - verify(subscriber, times(1)).unsubscribe(RjcUtils.decodeMultiple(channel)); - verify(subscriber, never()).close(); - assertTrue(subscription.isAlive()); - assertTrue(subscription.getChannels().isEmpty()); - Collection patterns = subscription.getPatterns(); - assertEquals(1, patterns.size()); - assertArrayEquals("s*".getBytes(), patterns.iterator().next()); - } - - @Test - public void testUnsubscribeChannelAndClose() { - byte[][] channel = new byte[][] { "a".getBytes() }; - subscription.subscribe(channel); - subscription.unsubscribe(channel); - verify(subscriber, times(1)).unsubscribe(RjcUtils.decodeMultiple(channel)); - verify(subscriber, never()).close(); - assertFalse(subscription.isAlive()); - assertTrue(subscription.getChannels().isEmpty()); - assertTrue(subscription.getPatterns().isEmpty()); - } - - @Test - public void testUnsubscribeChannelSomeLeft() { - byte[][] channels = new byte[][] { "a".getBytes(), "b".getBytes() }; - subscription.subscribe(channels); - subscription.unsubscribe(new byte[][] { "a".getBytes() }); - verify(subscriber, times(1)).unsubscribe( - RjcUtils.decodeMultiple(new byte[][] { "a".getBytes() })); - verify(subscriber, never()).close(); - assertTrue(subscription.isAlive()); - Collection subChannels = subscription.getChannels(); - assertEquals(1, subChannels.size()); - assertArrayEquals("b".getBytes(), subChannels.iterator().next()); - assertTrue(subscription.getPatterns().isEmpty()); - } - - @Test - public void testUnsubscribeChannelWithPatterns() { - byte[][] channel = new byte[][] { "a".getBytes() }; - subscription.subscribe(channel); - subscription.pSubscribe(new byte[][] { "s*".getBytes() }); - subscription.unsubscribe(channel); - verify(subscriber, times(1)).unsubscribe(RjcUtils.decodeMultiple(channel)); - verify(subscriber, never()).close(); - assertTrue(subscription.isAlive()); - assertTrue(subscription.getChannels().isEmpty()); - Collection patterns = subscription.getPatterns(); - assertEquals(1, patterns.size()); - assertArrayEquals("s*".getBytes(), patterns.iterator().next()); - } - - @Test - public void testUnsubscribeChannelWithPatternsSomeLeft() { - byte[][] channel = new byte[][] { "a".getBytes() }; - subscription.subscribe(new byte[][] { "a".getBytes(), "b".getBytes() }); - subscription.pSubscribe(new byte[][] { "s*".getBytes() }); - subscription.unsubscribe(channel); - verify(subscriber, times(1)).unsubscribe(RjcUtils.decodeMultiple(channel)); - verify(subscriber, never()).close(); - assertTrue(subscription.isAlive()); - Collection channels = subscription.getChannels(); - assertEquals(1, channels.size()); - assertArrayEquals("b".getBytes(), channels.iterator().next()); - Collection patterns = subscription.getPatterns(); - assertEquals(1, patterns.size()); - assertArrayEquals("s*".getBytes(), patterns.iterator().next()); - } - - @Test - public void testUnsubscribeAllNoChannels() { - subscription.pSubscribe(new byte[][] { "s*".getBytes() }); - subscription.unsubscribe(); - verify(subscriber, never()).close(); - assertTrue(subscription.isAlive()); - assertTrue(subscription.getChannels().isEmpty()); - Collection patterns = subscription.getPatterns(); - assertEquals(1, patterns.size()); - assertArrayEquals("s*".getBytes(), patterns.iterator().next()); - } - - @Test - public void testUnsubscribeNotAlive() { - byte[][] channel = new byte[][] { "a".getBytes() }; - subscription.subscribe(channel); - subscription.unsubscribe(); - assertFalse(subscription.isAlive()); - subscription.unsubscribe(); - verify(subscriber, times(1)).unsubscribe(RjcUtils.decodeMultiple(channel)); - verify(subscriber, never()).close(); - } - - @Test(expected = RedisInvalidSubscriptionException.class) - public void testSubscribeNotAlive() { - subscription.subscribe(new byte[][] { "a".getBytes() }); - subscription.unsubscribe(); - assertFalse(subscription.isAlive()); - subscription.subscribe(new byte[][] { "s".getBytes() }); - } - - @Test - public void testPUnsubscribeAllAndClose() { - byte[][] pattern = new byte[][] { "a*".getBytes() }; - subscription.pSubscribe(pattern); - subscription.pUnsubscribe(); - verify(subscriber, never()).close(); - verify(subscriber, times(1)).punsubscribe(RjcUtils.decodeMultiple(pattern)); - assertFalse(subscription.isAlive()); - assertTrue(subscription.getChannels().isEmpty()); - assertTrue(subscription.getPatterns().isEmpty()); - } - - @Test - public void testPUnsubscribeAllPatternsWithChannels() { - subscription.subscribe(new byte[][] { "a".getBytes() }); - byte[][] patterns = new byte[][] { "s*".getBytes() }; - subscription.pSubscribe(patterns); - subscription.pUnsubscribe(); - verify(subscriber, never()).close(); - verify(subscriber, times(1)).punsubscribe(RjcUtils.decodeMultiple(patterns)); - assertTrue(subscription.isAlive()); - assertTrue(subscription.getPatterns().isEmpty()); - Collection channels = subscription.getChannels(); - assertEquals(1, channels.size()); - assertArrayEquals("a".getBytes(), channels.iterator().next()); - } - - @Test - public void testPUnsubscribeAndClose() { - byte[][] pattern = new byte[][] { "a*".getBytes() }; - subscription.pSubscribe(pattern); - subscription.pUnsubscribe(pattern); - verify(subscriber, never()).close(); - verify(subscriber, times(1)).punsubscribe(RjcUtils.decodeMultiple(pattern)); - assertFalse(subscription.isAlive()); - assertTrue(subscription.getChannels().isEmpty()); - assertTrue(subscription.getPatterns().isEmpty()); - } - - @Test - public void testPUnsubscribePatternSomeLeft() { - byte[][] patterns = new byte[][] { "a*".getBytes(), "b*".getBytes() }; - subscription.pSubscribe(patterns); - byte[][] pattern = new byte[][] { "a*".getBytes() }; - subscription.pUnsubscribe(pattern); - verify(subscriber, times(1)).punsubscribe(RjcUtils.decodeMultiple(pattern)); - verify(subscriber, never()).close(); - assertTrue(subscription.isAlive()); - Collection subPatterns = subscription.getPatterns(); - assertEquals(1, subPatterns.size()); - assertArrayEquals("b*".getBytes(), subPatterns.iterator().next()); - assertTrue(subscription.getChannels().isEmpty()); - } - - @Test - public void testPUnsubscribePatternWithChannels() { - byte[][] pattern = new byte[][] { "s*".getBytes() }; - subscription.subscribe(new byte[][] { "a".getBytes() }); - subscription.pSubscribe(pattern); - subscription.pUnsubscribe(pattern); - verify(subscriber, times(1)).punsubscribe(RjcUtils.decodeMultiple(pattern)); - verify(subscriber, never()).close(); - assertTrue(subscription.isAlive()); - assertTrue(subscription.getPatterns().isEmpty()); - Collection channels = subscription.getChannels(); - assertEquals(1, channels.size()); - assertArrayEquals("a".getBytes(), channels.iterator().next()); - } - - @Test - public void testUnsubscribePatternWithChannelsSomeLeft() { - byte[][] pattern = new byte[][] { "a*".getBytes() }; - subscription.pSubscribe(new byte[][] { "a*".getBytes(), "b*".getBytes() }); - subscription.subscribe(new byte[][] { "a".getBytes() }); - subscription.pUnsubscribe(pattern); - verify(subscriber, never()).close(); - verify(subscriber, times(1)).punsubscribe(RjcUtils.decodeMultiple(pattern)); - assertTrue(subscription.isAlive()); - Collection channels = subscription.getChannels(); - assertEquals(1, channels.size()); - assertArrayEquals("a".getBytes(), channels.iterator().next()); - Collection patterns = subscription.getPatterns(); - assertEquals(1, patterns.size()); - assertArrayEquals("b*".getBytes(), patterns.iterator().next()); - } - - @Test - public void testPUnsubscribeAllNoPatterns() { - subscription.subscribe(new byte[][] { "s".getBytes() }); - subscription.pUnsubscribe(); - verify(subscriber, never()).close(); - assertTrue(subscription.isAlive()); - assertTrue(subscription.getPatterns().isEmpty()); - Collection channels = subscription.getChannels(); - assertEquals(1, channels.size()); - assertArrayEquals("s".getBytes(), channels.iterator().next()); - } - - @Test - public void testPUnsubscribeNotAlive() { - byte[][] channels = new byte[][] { "a".getBytes() }; - subscription.subscribe(channels); - subscription.unsubscribe(); - assertFalse(subscription.isAlive()); - subscription.pUnsubscribe(); - verify(subscriber, times(1)).unsubscribe(RjcUtils.decodeMultiple(channels)); - verify(subscriber, never()).close(); - } - - @Test(expected = RedisInvalidSubscriptionException.class) - public void testPSubscribeNotAlive() { - subscription.subscribe(new byte[][] { "a".getBytes() }); - subscription.unsubscribe(); - assertFalse(subscription.isAlive()); - subscription.pSubscribe(new byte[][] { "s*".getBytes() }); - } - - @Test - public void testDoCloseNotSubscribed() { - subscription.doClose(); - verify(subscriber, never()).close(); - } - - @Test - public void testDoCloseSubscribedChannels() { - subscription.subscribe(new byte[][] { "a".getBytes() }); - subscription.doClose(); - verify(subscriber, times(1)).close(); - } - - @Test - public void testDoCloseSubscribedPatterns() { - subscription.pSubscribe(new byte[][] { "a*".getBytes() }); - subscription.doClose(); - verify(subscriber, times(1)).close(); - } - -} diff --git a/src/test/java/org/springframework/data/redis/core/TemplateTest.java b/src/test/java/org/springframework/data/redis/core/TemplateTest.java index 15a18720b..a54a2f9a2 100644 --- a/src/test/java/org/springframework/data/redis/core/TemplateTest.java +++ b/src/test/java/org/springframework/data/redis/core/TemplateTest.java @@ -71,11 +71,6 @@ public class TemplateTest { @Test public void testIncrement() throws Exception { - // disable in case of Rjc - if (ConnectionUtils.isRjc(template.getConnectionFactory())) { - return; - } - StringRedisTemplate sr = new StringRedisTemplate(template.getConnectionFactory()); String key = "test.template.inc"; ValueOperations valueOps = sr.opsForValue(); diff --git a/src/test/java/org/springframework/data/redis/listener/PubSubTestParams.java b/src/test/java/org/springframework/data/redis/listener/PubSubTestParams.java index 1a683a11b..a95bc7fb6 100644 --- a/src/test/java/org/springframework/data/redis/listener/PubSubTestParams.java +++ b/src/test/java/org/springframework/data/redis/listener/PubSubTestParams.java @@ -22,7 +22,6 @@ import org.springframework.data.redis.Person; import org.springframework.data.redis.SettingsUtils; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; -import org.springframework.data.redis.connection.rjc.RjcConnectionFactory; import org.springframework.data.redis.connection.srp.SrpConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate; @@ -54,18 +53,6 @@ public class PubSubTestParams { personTemplate.setConnectionFactory(jedisConnFactory); personTemplate.afterPropertiesSet(); - // create RJC - RjcConnectionFactory rjcConnFactory = new RjcConnectionFactory(); - rjcConnFactory.setUsePool(true); - rjcConnFactory.setPort(SettingsUtils.getPort()); - rjcConnFactory.setHostName(SettingsUtils.getHost()); - rjcConnFactory.afterPropertiesSet(); - - RedisTemplate stringTemplateRJC = new StringRedisTemplate(rjcConnFactory); - RedisTemplate personTemplateRJC = new RedisTemplate(); - personTemplateRJC.setConnectionFactory(rjcConnFactory); - personTemplateRJC.afterPropertiesSet(); - // add Lettuce LettuceConnectionFactory lettuceConnFactory = new LettuceConnectionFactory(); lettuceConnFactory.setPort(SettingsUtils.getPort()); @@ -91,7 +78,6 @@ public class PubSubTestParams { // JRedis does not support pub/sub return Arrays.asList(new Object[][] { { stringFactory, stringTemplate }, { personFactory, personTemplate }, - { stringFactory, stringTemplateRJC }, { personFactory, personTemplateRJC }, { stringFactory, stringTemplateLtc }, { personFactory, personTemplateLtc }, { stringFactory, stringTemplateSrp }, { personFactory, personTemplateSrp } }); diff --git a/src/test/java/org/springframework/data/redis/listener/SubscriptionConnectionTests.java b/src/test/java/org/springframework/data/redis/listener/SubscriptionConnectionTests.java index 87f703dde..5baea36fe 100644 --- a/src/test/java/org/springframework/data/redis/listener/SubscriptionConnectionTests.java +++ b/src/test/java/org/springframework/data/redis/listener/SubscriptionConnectionTests.java @@ -35,7 +35,6 @@ import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; -import org.springframework.data.redis.connection.rjc.RjcConnectionFactory; import org.springframework.data.redis.connection.srp.SrpConnectionFactory; import org.springframework.data.redis.listener.adapter.MessageListenerAdapter; @@ -104,15 +103,8 @@ public class SubscriptionConnectionTests { srpConnFactory.setHostName(SettingsUtils.getHost()); srpConnFactory.afterPropertiesSet(); - // RJC - RjcConnectionFactory rjcConnFactory = new RjcConnectionFactory(); - rjcConnFactory.setPort(SettingsUtils.getPort()); - rjcConnFactory.setHostName(SettingsUtils.getHost()); - rjcConnFactory.setDatabase(2); - rjcConnFactory.afterPropertiesSet(); - return Arrays.asList(new Object[][] { { jedisConnFactory }, { lettuceConnFactory }, - { srpConnFactory }, { rjcConnFactory } }); + { srpConnFactory } }); } @Test diff --git a/src/test/java/org/springframework/data/redis/support/BoundKeyParams.java b/src/test/java/org/springframework/data/redis/support/BoundKeyParams.java index f7460247b..2c6edf06f 100644 --- a/src/test/java/org/springframework/data/redis/support/BoundKeyParams.java +++ b/src/test/java/org/springframework/data/redis/support/BoundKeyParams.java @@ -22,7 +22,6 @@ import org.springframework.data.redis.SettingsUtils; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; import org.springframework.data.redis.connection.jredis.JredisConnectionFactory; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; -import org.springframework.data.redis.connection.rjc.RjcConnectionFactory; import org.springframework.data.redis.connection.srp.SrpConnectionFactory; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.support.atomic.RedisAtomicInteger; @@ -84,17 +83,6 @@ public class BoundKeyParams { RedisList listSRP = new DefaultRedisList("bound:key:listSRP", templateSRP); - // RJC - RjcConnectionFactory rjcConnFactory = new RjcConnectionFactory(); - rjcConnFactory.setPort(SettingsUtils.getPort()); - rjcConnFactory.setHostName(SettingsUtils.getHost()); - rjcConnFactory.afterPropertiesSet(); - - StringRedisTemplate templateRJC = new StringRedisTemplate(rjcConnFactory); - DefaultRedisMap mapRJC = new DefaultRedisMap("bound:key:mapRJC", templateRJC); - DefaultRedisSet setRJC = new DefaultRedisSet("bound:key:setRJC", templateRJC); - RedisList listRJC = new DefaultRedisList("bound:key:listRJC", templateRJC); - StringObjectFactory sof = new StringObjectFactory(); return Arrays.asList(new Object[][] { @@ -109,9 +97,6 @@ public class BoundKeyParams { { listLT, sof, templateLT }, { setLT, sof, templateLT }, { mapLT, sof, templateLT }, { new RedisAtomicInteger("bound:key:intSrp", srpConnFactory), sof, templateSRP }, { new RedisAtomicLong("bound:key:longSrp", srpConnFactory), sof, templateSRP }, - { listSRP, sof, templateSRP }, { setSRP, sof, templateSRP }, { mapSRP, sof, templateSRP }, - { new RedisAtomicInteger("bound:key:intRjc", rjcConnFactory), sof, templateRJC }, - { new RedisAtomicLong("bound:key:longRjc", rjcConnFactory), sof, templateRJC }, - { listRJC, sof, templateRJC }, { setRJC, sof, templateRJC }, { mapRJC, sof, templateRJC }}); + { listSRP, sof, templateSRP }, { setSRP, sof, templateSRP }, { mapSRP, sof, templateSRP }}); } } diff --git a/src/test/java/org/springframework/data/redis/support/atomic/AtomicCountersParam.java b/src/test/java/org/springframework/data/redis/support/atomic/AtomicCountersParam.java index e1d260ebe..19ded6fe5 100644 --- a/src/test/java/org/springframework/data/redis/support/atomic/AtomicCountersParam.java +++ b/src/test/java/org/springframework/data/redis/support/atomic/AtomicCountersParam.java @@ -22,7 +22,6 @@ import org.springframework.data.redis.SettingsUtils; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; import org.springframework.data.redis.connection.jredis.JredisConnectionFactory; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; -import org.springframework.data.redis.connection.rjc.RjcConnectionFactory; import org.springframework.data.redis.connection.srp.SrpConnectionFactory; /** @@ -58,14 +57,8 @@ public abstract class AtomicCountersParam { srpConnFactory.setHostName(SettingsUtils.getHost()); srpConnFactory.afterPropertiesSet(); - // RJC - RjcConnectionFactory rjcConnFactory = new RjcConnectionFactory(); - rjcConnFactory.setPort(SettingsUtils.getPort()); - rjcConnFactory.setHostName(SettingsUtils.getHost()); - rjcConnFactory.afterPropertiesSet(); - return Arrays.asList(new Object[][] { { jedisConnFactory }, { jredisConnFactory}, { lettuceConnFactory }, - { srpConnFactory}, { rjcConnFactory } }); + { srpConnFactory} }); } } diff --git a/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicTests.java b/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicTests.java index c27f00022..e69ecd07b 100644 --- a/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicTests.java +++ b/src/test/java/org/springframework/data/redis/support/atomic/RedisAtomicTests.java @@ -93,24 +93,18 @@ public class RedisAtomicTests { @Test public void testLongIncrement() throws Exception { - // DATAREDIS-121 incr/decr broken in RJC - assumeTrue(!ConnectionUtils.isRjc(factory)); longCounter.set(0); assertEquals(1, longCounter.incrementAndGet()); } @Test public void testIntIncrement() throws Exception { - // DATAREDIS-121 incr/decr broken in RJC - assumeTrue(!ConnectionUtils.isRjc(factory)); intCounter.set(0); assertEquals(1, intCounter.incrementAndGet()); } @Test public void testLongCustomIncrement() throws Exception { - // DATAREDIS-121 incr/decr broken in RJC - assumeTrue(!ConnectionUtils.isRjc(factory)); longCounter.set(0); long delta = 5; assertEquals(delta, longCounter.addAndGet(delta)); @@ -118,8 +112,6 @@ public class RedisAtomicTests { @Test public void testIntCustomIncrement() throws Exception { - // DATAREDIS-121 incr/decr broken in RJC - assumeTrue(!ConnectionUtils.isRjc(factory)); intCounter.set(0); int delta = 5; assertEquals(delta, intCounter.addAndGet(delta)); @@ -127,16 +119,12 @@ public class RedisAtomicTests { @Test public void testLongDecrement() throws Exception { - // DATAREDIS-121 incr/decr broken in RJC - assumeTrue(!ConnectionUtils.isRjc(factory)); longCounter.set(1); assertEquals(0, longCounter.decrementAndGet()); } @Test public void testIntDecrement() throws Exception { - // DATAREDIS-121 incr/decr broken in RJC - assumeTrue(!ConnectionUtils.isRjc(factory)); intCounter.set(1); assertEquals(0, intCounter.decrementAndGet()); } diff --git a/src/test/java/org/springframework/data/redis/support/collections/CollectionTestParams.java b/src/test/java/org/springframework/data/redis/support/collections/CollectionTestParams.java index d22b2b4ad..771686698 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/CollectionTestParams.java +++ b/src/test/java/org/springframework/data/redis/support/collections/CollectionTestParams.java @@ -23,7 +23,6 @@ import org.springframework.data.redis.SettingsUtils; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; import org.springframework.data.redis.connection.jredis.JredisConnectionFactory; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; -import org.springframework.data.redis.connection.rjc.RjcConnectionFactory; import org.springframework.data.redis.connection.srp.SrpConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate; @@ -109,34 +108,6 @@ public abstract class CollectionTestParams { jsonPersonTemplateJR.setConnectionFactory(jredisConnFactory); jsonPersonTemplateJR.afterPropertiesSet(); - - // rjc - RjcConnectionFactory rjcConnFactory = new RjcConnectionFactory(); - rjcConnFactory.setUsePool(true); - rjcConnFactory.setPort(SettingsUtils.getPort()); - rjcConnFactory.setHostName(SettingsUtils.getHost()); - rjcConnFactory.afterPropertiesSet(); - - RedisTemplate stringTemplateRJC = new StringRedisTemplate(rjcConnFactory); - RedisTemplate personTemplateRJC = new RedisTemplate(); - personTemplateRJC.setConnectionFactory(rjcConnFactory); - personTemplateRJC.afterPropertiesSet(); - - RedisTemplate xstreamStringTemplateRJC = new RedisTemplate(); - xstreamStringTemplateRJC.setConnectionFactory(rjcConnFactory); - xstreamStringTemplateRJC.setDefaultSerializer(serializer); - xstreamStringTemplateRJC.afterPropertiesSet(); - - RedisTemplate xstreamPersonTemplateRJC = new RedisTemplate(); - xstreamPersonTemplateRJC.setValueSerializer(serializer); - xstreamPersonTemplateRJC.setConnectionFactory(rjcConnFactory); - xstreamPersonTemplateRJC.afterPropertiesSet(); - - RedisTemplate jsonPersonTemplateRJC = new RedisTemplate(); - jsonPersonTemplateRJC.setValueSerializer(jsonSerializer); - jsonPersonTemplateRJC.setConnectionFactory(rjcConnFactory); - jsonPersonTemplateRJC.afterPropertiesSet(); - // SRP SrpConnectionFactory srConnFactory = new SrpConnectionFactory(); srConnFactory.setPort(SettingsUtils.getPort()); @@ -189,8 +160,7 @@ public abstract class CollectionTestParams { jsonPersonTemplateLtc.setConnectionFactory(lettuceConnFactory); jsonPersonTemplateLtc.afterPropertiesSet(); - return Arrays.asList(new Object[][] { { stringFactory, stringTemplate }, { stringFactory, stringTemplateRJC }, - { personFactory, personTemplateRJC }, + return Arrays.asList(new Object[][] { { stringFactory, stringTemplate }, //{ stringFactory, stringTemplateJR }, //{ personFactory, personTemplateJR }, { personFactory, personTemplate }, @@ -199,9 +169,6 @@ public abstract class CollectionTestParams { //{ personFactory, xstreamPersonTemplateJR }, { personFactory, jsonPersonTemplate }, //{ personFactory, jsonPersonTemplateJR }, - // rjc - { stringFactory, xstreamStringTemplateRJC }, { personFactory, xstreamPersonTemplateRJC }, - { personFactory, jsonPersonTemplateRJC }, // srp { stringFactory, stringTemplateSRP },{ personFactory, personTemplateSRP }, { stringFactory, xstreamStringTemplateSRP }, { personFactory, xstreamPersonTemplateSRP }, diff --git a/src/test/java/org/springframework/data/redis/support/collections/RedisMapTests.java b/src/test/java/org/springframework/data/redis/support/collections/RedisMapTests.java index d32e454e2..c3b1f07cb 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/RedisMapTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/RedisMapTests.java @@ -24,13 +24,10 @@ import org.springframework.data.redis.SettingsUtils; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; import org.springframework.data.redis.connection.jredis.JredisConnectionFactory; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; -import org.springframework.data.redis.connection.rjc.RjcConnectionFactory; import org.springframework.data.redis.connection.srp.SrpConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.serializer.JacksonJsonRedisSerializer; import org.springframework.data.redis.serializer.OxmSerializer; -import org.springframework.data.redis.support.collections.DefaultRedisMap; -import org.springframework.data.redis.support.collections.RedisMap; import org.springframework.oxm.xstream.XStreamMarshaller; /** @@ -113,29 +110,6 @@ public class RedisMapTests extends AbstractRedisMapTests { jsonPersonTemplateJR.setHashValueSerializer(jsonStringSerializer); jsonPersonTemplateJR.afterPropertiesSet(); - // RJC - RjcConnectionFactory rjcConnFactory = new RjcConnectionFactory(); - rjcConnFactory.setUsePool(true); - rjcConnFactory.setPort(SettingsUtils.getPort()); - rjcConnFactory.setHostName(SettingsUtils.getHost()); - rjcConnFactory.afterPropertiesSet(); - - RedisTemplate genericTemplateRJC = new RedisTemplate(); - genericTemplateRJC.setConnectionFactory(rjcConnFactory); - genericTemplateRJC.afterPropertiesSet(); - - RedisTemplate xGenericTemplateRJC = new RedisTemplate(); - xGenericTemplateRJC.setConnectionFactory(rjcConnFactory); - xGenericTemplateRJC.setDefaultSerializer(serializer); - xGenericTemplateRJC.afterPropertiesSet(); - - RedisTemplate jsonPersonTemplateRJC = new RedisTemplate(); - jsonPersonTemplateRJC.setConnectionFactory(rjcConnFactory); - jsonPersonTemplateRJC.setDefaultSerializer(jsonSerializer); - jsonPersonTemplateRJC.setHashKeySerializer(jsonSerializer); - jsonPersonTemplateRJC.setHashValueSerializer(jsonStringSerializer); - jsonPersonTemplateRJC.afterPropertiesSet(); - // Lettuce LettuceConnectionFactory lettuceConnFactory = new LettuceConnectionFactory(); lettuceConnFactory.setPort(SettingsUtils.getPort()); @@ -194,12 +168,6 @@ public class RedisMapTests extends AbstractRedisMapTests { { personFactory, stringFactory, genericTemplateJR }, { personFactory, stringFactory, xGenericTemplateJR }, { personFactory, stringFactory, jsonPersonTemplateJR }, - { stringFactory, stringFactory, genericTemplateRJC }, - { personFactory, personFactory, genericTemplateRJC }, - { stringFactory, personFactory, genericTemplateRJC }, - { personFactory, stringFactory, genericTemplateRJC }, - { personFactory, stringFactory, xGenericTemplateRJC }, - { personFactory, stringFactory, jsonPersonTemplateRJC }, { stringFactory, stringFactory, genericTemplateLettuce }, { personFactory, personFactory, genericTemplateLettuce }, { stringFactory, personFactory, genericTemplateLettuce }, diff --git a/src/test/java/org/springframework/data/redis/support/collections/RedisPropertiesTests.java b/src/test/java/org/springframework/data/redis/support/collections/RedisPropertiesTests.java index e0d5b4a8e..544b84682 100644 --- a/src/test/java/org/springframework/data/redis/support/collections/RedisPropertiesTests.java +++ b/src/test/java/org/springframework/data/redis/support/collections/RedisPropertiesTests.java @@ -40,7 +40,6 @@ import org.springframework.data.redis.SettingsUtils; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; import org.springframework.data.redis.connection.jredis.JredisConnectionFactory; import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; -import org.springframework.data.redis.connection.rjc.RjcConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.serializer.JacksonJsonRedisSerializer; @@ -278,27 +277,6 @@ public class RedisPropertiesTests extends RedisMapTests { jsonPersonTemplateJR.setHashValueSerializer(jsonStringSerializer); jsonPersonTemplateJR.afterPropertiesSet(); - // RJC - - // rjc - RjcConnectionFactory rjcConnFactory = new RjcConnectionFactory(); - rjcConnFactory.setUsePool(true); - rjcConnFactory.setPort(SettingsUtils.getPort()); - rjcConnFactory.setHostName(SettingsUtils.getHost()); - rjcConnFactory.afterPropertiesSet(); - - RedisTemplate genericTemplateRJC = new StringRedisTemplate(jredisConnFactory); - RedisTemplate xGenericTemplateRJC = new RedisTemplate(); - xGenericTemplateRJC.setConnectionFactory(rjcConnFactory); - xGenericTemplateRJC.setDefaultSerializer(serializer); - xGenericTemplateRJC.afterPropertiesSet(); - - RedisTemplate jsonPersonTemplateRJC = new RedisTemplate(); - jsonPersonTemplateRJC.setConnectionFactory(rjcConnFactory); - jsonPersonTemplateRJC.setDefaultSerializer(jsonSerializer); - jsonPersonTemplateRJC.setHashKeySerializer(jsonSerializer); - jsonPersonTemplateRJC.setHashValueSerializer(jsonStringSerializer); - jsonPersonTemplateRJC.afterPropertiesSet(); // Lettuce LettuceConnectionFactory lettuceConnFactory = new LettuceConnectionFactory(); @@ -331,12 +309,6 @@ public class RedisPropertiesTests extends RedisMapTests { { stringFactory, stringFactory, xGenericTemplateJR }, { stringFactory, stringFactory, jsonPersonTemplate }, { stringFactory, stringFactory, jsonPersonTemplateJR }, - { stringFactory, stringFactory, genericTemplateRJC }, - { stringFactory, stringFactory, genericTemplateRJC }, - { stringFactory, stringFactory, genericTemplateRJC }, - { stringFactory, stringFactory, genericTemplateRJC }, - { stringFactory, stringFactory, xGenericTemplateRJC }, - { stringFactory, stringFactory, jsonPersonTemplateRJC }, { stringFactory, stringFactory, genericTemplateLtc }, { stringFactory, stringFactory, genericTemplateLtc }, { stringFactory, stringFactory, genericTemplateLtc },