use of org.apache.dubbo.config.ModuleConfig in project dubbo by alibaba.
the class ModuleBuilder method build.
public ModuleConfig build() {
ModuleConfig moduleConfig = new ModuleConfig();
super.build(moduleConfig);
moduleConfig.setDefault(isDefault);
moduleConfig.setMonitor(monitor);
moduleConfig.setName(name);
moduleConfig.setOrganization(organization);
moduleConfig.setOwner(owner);
moduleConfig.setRegistries(registries);
moduleConfig.setVersion(version);
return moduleConfig;
}
use of org.apache.dubbo.config.ModuleConfig 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.ModuleConfig in project dubbo by alibaba.
the class AnnotatedInterfaceConfigBeanBuilder method configureModuleConfig.
private void configureModuleConfig(C configBean) {
String moduleConfigBeanName = resolveModuleConfigBeanName(attributes);
ModuleConfig moduleConfig = getOptionalBean(applicationContext, moduleConfigBeanName, ModuleConfig.class);
configBean.setModule(moduleConfig);
}
use of org.apache.dubbo.config.ModuleConfig in project dubbo by alibaba.
the class AbstractAnnotationConfigBeanBuilder method configureModuleConfig.
private void configureModuleConfig(B bean) {
String moduleConfigBeanName = resolveModuleConfigBeanName(annotation);
ModuleConfig moduleConfig = getOptionalBean(applicationContext, moduleConfigBeanName, ModuleConfig.class);
bean.setModule(moduleConfig);
}
use of org.apache.dubbo.config.ModuleConfig 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