use of org.apache.dubbo.config.spring.registry.MockRegistry in project dubbo by alibaba.
the class ConfigTest method testGenericServiceConfig.
@Test
public void testGenericServiceConfig() throws Exception {
ServiceConfig<GenericService> service = new ServiceConfig<GenericService>();
service.setRegistry(new RegistryConfig("mock://localhost"));
service.setInterface(DemoService.class.getName());
service.setGeneric(GENERIC_SERIALIZATION_BEAN);
service.setRef((method, parameterTypes, args) -> null);
DubboBootstrap bootstrap = DubboBootstrap.getInstance().application(new ApplicationConfig("test")).service(service).start();
try {
Collection<Registry> collection = MockRegistryFactory.getCachedRegistry();
MockRegistry registry = (MockRegistry) collection.iterator().next();
URL url = registry.getRegistered().get(0);
Assertions.assertEquals(GENERIC_SERIALIZATION_BEAN, url.getParameter(GENERIC_KEY));
} finally {
MockRegistryFactory.cleanCachedRegistry();
bootstrap.stop();
}
}
Aggregations