Search in sources :

Example 1 with TestCluster

use of com.alipay.sofa.jraft.core.TestCluster in project sofa-jraft by sofastack.

the class RouteTableTest method setup.

@Before
public void setup() throws Exception {
    cliClientService = new CliClientServiceImpl();
    cliClientService.init(new CliOptions());
    this.dataPath = TestUtils.mkTempDir();
    FileUtils.forceMkdir(new File(this.dataPath));
    assertEquals(NodeImpl.GLOBAL_NUM_NODES.get(), 0);
    final List<PeerId> peers = TestUtils.generatePeers(3);
    cluster = new TestCluster(groupId, dataPath, peers);
    for (final PeerId peer : peers) {
        cluster.start(peer.getEndpoint());
    }
    cluster.waitLeader();
}
Also used : CliClientServiceImpl(com.alipay.sofa.jraft.rpc.impl.cli.CliClientServiceImpl) TestCluster(com.alipay.sofa.jraft.core.TestCluster) File(java.io.File) CliOptions(com.alipay.sofa.jraft.option.CliOptions) PeerId(com.alipay.sofa.jraft.entity.PeerId) Before(org.junit.Before)

Aggregations

TestCluster (com.alipay.sofa.jraft.core.TestCluster)1 PeerId (com.alipay.sofa.jraft.entity.PeerId)1 CliOptions (com.alipay.sofa.jraft.option.CliOptions)1 CliClientServiceImpl (com.alipay.sofa.jraft.rpc.impl.cli.CliClientServiceImpl)1 File (java.io.File)1 Before (org.junit.Before)1