Search in sources :

Example 6 with MonitorConfig

use of org.apache.dubbo.config.MonitorConfig in project dubbo by alibaba.

the class ConfigManagerTest method testMonitorConfig.

// Test MonitorConfig correlative methods
@Test
public void testMonitorConfig() {
    MonitorConfig monitorConfig = new MonitorConfig();
    monitorConfig.setGroup("test");
    configManager.setMonitor(monitorConfig);
    assertTrue(configManager.getMonitor().isPresent());
    assertEquals(monitorConfig, configManager.getMonitor().get());
}
Also used : MonitorConfig(org.apache.dubbo.config.MonitorConfig) Test(org.junit.jupiter.api.Test)

Example 7 with MonitorConfig

use of org.apache.dubbo.config.MonitorConfig in project dubbo by alibaba.

the class AbstractAnnotationConfigBeanBuilder method configureMonitorConfig.

private void configureMonitorConfig(B bean) {
    String monitorBeanName = resolveMonitorConfigBeanName(annotation);
    MonitorConfig monitorConfig = getOptionalBean(applicationContext, monitorBeanName, MonitorConfig.class);
    bean.setMonitor(monitorConfig);
}
Also used : MonitorConfig(org.apache.dubbo.config.MonitorConfig)

Example 8 with MonitorConfig

use of org.apache.dubbo.config.MonitorConfig in project dubbo by alibaba.

the class DubboBootstrap method getMonitor.

private MonitorConfig getMonitor() {
    MonitorConfig monitor = configManager.getMonitor().orElseGet(() -> {
        MonitorConfig monitorConfig = new MonitorConfig();
        configManager.setMonitor(monitorConfig);
        return monitorConfig;
    });
    monitor.refresh();
    return monitor;
}
Also used : MonitorConfig(org.apache.dubbo.config.MonitorConfig)

Example 9 with MonitorConfig

use of org.apache.dubbo.config.MonitorConfig in project dubbo by alibaba.

the class ModuleBuilderTest method build.

@Test
void build() {
    RegistryConfig registry = new RegistryConfig();
    MonitorConfig monitor = new MonitorConfig();
    ModuleBuilder builder = new ModuleBuilder();
    builder.name("name").version("version").owner("owner").organization("organization").addRegistry(registry).monitor(monitor).isDefault(false);
    ModuleConfig config = builder.build();
    ModuleConfig config2 = builder.build();
    Assertions.assertEquals("name", config.getName());
    Assertions.assertEquals("version", config.getVersion());
    Assertions.assertEquals("owner", config.getOwner());
    Assertions.assertEquals("organization", config.getOrganization());
    Assertions.assertTrue(builder.build().getRegistries().contains(registry));
    Assertions.assertSame(monitor, builder.build().getMonitor());
    Assertions.assertFalse(config.isDefault());
    Assertions.assertNotSame(config, config2);
}
Also used : RegistryConfig(org.apache.dubbo.config.RegistryConfig) ModuleConfig(org.apache.dubbo.config.ModuleConfig) MonitorConfig(org.apache.dubbo.config.MonitorConfig) Test(org.junit.jupiter.api.Test)

Example 10 with MonitorConfig

use of org.apache.dubbo.config.MonitorConfig in project dubbo by alibaba.

the class ModuleBuilderTest method monitor.

@Test
void monitor() {
    MonitorConfig monitor = new MonitorConfig();
    ModuleBuilder builder = new ModuleBuilder();
    builder.monitor(monitor);
    Assertions.assertSame(monitor, builder.build().getMonitor());
}
Also used : MonitorConfig(org.apache.dubbo.config.MonitorConfig) Test(org.junit.jupiter.api.Test)

Aggregations

MonitorConfig (org.apache.dubbo.config.MonitorConfig)16 Test (org.junit.jupiter.api.Test)11 ApplicationConfig (org.apache.dubbo.config.ApplicationConfig)5 RegistryConfig (org.apache.dubbo.config.RegistryConfig)4 ModuleConfig (org.apache.dubbo.config.ModuleConfig)3 MonitorService (org.apache.dubbo.monitor.MonitorService)2 HashMap (java.util.HashMap)1 URL (org.apache.dubbo.common.URL)1 AbstractInterfaceConfig (org.apache.dubbo.config.AbstractInterfaceConfig)1 AbstractInterfaceConfigTest (org.apache.dubbo.config.AbstractInterfaceConfigTest)1 ConfigCenterConfig (org.apache.dubbo.config.ConfigCenterConfig)1 ConsumerConfig (org.apache.dubbo.config.ConsumerConfig)1 MetadataReportConfig (org.apache.dubbo.config.MetadataReportConfig)1 ProtocolConfig (org.apache.dubbo.config.ProtocolConfig)1 ProviderConfig (org.apache.dubbo.config.ProviderConfig)1 MonitorFactory (org.apache.dubbo.monitor.MonitorFactory)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1