+ "but only found " + entityGroups.size(), expectedEntityGroups,
entityGroups.size());
System.err.println("Found " + entityGroups.size() + " entityGroups");
Iterator<EntityGroupInfo> egis = entityGroups.keySet().iterator();
EntityGroupInfo egi = egis.next();
assertTrue(egi.getStartKey() == null || egi.getStartKey().length == 0);
assertTrue(Bytes.equals(egi.getEndKey(), splitKeys[0]));
egi = egis.next();
assertTrue(Bytes.equals(egi.getStartKey(), splitKeys[0]));
assertTrue(Bytes.equals(egi.getEndKey(), splitKeys[1]));
egi = egis.next();
assertTrue(Bytes.equals(egi.getStartKey(), splitKeys[1]));
assertTrue(Bytes.equals(egi.getEndKey(), splitKeys[2]));
egi = egis.next();
assertTrue(Bytes.equals(egi.getStartKey(), splitKeys[2]));
assertTrue(Bytes.equals(egi.getEndKey(), splitKeys[3]));
egi = egis.next();
assertTrue(Bytes.equals(egi.getStartKey(), splitKeys[3]));
assertTrue(Bytes.equals(egi.getEndKey(), splitKeys[4]));
egi = egis.next();
assertTrue(Bytes.equals(egi.getStartKey(), splitKeys[4]));
assertTrue(Bytes.equals(egi.getEndKey(), splitKeys[5]));
egi = egis.next();
assertTrue(Bytes.equals(egi.getStartKey(), splitKeys[5]));
assertTrue(Bytes.equals(egi.getEndKey(), splitKeys[6]));
egi = egis.next();
assertTrue(Bytes.equals(egi.getStartKey(), splitKeys[6]));
assertTrue(Bytes.equals(egi.getEndKey(), splitKeys[7]));
egi = egis.next();
assertTrue(Bytes.equals(egi.getStartKey(), splitKeys[7]));
assertTrue(Bytes.equals(egi.getEndKey(), splitKeys[8]));
egi = egis.next();
assertTrue(Bytes.equals(egi.getStartKey(), splitKeys[8]));
assertTrue(egi.getEndKey() == null || egi.getEndKey().length == 0);
// Now test using start/end with a number of entityGroups
// Use 80 bit numbers to make sure we aren't limited
byte[] startKey = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
byte[] endKey = { 9, 9, 9, 9, 9, 9, 9, 9, 9, 9 };
// Splitting into 10 entityGroups, we expect (null,1) ... (9, null)
// with (1,2) (2,3) (3,4) (4,5) (5,6) (6,7) (7,8) (8,9) in the middle
expectedEntityGroups = 10;
byte[] TABLE_2 = Bytes.add(tableName, Bytes.toBytes("_2"));
desc = FMetaTestUtil.makeTable(Bytes.toString(TABLE_2));
admin = new WaspAdmin(TEST_UTIL.getConfiguration());
admin.createTable(desc, startKey, endKey, expectedEntityGroups);
entityGroups = admin.getEntityGroupLocations(TABLE_2);
assertEquals("Tried to create " + expectedEntityGroups + " entityGroups "
+ "but only found " + entityGroups.size(), expectedEntityGroups,
entityGroups.size());
System.err.println("Found " + entityGroups.size() + " entityGroups");
egis = entityGroups.keySet().iterator();
egi = egis.next();
assertTrue(egi.getStartKey() == null || egi.getStartKey().length == 0);
assertTrue(Bytes.equals(egi.getEndKey(), new byte[]{1, 1, 1, 1, 1, 1, 1,
1, 1, 1}));
egi = egis.next();
assertTrue(Bytes.equals(egi.getStartKey(), new byte[]{1, 1, 1, 1, 1, 1,
1, 1, 1, 1}));
assertTrue(Bytes.equals(egi.getEndKey(), new byte[]{2, 2, 2, 2, 2, 2, 2,
2, 2, 2}));
egi = egis.next();
assertTrue(Bytes.equals(egi.getStartKey(), new byte[]{2, 2, 2, 2, 2, 2,
2, 2, 2, 2}));
assertTrue(Bytes.equals(egi.getEndKey(), new byte[]{3, 3, 3, 3, 3, 3, 3,
3, 3, 3}));
egi = egis.next();
assertTrue(Bytes.equals(egi.getStartKey(), new byte[]{3, 3, 3, 3, 3, 3,
3, 3, 3, 3}));
assertTrue(Bytes.equals(egi.getEndKey(), new byte[]{4, 4, 4, 4, 4, 4, 4,
4, 4, 4}));
egi = egis.next();
assertTrue(Bytes.equals(egi.getStartKey(), new byte[]{4, 4, 4, 4, 4, 4,
4, 4, 4, 4}));
assertTrue(Bytes.equals(egi.getEndKey(), new byte[]{5, 5, 5, 5, 5, 5, 5,
5, 5, 5}));
egi = egis.next();
assertTrue(Bytes.equals(egi.getStartKey(), new byte[]{5, 5, 5, 5, 5, 5,
5, 5, 5, 5}));
assertTrue(Bytes.equals(egi.getEndKey(), new byte[]{6, 6, 6, 6, 6, 6, 6,
6, 6, 6}));
egi = egis.next();
assertTrue(Bytes.equals(egi.getStartKey(), new byte[]{6, 6, 6, 6, 6, 6,
6, 6, 6, 6}));
assertTrue(Bytes.equals(egi.getEndKey(), new byte[]{7, 7, 7, 7, 7, 7, 7,
7, 7, 7}));
egi = egis.next();
assertTrue(Bytes.equals(egi.getStartKey(), new byte[]{7, 7, 7, 7, 7, 7,
7, 7, 7, 7}));
assertTrue(Bytes.equals(egi.getEndKey(), new byte[]{8, 8, 8, 8, 8, 8, 8,
8, 8, 8}));
egi = egis.next();
assertTrue(Bytes.equals(egi.getStartKey(), new byte[]{8, 8, 8, 8, 8, 8,
8, 8, 8, 8}));
assertTrue(Bytes.equals(egi.getEndKey(), new byte[]{9, 9, 9, 9, 9, 9, 9,
9, 9, 9}));
egi = egis.next();
assertTrue(Bytes.equals(egi.getStartKey(), new byte[]{9, 9, 9, 9, 9, 9,
9, 9, 9, 9}));
assertTrue(egi.getEndKey() == null || egi.getEndKey().length == 0);
// Try once more with something that divides into something infinite
startKey = new byte[] { 0, 0, 0, 0, 0, 0 };
endKey = new byte[] { 1, 0, 0, 0, 0, 0 };