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();
}
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();
}
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();
}
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();
}
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);
}
Aggregations