view src/main/java/christie/test/topology/localTestTopology/StartLocalTestTopology.java @ 69:251e306094d4

update localTestTopology
author akahori
date Sat, 01 Sep 2018 08:10:55 +0900
parents src/main/java/christie/test/topology/localTestTopology/LocalTestTopology.java@597315102875
children 32f6f9de97c1
line wrap: on
line source

package christie.test.topology.localTestTopology;


import christie.codegear.CodeGearManager;
import christie.codegear.StartCodeGear;
import christie.topology.manager.StartTopologyManager;
import christie.topology.manager.TopologyManagerConfig;
import christie.topology.node.StartTopologyNode;
import christie.topology.node.TopologyNodeConfig;

import java.util.LinkedList;

public class StartLocalTestTopology extends StartCodeGear{


    public StartLocalTestTopology(CodeGearManager cgm) {
        super(cgm);
    }

    public static void main(String[] args) {
        LinkedList<LocalTestTopologyConfig> configs = new LinkedList<LocalTestTopologyConfig>();
        configs.add(new LocalTestTopologyConfig(args, 10001, "node0"));
        configs.add(new LocalTestTopologyConfig(args, 10002, "node1"));
        configs.add(new LocalTestTopologyConfig(args, 10003, "node2"));

        TopologyManagerConfig topologyManagerConfig = new TopologyManagerConfig(new String[]{"--confFile", "/Users/e155753/Specialized_subject/kono/hg/Alice/Alice/scripts/ring.dot", "--showTime"});
        CodeGearManager topologyManagerCGM = createCGM(10000);
        new StartTopologyManager(topologyManagerCGM, topologyManagerConfig);

        for (LocalTestTopologyConfig conf: configs ) {
            CodeGearManager nodeCGM = createCGM(conf.connectPort);
            String[] csarg = {"--host","localhost","--localKey",conf.key };
            TopologyNodeConfig cs  = new TopologyNodeConfig(csarg);

            new StartTopologyNode(nodeCGM, cs, new LTRemoteIncrement(conf));
        }
        topologyManagerCGM.setup(new StartLTCodeGear());
    }

}