Search in sources :

Example 1 with EVT_CACHE_OBJECT_PUT

use of org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT in project ignite by apache.

the class EventsRemoteSecurityContextCheckTest method checkRemoteListenWithNullFilter.

/**
 */
private void checkRemoteListenWithNullFilter(boolean async) throws Exception {
    for (IgniteEx initiator : initiators()) {
        IgniteCache<Object, Object> cache = initiator.createCache(new CacheConfiguration<>("test_cache_" + INDEX.incrementAndGet()).setCacheMode(REPLICATED));
        CountDownLatch srvNodesListenedLatch = new CountDownLatch(initiator.cluster().forServers().nodes().size());
        IgniteBiPredicate<UUID, ? extends Event> locLsnr = (uuid, e) -> {
            srvNodesListenedLatch.countDown();
            return true;
        };
        UUID lsnrId = async ? initiator.events().remoteListenAsync(locLsnr, null, EVT_CACHE_OBJECT_PUT).get() : initiator.events().remoteListen(locLsnr, null, EVT_CACHE_OBJECT_PUT);
        try {
            cache.put("key", "val");
            assertTrue(srvNodesListenedLatch.await(getTestTimeout(), MILLISECONDS));
        } finally {
            initiator.events().stopRemoteListen(lsnrId);
        }
    }
}
Also used : Arrays(java.util.Arrays) IgniteBiPredicate(org.apache.ignite.lang.IgniteBiPredicate) BiFunction(java.util.function.BiFunction) IgniteEx(org.apache.ignite.internal.IgniteEx) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) IgnitePredicate(org.apache.ignite.lang.IgnitePredicate) Map(java.util.Map) AbstractRemoteSecurityContextCheckTest(org.apache.ignite.internal.processors.security.AbstractRemoteSecurityContextCheckTest) IgniteEvents(org.apache.ignite.IgniteEvents) CacheEvent(org.apache.ignite.events.CacheEvent) EVT_CACHE_OBJECT_PUT(org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT) EventType(org.apache.ignite.events.EventType) Collection(java.util.Collection) Event(org.apache.ignite.events.Event) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Test(org.junit.Test) UUID(java.util.UUID) Ignite(org.apache.ignite.Ignite) MILLISECONDS(java.util.concurrent.TimeUnit.MILLISECONDS) IgniteCache(org.apache.ignite.IgniteCache) REPLICATED(org.apache.ignite.cache.CacheMode.REPLICATED) TimeUnit(java.util.concurrent.TimeUnit) CountDownLatch(java.util.concurrent.CountDownLatch) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) Ignition(org.apache.ignite.Ignition) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) Collections(java.util.Collections) IgniteEx(org.apache.ignite.internal.IgniteEx) CountDownLatch(java.util.concurrent.CountDownLatch) UUID(java.util.UUID) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Aggregations

Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 Map (java.util.Map)1 UUID (java.util.UUID)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 TimeUnit (java.util.concurrent.TimeUnit)1 MILLISECONDS (java.util.concurrent.TimeUnit.MILLISECONDS)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 BiFunction (java.util.function.BiFunction)1 Ignite (org.apache.ignite.Ignite)1 IgniteCache (org.apache.ignite.IgniteCache)1 IgniteEvents (org.apache.ignite.IgniteEvents)1 Ignition (org.apache.ignite.Ignition)1 REPLICATED (org.apache.ignite.cache.CacheMode.REPLICATED)1 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)1 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)1 CacheEvent (org.apache.ignite.events.CacheEvent)1 Event (org.apache.ignite.events.Event)1