Search in sources :

Example 6 with NodeArbitrateEvent

use of com.alibaba.otter.shared.arbitrate.impl.manage.NodeArbitrateEvent in project otter by alibaba.

the class BaseLoadBalanceTest method init.

@BeforeClass
public void init() {
    // 初始化节点
    Mockit.setUpMock(ArbitrateConfigUtils.class, new Object() {

        @Mock
        public Channel getChannel(Long pipelineId) {
            Channel channel = new Channel();
            channel.setId(channelId);
            return channel;
        }

        @Mock
        public Long getCurrentNid() {
            return 1L;
        }
    });
    node1.setId(1L);
    node2.setId(2L);
    node3.setId(3L);
    node4.setId(4L);
    zookeeper = getZookeeper();
    nodeEvent = new NodeArbitrateEvent();
    nodeMonitor = new NodeMonitor();
}
Also used : Channel(com.alibaba.otter.shared.common.model.config.channel.Channel) NodeMonitor(com.alibaba.otter.shared.arbitrate.impl.setl.monitor.NodeMonitor) Mock(mockit.Mock) NodeArbitrateEvent(com.alibaba.otter.shared.arbitrate.impl.manage.NodeArbitrateEvent) BeforeClass(org.testng.annotations.BeforeClass)

Example 7 with NodeArbitrateEvent

use of com.alibaba.otter.shared.arbitrate.impl.manage.NodeArbitrateEvent in project otter by alibaba.

the class MainStemMonitorTest method init.

@BeforeClass
public void init() {
    // 初始化节点
    Mockit.setUpMock(ArbitrateConfigUtils.class, new Object() {

        @Mock
        public Channel getChannel(Long pipelineId) {
            Channel channel = new Channel();
            channel.setId(channelId);
            return channel;
        }

        @Mock
        public Pipeline getOppositePipeline(Long pipelineId) {
            // 没有反向同步
            return null;
        }

        @Mock
        public int getParallelism(Long pipelineId) {
            // 并行度
            return 3;
        }

        @Mock
        public Pipeline getPipeline(Long pipelineId) {
            Pipeline pipeline = new Pipeline();
            pipeline.setId(pipelineId);
            pipeline.setSelectNodes(Arrays.asList(local));
            pipeline.setExtractNodes(Arrays.asList(local));
            pipeline.setLoadNodes(Arrays.asList(local));
            return pipeline;
        }

        @Mock
        public Long getCurrentNid() {
            return nid;
        }
    });
    zookeeper = getZookeeper();
    local.setId(nid);
    nodeEvent = new NodeArbitrateEvent();
    channelEvent = new ChannelArbitrateEvent();
    pipelineEvent = new PipelineArbitrateEvent();
}
Also used : Channel(com.alibaba.otter.shared.common.model.config.channel.Channel) ChannelArbitrateEvent(com.alibaba.otter.shared.arbitrate.impl.manage.ChannelArbitrateEvent) PipelineArbitrateEvent(com.alibaba.otter.shared.arbitrate.impl.manage.PipelineArbitrateEvent) Mock(mockit.Mock) Pipeline(com.alibaba.otter.shared.common.model.config.pipeline.Pipeline) NodeArbitrateEvent(com.alibaba.otter.shared.arbitrate.impl.manage.NodeArbitrateEvent) BeforeClass(org.testng.annotations.BeforeClass)

Example 8 with NodeArbitrateEvent

use of com.alibaba.otter.shared.arbitrate.impl.manage.NodeArbitrateEvent in project otter by alibaba.

the class NodeMonitorTest method init.

@BeforeClass
public void init() {
    // 初始化节点
    Mockit.setUpMock(ArbitrateConfigUtils.class, new Object() {

        @Mock
        public Channel getChannel(Long pipelineId) {
            Channel channel = new Channel();
            channel.setId(channelId);
            return channel;
        }

        @Mock
        public Pipeline getOppositePipeline(Long pipelineId) {
            Pipeline pipeline = new Pipeline();
            pipeline.setId(pipelineId);
            return pipeline;
        }

        @Mock
        public Pipeline getPipeline(Long pipelineId) {
            Pipeline pipeline = new Pipeline();
            pipeline.setSelectNodes(sourceList);
            pipeline.setExtractNodes(sourceList);
            pipeline.setLoadNodes(targetList);
            return pipeline;
        }
    });
    node1.setId(1L);
    node2.setId(2L);
    node3.setId(3L);
    node4.setId(4L);
    getZookeeper();
    nodeEvent = new NodeArbitrateEvent();
}
Also used : Channel(com.alibaba.otter.shared.common.model.config.channel.Channel) Mock(mockit.Mock) Pipeline(com.alibaba.otter.shared.common.model.config.pipeline.Pipeline) NodeArbitrateEvent(com.alibaba.otter.shared.arbitrate.impl.manage.NodeArbitrateEvent) BeforeClass(org.testng.annotations.BeforeClass)

