use of com.weibo.api.motan.cluster.loadbalance.RandomLoadBalance in project motan by weibocom.
the class ClusterTest method setUp.
@Override
@SuppressWarnings("unchecked")
public void setUp() throws Exception {
super.setUp();
HaStrategy<IHello> ha = new FailoverHaStrategy<IHello>();
LoadBalance<IHello> lb = new RandomLoadBalance<IHello>();
referers = new ArrayList<Referer<IHello>>();
referers.add(mockery.mock(Referer.class, "ref1"));
referers.add(mockery.mock(Referer.class, "ref2"));
cluster.setUrl(new URL(MotanConstants.PROTOCOL_MOTAN, NetUtils.getLocalAddress().getHostAddress(), 0, RegistryService.class.getName()));
cluster.setHaStrategy(ha);
cluster.setLoadBalance(lb);
cluster.onRefresh(referers);
cluster.init();
}
Aggregations