use of org.apache.dubbo.registry.RegistryService in project dubbo by alibaba.
the class ConfigTest method testMultiRegistry.
@Test
public void testMultiRegistry() {
SimpleRegistryService registryService1 = new SimpleRegistryService();
Exporter<RegistryService> exporter1 = SimpleRegistryExporter.export(4545, registryService1);
SimpleRegistryService registryService2 = new SimpleRegistryService();
Exporter<RegistryService> exporter2 = SimpleRegistryExporter.export(4546, registryService2);
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.', '/') + "/multi-registry.xml");
ctx.start();
try {
List<URL> urls1 = registryService1.getRegistered().get("org.apache.dubbo.config.spring.api.DemoService");
assertNull(urls1);
List<URL> urls2 = registryService2.getRegistered().get("org.apache.dubbo.config.spring.api.DemoService");
assertNotNull(urls2);
assertEquals(1, urls2.size());
assertEquals("dubbo://" + NetUtils.getLocalHost() + ":20880/org.apache.dubbo.config.spring.api.DemoService", urls2.get(0).toIdentityString());
} finally {
ctx.stop();
ctx.close();
exporter1.unexport();
exporter2.unexport();
}
}
Aggregations