use of org.apache.dubbo.config.bootstrap.EchoServiceImpl in project dubbo by alibaba.
the class PublishingServiceDefinitionListenerTest method testOnServiceConfigExportedEvent.
/**
* Test {@link ServiceConfigExportedEvent} arising
*/
@Test
public void testOnServiceConfigExportedEvent() {
ServiceConfig<EchoService> serviceConfig = new ServiceConfig<>();
serviceConfig.setInterface(EchoService.class);
serviceConfig.setRef(new EchoServiceImpl());
serviceConfig.setRegistry(new RegistryConfig("N/A"));
serviceConfig.setProtocol(new ProtocolConfig("dubbo", NetUtils.getAvailablePort(20880 + new Random().nextInt(10000))));
serviceConfig.export();
String serviceDefinition = writableMetadataService.getServiceDefinition(EchoService.class.getName());
ServiceDefinition serviceDefinitionBuild = ServiceDefinitionBuilder.build(serviceConfig.getInterfaceClass());
assertEquals(serviceDefinition, JSON.toJSONString(serviceDefinitionBuild));
serviceConfig.unexport();
}
Aggregations