view src/main/java/alice/test/topology/localTestTopology/LocalTestTopology.java @ 645:cb16036404ba

fix local topology test
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 31 Dec 2017 11:04:29 +0900
parents e0621f645e2e
children 3c060de44c2e
line wrap: on
line source

package alice.test.topology.localTestTopology;

import alice.daemon.AliceDaemon;
import alice.datasegment.DataSegment;
import alice.topology.manager.StartTopologyManager;
import alice.topology.manager.TopologyManagerConfig;
import alice.topology.node.StartTopologyNode;
import alice.topology.node.TopologyNodeConfig;

import java.util.LinkedList;

public class LocalTestTopology {


    public static void main(String[] args) {
        LinkedList<LocalTestTopologyConfig> configs = new LinkedList<LocalTestTopologyConfig>();
        int port = 10001;
        configs.add(new LocalTestTopologyConfig(args, port++, "remote1"));
        configs.add(new LocalTestTopologyConfig(args, port++, "remote2"));
        configs.add(new LocalTestTopologyConfig(args, port++, "remote3"));

        TopologyManagerConfig topologyManagerConfig = new TopologyManagerConfig(args);
        new AliceDaemon(topologyManagerConfig).listen();
        new StartTopologyManager(topologyManagerConfig).execute();

        for (LocalTestTopologyConfig conf: configs ) {
            String[] csarg = {"--port ", Integer.toString(topologyManagerConfig.localPort), "--host","localhost" };
            TopologyNodeConfig cs  = new TopologyNodeConfig(csarg);
            cs.setLocalKey(conf.key);
            cs.setManagerKey("manager");
            new StartTopologyNode(cs, new LTRemoteIncrement(conf));
        }
        new LTopologyStartCodeSegment(configs).execute();
    }

}