use of org.apache.dubbo.config.ModuleConfig in project dubbo by alibaba.
the class AbstractInterfaceBuilderTest method module.
@Test
void module() {
ModuleConfig moduleConfig = new ModuleConfig();
InterfaceBuilder builder = new InterfaceBuilder();
builder.module(moduleConfig);
Assertions.assertEquals(moduleConfig, builder.build().getModule());
}
use of org.apache.dubbo.config.ModuleConfig in project dubbo by alibaba.
the class AbstractInterfaceBuilderTest method build.
@Test
void build() {
MonitorConfig monitorConfig = new MonitorConfig("123");
ApplicationConfig applicationConfig = new ApplicationConfig();
ModuleConfig moduleConfig = new ModuleConfig();
RegistryConfig registryConfig = new RegistryConfig();
MetadataReportConfig metadataReportConfig = new MetadataReportConfig();
ConfigCenterConfig configCenterConfig = new ConfigCenterConfig();
InterfaceBuilder builder = new InterfaceBuilder();
builder.id("id").prefix("prefix").local(true).stub(false).monitor("123").proxy("mockproxyfactory").cluster("mockcluster").filter("mockfilter").listener("mockinvokerlistener").owner("owner").connections(1).layer("layer").application(applicationConfig).module(moduleConfig).addRegistry(registryConfig).registryIds("registryIds").onconnect("onconnet").ondisconnect("ondisconnect").metadataReportConfig(metadataReportConfig).configCenter(configCenterConfig).callbacks(2).scope("scope");
InterfaceConfig config = builder.build();
InterfaceConfig config2 = builder.build();
Assertions.assertEquals("id", config.getId());
Assertions.assertEquals("prefix", config.getPrefix());
Assertions.assertEquals("true", config.getLocal());
Assertions.assertEquals("false", config.getStub());
Assertions.assertEquals(monitorConfig, config.getMonitor());
Assertions.assertEquals("mockproxyfactory", config.getProxy());
Assertions.assertEquals("mockcluster", config.getCluster());
Assertions.assertEquals("mockfilter", config.getFilter());
Assertions.assertEquals("mockinvokerlistener", config.getListener());
Assertions.assertEquals("owner", config.getOwner());
Assertions.assertEquals(1, config.getConnections().intValue());
Assertions.assertEquals("layer", config.getLayer());
Assertions.assertEquals(applicationConfig, config.getApplication());
Assertions.assertEquals(moduleConfig, config.getModule());
Assertions.assertEquals(registryConfig, config.getRegistry());
Assertions.assertEquals("registryIds", config.getRegistryIds());
Assertions.assertEquals("onconnet", config.getOnconnect());
Assertions.assertEquals("ondisconnect", config.getOndisconnect());
Assertions.assertEquals(metadataReportConfig, config.getMetadataReportConfig());
Assertions.assertEquals(configCenterConfig, config.getConfigCenter());
Assertions.assertEquals(2, config.getCallbacks().intValue());
Assertions.assertEquals("scope", config.getScope());
Assertions.assertNotSame(config, config2);
}
use of org.apache.dubbo.config.ModuleConfig in project dubbo by alibaba.
the class DubboConfigConfigurationTest method testSingle.
@Test
public void testSingle() throws IOException {
context.register(DubboConfigConfiguration.Single.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());
}
use of org.apache.dubbo.config.ModuleConfig in project dubbo by alibaba.
the class DubboNamespaceHandlerTest method testModuleInfo.
// @Test
// public void testMultiMonitor() {
// Assertions.assertThrows(BeanCreationException.class, () -> {
// ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.', '/') + "/multi-monitor.xml");
// ctx.start();
// });
// }
//
// @Test
// public void testMultiProviderConfig() {
// Assertions.assertThrows(BeanCreationException.class, () -> {
// ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.', '/') + "/provider-multi.xml");
// ctx.start();
// });
// }
@Test
public void testModuleInfo() {
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(ConfigTest.class.getPackage().getName().replace('.', '/') + "/provider-with-module.xml");
ctx.start();
ModuleConfig moduleConfig = ctx.getBean(ModuleConfig.class);
assertThat(moduleConfig.getName(), is("test-module"));
ctx.close();
}
use of org.apache.dubbo.config.ModuleConfig in project dubbo by alibaba.
the class DubboBootstrap method getModule.
private ModuleConfig getModule() {
ModuleConfig module = configManager.getModule().orElseGet(() -> {
ModuleConfig moduleConfig = new ModuleConfig();
configManager.setModule(moduleConfig);
return moduleConfig;
});
module.refresh();
return module;
}
Aggregations