use of org.finos.symphony.toolkit.stream.fixture.TestNetwork in project spring-bot by finos.
the class AbstractClusterTest method setupNetwork.
public Setup setupNetwork(Configuration c) {
Setup setup = new Setup();
setup.c = new Connectivity();
setup.n = new TestNetwork(setup.c, c.time / 10);
Random r = new Random();
setup.allParticipants = IntStream.range(0, c.size).mapToObj(i -> new Participant("P" + i)).collect(Collectors.toSet());
setup.ls = new DummyLeaderServiceImpl(setup.allParticipants);
setup.members = setup.allParticipants.stream().map(p -> createClusterMember(p, c, setup, r)).collect(Collectors.toList());
// setup.members.forEach(m -> setup.allParticipants.forEach(p -> m.accept(p)));
setup.c.set(Collections.singleton(setup.allParticipants));
setup.size = c.size;
setup.maxTimeout = c.time;
setup.canTalkToSymphony = new HashSet<Participant>(setup.allParticipants);
setup.members.forEach(m -> setup.n.register(m.getSelfDetails(), (TestClusterMember) m));
return setup;
}
Aggregations