tracker.open();
Assert.assertEquals(
ImmutableMultimap.<String, String>of(), usersQueue.poll(1, TimeUnit.SECONDS));
TableUserRegistration registration = mMonitor.newTableUserRegistration(user, tableURI);
try {
Assert.assertNull("Unexpected users update.", usersQueue.poll());
registration.updateRegisteredLayout(layout1);
Assert.assertEquals(
ImmutableSetMultimap.of(user, layout1), usersQueue.take());
registration.updateRegisteredLayout(layout2);
// First action is to unregister
Assert.assertEquals(
ImmutableSetMultimap.<String, String>of(), usersQueue.take());
// and then re-register with updated layout
Assert.assertEquals(
ImmutableSetMultimap.of(user, layout2), usersQueue.take());
registration.close();
Assert.assertEquals(
ImmutableSetMultimap.<String, String>of(), usersQueue.take());
} finally {
registration.close();
}
} finally {
tracker.close();
}
}