use of org.apache.dubbo.config.ProviderConfig in project dubbo by alibaba.
the class DubboHealthIndicator method resolveStatusCheckerNamesMapFromProviderConfig.
private Map<String, String> resolveStatusCheckerNamesMapFromProviderConfig() {
Map<String, String> statusCheckerNamesMap = new LinkedHashMap<>();
for (Map.Entry<String, ProviderConfig> entry : providerConfigs.entrySet()) {
String beanName = entry.getKey();
ProviderConfig providerConfig = entry.getValue();
Set<String> statusCheckerNames = getStatusCheckerNames(providerConfig);
for (String statusCheckerName : statusCheckerNames) {
String source = buildSource(beanName, providerConfig);
statusCheckerNamesMap.put(statusCheckerName, source);
}
}
return statusCheckerNamesMap;
}
use of org.apache.dubbo.config.ProviderConfig in project dubbo by alibaba.
the class ConfigManagerTest method testProviderConfig.
// Test ProviderConfig correlative methods
@Test
public void testProviderConfig() {
ProviderConfig config = new ProviderConfig();
configManager.addProviders(asList(config, null));
Collection<ProviderConfig> configs = configManager.getProviders();
assertEquals(1, configs.size());
assertEquals(config, configs.iterator().next());
assertTrue(configManager.getDefaultProvider().isPresent());
config.setId(DEFAULT_KEY);
configManager.addProvider(config);
assertTrue(configManager.getDefaultProvider().isPresent());
configs = configManager.getProviders();
assertEquals(2, configs.size());
}
use of org.apache.dubbo.config.ProviderConfig in project dubbo by alibaba.
the class ConfigManagerTest method testAddConfig.
@Test
public void testAddConfig() {
configManager.addConfig(new ApplicationConfig());
configManager.addConfig(new ProviderConfig());
configManager.addConfig(new ProtocolConfig());
assertTrue(configManager.getApplication().isPresent());
assertFalse(configManager.getProviders().isEmpty());
assertFalse(configManager.getProtocols().isEmpty());
}
use of org.apache.dubbo.config.ProviderConfig 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();
}
Aggregations