CAMEL-8478: IdempotentRepository - Add clear operation, align HazelcastIdempotentRepository
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/da71c7b6 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/da71c7b6 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/da71c7b6 Branch: refs/heads/master Commit: da71c7b6b3349b46a3190140f23a368e2f5f835f Parents: e12ff48 Author: Andrea Cosentino <anco...@gmail.com> Authored: Fri Jul 3 17:07:52 2015 +0200 Committer: Andrea Cosentino <anco...@gmail.com> Committed: Fri Jul 3 17:07:52 2015 +0200 ---------------------------------------------------------------------- .../hazelcast/HazelcastIdempotentRepository.java | 6 +++++- .../hazelcast/HazelcastIdempotentRepositoryTest.java | 12 ++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/da71c7b6/components/camel-hazelcast/src/main/java/org/apache/camel/processor/idempotent/hazelcast/HazelcastIdempotentRepository.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/main/java/org/apache/camel/processor/idempotent/hazelcast/HazelcastIdempotentRepository.java b/components/camel-hazelcast/src/main/java/org/apache/camel/processor/idempotent/hazelcast/HazelcastIdempotentRepository.java index 4061240..fcd92ab 100644 --- a/components/camel-hazelcast/src/main/java/org/apache/camel/processor/idempotent/hazelcast/HazelcastIdempotentRepository.java +++ b/components/camel-hazelcast/src/main/java/org/apache/camel/processor/idempotent/hazelcast/HazelcastIdempotentRepository.java @@ -85,9 +85,13 @@ public class HazelcastIdempotentRepository extends ServiceSupport implements Ide repo.unlock(key); } } + + @Override + public void clear() { + repo.clear(); + } public String getRepositoryName() { return repositoryName; } - } http://git-wip-us.apache.org/repos/asf/camel/blob/da71c7b6/components/camel-hazelcast/src/test/java/org/apache/camel/processor/idempotent/hazelcast/HazelcastIdempotentRepositoryTest.java ---------------------------------------------------------------------- diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/processor/idempotent/hazelcast/HazelcastIdempotentRepositoryTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/processor/idempotent/hazelcast/HazelcastIdempotentRepositoryTest.java index 15fbae9..8d09d87 100644 --- a/components/camel-hazelcast/src/test/java/org/apache/camel/processor/idempotent/hazelcast/HazelcastIdempotentRepositoryTest.java +++ b/components/camel-hazelcast/src/test/java/org/apache/camel/processor/idempotent/hazelcast/HazelcastIdempotentRepositoryTest.java @@ -88,6 +88,18 @@ public class HazelcastIdempotentRepositoryTest extends CamelTestSupport { public void testRemove() throws Exception { // add key to remove assertTrue(repo.add(key01)); + assertTrue(repo.add(key02)); + assertEquals(2, cache.size()); + + // clear repo + repo.clear(); + assertEquals(0, cache.size()); + } + + @Test + public void testClear() throws Exception { + // add key to remove + assertTrue(repo.add(key01)); assertEquals(1, cache.size()); // remove key