Search in sources :

Example 1 with Connectivity

use of org.finos.symphony.toolkit.stream.fixture.Connectivity 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;
}
Also used : TestClusterMember(org.finos.symphony.toolkit.stream.fixture.TestClusterMember) DummyLeaderServiceImpl(org.finos.symphony.toolkit.stream.fixture.DummyLeaderServiceImpl) Random(java.util.Random) Participant(org.finos.symphony.toolkit.stream.Participant) TestNetwork(org.finos.symphony.toolkit.stream.fixture.TestNetwork) Connectivity(org.finos.symphony.toolkit.stream.fixture.Connectivity)

Aggregations

Random (java.util.Random)1 Participant (org.finos.symphony.toolkit.stream.Participant)1 Connectivity (org.finos.symphony.toolkit.stream.fixture.Connectivity)1 DummyLeaderServiceImpl (org.finos.symphony.toolkit.stream.fixture.DummyLeaderServiceImpl)1 TestClusterMember (org.finos.symphony.toolkit.stream.fixture.TestClusterMember)1 TestNetwork (org.finos.symphony.toolkit.stream.fixture.TestNetwork)1