Java Code Examples for com.alibaba.dubbo.config.ProviderConfig#setFilter()
The following examples show how to use
com.alibaba.dubbo.config.ProviderConfig#setFilter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DubboAutoConfiguration.java From spring-boot-starter-dubbo with Apache License 2.0 | 6 votes |
private void registerProvider(ProviderConfig provider, ConfigurableListableBeanFactory beanFactory) { if (provider != null) { String beanName = provider.getId(); if (StringUtils.isEmpty(beanName)) { beanName = "providerConfig"; } String filter = provider.getFilter(); if (StringUtils.isEmpty(filter)) { filter = "regerProviderFilter"; } else { filter = filter.trim() + ",regerProviderFilter"; } logger.debug("添加consumerFilter后的Filter, {}", filter); provider.setFilter(filter); beanFactory.registerSingleton(beanName, provider); } else { logger.debug("dubbo 没有配置默认的生成者参数"); } }
Example 2
Source File: ConfigTest.java From dubbo-2.6.5 with Apache License 2.0 | 4 votes |
@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(); } }
Example 3
Source File: ConfigTest.java From dubbox with Apache License 2.0 | 4 votes |
@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(); } }
Example 4
Source File: ConfigTest.java From dubbox-hystrix with Apache License 2.0 | 4 votes |
@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(); } }
Example 5
Source File: ConfigTest.java From dubbo3 with Apache License 2.0 | 4 votes |
@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(); } }
Example 6
Source File: ConfigTest.java From dubbox with Apache License 2.0 | 4 votes |
@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(); } }
Example 7
Source File: ConfigTest.java From dubbox with Apache License 2.0 | 4 votes |
@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(); } }