use of org.apache.dubbo.config.ApplicationConfig 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();
}
use of org.apache.dubbo.config.ApplicationConfig in project dubbo by alibaba.
the class ConsumerConfiguration method applicationConfig.
/**
* Current application configuration, to replace XML config:
* <prev>
* <dubbo:application name="dubbo-demo-application"/>
* </prev>
*
* @return {@link ApplicationConfig} Bean
*/
@Bean("dubbo-demo-application")
public ApplicationConfig applicationConfig() {
ApplicationConfig applicationConfig = new ApplicationConfig();
applicationConfig.setName("dubbo-demo-application");
return applicationConfig;
}
use of org.apache.dubbo.config.ApplicationConfig in project dubbo by alibaba.
the class ProviderConfiguration method applicationConfig.
/**
* Current application configuration, to replace XML config:
* <prev>
* <dubbo:application name="dubbo-demo-application"/>
* </prev>
*
* @return {@link ApplicationConfig} Bean
*/
@Bean("dubbo-demo-application")
public ApplicationConfig applicationConfig() {
ApplicationConfig applicationConfig = new ApplicationConfig();
applicationConfig.setName("dubbo-demo-application");
return applicationConfig;
}
use of org.apache.dubbo.config.ApplicationConfig in project dubbo by alibaba.
the class ServiceAnnotationTestConfiguration method applicationConfig.
/**
* Current application configuration, to replace XML config:
* <prev>
* <dubbo:application name="dubbo-demo-application"/>
* </prev>
*
* @return {@link ApplicationConfig} Bean
*/
@Bean("dubbo-demo-application")
public ApplicationConfig applicationConfig() {
ApplicationConfig applicationConfig = new ApplicationConfig();
applicationConfig.setName("dubbo-demo-application");
return applicationConfig;
}
use of org.apache.dubbo.config.ApplicationConfig in project dubbo by alibaba.
the class DubboConfigConfigurationTest method testMultiple.
@Test
public void testMultiple() {
context.register(DubboConfigConfiguration.Multiple.class);
context.refresh();
// application
ApplicationConfig applicationConfig = context.getBean("applicationBean", ApplicationConfig.class);
Assertions.assertEquals("dubbo-demo-application", applicationConfig.getName());
ApplicationConfig applicationBean2 = context.getBean("applicationBean2", ApplicationConfig.class);
Assertions.assertEquals("dubbo-demo-application2", applicationBean2.getName());
ApplicationConfig applicationBean3 = context.getBean("applicationBean3", ApplicationConfig.class);
Assertions.assertEquals("dubbo-demo-application3", applicationBean3.getName());
}
Aggregations