AdvancedDcMetaService implements DcMetaService { @VisibleForTesting protected List<RouteMeta> combineRouteInfo(List<RouteTbl> routes, List<ProxyTbl> proxies, DcMeta dcMeta) { List<DcTbl> dcTbls = dcService.findAllDcBasic(); Map<Long, ProxyTbl> proxyTblMap = convertToMap(proxies); List<RouteMeta> result = Lists.newArrayListWithCapacity(routes.size()); for(RouteTbl route : routes) { if(!dcMeta.getId().equals(getDcName(route.getSrcDcId(), dcTbls))) { continue; } RouteMeta routeMeta = new RouteMeta(); routeMeta.setId((int) route.getId()).setOrgId((int) route.getRouteOrgId()).setTag(route.getTag()); routeMeta.setSrcDc(getDcName(route.getSrcDcId(), dcTbls)).setDstDc(getDcName(route.getDstDcId(), dcTbls)); routeMeta.setRouteInfo(getRouteInfo(route, proxyTblMap)); result.add(routeMeta); } return result; }  @PostConstruct void initService(); @Override DcMeta getDcMeta(String dcName); @Override DcMeta getDcMeta(String dcName, Set<String> allowTypes); AdvancedDcMetaService setScheduled(ScheduledExecutorService scheduled); AdvancedDcMetaService setExecutors(ExecutorService executors); AdvancedDcMetaService setFactory(RetryCommandFactory factory);  }
@Test public void testProcess() { DcMeta meta = new DcMeta().setId("jq"); List<RouteTbl> routes = routeService.getActiveRouteTbls(); List<ProxyTbl> proxies = proxyService.getActiveProxyTbls(); List<RouteMeta> routeMetas = service.combineRouteInfo(routes, proxies, meta); routeMetas.forEach((routeMeta)->meta.addRoute(routeMeta)); logger.info("{}", meta); }