Example 9 with NodeArbitrateEvent

use of com.alibaba.otter.shared.arbitrate.impl.manage.NodeArbitrateEvent in project otter by alibaba.

the class NodeArbitrateEventTest method setUp.

@BeforeMethod
public void setUp() {
    zookeeper = getZookeeper();
    nodeEvent = new NodeArbitrateEvent();
}
Also used : NodeArbitrateEvent(com.alibaba.otter.shared.arbitrate.impl.manage.NodeArbitrateEvent) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 10 with NodeArbitrateEvent

use of com.alibaba.otter.shared.arbitrate.impl.manage.NodeArbitrateEvent in project otter by alibaba.

the class MainStemArbitrateEventTest method init.

@BeforeClass
public void init() {
    // 初始化节点
    // mock 配置信息数据
    Mockit.setUpMock(ArbitrateConfigUtils.class, new Object() {

        @Mock
        public Channel getChannel(Long pipelineId) {
            Channel channel = new Channel();
            channel.setId(channelId);
            return channel;
        }

        @Mock
        public Pipeline getOppositePipeline(Long pipelineId) {
            // 没有反向同步
            return null;
        }

        @Mock
        public int getParallelism(Long pipelineId) {
            // 并行度
            return 3;
        }

        @Mock
        public Pipeline getPipeline(Long pipelineId) {
            Pipeline pipeline = new Pipeline();
            pipeline.setId(pipelineId);
            pipeline.setSelectNodes(Arrays.asList(local));
            pipeline.setExtractNodes(Arrays.asList(local));
            pipeline.setLoadNodes(Arrays.asList(local));
            return pipeline;
        }

        @Mock
        public Long getCurrentNid() {
            return nid;
        }
    });
    getZookeeper();
    local.setId(nid);
    nodeEvent = new NodeArbitrateEvent();
    channelEvent = new ChannelArbitrateEvent();
    pipelineEvent = new PipelineArbitrateEvent();
    nodeEvent.init(nid);
    channelEvent.init(channelId);
    pipelineEvent.init(channelId, pipelineId);
    channelEvent.start(channelId);
}
Also used : Channel(com.alibaba.otter.shared.common.model.config.channel.Channel) ChannelArbitrateEvent(com.alibaba.otter.shared.arbitrate.impl.manage.ChannelArbitrateEvent) PipelineArbitrateEvent(com.alibaba.otter.shared.arbitrate.impl.manage.PipelineArbitrateEvent) Mock(mockit.Mock) Pipeline(com.alibaba.otter.shared.common.model.config.pipeline.Pipeline) NodeArbitrateEvent(com.alibaba.otter.shared.arbitrate.impl.manage.NodeArbitrateEvent) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

NodeArbitrateEvent (com.alibaba.otter.shared.arbitrate.impl.manage.NodeArbitrateEvent)10 Channel (com.alibaba.otter.shared.common.model.config.channel.Channel)8 Mock (mockit.Mock)8 Pipeline (com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)7 ChannelArbitrateEvent (com.alibaba.otter.shared.arbitrate.impl.manage.ChannelArbitrateEvent)6 PipelineArbitrateEvent (com.alibaba.otter.shared.arbitrate.impl.manage.PipelineArbitrateEvent)6 BeforeClass (org.testng.annotations.BeforeClass)5 Event (com.alibaba.otter.shared.communication.core.model.Event)4 BeforeMethod (org.testng.annotations.BeforeMethod)4 ExtractServiceDemo (com.alibaba.otter.shared.arbitrate.demo.servcie.ExtractServiceDemo)3 LoadServiceDemo (com.alibaba.otter.shared.arbitrate.demo.servcie.LoadServiceDemo)3 MainStemServiceDemo (com.alibaba.otter.shared.arbitrate.demo.servcie.MainStemServiceDemo)3 ProcessViewDemo (com.alibaba.otter.shared.arbitrate.demo.servcie.ProcessViewDemo)3 SelectServiceDemo (com.alibaba.otter.shared.arbitrate.demo.servcie.SelectServiceDemo)3 TerminProcessDemo (com.alibaba.otter.shared.arbitrate.demo.servcie.TerminProcessDemo)3 TransformServiceDemo (com.alibaba.otter.shared.arbitrate.demo.servcie.TransformServiceDemo)3 IOException (java.io.IOException)2 BaseOtterTest (com.alibaba.otter.manager.biz.BaseOtterTest)1 NodeDO (com.alibaba.otter.manager.biz.config.node.dal.dataobject.NodeDO)1 NodeMonitor (com.alibaba.otter.shared.arbitrate.impl.setl.monitor.NodeMonitor)1