You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sd...@apache.org on 2022/03/04 11:04:12 UTC

[ignite-3] 12/12: .

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

sdanilov pushed a commit to branch ignite-16393
in repository https://gitbox.apache.org/repos/asf/ignite-3.git

commit 97f6c4e2e024686754fea95cd5a96a9ae1c8b613
Author: Semyon Danilov <sa...@yandex.ru>
AuthorDate: Fri Mar 4 13:59:19 2022 +0300

    .
---
 .../raft/server/ItJraftCounterServerTest.java      | 42 ++++++----------------
 1 file changed, 11 insertions(+), 31 deletions(-)

diff --git a/modules/raft/src/integrationTest/java/org/apache/ignite/raft/server/ItJraftCounterServerTest.java b/modules/raft/src/integrationTest/java/org/apache/ignite/raft/server/ItJraftCounterServerTest.java
index c329f76..80b81b4 100644
--- a/modules/raft/src/integrationTest/java/org/apache/ignite/raft/server/ItJraftCounterServerTest.java
+++ b/modules/raft/src/integrationTest/java/org/apache/ignite/raft/server/ItJraftCounterServerTest.java
@@ -569,44 +569,24 @@ class ItJraftCounterServerTest extends RaftServerAbstractTest {
         listenerFactory = () -> new CounterListener() {
             @Override
             public void onWrite(Iterator<CommandClosure<WriteCommand>> iterator) {
-                Iterator<CommandClosure<WriteCommand>> wrapper = new Iterator<>() {
-                    @Override
-                    public boolean hasNext() {
-                        return iterator.hasNext();
-                    }
+                while (iterator.hasNext()) {
+                    CommandClosure<WriteCommand> clo = iterator.next();
 
-                    @Override
-                    public CommandClosure<WriteCommand> next() {
-                        CommandClosure<WriteCommand> cmd = iterator.next();
-
-                        cmd.result(new RuntimeException("Expected message"));
-
-                        return cmd;
-                    }
-                };
+                    IncrementAndGetCommand cmd0 = (IncrementAndGetCommand) clo.command();
 
-                super.onWrite(wrapper);
+                    clo.result(new RuntimeException("Expected message"));
+                }
             }
 
             @Override
             public void onRead(Iterator<CommandClosure<ReadCommand>> iterator) {
-                Iterator<CommandClosure<ReadCommand>> wrapper = new Iterator<>() {
-                    @Override
-                    public boolean hasNext() {
-                        return iterator.hasNext();
-                    }
+                while (iterator.hasNext()) {
+                    CommandClosure<ReadCommand> clo = iterator.next();
 
-                    @Override
-                    public CommandClosure<ReadCommand> next() {
-                        CommandClosure<ReadCommand> cmd = iterator.next();
+                    assert clo.command() instanceof GetValueCommand;
 
-                        cmd.result(new RuntimeException("Another expected message"));
-
-                        return cmd;
-                    }
-                };
-
-                super.onRead(wrapper);
+                    clo.result(new RuntimeException("Another expected message"));
+                }
             }
         };
 
@@ -624,7 +604,7 @@ class ItJraftCounterServerTest extends RaftServerAbstractTest {
         assertNotNull(leader);
 
         try {
-            client1.<Long>run(new IncrementAndGetCommand(0)).get();
+            Long aLong = client1.<Long>run(new IncrementAndGetCommand(3)).get();
 
             fail();
         } catch (Exception e) {