sashapolo commented on a change in pull request #340: URL: https://github.com/apache/ignite-3/pull/340#discussion_r719478896
########## File path: modules/raft/src/integrationTest/java/org/apache/ignite/internal/raft/ITLozaTest.java ########## @@ -0,0 +1,165 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.raft; + +import java.io.IOException; +import java.nio.file.Path; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import org.apache.ignite.internal.testframework.WorkDirectory; +import org.apache.ignite.internal.testframework.WorkDirectoryExtension; +import org.apache.ignite.network.ClusterNode; +import org.apache.ignite.network.ClusterService; +import org.apache.ignite.network.ClusterServiceFactory; +import org.apache.ignite.network.MessageSerializationRegistryImpl; +import org.apache.ignite.network.MessagingService; +import org.apache.ignite.network.NetworkAddress; +import org.apache.ignite.network.NetworkMessage; +import org.apache.ignite.network.StaticNodeFinder; +import org.apache.ignite.network.scalecube.TestScaleCubeClusterServiceFactory; +import org.apache.ignite.network.serialization.MessageSerializationRegistry; +import org.apache.ignite.raft.client.service.RaftGroupListener; +import org.apache.ignite.utils.ClusterServiceTestUtils; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInfo; +import org.junit.jupiter.api.extension.ExtendWith; + +import static org.apache.ignite.raft.jraft.test.TestUtils.getLocalAddress; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsString; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +/** + * Tests for {@link Loza} functionality. + */ +@ExtendWith(WorkDirectoryExtension.class) +public class ITLozaTest { + /** Node's name. */ + private static final String NODE_NAME = "node1"; + + /** Network factory. */ + private static final ClusterServiceFactory NETWORK_FACTORY = new TestScaleCubeClusterServiceFactory(); + + /** Server port offset. */ + private static final int PORT = 20010; + + /** */ + private static final MessageSerializationRegistry SERIALIZATION_REGISTRY = new MessageSerializationRegistryImpl(); + + /** */ + @WorkDirectory + private Path dataPath; + + /** Test node. */ + private final ClusterNode node = new ClusterNode( Review comment: Discussed in person, this field is redundant and causes the Raft service to fail while electing a leader ########## File path: modules/raft/src/integrationTest/java/org/apache/ignite/internal/raft/ITLozaTest.java ########## @@ -0,0 +1,165 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.raft; + +import java.io.IOException; +import java.nio.file.Path; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import org.apache.ignite.internal.testframework.WorkDirectory; +import org.apache.ignite.internal.testframework.WorkDirectoryExtension; +import org.apache.ignite.network.ClusterNode; +import org.apache.ignite.network.ClusterService; +import org.apache.ignite.network.ClusterServiceFactory; +import org.apache.ignite.network.MessageSerializationRegistryImpl; +import org.apache.ignite.network.MessagingService; +import org.apache.ignite.network.NetworkAddress; +import org.apache.ignite.network.NetworkMessage; +import org.apache.ignite.network.StaticNodeFinder; +import org.apache.ignite.network.scalecube.TestScaleCubeClusterServiceFactory; +import org.apache.ignite.network.serialization.MessageSerializationRegistry; +import org.apache.ignite.raft.client.service.RaftGroupListener; +import org.apache.ignite.utils.ClusterServiceTestUtils; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInfo; +import org.junit.jupiter.api.extension.ExtendWith; + +import static org.apache.ignite.raft.jraft.test.TestUtils.getLocalAddress; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsString; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +/** + * Tests for {@link Loza} functionality. + */ +@ExtendWith(WorkDirectoryExtension.class) +public class ITLozaTest { + /** Node's name. */ + private static final String NODE_NAME = "node1"; + + /** Network factory. */ + private static final ClusterServiceFactory NETWORK_FACTORY = new TestScaleCubeClusterServiceFactory(); + + /** Server port offset. */ + private static final int PORT = 20010; + + /** */ + private static final MessageSerializationRegistry SERIALIZATION_REGISTRY = new MessageSerializationRegistryImpl(); + + /** */ + @WorkDirectory + private Path dataPath; + + /** Test node. */ + private final ClusterNode node = new ClusterNode( + UUID.randomUUID().toString(), + NODE_NAME, + new NetworkAddress(getLocalAddress(), PORT) + ); + + /** + * Starts a raft group service with a provided group id on a provided Loza instance. + */ + private void startClient(String groupId, + Loza loza) throws ExecutionException, InterruptedException, TimeoutException { Review comment: This formatting looks odd, can we change it to `throws Exception` and fit everything on one line? -- 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]
