StorageNodeStatsBridge { public static ContentClusterStats generate(Distributor distributor) { Map<Integer, ContentNodeStats> mapToNodeStats = new HashMap<>(); for (StorageNode storageNode : distributor.getStorageNodes()) { mapToNodeStats.put(storageNode.getIndex(), new ContentNodeStats(storageNode)); } return new ContentClusterStats(mapToNodeStats); } private  StorageNodeStatsBridge(); static ContentClusterStats generate(Distributor distributor);  }
@Test public void testContentNodeStats() throws IOException { String data = getJsonString(); HostInfo hostInfo = HostInfo.createHostInfo(data); ContentClusterStats clusterStats = StorageNodeStatsBridge.generate(hostInfo.getDistributor()); Iterator<ContentNodeStats> itr = clusterStats.iterator(); { ContentNodeStats stats = itr.next(); assertThat(stats.getNodeIndex(), is(0)); assertThat(stats.getBucketSpaces().size(), is(2)); assertBucketSpaceStats(11, 3, stats.getBucketSpaces().get("default")); assertBucketSpaceStats(13, 5, stats.getBucketSpaces().get("global")); } { ContentNodeStats stats = itr.next(); assertThat(stats.getNodeIndex(), is(1)); assertThat(stats.getBucketSpaces().size(), is(1)); assertBucketSpaceStats(0, 0, stats.getBucketSpaces().get("default")); } assertFalse(itr.hasNext()); }