use of com.weibo.api.motan.cluster.LoadBalance in project motan by weibocom.
the class FailoverHaStrategyTest method setUp.
@Before
@Override
@SuppressWarnings("unchecked")
public void setUp() throws Exception {
super.setUp();
loadBalance = mockery.mock(LoadBalance.class);
final Referer<IWorld> referer1 = mockery.mock(Referer.class, "ref1");
final Referer<IWorld> referer2 = mockery.mock(Referer.class, "ref2");
referers = new ArrayList<Referer<IWorld>>();
referers.add(referer1);
referers.add(referer2);
failoverHaStrategy = new FailoverHaStrategy<IWorld>() {
@Override
protected List<Referer<IWorld>> selectReferers(Request request, LoadBalance<IWorld> loadBalance) {
return referers;
}
};
URL url = new URL(MotanConstants.PROTOCOL_MOTAN, NetUtils.LOCALHOST, 0, IWorld.class.getName());
url.addParameter(URLParamType.retries.getName(), String.valueOf(retries));
failoverHaStrategy.setUrl(url);
}
Aggregations