use of org.infinispan.distribution.MagicKey in project infinispan by infinispan.
the class AbstractClusterListenerTest method testCreateFromNonOwnerWithListenerNotOwner.
@Test
public void testCreateFromNonOwnerWithListenerNotOwner() {
Cache<Object, String> cache0 = cache(0, CACHE_NAME);
Cache<Object, String> cache1 = cache(1, CACHE_NAME);
Cache<Object, String> cache2 = cache(2, CACHE_NAME);
ClusterListener clusterListener = listener();
cache0.addListener(clusterListener);
MagicKey key = new MagicKey(cache1, cache2);
verifySimpleInsertion(cache2, key, FIRST_VALUE, null, clusterListener, FIRST_VALUE);
}
use of org.infinispan.distribution.MagicKey in project infinispan by infinispan.
the class AbstractClusterListenerTest method testMetadataFilterLocalOnly.
@Test
public void testMetadataFilterLocalOnly() {
final String keyToFilterOut = "filter-me";
testFilter(keyToFilterOut, new MagicKey(cache(0, CACHE_NAME)), 1000l, new KeyValueFilterAsCacheEventFilter(new LifespanFilter<Object, String>(100)));
}
use of org.infinispan.distribution.MagicKey in project infinispan by infinispan.
the class AbstractClusterListenerTest method testMetadataConverterNoPassReturnNullNotOwner.
@Test
public void testMetadataConverterNoPassReturnNullNotOwner() {
long lifespan = 25000;
LifespanConverter converter = new LifespanConverter(false, Long.MAX_VALUE);
testConverter(new MagicKey(cache(1, CACHE_NAME), cache(2, CACHE_NAME)), FIRST_VALUE, null, lifespan, converter);
}
use of org.infinispan.distribution.MagicKey in project infinispan by infinispan.
the class AbstractClusterListenerTest method testListenerOnBackupOwnerNodeBackupRead.
public void testListenerOnBackupOwnerNodeBackupRead() {
Cache<Object, String> cache0 = cache(0, CACHE_NAME);
Cache<Object, String> cache1 = cache(1, CACHE_NAME);
MagicKey key = new MagicKey(cache0, cache1);
String expectedValue = key + "-expiring";
cache0.put(key, key + "-expiring", 10, TimeUnit.MILLISECONDS);
ClusterListener clusterListener = listener();
cache0.addListener(clusterListener);
ts1.advance(11);
assertNull(cache1.get(key));
int expectCount = clusterListener.hasIncludeState() ? 2 : 1;
eventually(() -> clusterListener.events.size() >= expectCount);
assertEquals(expectCount, clusterListener.events.size());
CacheEntryEvent event = clusterListener.events.get(clusterListener.hasIncludeState() ? 1 : 0);
assertEquals(Event.Type.CACHE_ENTRY_EXPIRED, event.getType());
assertEquals(key, event.getKey());
assertEquals(expectedValue, event.getValue());
}
use of org.infinispan.distribution.MagicKey in project infinispan by infinispan.
the class AbstractClusterListenerTest method testLocalNodeNonOwnerAndClusterListener.
@Test
public void testLocalNodeNonOwnerAndClusterListener() {
Cache<Object, String> cache0 = cache(0, CACHE_NAME);
Cache<Object, String> cache1 = cache(1, CACHE_NAME);
Cache<Object, String> cache2 = cache(2, CACHE_NAME);
ClusterListener clusterListener = listener();
cache0.addListener(clusterListener);
MagicKey key = new MagicKey(cache1, cache2);
verifySimpleInsertion(cache0, key, FIRST_VALUE, null, clusterListener, FIRST_VALUE);
}
Aggregations