Search in sources :

Example 11 with MonitorConfig

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

the class AbstractInterfaceBuilderTest method monitor.

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

Example 12 with MonitorConfig

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

the class ApplicationBuilderTest method monitor.

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

Example 13 with MonitorConfig

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

the class AnnotatedInterfaceConfigBeanBuilder method configureMonitorConfig.

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

Example 14 with MonitorConfig

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

the class EnableDubboConfigTest method testSingle.

@Test
public void testSingle() {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    context.register(TestConfig.class);
    context.refresh();
    // application
    ApplicationConfig applicationConfig = context.getBean("applicationBean", ApplicationConfig.class);
    Assertions.assertEquals("dubbo-demo-application", applicationConfig.getName());
    // module
    ModuleConfig moduleConfig = context.getBean("moduleBean", ModuleConfig.class);
    Assertions.assertEquals("dubbo-demo-module", moduleConfig.getName());
    // registry
    RegistryConfig registryConfig = context.getBean(RegistryConfig.class);
    Assertions.assertEquals("zookeeper://192.168.99.100:32770", registryConfig.getAddress());
    // protocol
    ProtocolConfig protocolConfig = context.getBean(ProtocolConfig.class);
    Assertions.assertEquals("dubbo", protocolConfig.getName());
    Assertions.assertEquals(Integer.valueOf(20880), protocolConfig.getPort());
    // monitor
    MonitorConfig monitorConfig = context.getBean(MonitorConfig.class);
    Assertions.assertEquals("zookeeper://127.0.0.1:32770", monitorConfig.getAddress());
    // provider
    ProviderConfig providerConfig = context.getBean(ProviderConfig.class);
    Assertions.assertEquals("127.0.0.1", providerConfig.getHost());
    // consumer
    ConsumerConfig consumerConfig = context.getBean(ConsumerConfig.class);
    Assertions.assertEquals("netty", consumerConfig.getClient());
    // asserts aliases
    assertFalse(hasAlias(context, "org.apache.dubbo.config.RegistryConfig#0", "zookeeper"));
    assertFalse(hasAlias(context, "org.apache.dubbo.config.MonitorConfig#0", "zookeeper"));
    context.close();
}
Also used : RegistryConfig(org.apache.dubbo.config.RegistryConfig) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) ApplicationConfig(org.apache.dubbo.config.ApplicationConfig) ProviderConfig(org.apache.dubbo.config.ProviderConfig) ModuleConfig(org.apache.dubbo.config.ModuleConfig) ConsumerConfig(org.apache.dubbo.config.ConsumerConfig) ProtocolConfig(org.apache.dubbo.config.ProtocolConfig) MonitorConfig(org.apache.dubbo.config.MonitorConfig) Test(org.junit.jupiter.api.Test)

Example 15 with MonitorConfig

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

the class MonitorBuilder method build.

public MonitorConfig build() {
    MonitorConfig monitorConfig = new MonitorConfig();
    super.build(monitorConfig);
    monitorConfig.setProtocol(protocol);
    monitorConfig.setAddress(address);
    monitorConfig.setUsername(username);
    monitorConfig.setPassword(password);
    monitorConfig.setGroup(group);
    monitorConfig.setVersion(version);
    monitorConfig.setInterval(interval);
    monitorConfig.setParameters(parameters);
    monitorConfig.setDefault(isDefault);
    return monitorConfig;
}
Also used : MonitorConfig(org.apache.dubbo.config.MonitorConfig)

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