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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]