for (int i = 0; i < egis.size(); i++) {
fMetaService.updateEntityGroupLocation(egis.get(i), egLocations[i]);
}
for (int i = 0; i < egis.size(); i++) {
// getEntityGroupLocation
ServerName sn = fMetaService.getEntityGroupLocation(egis.get(i));
assertEquals(sn.compareTo(egLocations[i]), 0);
}
for (int i = 0; i < egis.size(); i++) {
// getEntityGroupsAndLocations
Pair<EntityGroupInfo, ServerName> pair = fMetaService
.getEntityGroupAndLocation(egis.get(i).getEntityGroupName());
assertEquals(pair.getFirst().compareTo(egis.get(i)), 0);
assertEquals(pair.getSecond().compareTo(egLocations[i]), 0);
}
Set<String> disabledTables = new HashSet<String>();
// fullScan
Map<EntityGroupInfo, ServerName> entityGroups = fMetaService.fullScan(
disabledTables, false);
assertEquals(entityGroups.size(), egis.size());
for (int i = 0; i < egis.size(); i++) {
ServerName sn = entityGroups.get(egis.get(i));
assertEquals(sn.compareTo(egLocations[i]), 0);
}
// getOfflineSplitParents
Map<EntityGroupInfo, Result> offlineSplitParents = fMetaService
.getOfflineSplitParents();
assertEquals(offlineSplitParents.size(), 0);
// getServerUserEntityGroups
NavigableMap<EntityGroupInfo, Result> egR = fMetaService
.getServerUserEntityGroups(egLocations[0]);
assertEquals(1, egR.size());
{
Result r = egR.get(egis.get(0));
byte[] infoValue = r.getValue(FConstants.CATALOG_FAMILY,
FConstants.EGINFO);
byte[] locationValue = r.getValue(FConstants.CATALOG_FAMILY,
FConstants.EGLOCATION);
EntityGroupInfo key = EntityGroupInfo.parseFromOrNull(infoValue);
ServerName value = ServerName.convert(locationValue);
assertEquals(key.compareTo(egis.get(0)), 0);
assertEquals(value.compareTo(egLocations[0]), 0);
}
// getTableEntityGroupsAndLocations
List<Pair<EntityGroupInfo, ServerName>> entityGroupInfos = fMetaService
.getTableEntityGroupsAndLocations(Bytes.toBytes(tableName), false);
entityGroups = new TreeMap<EntityGroupInfo, ServerName>();
for (Pair<EntityGroupInfo, ServerName> pair : entityGroupInfos) {
entityGroups.put(pair.getFirst(), pair.getSecond());
}
for (int i = 0; i < egis.size(); i++) {
ServerName sn = entityGroups.get(egis.get(i));
assertEquals(sn.compareTo(egLocations[i]), 0);
}
fMetaService.dropTable(FMetaTestUtil.User.getTableName());
}