本文整理汇总了Java中com.alibaba.dubbo.config.spring.api.HelloService类的典型用法代码示例。如果您正苦于以下问题:Java HelloService类的具体用法?Java HelloService怎么用?Java HelloService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HelloService类属于com.alibaba.dubbo.config.spring.api包,在下文中一共展示了HelloService类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testProtocolRandomPort
import com.alibaba.dubbo.config.spring.api.HelloService; //导入依赖的package包/类
@Test
public void testProtocolRandomPort() throws Exception {
ServiceConfig<DemoService> demoService = null;
ServiceConfig<HelloService> helloService = null;
ApplicationConfig application = new ApplicationConfig();
application.setName("test-protocol-random-port");
RegistryConfig registry = new RegistryConfig();
registry.setAddress("N/A");
ProtocolConfig protocol = new ProtocolConfig();
protocol.setName("dubbo");
protocol.setPort(-1);
demoService = new ServiceConfig<DemoService>();
demoService.setInterface(DemoService.class);
demoService.setRef(new DemoServiceImpl());
demoService.setApplication(application);
demoService.setRegistry(registry);
demoService.setProtocol(protocol);
helloService = new ServiceConfig<HelloService>();
helloService.setInterface(HelloService.class);
helloService.setRef(new HelloServiceImpl());
helloService.setApplication(application);
helloService.setRegistry(registry);
helloService.setProtocol(protocol);
try {
demoService.export();
helloService.export();
Assert.assertEquals(demoService.getExportedUrls().get(0).getPort(),
helloService.getExportedUrls().get(0).getPort());
} finally {
unexportService(demoService);
unexportService(helloService);
}
}
示例2: testProtocolRandomPort
import com.alibaba.dubbo.config.spring.api.HelloService; //导入依赖的package包/类
@Test
public void testProtocolRandomPort() throws Exception {
ServiceConfig<DemoService> demoService = null;
ServiceConfig<HelloService> helloService = null;
ApplicationConfig application = new ApplicationConfig();
application.setName("test-protocol-random-port");
RegistryConfig registry = new RegistryConfig();
registry.setAddress("N/A");
ProtocolConfig protocol = new ProtocolConfig();
protocol.setName("dubbo");
protocol.setPort(-1);
demoService = new ServiceConfig<DemoService>();
demoService.setInterface(DemoService.class);
demoService.setRef(new DemoServiceImpl());
demoService.setApplication(application);
demoService.setRegistry(registry);
demoService.setProtocol(protocol);
helloService = new ServiceConfig<HelloService>();
helloService.setInterface(HelloService.class);
helloService.setRef(new HelloServiceImpl());
helloService.setApplication(application);
helloService.setRegistry(registry);
helloService.setProtocol(protocol);
try {
demoService.export();
helloService.export();
Assert.assertEquals(demoService.getExportedUrls().get(0).getPort(),
helloService.getExportedUrls().get(0).getPort());
} finally {
unexportService(demoService);
unexportService(helloService);
}
}