public void testSameValues2() { Random rnd = new Random(); for (int i = 0; i < 10000; i++) { byte[] key = new byte[i + 1]; rnd.nextBytes(key); assertEquals(vOld.getServer(key), vNew.getServer(key), "int value is " + i); } }
@BeforeTest public void init() { int hashSpace = Integer.MAX_VALUE; int share = hashSpace / PHISYCAL_NODES; int virtualNodesSpan = share / VIRTUAL_NODES - 1; ch = new LinkedHashMap<SocketAddress, Set<Integer>>(); for (int i = 0; i < PHISYCAL_NODES; i++) { Set<Integer> virtualNodes = new HashSet<Integer>(); for (int j = 0; j < VIRTUAL_NODES; j++) { virtualNodes.add(share * i + virtualNodesSpan * j); } ch.put(new InetSocketAddress(i), virtualNodes); } vOld.init(ch, 2, Integer.MAX_VALUE); vNew.init(ch, 2, Integer.MAX_VALUE); }
public void testIsolatedValue2() { byte[] key = String.valueOf(7).getBytes(); SocketAddress newOne = vNew.getServer(key); SocketAddress oldOne = vOld.getServer(key); assertEquals(oldOne, newOne); }
public void testSameValues() { for (int i = 0; i < 1000; i++) { byte[] key = String.valueOf(i).getBytes(); assertEquals(vOld.getServer(key), vNew.getServer(key), "int value is " + i); } }