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());
}
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);
}
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;
}
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);
}
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());
}
Aggregations