use of org.apache.dubbo.registry.status.RegistryStatusChecker in project dubbo by alibaba.
the class ZookeeperRegistryTest method testStatusChecker.
@Disabled
@Test
public /*
This UT is unstable, consider remove it later.
@see https://github.com/apache/dubbo/issues/1787
*/
void testStatusChecker() {
RegistryStatusChecker registryStatusChecker = new RegistryStatusChecker();
Status status = registryStatusChecker.check();
assertThat(status.getLevel(), is(Status.Level.UNKNOWN));
Registry registry = zookeeperRegistryFactory.getRegistry(registryUrl);
assertThat(registry, not(nullValue()));
status = registryStatusChecker.check();
assertThat(status.getLevel(), is(Status.Level.ERROR));
registry.register(serviceUrl);
status = registryStatusChecker.check();
assertThat(status.getLevel(), is(Status.Level.OK));
}
use of org.apache.dubbo.registry.status.RegistryStatusChecker in project dubbo by alibaba.
the class ConsulRegistryTest method testStatusChecker.
@Test
public void testStatusChecker() {
RegistryStatusChecker registryStatusChecker = new RegistryStatusChecker();
Status status = registryStatusChecker.check();
assertThat(status.getLevel(), is(Status.Level.UNKNOWN));
Registry registry = consulRegistryFactory.getRegistry(registryUrl);
assertThat(registry, not(nullValue()));
status = registryStatusChecker.check();
assertThat(status.getLevel(), is(Status.Level.OK));
registry.register(serviceUrl);
status = registryStatusChecker.check();
assertThat(status.getLevel(), is(Status.Level.OK));
}
use of org.apache.dubbo.registry.status.RegistryStatusChecker in project dubbo by alibaba.
the class RegistryStatusCheckerTest method testCheckOK.
@Test
public void testCheckOK() {
ApplicationModel.setApplication("testCheckOK");
ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension().getRegistry(registryUrl);
ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension().getRegistry(registryUrl2);
assertEquals(Status.Level.OK, new RegistryStatusChecker().check().getLevel());
String message = new RegistryStatusChecker().check().getMessage();
Assertions.assertTrue(message.contains(registryUrl.getHost() + "(connected)"));
Assertions.assertTrue(message.contains(registryUrl2.getHost() + "(connected)"));
}
Aggregations