You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/03/04 12:47:01 UTC

[GitHub] [ignite-3] ascherbakoff commented on a change in pull request #703: IGNITE-16624 Tx state replication fixed.

ascherbakoff commented on a change in pull request #703:
URL: https://github.com/apache/ignite-3/pull/703#discussion_r819540707



##########
File path: modules/table/src/test/java/org/apache/ignite/internal/table/InteropOperationsTest.java
##########
@@ -116,6 +125,26 @@
         TxManager txManager = new TxManagerImpl(clusterService, new HeapLockManager());
         txManager.start();
 
+        MessagingService messagingService = Mockito.mock(MessagingService.class, RETURNS_DEEP_STUBS);
+        Mockito.when(clusterService.messagingService()).thenReturn(messagingService);
+
+        doAnswer(
+                invocationClose -> {
+                    assert invocationClose.getArgument(1) instanceof TxFinishRequest;
+
+                    TxFinishRequest txFinishRequest = invocationClose.getArgument(1);
+
+                    if (txFinishRequest.commit()) {
+                        txManager.commitAsync(txFinishRequest.timestamp()).get();
+                    } else {
+                        txManager.rollbackAsync(txFinishRequest.timestamp()).get();
+                    }
+
+                    return CompletableFuture.completedFuture(mock(TxFinishResponse.class));
+                }
+        ).when(messagingService)
+                .invoke(any(NetworkAddress.class), any(TxFinishRequest.class), anyLong());

Review comment:
       Here and below a lot of copypaste. You can create some kind of TestMessagingService to avoid this.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org