use of org.atmosphere.cache.CacheMessage in project atmosphere by Atmosphere.
the class BroadcasterCacheTest method testEmptyRejectedCache.
@Test
public void testEmptyRejectedCache() throws ExecutionException, InterruptedException, ServletException {
final CountDownLatch latch = new CountDownLatch(1);
broadcaster.getBroadcasterConfig().setBroadcasterCache(new AbstractBroadcasterCache() {
@Override
public CacheMessage addToCache(String id, String uuid, BroadcastMessage e) {
CacheMessage c = put(e, System.nanoTime(), uuid, broadcaster.getID());
cachedMessage.set(messages);
latch.countDown();
return c;
}
@Override
public List<Object> retrieveFromCache(String id, String uuid) {
return Collections.<Object>emptyList();
}
}).getBroadcasterCache().inspector(new BroadcasterCacheInspector() {
@Override
public boolean inspect(BroadcastMessage message) {
return false;
}
});
broadcaster.broadcast("foo", ar);
latch.await(10, TimeUnit.SECONDS);
assertEquals(cachedMessage.get().size(), 0);
}
Aggregations