Search in sources :

Example 6 with UUIDBroadcasterCache

use of org.atmosphere.cache.UUIDBroadcasterCache in project atmosphere by Atmosphere.

the class BroadcasterCacheTest method testBasicExcludeCache.

@Test
public void testBasicExcludeCache() throws ExecutionException, InterruptedException, ServletException {
    BroadcasterCache cache = new UUIDBroadcasterCache();
    cache.configure(config);
    AtmosphereResource r = config.resourcesFactory().create(broadcaster.getBroadcasterConfig().getAtmosphereConfig(), "1234567");
    cache.excludeFromCache(broadcaster.getID(), r);
    broadcaster.getBroadcasterConfig().setBroadcasterCache(cache);
    broadcaster.removeAtmosphereResource(r);
    broadcaster.broadcast("foo").get();
    List<Object> l = cache.retrieveFromCache(broadcaster.getID(), ar.uuid());
    assertNotNull(l);
    assertEquals(l.isEmpty(), true);
}
Also used : UUIDBroadcasterCache(org.atmosphere.cache.UUIDBroadcasterCache) UUIDBroadcasterCache(org.atmosphere.cache.UUIDBroadcasterCache) AbstractBroadcasterCache(org.atmosphere.cache.AbstractBroadcasterCache) Test(org.testng.annotations.Test)

Aggregations

UUIDBroadcasterCache (org.atmosphere.cache.UUIDBroadcasterCache)6 Test (org.testng.annotations.Test)5 AbstractBroadcasterCache (org.atmosphere.cache.AbstractBroadcasterCache)2 SimpleBroadcaster (org.atmosphere.util.SimpleBroadcaster)2 List (java.util.List)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 AtmosphereHandlerAdapter (org.atmosphere.handler.AtmosphereHandlerAdapter)1 BeforeMethod (org.testng.annotations.BeforeMethod)1