Search in sources :

Example 66 with ApplicationConfig

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;
}
Also used : ApplicationConfig(org.apache.dubbo.config.ApplicationConfig)

Example 67 with ApplicationConfig

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());
}
Also used : RegistryConfig(org.apache.dubbo.config.RegistryConfig) ApplicationConfig(org.apache.dubbo.config.ApplicationConfig) ProtocolConfig(org.apache.dubbo.config.ProtocolConfig) Test(org.junit.Test)

Example 68 with ApplicationConfig

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());
}
Also used : ApplicationConfig(org.apache.dubbo.config.ApplicationConfig) Test(org.junit.Test)

Example 69 with ApplicationConfig

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());
}
Also used : RegistryConfig(org.apache.dubbo.config.RegistryConfig) ApplicationConfig(org.apache.dubbo.config.ApplicationConfig) ProtocolConfig(org.apache.dubbo.config.ProtocolConfig) Test(org.junit.Test)

Example 70 with ApplicationConfig

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());
}
Also used : ApplicationConfig(org.apache.dubbo.config.ApplicationConfig) Test(org.junit.jupiter.api.Test)

Aggregations

ApplicationConfig (org.apache.dubbo.config.ApplicationConfig)75 RegistryConfig (org.apache.dubbo.config.RegistryConfig)42 Test (org.junit.jupiter.api.Test)32 ProtocolConfig (org.apache.dubbo.config.ProtocolConfig)27 DubboBootstrap (org.apache.dubbo.config.bootstrap.DubboBootstrap)19 ServiceConfig (org.apache.dubbo.config.ServiceConfig)18 ReferenceConfig (org.apache.dubbo.config.ReferenceConfig)16 DemoService (org.apache.dubbo.config.spring.api.DemoService)13 URL (org.apache.dubbo.common.URL)9 GenericService (org.apache.dubbo.rpc.service.GenericService)8 Test (org.junit.Test)8 DemoServiceImpl (org.apache.dubbo.config.spring.impl.DemoServiceImpl)7 ArrayList (java.util.ArrayList)6 MonitorConfig (org.apache.dubbo.config.MonitorConfig)5 Matchers.containsString (org.hamcrest.Matchers.containsString)5 AbstractInterfaceConfigTest (org.apache.dubbo.config.AbstractInterfaceConfigTest)4 UserService (org.apache.dubbo.config.bootstrap.rest.UserService)4 MetadataReportConfig (org.apache.dubbo.config.MetadataReportConfig)3 ModuleConfig (org.apache.dubbo.config.ModuleConfig)3 UserServiceImpl (org.apache.dubbo.config.bootstrap.rest.UserServiceImpl)3