geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From upthewatersp...@apache.org
Subject geode git commit: Make sure IndexRepositorySpy doesn't mock the same object twice
Date Fri, 17 Feb 2017 01:55:08 GMT
Repository: geode
Updated Branches:
  refs/heads/develop 988bf04da -> e9b4250fe


Make sure IndexRepositorySpy doesn't mock the same object twice

In some cases we can retry an operation and end up trying to spy a spy.


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

Branch: refs/heads/develop
Commit: e9b4250fe57818ae5e81aaefc8777a18d672cbdd
Parents: 988bf04
Author: Dan Smith <upthewaterspout@apache.org>
Authored: Thu Feb 16 17:34:46 2017 -0800
Committer: Dan Smith <upthewaterspout@apache.org>
Committed: Thu Feb 16 17:51:45 2017 -0800

----------------------------------------------------------------------
 .../org/apache/geode/cache/lucene/test/IndexRepositorySpy.java   | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/e9b4250f/geode-lucene/src/test/java/org/apache/geode/cache/lucene/test/IndexRepositorySpy.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/test/IndexRepositorySpy.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/test/IndexRepositorySpy.java
index aac3f97..5fd2abe 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/test/IndexRepositorySpy.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/test/IndexRepositorySpy.java
@@ -58,6 +58,10 @@ public class IndexRepositorySpy extends IndexRepositoryFactory {
     if (indexRepo == null) {
       return null;
     }
+    if (mockingDetails(indexRepo).isSpy()) {
+      return indexRepo;
+    }
+
     final IndexRepository spy = Mockito.spy(indexRepo);
 
     Answer invokeBeforeWrite = invocation -> {


Mime
View raw message