Search in sources :

Example 51 with RaftProperties

use of org.apache.ratis.conf.RaftProperties in project incubator-ratis by apache.

the class WatchRequestTests method setup.

@Before
public void setup() {
    final RaftProperties p = getProperties();
    p.setClass(MiniRaftCluster.STATEMACHINE_CLASS_KEY, SimpleStateMachine4Testing.class, StateMachine.class);
}
Also used : RaftProperties(org.apache.ratis.conf.RaftProperties) Before(org.junit.Before)

Example 52 with RaftProperties

use of org.apache.ratis.conf.RaftProperties in project incubator-ratis by apache.

the class RaftAsyncTests method testAsyncConfiguration.

@Test
public void testAsyncConfiguration() throws IOException {
    LOG.info("Running testAsyncConfiguration");
    final RaftProperties properties = new RaftProperties();
    RaftClientConfigKeys.Async.Experimental.setSendDummyRequest(properties, false);
    RaftClient.Builder clientBuilder = RaftClient.newBuilder().setRaftGroup(RaftGroup.emptyGroup()).setProperties(properties);
    int maxOutstandingRequests = RaftClientConfigKeys.Async.OUTSTANDING_REQUESTS_MAX_DEFAULT;
    try (RaftClient client = clientBuilder.build()) {
        RaftClientTestUtil.assertAsyncRequestSemaphore(client, maxOutstandingRequests, 0);
    }
    maxOutstandingRequests = 5;
    RaftClientConfigKeys.Async.setOutstandingRequestsMax(properties, maxOutstandingRequests);
    try (RaftClient client = clientBuilder.build()) {
        RaftClientTestUtil.assertAsyncRequestSemaphore(client, maxOutstandingRequests, 0);
    }
}
Also used : RaftProperties(org.apache.ratis.conf.RaftProperties) RaftClient(org.apache.ratis.client.RaftClient) Test(org.junit.Test)

Example 53 with RaftProperties

use of org.apache.ratis.conf.RaftProperties in project incubator-ratis by apache.

the class MessageStreamApiTests method testStreamAsync.

@Test
public void testStreamAsync() throws Exception {
    final RaftProperties p = getProperties();
    RaftClientConfigKeys.MessageStream.setSubmessageSize(p, SUBMESSAGE_SIZE);
    p.setClass(MiniRaftCluster.STATEMACHINE_CLASS_KEY, SimpleStateMachine4Testing.class, StateMachine.class);
    runWithNewCluster(NUM_SERVERS, this::runTestStreamAsync);
    RaftClientConfigKeys.MessageStream.setSubmessageSize(p);
}
Also used : RaftProperties(org.apache.ratis.conf.RaftProperties) Test(org.junit.Test)

Example 54 with RaftProperties

use of org.apache.ratis.conf.RaftProperties in project incubator-ratis by apache.

the class MessageStreamApiTests method testStream.

@Test
public void testStream() throws Exception {
    final RaftProperties p = getProperties();
    p.setClass(MiniRaftCluster.STATEMACHINE_CLASS_KEY, SimpleStateMachine4Testing.class, StateMachine.class);
    runWithNewCluster(NUM_SERVERS, this::runTestStream);
}
Also used : RaftProperties(org.apache.ratis.conf.RaftProperties) Test(org.junit.Test)

Aggregations

RaftProperties (org.apache.ratis.conf.RaftProperties)54 Test (org.junit.Test)22 BaseTest (org.apache.ratis.BaseTest)14 Before (org.junit.Before)12 RaftPeerId (org.apache.ratis.protocol.RaftPeerId)9 RaftServer (org.apache.ratis.server.RaftServer)8 File (java.io.File)7 CompletableFuture (java.util.concurrent.CompletableFuture)7 RaftClient (org.apache.ratis.client.RaftClient)7 IOException (java.io.IOException)5 ArrayList (java.util.ArrayList)5 Parameters (org.apache.ratis.conf.Parameters)4 LogEntryProto (org.apache.ratis.proto.RaftProtos.LogEntryProto)4 RaftGroupId (org.apache.ratis.protocol.RaftGroupId)4 RaftGroupMemberId (org.apache.ratis.protocol.RaftGroupMemberId)4 RaftGroup (org.apache.ratis.protocol.RaftGroup)3 StateMachine (org.apache.ratis.statemachine.StateMachine)3 TimeDuration (org.apache.ratis.util.TimeDuration)3 List (java.util.List)2 UUID (java.util.UUID)2