Search in sources :

Example 1 with ProviderConfig

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);
}
Also used : ProviderConfig(com.alibaba.dubbo.config.ProviderConfig)

Example 2 with ProviderConfig

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");
}
Also used : RegistryConfig(com.alibaba.dubbo.config.RegistryConfig) MethodConfig(com.alibaba.dubbo.config.MethodConfig) ApplicationConfig(com.alibaba.dubbo.config.ApplicationConfig) ProviderConfig(com.alibaba.dubbo.config.ProviderConfig) DemoService(com.alibaba.dubbo.config.api.DemoService) ProtocolConfig(com.alibaba.dubbo.config.ProtocolConfig)

Example 3 with ProviderConfig

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();
    }
}
Also used : RegistryConfig(com.alibaba.dubbo.config.RegistryConfig) ProviderConfig(com.alibaba.dubbo.config.ProviderConfig) DemoService(com.alibaba.dubbo.config.spring.api.DemoService) URL(com.alibaba.dubbo.common.URL) ServiceConfig(com.alibaba.dubbo.config.ServiceConfig) ApplicationConfig(com.alibaba.dubbo.config.ApplicationConfig) ReferenceConfig(com.alibaba.dubbo.config.ReferenceConfig) ConsumerConfig(com.alibaba.dubbo.config.ConsumerConfig) ProtocolConfig(com.alibaba.dubbo.config.ProtocolConfig) DemoServiceImpl(com.alibaba.dubbo.config.spring.impl.DemoServiceImpl) Test(org.junit.Test)

Aggregations

ProviderConfig (com.alibaba.dubbo.config.ProviderConfig)3 ApplicationConfig (com.alibaba.dubbo.config.ApplicationConfig)2 ProtocolConfig (com.alibaba.dubbo.config.ProtocolConfig)2 RegistryConfig (com.alibaba.dubbo.config.RegistryConfig)2 URL (com.alibaba.dubbo.common.URL)1 ConsumerConfig (com.alibaba.dubbo.config.ConsumerConfig)1 MethodConfig (com.alibaba.dubbo.config.MethodConfig)1 ReferenceConfig (com.alibaba.dubbo.config.ReferenceConfig)1 ServiceConfig (com.alibaba.dubbo.config.ServiceConfig)1 DemoService (com.alibaba.dubbo.config.api.DemoService)1 DemoService (com.alibaba.dubbo.config.spring.api.DemoService)1 DemoServiceImpl (com.alibaba.dubbo.config.spring.impl.DemoServiceImpl)1 Test (org.junit.Test)1