assertEquals(3, externalizers.size());
assertTrue(externalizers.get(1234) instanceof AdvancedExternalizerTest.IdViaConfigObj.Externalizer);
assertTrue(externalizers.get(5678) instanceof AdvancedExternalizerTest.IdViaAnnotationObj.Externalizer);
assertTrue(externalizers.get(3456) instanceof AdvancedExternalizerTest.IdViaBothObj.Externalizer);
Configuration defaultCfg = cm.getDefaultCacheConfiguration();
assertEquals(1000, defaultCfg.locking().lockAcquisitionTimeout());
assertEquals(100, defaultCfg.locking().concurrencyLevel());
assertEquals(IsolationLevel.READ_COMMITTED, defaultCfg.locking().isolationLevel());
if (!deprecated) {
assertReaperAndTimeoutInfo(defaultCfg);
}
Configuration c = cm.getCacheConfiguration("transactional");
assertTrue(!c.clustering().cacheMode().isClustered());
assertTrue(c.transaction().transactionManagerLookup() instanceof GenericTransactionManagerLookup);
assertTrue(c.transaction().useEagerLocking());
assertTrue(c.transaction().eagerLockingSingleNode());
assertTrue(!c.transaction().syncRollbackPhase());
if (!deprecated) {
assertReaperAndTimeoutInfo(defaultCfg);
}
c = cm.getCacheConfiguration("transactional2");
assertTrue(c.transaction().transactionManagerLookup() instanceof TestLookup);
assertEquals(10000, c.transaction().cacheStopTimeout());
assertEquals(LockingMode.PESSIMISTIC, c.transaction().lockingMode());
assertTrue(!c.transaction().autoCommit());
c = cm.getCacheConfiguration("transactional3");
if (!deprecated) {
assertEquals(TransactionProtocol.TOTAL_ORDER, c.transaction().transactionProtocol());
}
c = cm.getCacheConfiguration("syncInval");
assertEquals(CacheMode.INVALIDATION_SYNC, c.clustering().cacheMode());
assertTrue(!c.clustering().stateTransfer().fetchInMemoryState());
assertTrue(c.clustering().stateTransfer().awaitInitialTransfer());
assertEquals(15000, c.clustering().sync().replTimeout());
c = cm.getCacheConfiguration("asyncInval");
assertEquals(CacheMode.INVALIDATION_ASYNC, c.clustering().cacheMode());
assertTrue(!c.clustering().stateTransfer().fetchInMemoryState());
if (!deprecated) assertTrue(!c.clustering().stateTransfer().awaitInitialTransfer());
assertEquals(15000, c.clustering().sync().replTimeout());
c = cm.getCacheConfiguration("syncRepl");
assertEquals(CacheMode.REPL_SYNC, c.clustering().cacheMode());
assertTrue(!c.clustering().stateTransfer().fetchInMemoryState());
assertTrue(c.clustering().stateTransfer().awaitInitialTransfer());
assertEquals(15000, c.clustering().sync().replTimeout());
c = cm.getCacheConfiguration("asyncRepl");
assertEquals(CacheMode.REPL_ASYNC, c.clustering().cacheMode());
assertTrue(!c.clustering().async().useReplQueue());
assertTrue(!c.clustering().async().asyncMarshalling());
assertTrue(!c.clustering().stateTransfer().fetchInMemoryState());
assertTrue(c.clustering().stateTransfer().awaitInitialTransfer());
c = cm.getCacheConfiguration("asyncReplQueue");
assertEquals(CacheMode.REPL_ASYNC, c.clustering().cacheMode());
assertTrue(c.clustering().async().useReplQueue());
assertTrue(!c.clustering().async().asyncMarshalling());
assertTrue(!c.clustering().stateTransfer().fetchInMemoryState());
assertTrue(c.clustering().stateTransfer().awaitInitialTransfer());
c = cm.getCacheConfiguration("txSyncRepl");
assertTrue(c.transaction().transactionManagerLookup() instanceof GenericTransactionManagerLookup);
assertEquals(CacheMode.REPL_SYNC, c.clustering().cacheMode());
assertTrue(!c.clustering().stateTransfer().fetchInMemoryState());
assertTrue(c.clustering().stateTransfer().awaitInitialTransfer());
assertEquals(15000, c.clustering().sync().replTimeout());
c = cm.getCacheConfiguration("overriding");
assertEquals(CacheMode.LOCAL, c.clustering().cacheMode());
assertEquals(20000, c.locking().lockAcquisitionTimeout());
assertEquals(1000, c.locking().concurrencyLevel());
assertEquals(IsolationLevel.REPEATABLE_READ, c.locking().isolationLevel());
assertTrue(!c.storeAsBinary().enabled());
c = cm.getCacheConfiguration("storeAsBinary");
assertTrue(c.storeAsBinary().enabled());
c = cm.getCacheConfiguration("withFileStore");
assertTrue(c.loaders().preload());
assertTrue(!c.loaders().passivation());
assertTrue(!c.loaders().shared());
assertEquals(1, c.loaders().cacheLoaders().size());
FileCacheStoreConfiguration loaderCfg = (FileCacheStoreConfiguration) c.loaders().cacheLoaders().get(0);
assertTrue(loaderCfg.fetchPersistentState());
assertTrue(loaderCfg.ignoreModifications());
assertTrue(loaderCfg.purgeOnStartup());
assertEquals("/tmp/FileCacheStore-Location", loaderCfg.location());
assertEquals(FileCacheStoreConfigurationBuilder.FsyncMode.PERIODIC, loaderCfg.fsyncMode());
assertEquals(2000, loaderCfg.fsyncInterval());
assertEquals(20000, loaderCfg.singletonStore().pushStateTimeout());
assertTrue(loaderCfg.singletonStore().pushStateWhenCoordinator());
assertEquals(5, loaderCfg.async().threadPoolSize());
assertEquals(15000, loaderCfg.async().flushLockTimeout());
assertTrue(loaderCfg.async().enabled());
assertEquals(700, loaderCfg.async().modificationQueueSize());
c = cm.getCacheConfiguration("withClusterLoader");
assertEquals(1, c.loaders().cacheLoaders().size());
ClusterCacheLoaderConfiguration clusterLoaderCfg = (ClusterCacheLoaderConfiguration) c.loaders().cacheLoaders().get(0);
assertEquals(15000, clusterLoaderCfg.remoteCallTimeout());
c = cm.getCacheConfiguration("withLoaderDefaults");
loaderCfg = (FileCacheStoreConfiguration) c.loaders().cacheLoaders().get(0);
assertEquals("/tmp/Another-FileCacheStore-Location", loaderCfg.location());
assertEquals(FileCacheStoreConfigurationBuilder.FsyncMode.DEFAULT, loaderCfg.fsyncMode());
c = cm.getCacheConfiguration("withouthJmxEnabled");
assertTrue(!c.jmxStatistics().enabled());
assertTrue(gc.globalJmxStatistics().enabled());
assertTrue(gc.globalJmxStatistics().allowDuplicateDomains());
assertEquals("funky_domain", gc.globalJmxStatistics().domain());
assertTrue(gc.globalJmxStatistics().mbeanServerLookup() instanceof PerThreadMBeanServerLookup);
c = cm.getCacheConfiguration("dist");
assertEquals(CacheMode.DIST_SYNC, c.clustering().cacheMode());
assertEquals(600000, c.clustering().l1().lifespan());
if (deprecated) assertEquals(120000, c.clustering().hash().rehashRpcTimeout());
assertEquals(120000, c.clustering().stateTransfer().timeout());
assertEquals(1200, c.clustering().l1().cleanupTaskFrequency());
assertEquals(null, c.clustering().hash().consistentHash()); // this is just an override.
assertEquals(3, c.clustering().hash().numOwners());
assertTrue(c.clustering().l1().enabled());
c = cm.getCacheConfiguration("dist_with_vnodes");
assertEquals(CacheMode.DIST_SYNC, c.clustering().cacheMode());
assertEquals(600000, c.clustering().l1().lifespan());
if (deprecated) assertEquals(120000, c.clustering().hash().rehashRpcTimeout());
assertEquals(120000, c.clustering().stateTransfer().timeout());
assertEquals(null, c.clustering().hash().consistentHash()); // this is just an override.
assertEquals(3, c.clustering().hash().numOwners());
assertTrue(c.clustering().l1().enabled());
assertEquals(1, c.clustering().hash().numVirtualNodes());
if (!deprecated) assertEquals(1000, c.clustering().hash().numSegments());
c = cm.getCacheConfiguration("groups");
assertTrue(c.clustering().hash().groups().enabled());
assertEquals(1, c.clustering().hash().groups().groupers().size());
assertEquals(String.class, c.clustering().hash().groups().groupers().get(0).getKeyType());
c = cm.getCacheConfiguration("chunkSize");
assertTrue(c.clustering().stateTransfer().fetchInMemoryState());
assertEquals(120000, c.clustering().stateTransfer().timeout());
assertEquals(1000, c.clustering().stateTransfer().chunkSize());
c = cm.getCacheConfiguration("cacheWithCustomInterceptors");
assertTrue(!c.customInterceptors().interceptors().isEmpty());
assertEquals(6, c.customInterceptors().interceptors().size());
for(InterceptorConfiguration i : c.customInterceptors().interceptors()) {
if (i.interceptor() instanceof FooInterceptor) {
assertEquals(i.properties().getProperty("foo"), "bar");
}
}
c = cm.getCacheConfiguration("evictionCache");
assertEquals(5000, c.eviction().maxEntries());
assertEquals(EvictionStrategy.LRU, c.eviction().strategy());
assertEquals(60000, c.expiration().lifespan());
assertEquals(1000, c.expiration().maxIdle());
assertEquals(EvictionThreadPolicy.PIGGYBACK, c.eviction().threadPolicy());
assertEquals(500, c.expiration().wakeUpInterval());
c = cm.getCacheConfiguration("withDeadlockDetection");
assertTrue(c.deadlockDetection().enabled());
assertEquals(1221, c.deadlockDetection().spinDuration());
assertEquals(CacheMode.DIST_SYNC, c.clustering().cacheMode());
c = cm.getCacheConfiguration("storeKeyValueBinary");
assertTrue(c.storeAsBinary().enabled());
assertTrue(c.storeAsBinary().storeKeysAsBinary());
assertTrue(!c.storeAsBinary().storeValuesAsBinary());
Configuration withJDBCLoader = cm.getCacheConfiguration("withJDBCLoader");
assertTrue(withJDBCLoader.locking().supportsConcurrentUpdates());
}