RemoteRpcRegistryMXBeanImpl extends AbstractRegistryMXBean<RoutingTable, DOMRpcIdentifier> implements RemoteRpcRegistryMXBean { @Override public Map<String, String> findRpcByName(final String name) { RoutingTable localTable = localData(); Map<String, String> rpcMap = new HashMap<>(getRpcMemberMapByName(localTable, name, LOCAL_CONSTANT)); Map<Address, Bucket<RoutingTable>> buckets = remoteBuckets(); for (Entry<Address, Bucket<RoutingTable>> entry : buckets.entrySet()) { RoutingTable table = entry.getValue().getData(); rpcMap.putAll(getRpcMemberMapByName(table, name, entry.getKey().toString())); } log.debug("list of RPCs {} searched by name {}", rpcMap, name); return rpcMap; } RemoteRpcRegistryMXBeanImpl(final BucketStoreAccess rpcRegistryAccess, final Timeout timeout); @Override Set<String> getGlobalRpc(); @Override Set<String> getLocalRegisteredRoutedRpc(); @Override Map<String, String> findRpcByName(final String name); @Override Map<String, String> findRpcByRoute(final String routeId); @Override String getBucketVersions();  }
@Test public void testFindRpcByNameEmptyBuckets() { final Map<String, String> rpcByName = mxBean.findRpcByName(""); assertNotNull(rpcByName); assertTrue(rpcByName.isEmpty()); }
@Test public void testFindRpcByName() { testActor.tell(new RpcRegistry.Messages.AddOrUpdateRoutes(Lists.newArrayList(buckets)), ActorRef.noSender()); final Map<String, String> rpcByName = mxBean.findRpcByName(""); assertNotNull(rpcByName); assertEquals(1, rpcByName.size()); assertTrue(rpcByName.containsValue(LOCAL_QNAME.getLocalName())); }