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;
}
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());
}
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());
}
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());
}
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();
}
Aggregations