Search in sources :

Example 1 with RegistryStatusChecker

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));
}
Also used : Status(org.apache.dubbo.common.status.Status) Registry(org.apache.dubbo.registry.Registry) RegistryStatusChecker(org.apache.dubbo.registry.status.RegistryStatusChecker) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 2 with RegistryStatusChecker

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));
}
Also used : Status(org.apache.dubbo.common.status.Status) Registry(org.apache.dubbo.registry.Registry) RegistryStatusChecker(org.apache.dubbo.registry.status.RegistryStatusChecker) Test(org.junit.jupiter.api.Test)

Example 3 with RegistryStatusChecker

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)"));
}
Also used : RegistryStatusChecker(org.apache.dubbo.registry.status.RegistryStatusChecker) Test(org.junit.jupiter.api.Test)

Aggregations

RegistryStatusChecker (org.apache.dubbo.registry.status.RegistryStatusChecker)3 Test (org.junit.jupiter.api.Test)3 Status (org.apache.dubbo.common.status.Status)2 Registry (org.apache.dubbo.registry.Registry)2 Disabled (org.junit.jupiter.api.Disabled)1