@Test public void testGetTargetNodeOfVirtualNode() { List<MigrationRoutePair> migrationRoutePairs = new ArrayList<MigrationRoutePair>(); for (int i = 0; i < 1000 ; i++) { MigrationRoutePair pair = new MigrationRoutePair(); pair.setVnode( i ); pair.setTargetPhysicalId("127.0.0.1"); migrationRoutePairs.add( pair ); } MigrationVirtualNodeFinder finder = new MigrationVirtualNodeFinder(migrationRoutePairs); String targetNode1 = finder.getTargetNodeOfVirtualNode( 100 ); assertNotNull("targetNode1 found", targetNode1); String targetNode2 = finder.getTargetNodeOfVirtualNode( 1000 + 1 ); assertNull("targetNode2 not found ", targetNode2); }
public String getTargetNodeOfVirtualNode(int vnode) { return index.get( vnode ); }
MigrationVirtualNodeFinder { public String getTargetNodeOfVirtualNode(int vnode) { return index.get( vnode ); } }
MigrationVirtualNodeFinder { public String getTargetNodeOfVirtualNode(int vnode) { return index.get( vnode ); } MigrationVirtualNodeFinder(List<MigrationRoutePair> migrationRoutePairs); }
MigrationVirtualNodeFinder { public String getTargetNodeOfVirtualNode(int vnode) { return index.get( vnode ); } MigrationVirtualNodeFinder(List<MigrationRoutePair> migrationRoutePairs); String getTargetNodeOfVirtualNode(int vnode); }
MigrationVirtualNodeFinder { public String getTargetNodeOfVirtualNode(int vnode) { return index.get( vnode ); } MigrationVirtualNodeFinder(List<MigrationRoutePair> migrationRoutePairs); String getTargetNodeOfVirtualNode(int vnode);  }