You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/06/26 08:01:00 UTC

[4/5] git commit: CAMEL-7541 fixed the issue of RedisIdempotentRepository doesn't work out of box

CAMEL-7541 fixed the issue of RedisIdempotentRepository doesn't work out of box


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ab468841
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ab468841
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ab468841

Branch: refs/heads/master
Commit: ab46884160dcb8988208732734b9e15ad31a844b
Parents: e0c7ac4
Author: Willem Jiang <wi...@gmail.com>
Authored: Thu Jun 26 11:17:23 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Thu Jun 26 12:03:12 2014 +0800

----------------------------------------------------------------------
 components/camel-spring-redis/pom.xml                         | 7 ++++++-
 .../redis/processor/idempotent/RedisIdempotentRepository.java | 7 ++++++-
 .../component/redis/RedisComponentSpringIntegrationTest.java  | 2 +-
 3 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ab468841/components/camel-spring-redis/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring-redis/pom.xml b/components/camel-spring-redis/pom.xml
index 7129da7..9b18a5d 100755
--- a/components/camel-spring-redis/pom.xml
+++ b/components/camel-spring-redis/pom.xml
@@ -45,7 +45,7 @@
             <artifactId>spring-data-redis</artifactId>
             <version>${spring-data-redis-version}</version>
         </dependency>
-
+        <!-- need to add the dependency of jedis as redis client lib -->
         <dependency>
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-test</artifactId>
@@ -71,6 +71,11 @@
             <artifactId>log4j</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>commons-pool</groupId>
+            <artifactId>commons-pool</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
 </project>

http://git-wip-us.apache.org/repos/asf/camel/blob/ab468841/components/camel-spring-redis/src/main/java/org/apache/camel/component/redis/processor/idempotent/RedisIdempotentRepository.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-redis/src/main/java/org/apache/camel/component/redis/processor/idempotent/RedisIdempotentRepository.java b/components/camel-spring-redis/src/main/java/org/apache/camel/component/redis/processor/idempotent/RedisIdempotentRepository.java
index 36c3c98..aad2da8 100755
--- a/components/camel-spring-redis/src/main/java/org/apache/camel/component/redis/processor/idempotent/RedisIdempotentRepository.java
+++ b/components/camel-spring-redis/src/main/java/org/apache/camel/component/redis/processor/idempotent/RedisIdempotentRepository.java
@@ -54,7 +54,11 @@ public class RedisIdempotentRepository extends ServiceSupport implements Idempot
 
     @ManagedOperation(description = "Adds the key to the store")
     public boolean add(String key) {
-        return setOperations.add(processorName, key) != null;
+        if (!contains(key)) { 
+            return setOperations.add(processorName, key) != null;
+        } else {
+            return false;
+        }
     }
 
     @ManagedOperation(description = "Does the store contain the given key")
@@ -64,6 +68,7 @@ public class RedisIdempotentRepository extends ServiceSupport implements Idempot
 
     @ManagedOperation(description = "Remove the key from the store")
     public boolean remove(String key) {
+        System.out.println("Remove the key" + key);
         return setOperations.remove(processorName, key) != null;
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/ab468841/components/camel-spring-redis/src/test/java/org/apache/camel/component/redis/RedisComponentSpringIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-redis/src/test/java/org/apache/camel/component/redis/RedisComponentSpringIntegrationTest.java b/components/camel-spring-redis/src/test/java/org/apache/camel/component/redis/RedisComponentSpringIntegrationTest.java
index f2d5758..d8548bd 100755
--- a/components/camel-spring-redis/src/test/java/org/apache/camel/component/redis/RedisComponentSpringIntegrationTest.java
+++ b/components/camel-spring-redis/src/test/java/org/apache/camel/component/redis/RedisComponentSpringIntegrationTest.java
@@ -26,7 +26,7 @@ import org.junit.Ignore;
 import org.junit.Test;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
-@Ignore
+@Ignore ("IntegrationTest")
 public class RedisComponentSpringIntegrationTest extends CamelSpringTestSupport {
 
     @EndpointInject(uri = "direct:start")