use of com.alibaba.dubbo.config.ProviderConfig in project dubbo by alibaba.
the class ServiceBean method isDelay.
private boolean isDelay() {
Integer delay = getDelay();
ProviderConfig provider = getProvider();
if (delay == null && provider != null) {
delay = provider.getDelay();
}
return supportedApplicationListener && (delay == null || delay.intValue() == -1);
}
use of com.alibaba.dubbo.config.ProviderConfig in project dubbo by alibaba.
the class UrlTestBase method initServConf.
@SuppressWarnings("deprecation")
protected void initServConf() {
appConfForProvider = new ApplicationConfig();
appConfForService = new ApplicationConfig();
regConfForProvider = new RegistryConfig();
regConfForService = new RegistryConfig();
provConf = new ProviderConfig();
protoConfForProvider = new ProtocolConfig();
protoConfForService = new ProtocolConfig();
methodConfForService = new MethodConfig();
servConf = new ServiceConfig<DemoService>();
provConf.setApplication(appConfForProvider);
servConf.setApplication(appConfForService);
provConf.setRegistry(regConfForProvider);
servConf.setRegistry(regConfForService);
provConf.setProtocols(Arrays.asList(new ProtocolConfig[] { protoConfForProvider }));
servConf.setProtocols(Arrays.asList(new ProtocolConfig[] { protoConfForService }));
servConf.setMethods(Arrays.asList(new MethodConfig[] { methodConfForService }));
servConf.setProvider(provConf);
servConf.setRef(demoService);
servConf.setInterfaceClass(DemoService.class);
methodConfForService.setName("sayName");
regConfForService.setAddress("127.0.0.1:9090");
regConfForService.setProtocol("mockregistry");
appConfForService.setName("ConfigTests");
}
use of com.alibaba.dubbo.config.ProviderConfig in project dubbo by alibaba.
the class ConfigTest method testAppendFilter.
@Test
public void testAppendFilter() throws Exception {
ProviderConfig provider = new ProviderConfig();
provider.setFilter("classloader,monitor");
ServiceConfig<DemoService> service = new ServiceConfig<DemoService>();
service.setFilter("accesslog,trace");
service.setProvider(provider);
service.setProtocol(new ProtocolConfig("dubbo", 20880));
service.setApplication(new ApplicationConfig("provider"));
service.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE));
service.setInterface(DemoService.class);
service.setRef(new DemoServiceImpl());
try {
service.export();
List<URL> urls = service.toUrls();
assertNotNull(urls);
assertEquals(1, urls.size());
assertEquals("classloader,monitor,accesslog,trace", urls.get(0).getParameter("service.filter"));
ConsumerConfig consumer = new ConsumerConfig();
consumer.setFilter("classloader,monitor");
ReferenceConfig<DemoService> reference = new ReferenceConfig<DemoService>();
reference.setFilter("accesslog,trace");
reference.setConsumer(consumer);
reference.setApplication(new ApplicationConfig("consumer"));
reference.setRegistry(new RegistryConfig(RegistryConfig.NO_AVAILABLE));
reference.setInterface(DemoService.class);
reference.setUrl("dubbo://" + NetUtils.getLocalHost() + ":20880?" + DemoService.class.getName() + "?check=false");
try {
reference.get();
urls = reference.toUrls();
assertNotNull(urls);
assertEquals(1, urls.size());
assertEquals("classloader,monitor,accesslog,trace", urls.get(0).getParameter("reference.filter"));
} finally {
reference.destroy();
}
} finally {
service.unexport();
}
}
Aggregations