registryDirectory.notify(serviceUrls);
invocation = new RpcInvocation();
List invokers = registryDirectory.list(invocation);
Invoker invoker = (Invoker) invokers.get(0);
URL url = invoker.getUrl();
Assert.assertEquals(null, url.getParameter("key"));
}
// 检验服务提供方的参数需要merge
{
serviceUrls.clear();
serviceUrls.add(SERVICEURL.addParameter("methods", "getXXX2").addParameter("key", "provider"));
registryDirectory.notify(serviceUrls);
invocation = new RpcInvocation();
List invokers = registryDirectory.list(invocation);
Invoker invoker = (Invoker) invokers.get(0);
URL url = invoker.getUrl();
Assert.assertEquals("provider", url.getParameter("key"));
}
// 检验服务query的参数需要与providermerge 。
{
serviceUrls.clear();
serviceUrls.add(SERVICEURL.addParameter("methods", "getXXX3").addParameter("key", "provider"));
registryDirectory2.notify(serviceUrls);
invocation = new RpcInvocation();
List invokers = registryDirectory2.list(invocation);
Invoker invoker = (Invoker) invokers.get(0);
URL url = invoker.getUrl();
Assert.assertEquals("query", url.getParameter("key"));
}
{
serviceUrls.clear();
serviceUrls.add(SERVICEURL.addParameter("methods", "getXXX1"));
registryDirectory.notify(serviceUrls);
invocation = new RpcInvocation();
List invokers = registryDirectory.list(invocation);
Invoker invoker = (Invoker) invokers.get(0);
URL url = invoker.getUrl();
Assert.assertEquals(false, url.getParameter(Constants.CHECK_KEY, false));
}
{
serviceUrls.clear();
serviceUrls.add(SERVICEURL.addParameter(Constants.LOADBALANCE_KEY, RoundRobinLoadBalance.NAME));
registryDirectory2.notify(serviceUrls);
invocation = new RpcInvocation();
invocation.setMethodName("get");
List invokers = registryDirectory2.list(invocation);
Invoker invoker = (Invoker) invokers.get(0);
URL url = invoker.getUrl();
Assert.assertEquals(LeastActiveLoadBalance.NAME, url.getMethodParameter("get", Constants.LOADBALANCE_KEY));
}
//test geturl
{
Assert.assertEquals(null, registryDirectory2.getUrl().getParameter("mock"));