use of com.alibaba.dubbo.registry.RegistryService in project dubbo by alibaba.
the class ConfigTest method testDelayFixedTime.
@Test
public void testDelayFixedTime() throws Exception {
SimpleRegistryService registryService = new SimpleRegistryService();
Exporter<RegistryService> exporter = SimpleRegistryExporter.export(4548, registryService);
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.', '/') + "/delay-fixed-time.xml");
ctx.start();
try {
List<URL> urls = registryService.getRegistered().get("com.alibaba.dubbo.config.spring.api.DemoService");
assertNull(urls);
int i = 0;
while ((i++) < 60 && urls == null) {
urls = registryService.getRegistered().get("com.alibaba.dubbo.config.spring.api.DemoService");
Thread.sleep(10);
}
assertNotNull(urls);
assertEquals(1, urls.size());
assertEquals("dubbo://" + NetUtils.getLocalHost() + ":20883/com.alibaba.dubbo.config.spring.api.DemoService", urls.get(0).toIdentityString());
} finally {
ctx.stop();
ctx.close();
exporter.unexport();
}
}
Aggregations