/** * Blocks and waits for a replication event on async caches * @param key key that causes the replication. Used to determine which caches to listen on. If null, all caches * are checked * @param command command to listen for */ protected void asyncWait(Object key, Class<? extends VisitableCommand> command) { asyncWait(key, command::isInstance); }
protected void initAndTest() { for (Cache<K, V> c : caches) assert c.isEmpty(); // TODO: A bit hacky, this should be moved somewhere else really... Cache<Object, Object> firstCache = (Cache<Object, Object>) caches.get(0); firstCache.put("k1", "value"); asyncWait("k1", PutKeyValueCommand.class); assertOnAllCachesAndOwnership("k1", "value"); }