当前位置: 首页>>代码示例>>Java>>正文


Java RegistryProtocol.export方法代码示例

本文整理汇总了Java中com.alibaba.dubbo.registry.integration.RegistryProtocol.export方法的典型用法代码示例。如果您正苦于以下问题:Java RegistryProtocol.export方法的具体用法?Java RegistryProtocol.export怎么用?Java RegistryProtocol.export使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.alibaba.dubbo.registry.integration.RegistryProtocol的用法示例。


在下文中一共展示了RegistryProtocol.export方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testExport

import com.alibaba.dubbo.registry.integration.RegistryProtocol; //导入方法依赖的package包/类
@Test
public void testExport() {
    RegistryProtocol registryProtocol = new RegistryProtocol();
    registryProtocol.setCluster(new FailfastCluster());
    registryProtocol.setRegistryFactory(ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension());

    Protocol dubboProtocol = DubboProtocol.getDubboProtocol();
    registryProtocol.setProtocol(dubboProtocol);
    URL newRegistryUrl = registryUrl.addParameter(Constants.EXPORT_KEY, serviceUrl);
    DubboInvoker<DemoService> invoker = new DubboInvoker<DemoService>(DemoService.class,
            newRegistryUrl, new ExchangeClient[] { new MockedClient("10.20.20.20", 2222, true) });
    Exporter<DemoService> exporter = registryProtocol.export(invoker);
    Exporter<DemoService> exporter2 = registryProtocol.export(invoker);
    //同一个invoker,多次export的exporter不同
    Assert.assertNotSame(exporter, exporter2);
    exporter.unexport();
    exporter2.unexport();
    
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:20,代码来源:RegistryProtocolTest.java

示例2: testExport

import com.alibaba.dubbo.registry.integration.RegistryProtocol; //导入方法依赖的package包/类
@Test
public void testExport() {
    RegistryProtocol registryProtocol = new RegistryProtocol();
    registryProtocol.setCluster(new FailfastCluster());
    registryProtocol.setRegistryFactory(ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension());

    Protocol dubboProtocol = DubboProtocol.getDubboProtocol();
    registryProtocol.setProtocol(dubboProtocol);
    URL newRegistryUrl = registryUrl.addParameter(Constants.EXPORT_KEY, serviceUrl);
    DubboInvoker<DemoService> invoker = new DubboInvoker<DemoService>(DemoService.class,
            newRegistryUrl, new ExchangeClient[]{new MockedClient("10.20.20.20", 2222, true)});
    Exporter<DemoService> exporter = registryProtocol.export(invoker);
    Exporter<DemoService> exporter2 = registryProtocol.export(invoker);
    //同一个invoker,多次export的exporter不同
    Assert.assertNotSame(exporter, exporter2);
    exporter.unexport();
    exporter2.unexport();

}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:20,代码来源:RegistryProtocolTest.java

示例3: testExportUrlNull

import com.alibaba.dubbo.registry.integration.RegistryProtocol; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testExportUrlNull() {
    RegistryProtocol registryProtocol = new RegistryProtocol();
    registryProtocol.setCluster(new FailfastCluster());

    Protocol dubboProtocol = DubboProtocol.getDubboProtocol();
    registryProtocol.setProtocol(dubboProtocol);
    Invoker<DemoService> invoker = new DubboInvoker<DemoService>(DemoService.class,
            registryUrl, new ExchangeClient[] { new MockedClient("10.20.20.20", 2222, true) });
    registryProtocol.export(invoker);
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:12,代码来源:RegistryProtocolTest.java

示例4: testExportUrlNull

import com.alibaba.dubbo.registry.integration.RegistryProtocol; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testExportUrlNull() {
    RegistryProtocol registryProtocol = new RegistryProtocol();
    registryProtocol.setCluster(new FailfastCluster());

    Protocol dubboProtocol = DubboProtocol.getDubboProtocol();
    registryProtocol.setProtocol(dubboProtocol);
    Invoker<DemoService> invoker = new DubboInvoker<DemoService>(DemoService.class,
            registryUrl, new ExchangeClient[]{new MockedClient("10.20.20.20", 2222, true)});
    registryProtocol.export(invoker);
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:12,代码来源:RegistryProtocolTest.java


注:本文中的com.alibaba.dubbo.registry.integration.RegistryProtocol.export方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。