use of org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker in project dubbo by alibaba.
the class RegistryDirectoryTest method test_Notified_withGroupFilter.
@Test
public void test_Notified_withGroupFilter() {
URL directoryUrl = noMeaningUrl.addParameterAndEncoded(REFER_KEY, "interface" + service + "&group=group1,group2");
RegistryDirectory directory = this.getRegistryDirectory(directoryUrl);
URL provider1 = URL.valueOf("dubbo://10.134.108.1:20880/" + service + "?methods=getXXX&group=group1&mock=false&application=mockApplication");
URL provider2 = URL.valueOf("dubbo://10.134.108.1:20880/" + service + "?methods=getXXX&group=group2&mock=false&application=mockApplication");
List<URL> providers = new ArrayList<>();
providers.add(provider1);
providers.add(provider2);
directory.notify(providers);
invocation = new RpcInvocation();
invocation.setMethodName("getXXX");
List<Invoker<DemoService>> invokers = directory.list(invocation);
Assertions.assertEquals(2, invokers.size());
Assertions.assertTrue(invokers.get(0) instanceof MockClusterInvoker);
Assertions.assertTrue(invokers.get(1) instanceof MockClusterInvoker);
directoryUrl = noMeaningUrl.addParameterAndEncoded(REFER_KEY, "interface" + service + "&group=group1");
directory = this.getRegistryDirectory(directoryUrl);
directory.notify(providers);
invokers = directory.list(invocation);
Assertions.assertEquals(2, invokers.size());
Assertions.assertFalse(invokers.get(0) instanceof MockClusterInvoker);
Assertions.assertFalse(invokers.get(1) instanceof MockClusterInvoker);
}
Aggregations