use of org.apache.dubbo.rpc.protocol.DelegateExporterMap in project dubbo by alibaba.
the class InjvmProtocolTest method testLocalProtocol.
@Test
public void testLocalProtocol() throws Exception {
DemoService service = new DemoServiceImpl();
Invoker<?> invoker = proxy.getInvoker(service, DemoService.class, URL.valueOf("injvm://127.0.0.1/TestService").addParameter(INTERFACE_KEY, DemoService.class.getName()));
assertTrue(invoker.isAvailable());
Exporter<?> exporter = protocol.export(invoker);
exporters.add(exporter);
service = proxy.getProxy(protocol.refer(DemoService.class, URL.valueOf("injvm://127.0.0.1/TestService").addParameter(INTERFACE_KEY, DemoService.class.getName())));
assertEquals(service.getSize(new String[] { "", "", "" }), 3);
service.invoke("injvm://127.0.0.1/TestService", "invoke");
InjvmInvoker injvmInvoker = new InjvmInvoker(DemoService.class, URL.valueOf("injvm://127.0.0.1/TestService"), null, new DelegateExporterMap() {
@Override
public boolean isEmpty() {
return true;
}
@Override
public Exporter<?> getExport(String key) {
return null;
}
@Override
public void addExportMap(String key, Exporter<?> exporter) {
}
@Override
public boolean removeExportMap(String key, Exporter<?> exporter) {
return true;
}
@Override
public Collection<Exporter<?>> getExporters() {
return null;
}
});
assertFalse(injvmInvoker.isAvailable());
}
Aggregations