use of suite.net.cluster.impl.ClusterProbeImpl in project suite by stupidsing.
the class ClusterProbeTest method test.
@Test
public void test() throws IOException {
var nNodes = 3;
var peers = forInt(nNodes).map2(i -> "NODE" + i, i -> new InetSocketAddress(localHost, 3000 + i)).toMap();
var probes = //
Read.from2(//
peers).keys().<String, ClusterProbe>map2(name -> name, //
name -> ex(() -> new ClusterProbeImpl(name, peers))).toMap();
for (var probe : probes.values()) probe.start();
Sleep.quietly(10 * 1000);
System.out.println("=== CLUSTER FORMED (" + LocalDateTime.now() + ") ===\n");
dumpActivePeers(probes);
assertActiveNodesSize(nNodes, probes);
for (var probe : probes.values()) probe.stop();
Sleep.quietly(5 * 1000);
System.out.println("=== CLUSTER STOPPED (" + LocalDateTime.now() + ") ===\n");
dumpActivePeers(probes);
assertActiveNodesSize(0, probes);
}
Aggregations