@SuppressWarnings({"unchecked"}) ShardedAvroBase<User, String> sab = pusher.create(ShardedAvroBase.class);
sab.addShard(mab1, 1.0, false);
int T = 1000;
for (int i = 0; i < T; i++) {
User user = getUser();
String row = KEYTX.newKey();
user.firstName = new Utf8(user.firstName.toString() + row);
sab.put(row, user);
}
sab.addShard(mab2, 3.0, true);
int count = 0;
for (String tRow : mab1.scanKeys(null, null)) {
count++;
}
assertEquals(T/4, count);
for (String tRow : mab2.scanKeys(null, null)) {
count++;
}
assertEquals(T, count);
sab.addShard(mab3, 1.0, true);
count = 0;
for (String tRow : mab1.scanKeys(null, null)) {
count++;
}
assertEquals(T/5, count);
for (String tRow : mab2.scanKeys(null, null)) {
count++;
}
assertEquals(T/5*4, count);
for (String tRow : mab3.scanKeys(null, null)) {
count++;
}
assertEquals(T, count);
sab.addShard(mab4, 5.0, true);
for (int i = 0; i < T; i++) {
User user = getUser();
String row = KEYTX.newKey();
user.firstName = new Utf8(user.firstName.toString() + row);
sab.put(row, user);
}