Search in sources :

Example 11 with ExtendedStatisticInterceptor

use of org.infinispan.extendedstats.wrappers.ExtendedStatisticInterceptor in project infinispan by infinispan.

the class LocalExtendedStatisticTest method testPut.

public void testPut() {
    assertEmpty(KEY_1, KEY_2, KEY_3);
    ExtendedStatisticInterceptor statisticInterceptor = getExtendedStatistic(cache);
    cache.put(KEY_1, VALUE_1);
    assertCacheValue(KEY_1, VALUE_1);
    Map<Object, Object> map = new HashMap<>();
    map.put(KEY_2, VALUE_2);
    map.put(KEY_3, VALUE_3);
    cache.putAll(map);
    assertCacheValue(KEY_1, VALUE_1);
    assertCacheValue(KEY_2, VALUE_2);
    assertCacheValue(KEY_3, VALUE_3);
    assertNoTransactions();
    Assert.assertFalse(statisticInterceptor.getCacheStatisticManager().hasPendingTransactions());
}
Also used : HashMap(java.util.HashMap) ExtendedStatisticInterceptor(org.infinispan.extendedstats.wrappers.ExtendedStatisticInterceptor)

Example 12 with ExtendedStatisticInterceptor

use of org.infinispan.extendedstats.wrappers.ExtendedStatisticInterceptor in project infinispan by infinispan.

the class LocalExtendedStatisticTest method removeTest.

public void removeTest() {
    assertEmpty(KEY_1);
    ExtendedStatisticInterceptor statisticInterceptor = getExtendedStatistic(cache);
    cache.put(KEY_1, VALUE_1);
    assertCacheValue(KEY_1, VALUE_1);
    cache.remove(KEY_1);
    assertCacheValue(KEY_1, null);
    cache.put(KEY_1, VALUE_1);
    assertCacheValue(KEY_1, VALUE_1);
    cache.remove(KEY_1);
    assertCacheValue(KEY_1, null);
    assertNoTransactions();
    Assert.assertFalse(statisticInterceptor.getCacheStatisticManager().hasPendingTransactions());
}
Also used : ExtendedStatisticInterceptor(org.infinispan.extendedstats.wrappers.ExtendedStatisticInterceptor)

Example 13 with ExtendedStatisticInterceptor

use of org.infinispan.extendedstats.wrappers.ExtendedStatisticInterceptor in project infinispan by infinispan.

the class LocalExtendedStatisticTest method getExtendedStatistic.

private ExtendedStatisticInterceptor getExtendedStatistic(Cache<?, ?> cache) {
    AsyncInterceptorChain interceptorChain = cache.getAdvancedCache().getAsyncInterceptorChain();
    ExtendedStatisticInterceptor extendedStatisticInterceptor = interceptorChain.findInterceptorExtending(ExtendedStatisticInterceptor.class);
    if (extendedStatisticInterceptor != null) {
        extendedStatisticInterceptor.resetStatistics();
    }
    return extendedStatisticInterceptor;
}
Also used : AsyncInterceptorChain(org.infinispan.interceptors.AsyncInterceptorChain) ExtendedStatisticInterceptor(org.infinispan.extendedstats.wrappers.ExtendedStatisticInterceptor)

Example 14 with ExtendedStatisticInterceptor

use of org.infinispan.extendedstats.wrappers.ExtendedStatisticInterceptor in project infinispan by infinispan.

the class LocalExtendedStatisticTest method testReplace.

public void testReplace() {
    assertEmpty(KEY_1);
    ExtendedStatisticInterceptor statisticInterceptor = getExtendedStatistic(cache);
    cache.put(KEY_1, VALUE_1);
    assertCacheValue(KEY_1, VALUE_1);
    Assert.assertEquals(cache.replace(KEY_1, VALUE_2), VALUE_1);
    assertCacheValue(KEY_1, VALUE_2);
    cache.put(KEY_1, VALUE_3);
    assertCacheValue(KEY_1, VALUE_3);
    cache.replace(KEY_1, VALUE_3);
    assertCacheValue(KEY_1, VALUE_3);
    cache.put(KEY_1, VALUE_4);
    assertCacheValue(KEY_1, VALUE_4);
    assertNoTransactions();
    Assert.assertFalse(statisticInterceptor.getCacheStatisticManager().hasPendingTransactions());
}
Also used : ExtendedStatisticInterceptor(org.infinispan.extendedstats.wrappers.ExtendedStatisticInterceptor)

Example 15 with ExtendedStatisticInterceptor

use of org.infinispan.extendedstats.wrappers.ExtendedStatisticInterceptor in project infinispan by infinispan.

the class LocalExtendedStatisticTest method testReplaceWithOldVal.

public void testReplaceWithOldVal() {
    assertEmpty(KEY_1);
    ExtendedStatisticInterceptor statisticInterceptor = getExtendedStatistic(cache);
    cache.put(KEY_1, VALUE_1);
    assertCacheValue(KEY_1, VALUE_1);
    cache.put(KEY_1, VALUE_2);
    assertCacheValue(KEY_1, VALUE_2);
    cache.replace(KEY_1, VALUE_3, VALUE_4);
    assertCacheValue(KEY_1, VALUE_2);
    cache.replace(KEY_1, VALUE_2, VALUE_4);
    assertCacheValue(KEY_1, VALUE_4);
    assertNoTransactions();
    Assert.assertFalse(statisticInterceptor.getCacheStatisticManager().hasPendingTransactions());
}
Also used : ExtendedStatisticInterceptor(org.infinispan.extendedstats.wrappers.ExtendedStatisticInterceptor)

Aggregations

ExtendedStatisticInterceptor (org.infinispan.extendedstats.wrappers.ExtendedStatisticInterceptor)17 ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)6 ConcurrentGlobalContainer (org.infinispan.extendedstats.container.ConcurrentGlobalContainer)3 ExtendedStatisticRpcManager (org.infinispan.extendedstats.wrappers.ExtendedStatisticRpcManager)3 RpcManager (org.infinispan.remoting.rpc.RpcManager)3 CacheStatisticCollector (org.infinispan.extendedstats.CacheStatisticCollector)2 CacheStatisticManager (org.infinispan.extendedstats.CacheStatisticManager)2 ExtendedStatisticLockManager (org.infinispan.extendedstats.wrappers.ExtendedStatisticLockManager)2 AsyncInterceptorChain (org.infinispan.interceptors.AsyncInterceptorChain)2 TestingUtil.extractLockManager (org.infinispan.test.TestingUtil.extractLockManager)2 ControlledRpcManager (org.infinispan.util.ControlledRpcManager)2 ReplicatedControlledConsistentHashFactory (org.infinispan.util.ReplicatedControlledConsistentHashFactory)2 WithinThreadExecutor (org.infinispan.util.concurrent.WithinThreadExecutor)2 LockManager (org.infinispan.util.concurrent.locks.LockManager)2 LockContainer (org.infinispan.util.concurrent.locks.impl.LockContainer)2 HashMap (java.util.HashMap)1