@BeforeClass public void setUp() { // create cache configuration ConfigurationBuilder cb = new ConfigurationBuilder(); cb.clustering().invocationBatching().enable() .clustering().cacheMode(CacheMode.DIST_SYNC) .clustering().stateTransfer().timeout(10000) .locking().lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()) .locking().isolationLevel(IsolationLevel.REPEATABLE_READ); configuration = cb.build(); mockExecutorService = mock(ExecutorService.class); cache = mock(Cache.class); when(cache.getName()).thenReturn("testCache"); rpcManager = mock(RpcManager.class); commandsFactory = mock(CommandsFactory.class); cacheNotifier = mock(ClusterCacheNotifier.class); persistenceManager = mock(PersistenceManager.class); dataContainer = mock(InternalDataContainer.class); transactionTable = mock(TransactionTable.class); stateTransferLock = mock(StateTransferLock.class); distributionManager = mock(DistributionManager.class); ef = mock(InternalEntryFactory.class); when(distributionManager.getCacheTopology()).thenAnswer(invocation -> cacheTopology); }
@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); }
.clustering().cacheMode(CacheMode.DIST_SYNC) .clustering().stateTransfer().timeout(10000) .locking().lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis())
@BeforeMethod protected void setUp() throws Exception { ConfigurationBuilder configurationBuilder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); configurationBuilder.transaction().invocationBatching().enable() .clustering().cacheMode(CacheMode.DIST_SYNC) .clustering().hash().numOwners(1) .clustering().stateTransfer().fetchInMemoryState(false); manager1 = TestCacheManagerFactory.createClusteredCacheManager(configurationBuilder); manager1.defineConfiguration("test", configurationBuilder.build()); cache1 = manager1.getCache("test").getAdvancedCache(); ex1 = Executors.newSingleThreadExecutor(getTestThreadFactory("KeyGenerator1")); keyAffinityService1 = KeyAffinityServiceFactory.newLocalKeyAffinityService(cache1, new RndKeyGenerator(), ex1, KEY_QUEUE_SIZE); log.trace("Address for manager1: " + manager1.getAddress()); manager2 = TestCacheManagerFactory.createClusteredCacheManager(configurationBuilder); manager2.defineConfiguration("test", configurationBuilder.build()); cache2 = manager2.getCache("test").getAdvancedCache(); ex2 = Executors.newSingleThreadExecutor(getTestThreadFactory("KeyGenerator2")); keyAffinityService2 = KeyAffinityServiceFactory.newLocalKeyAffinityService(cache2, new RndKeyGenerator(), ex2, KEY_QUEUE_SIZE); log.trace("Address for manager2: " + manager2.getAddress()); TestingUtil.blockUntilViewsReceived(60000, cache1, cache2); Thread.sleep(5000); }
private ConfigurationBuilder makeCfg() { ConfigurationBuilder cfg = new ConfigurationBuilder(); cfg.transaction() .transactionMode(TransactionMode.TRANSACTIONAL).invocationBatching().enable() .clustering().cacheMode(CacheMode.REPL_SYNC) .clustering().sync() .stateTransfer().fetchInMemoryState(true) .transaction().lockingMode(LockingMode.PESSIMISTIC) .locking().isolationLevel(IsolationLevel.READ_COMMITTED).useLockStriping(false) .customInterceptors().addInterceptor() .interceptor(new ProtobufMetadataManagerInterceptor()).after(PessimisticLockingInterceptor.class); return cfg; }