This is an automated email from the ASF dual-hosted git repository.

bschuchardt pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new ca7ea46  GEODE-5283: Client transaction fails with 
TransactionException: GemFireInternalException
ca7ea46 is described below

commit ca7ea4636451b8b42342ad8598f44ef768a006d2
Author: Bruce Schuchardt <[email protected]>
AuthorDate: Tue Jun 5 14:19:37 2018 -0700

    GEODE-5283: Client transaction fails with TransactionException: 
GemFireInternalException
    
    Reverted changes allowing injection of a mock object into the product and
    rewrote the unit test to use Mockito.spy() instead.
---
 .../geode/internal/cache/tx/AbstractPeerTXRegionStub.java  |  2 +-
 .../geode/internal/cache/tx/RemoteFetchKeysMessage.java    |  4 ++--
 .../internal/cache/tx/AbstractPeerTXRegionStubTest.java    | 14 ++++++++------
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git 
a/geode-core/src/main/java/org/apache/geode/internal/cache/tx/AbstractPeerTXRegionStub.java
 
b/geode-core/src/main/java/org/apache/geode/internal/cache/tx/AbstractPeerTXRegionStub.java
index f9040de..1a8b0bb 100644
--- 
a/geode-core/src/main/java/org/apache/geode/internal/cache/tx/AbstractPeerTXRegionStub.java
+++ 
b/geode-core/src/main/java/org/apache/geode/internal/cache/tx/AbstractPeerTXRegionStub.java
@@ -41,7 +41,7 @@ public abstract class AbstractPeerTXRegionStub implements 
TXRegionStub {
     try {
       RemoteFetchKeysMessage.FetchKeysResponse response =
           RemoteFetchKeysMessage.send((LocalRegion) getRegion(), 
state.getTarget());
-      return response.waitForKeys(response);
+      return response.waitForKeys();
     } catch (RegionDestroyedException e) {
       throw new TransactionDataNotColocatedException(
           
LocalizedStrings.RemoteMessage_REGION_0_NOT_COLOCATED_WITH_TRANSACTION
diff --git 
a/geode-core/src/main/java/org/apache/geode/internal/cache/tx/RemoteFetchKeysMessage.java
 
b/geode-core/src/main/java/org/apache/geode/internal/cache/tx/RemoteFetchKeysMessage.java
index 266a6d0..aaf53b0 100644
--- 
a/geode-core/src/main/java/org/apache/geode/internal/cache/tx/RemoteFetchKeysMessage.java
+++ 
b/geode-core/src/main/java/org/apache/geode/internal/cache/tx/RemoteFetchKeysMessage.java
@@ -421,9 +421,9 @@ public class RemoteFetchKeysMessage extends 
RemoteOperationMessage {
     }
 
     @SuppressWarnings("rawtypes")
-    public Set waitForKeys(ReplyProcessor21 responseProcessor) {
+    public Set waitForKeys() {
       try {
-        responseProcessor.waitForRepliesUninterruptibly();
+        waitForRepliesUninterruptibly();
       } catch (ReplyException e) {
         if (e.getCause() instanceof RemoteOperationException) {
           if (e.getCause().getCause() instanceof CancelException) {
diff --git 
a/geode-core/src/test/java/org/apache/geode/internal/cache/tx/AbstractPeerTXRegionStubTest.java
 
b/geode-core/src/test/java/org/apache/geode/internal/cache/tx/AbstractPeerTXRegionStubTest.java
index b8e33a7..ec95258 100644
--- 
a/geode-core/src/test/java/org/apache/geode/internal/cache/tx/AbstractPeerTXRegionStubTest.java
+++ 
b/geode-core/src/test/java/org/apache/geode/internal/cache/tx/AbstractPeerTXRegionStubTest.java
@@ -28,6 +28,7 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.rules.ExpectedException;
+import org.mockito.Mockito;
 
 import org.apache.geode.CancelCriterion;
 import org.apache.geode.cache.CacheClosedException;
@@ -38,7 +39,6 @@ import 
org.apache.geode.cache.TransactionDataNotColocatedException;
 import org.apache.geode.distributed.internal.ClusterDistributionManager;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.ReplyException;
-import org.apache.geode.distributed.internal.ReplyProcessor21;
 import 
org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.cache.DistributedPutAllOperation;
 import org.apache.geode.internal.cache.DistributedRemoveAllOperation;
@@ -168,10 +168,6 @@ public class AbstractPeerTXRegionStubTest {
   public void getRegionKeysForIterationTranslatesRemoteOperationException() {
     expectedException.expect(TransactionDataNodeHasDepartedException.class);
 
-    ReplyProcessor21 replyProcessor = mock(ReplyProcessor21.class);
-    Exception replyException = new ReplyException("testing",
-        new RemoteOperationException("The cache is closing", new 
CacheClosedException()));
-    
doThrow(replyException).when(replyProcessor).waitForRepliesUninterruptibly();
 
     InternalDistributedSystem system = mock(InternalDistributedSystem.class);
     ClusterDistributionManager manager = 
mock(ClusterDistributionManager.class);
@@ -181,7 +177,13 @@ public class AbstractPeerTXRegionStubTest {
 
     RemoteFetchKeysMessage.FetchKeysResponse responseProcessor =
         new RemoteFetchKeysMessage.FetchKeysResponse(system, target);
-    responseProcessor.waitForKeys(replyProcessor);
+    RemoteFetchKeysMessage.FetchKeysResponse spy = 
Mockito.spy(responseProcessor);
+
+    Exception replyException = new ReplyException("testing",
+        new RemoteOperationException("The cache is closing", new 
CacheClosedException()));
+    doThrow(replyException).when(spy).waitForRepliesUninterruptibly();
+
+    spy.waitForKeys();
 
     fail(
         "Expected to transalate RemoteOperationException.CacheClosedException 
to TransactionDataNodeHasDepartedException ");

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to