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