use of org.apache.dubbo.config.ApplicationConfig in project dubbo by alibaba.
the class ApplicationBuilder method build.
public ApplicationConfig build() {
ApplicationConfig config = new ApplicationConfig();
super.build(config);
config.setName(name);
config.setMetadataType(metadata);
config.setVersion(this.version);
config.setOwner(this.owner);
config.setOrganization(this.organization);
config.setArchitecture(this.architecture);
config.setEnvironment(this.environment);
config.setCompiler(this.compiler);
config.setLogger(this.logger);
config.setRegistries(this.registries);
config.setRegistryIds(this.registryIds);
config.setMonitor(this.monitor);
config.setDefault(this.isDefault);
config.setDumpDirectory(this.dumpDirectory);
config.setQosEnable(this.qosEnable);
config.setQosPort(this.qosPort);
config.setQosAcceptForeignIp(this.qosAcceptForeignIp);
config.setMetadataServicePort(this.metadataServicePort);
config.setParameters(this.parameters);
if (!StringUtils.isEmpty(shutwait)) {
config.setShutwait(shutwait);
}
return config;
}
use of org.apache.dubbo.config.ApplicationConfig in project dubbo by alibaba.
the class RelaxedDubboConfigBinderTest method testBinder.
@Test
public void testBinder() {
ApplicationConfig applicationConfig = new ApplicationConfig();
Map<String, Object> properties = getSubProperties(environment.getPropertySources(), "dubbo.application");
dubboConfigBinder.bind(properties, true, true, applicationConfig);
Assert.assertEquals("hello", applicationConfig.getName());
Assert.assertEquals("world", applicationConfig.getOwner());
RegistryConfig registryConfig = new RegistryConfig();
properties = getSubProperties(environment.getPropertySources(), "dubbo.registry");
dubboConfigBinder.bind(properties, true, true, registryConfig);
Assert.assertEquals("10.20.153.17", registryConfig.getAddress());
ProtocolConfig protocolConfig = new ProtocolConfig();
properties = getSubProperties(environment.getPropertySources(), "dubbo.protocol");
dubboConfigBinder.bind(properties, true, true, protocolConfig);
Assert.assertEquals(Integer.valueOf(20881), protocolConfig.getPort());
}
use of org.apache.dubbo.config.ApplicationConfig in project dubbo by alibaba.
the class DubboConfigBeanDefinitionConflictApplicationListenerTest method testNormalCase.
@Test
public void testNormalCase() {
System.setProperty("dubbo.application.name", "test-dubbo-application");
context.register(DubboConfig.class);
context.refresh();
ApplicationConfig applicationConfig = context.getBean(ApplicationConfig.class);
Assert.assertEquals("test-dubbo-application", applicationConfig.getName());
}
use of org.apache.dubbo.config.ApplicationConfig in project dubbo by alibaba.
the class BinderDubboConfigBinderTest method testBinder.
@Test
public void testBinder() {
ApplicationConfig applicationConfig = new ApplicationConfig();
Map<String, Object> properties = getSubProperties(environment.getPropertySources(), "dubbo.application");
dubboConfigBinder.bind(properties, true, true, applicationConfig);
Assert.assertEquals("hello", applicationConfig.getName());
Assert.assertEquals("world", applicationConfig.getOwner());
RegistryConfig registryConfig = new RegistryConfig();
properties = getSubProperties(environment.getPropertySources(), "dubbo.registry");
dubboConfigBinder.bind(properties, true, true, registryConfig);
Assert.assertEquals("10.20.153.17", registryConfig.getAddress());
ProtocolConfig protocolConfig = new ProtocolConfig();
properties = getSubProperties(environment.getPropertySources(), "dubbo.protocol");
dubboConfigBinder.bind(properties, true, true, protocolConfig);
Assert.assertEquals(Integer.valueOf(20881), protocolConfig.getPort());
}
use of org.apache.dubbo.config.ApplicationConfig in project dubbo by alibaba.
the class ConfigManagerTest method testApplicationConfig.
// Test ApplicationConfig correlative methods
@Test
public void testApplicationConfig() {
ApplicationConfig config = new ApplicationConfig();
configManager.setApplication(config);
assertTrue(configManager.getApplication().isPresent());
assertEquals(config, configManager.getApplication().get());
}
Aggregations