Search in sources :

Example 61 with RegistryConfig

use of org.apache.dubbo.config.RegistryConfig in project dubbo by alibaba.

the class RegistryBuilder method build.

public RegistryConfig build() {
    RegistryConfig registry = new RegistryConfig();
    super.build(registry);
    registry.setCheck(check);
    registry.setClient(client);
    registry.setCluster(cluster);
    registry.setDefault(isDefault);
    registry.setDynamic(dynamic);
    registry.setExtraKeys(extraKeys);
    registry.setFile(file);
    registry.setGroup(group);
    registry.setParameters(parameters);
    registry.setPassword(password);
    registry.setPort(port);
    registry.setProtocol(protocol);
    registry.setRegister(register);
    registry.setServer(server);
    registry.setSession(session);
    registry.setSimplified(simplified);
    registry.setSubscribe(subscribe);
    registry.setTimeout(timeout);
    registry.setTransporter(transporter);
    registry.setUsername(username);
    registry.setVersion(version);
    registry.setWait(wait);
    registry.setUseAsConfigCenter(useAsConfigCenter);
    registry.setUseAsMetadataCenter(useAsMetadataCenter);
    registry.setAccepts(accepts);
    registry.setPreferred(preferred);
    registry.setWeight(weight);
    registry.setAddress(address);
    return registry;
}
Also used : RegistryConfig(org.apache.dubbo.config.RegistryConfig)

Example 62 with RegistryConfig

use of org.apache.dubbo.config.RegistryConfig 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 63 with RegistryConfig

use of org.apache.dubbo.config.RegistryConfig 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 64 with RegistryConfig

use of org.apache.dubbo.config.RegistryConfig in project dubbo by alibaba.

the class ConfigManagerTest method testRegistryConfig.

// Test RegistryConfig correlative methods
@Test
public void testRegistryConfig() {
    RegistryConfig config = new RegistryConfig();
    configManager.addRegistries(asList(config, null));
    Collection<RegistryConfig> configs = configManager.getRegistries();
    assertEquals(1, configs.size());
    assertEquals(config, configs.iterator().next());
    assertFalse(configManager.getDefaultRegistries().isEmpty());
}
Also used : RegistryConfig(org.apache.dubbo.config.RegistryConfig) Test(org.junit.jupiter.api.Test)

Example 65 with RegistryConfig

use of org.apache.dubbo.config.RegistryConfig in project dubbo by alibaba.

the class Application method startWithBootstrap.

private static void startWithBootstrap() {
    ServiceConfig<DemoServiceImpl> service = new ServiceConfig<>();
    service.setInterface(DemoService.class);
    service.setRef(new DemoServiceImpl());
    DubboBootstrap bootstrap = DubboBootstrap.getInstance();
    bootstrap.application(new ApplicationConfig("dubbo-demo-api-provider")).registry(new RegistryConfig("zookeeper://127.0.0.1:2181")).service(service).start().await();
}
Also used : RegistryConfig(org.apache.dubbo.config.RegistryConfig) ServiceConfig(org.apache.dubbo.config.ServiceConfig) ApplicationConfig(org.apache.dubbo.config.ApplicationConfig) DubboBootstrap(org.apache.dubbo.config.bootstrap.DubboBootstrap)

Aggregations

RegistryConfig (org.apache.dubbo.config.RegistryConfig)68 ApplicationConfig (org.apache.dubbo.config.ApplicationConfig)42 Test (org.junit.jupiter.api.Test)34 ProtocolConfig (org.apache.dubbo.config.ProtocolConfig)29 DubboBootstrap (org.apache.dubbo.config.bootstrap.DubboBootstrap)20 ServiceConfig (org.apache.dubbo.config.ServiceConfig)19 ReferenceConfig (org.apache.dubbo.config.ReferenceConfig)16 DemoService (org.apache.dubbo.config.spring.api.DemoService)13 GenericService (org.apache.dubbo.rpc.service.GenericService)8 ArrayList (java.util.ArrayList)7 URL (org.apache.dubbo.common.URL)7 DemoServiceImpl (org.apache.dubbo.config.spring.impl.DemoServiceImpl)7 ConsumerConfig (org.apache.dubbo.config.ConsumerConfig)5 Matchers.containsString (org.hamcrest.Matchers.containsString)5 ModuleConfig (org.apache.dubbo.config.ModuleConfig)4 MonitorConfig (org.apache.dubbo.config.MonitorConfig)4 ProviderConfig (org.apache.dubbo.config.ProviderConfig)4 Bean (org.springframework.context.annotation.Bean)4 List (java.util.List)3 MethodConfig (org.apache.dubbo.config.MethodConfig)3