@BeforeMethod public void setUp() throws Exception { ConfigurationBuilder c = new ConfigurationBuilder(); c .transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL) .clustering().cacheMode(CacheMode.LOCAL) .locking().isolationLevel(IsolationLevel.REPEATABLE_READ); cm = TestCacheManagerFactory.createCacheManager(c); cache = getCache(); CacheNotifier mockNotifier = mock(CacheNotifier.class); TestingUtil.replaceComponent(cache, CacheNotifier.class, mockNotifier, true); }
@BeforeMethod public void setUp() throws Exception { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); builder.transaction().autoCommit(false) .clustering().cacheMode(CacheMode.LOCAL) .locking().isolationLevel(IsolationLevel.REPEATABLE_READ); cm = TestCacheManagerFactory.createCacheManager(builder); cache = cm.getCache(); tm = TestingUtil.getTransactionManager(cache); mockNotifier = mock(CacheNotifier.class); origNotifier = TestingUtil.replaceComponent(cache, CacheNotifier.class, mockNotifier, true); }
private ConfigurationBuilder defaultConfigurationBuilder() { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); builder.clustering().cacheMode(getCacheMode()) .locking().isolationLevel(IsolationLevel.REPEATABLE_READ) .transaction().lockingMode(LockingMode.OPTIMISTIC); return builder; }
@BeforeMethod public void setUp() { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.invocationBatching().enable() .clustering().cacheMode(CacheMode.LOCAL) .locking().concurrencyLevel(2000) .lockAcquisitionTimeout(120000) .isolationLevel(IsolationLevel.READ_COMMITTED); cacheContainer = TestCacheManagerFactory.createCacheManager(cb); Cache c = cacheContainer.getCache(); cache = new TreeCacheImpl<>(c); }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); builder.clustering().cacheMode(getCacheMode()) .locking().isolationLevel(IsolationLevel.REPEATABLE_READ).lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()) .transaction().lockingMode(LockingMode.OPTIMISTIC); decorate(builder); createCluster(builder, 2); waitForClusterToForm(); }
@Override protected void createCacheManagers() throws Throwable { builder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); builder.clustering().cacheMode(CacheMode.REPL_SYNC) .locking().isolationLevel(IsolationLevel.REPEATABLE_READ) .transaction().lockingMode(LockingMode.OPTIMISTIC) .recovery().disable(); if (totalOrder) { builder.transaction().transactionProtocol(TransactionProtocol.TOTAL_ORDER); } createCluster(builder, 2); waitForClusterToForm(); }
protected ConfigurationBuilder createTopologyCacheConfig(long distSyncTimeout) { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.clustering().cacheMode(CacheMode.REPL_SYNC).remoteTimeout(configuration.topologyReplTimeout()) .locking().lockAcquisitionTimeout(configuration.topologyLockTimeout()) .clustering().partitionHandling().mergePolicy(null) .expiration().lifespan(-1).maxIdle(-1); if (configuration.topologyStateTransfer()) { builder .clustering() .stateTransfer() .awaitInitialTransfer(configuration.topologyAwaitInitialTransfer()) .fetchInMemoryState(true) .timeout(distSyncTimeout + configuration.topologyReplTimeout()); } else { builder.persistence().addClusterLoader().remoteCallTimeout(configuration.topologyReplTimeout()); } return builder; }
@BeforeClass public void setup() throws Exception { ConfigurationBuilder sourceStoreBuilder = new ConfigurationBuilder(); sourceStoreBuilder.clustering().cacheMode(CacheMode.DIST_SYNC) .locking().isolationLevel(IsolationLevel.REPEATABLE_READ) .persistence().addStore(DummyInMemoryStoreConfigurationBuilder.class).shared(true).storeName("sourceStore"); ConfigurationBuilder targetStoreBuilder = new ConfigurationBuilder(); targetStoreBuilder.clustering().cacheMode(CacheMode.DIST_SYNC) .locking().isolationLevel(IsolationLevel.REPEATABLE_READ) .persistence().addStore(DummyInMemoryStoreConfigurationBuilder.class).shared(true).storeName("targetStore"); sourceCluster = new TestCluster.Builder().setName("sourceCluster").setNumMembers(1) .cache().name(CACHE_NAME).configuredWith(sourceStoreBuilder) .build(); targetCluster = new TestCluster.Builder().setName("targetCluster").setNumMembers(1) .cache().name(CACHE_NAME).remotePort(sourceCluster.getHotRodPort()).configuredWith(targetStoreBuilder) .build(); }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder config = new ConfigurationBuilder(); config.clustering().cacheMode(CacheMode.DIST_SYNC); config.transaction().lockingMode(LockingMode.OPTIMISTIC); config.clustering().locking().lockAcquisitionTimeout(2, SECONDS); config.clustering().hash().numSegments(1) .consistentHashFactory(new ControlledConsistentHashFactory.Default(1, 0)); config.transaction().transactionManagerLookup(new EmbeddedTransactionManagerLookup()) .cacheStopTimeout(1, SECONDS); createCluster(config, 2); waitForClusterToForm(); } }
@Override protected void createCacheManagers() { ConfigurationBuilder cfg = new ConfigurationBuilder(); cfg.clustering().cacheMode(CacheMode.REPL_SYNC) .locking() .concurrencyLevel(10000) .isolationLevel(IsolationLevel.REPEATABLE_READ) .lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()) .useLockStriping(false) .transaction() .transactionMode(TransactionMode.TRANSACTIONAL) .lockingMode(LockingMode.PESSIMISTIC) .transactionManagerLookup(new EmbeddedTransactionManagerLookup()) .recovery().enable(); registerCacheManager(TestCacheManagerFactory.createClusteredCacheManager(cfg), TestCacheManagerFactory.createClusteredCacheManager(cfg)); }