@Override protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder c = TestCacheManagerFactory.getDefaultCacheConfiguration(true); return TestCacheManagerFactory.createCacheManager(c); }
@Override protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder cacheConfiguration = TestCacheManagerFactory.getDefaultCacheConfiguration(true); //cacheConfiguration.transaction().lockingMode(LockingMode.PESSIMISTIC); EmbeddedCacheManager cm = TestCacheManagerFactory.createCacheManager(cacheConfiguration); TestingUtil.replaceComponent(cm, TimeService.class, timeService, true); return cm; }
@BeforeMethod protected void setup() throws Exception { EmbeddedCacheManager manager = TestCacheManagerFactory.createCacheManager(); for (int i = 0; i < NUM_CACHES; i++) { manager.defineConfiguration("cache" + i, TestCacheManagerFactory.getDefaultCacheConfiguration(false).build()); } cacheManager = manager; }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder cfgBuilder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); cfgBuilder.transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL); createClusteredCaches(numNodes, cfgBuilder); } }
private void testNoDriverClassFound() throws Exception { storeBuilder = TestCacheManagerFactory .getDefaultCacheConfiguration(false) .persistence() .addStore(JdbcStringBasedStoreConfigurationBuilder.class); factoryBuilder = UnitTestDatabaseManager.configureBrokenConnectionFactory(storeBuilder); ConnectionFactoryConfiguration factoryConfiguration = factoryBuilder.create(); factory.start(factoryConfiguration, Thread.currentThread().getContextClassLoader()); }
@Test(expectedExceptions = CacheConfigurationException.class, expectedExceptionsMessageRegExp = ".* Cannot enable 'fetchPersistentState' in invalidation caches!") public void testFetchPersistentStateInInvalidationMode() { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(false); builder.clustering() .cacheMode(CacheMode.INVALIDATION_SYNC) .persistence() .addStore(DummyInMemoryStoreConfigurationBuilder.class) .fetchPersistentState(true) .validate(); }
public void testAsyncStoreDisabling() { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(false); builder.persistence().addStore(DummyInMemoryStoreConfigurationBuilder.class).async().enable(); disableWithConfiguration(builder); }
public void testSingletonStoreDisabling() { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(false); builder.persistence().addStore(DummyInMemoryStoreConfigurationBuilder.class).singleton().enable(); disableWithConfiguration(builder); }
@BeforeClass public void setUp() { cfg = TestCacheManagerFactory.getDefaultCacheConfiguration(true); cfg .persistence() .passivation(true) .addStore(DummyInMemoryStoreConfigurationBuilder.class); cm = TestCacheManagerFactory.createCacheManager(cfg); cache = cm.getCache(); store = (AdvancedLoadWriteStore) TestingUtil.getCacheLoader(cache); tm = TestingUtil.getTransactionManager(cache); }
@Override protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); builder.locking().isolationLevel(IsolationLevel.REPEATABLE_READ) .transaction().lockingMode(LockingMode.OPTIMISTIC); return TestCacheManagerFactory.createCacheManager(builder); }
@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); }
@BeforeTest public void beforeMethod() { embeddedCacheManager = TestCacheManagerFactory.createCacheManager( hotRodCacheConfiguration(TestCacheManagerFactory .getDefaultCacheConfiguration(false))); embeddedCacheManager.defineConfiguration("small", embeddedCacheManager.getDefaultCacheConfiguration()); hotRodServer = startHotRodServer(embeddedCacheManager); }
private ConfigurationBuilder defaultConfigurationBuilder() { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); builder.clustering().cacheMode(getCacheMode()) .locking().isolationLevel(IsolationLevel.REPEATABLE_READ) .transaction().lockingMode(LockingMode.OPTIMISTIC); return builder; }
@Override protected ConfigurationBuilder getConfiguration() { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(true, false); builder.compatibility().enable() .clustering() .cacheMode(CacheMode.DIST_SYNC) .stateTransfer().fetchInMemoryState(false) .transaction().cacheStopTimeout(0L); return builder; }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder configBuilder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); configBuilder.memory().size(1) .persistence().addStore(DummyInMemoryStoreConfigurationBuilder.class); configBuilder.clustering().hash().groups().enabled(); addClusterEnabledCacheManager(configBuilder); }
private Cache<Object, Object> createManagerAndGetCache(int startFailures) { GlobalConfiguration globalConfiguration = new GlobalConfigurationBuilder().globalJmxStatistics().allowDuplicateDomains(true).build(); ConfigurationBuilder cb = TestCacheManagerFactory.getDefaultCacheConfiguration(false); Configuration config = cb.persistence() .addStore(DummyInMemoryStoreConfigurationBuilder.class) .startFailures(startFailures) .build(); return new DefaultCacheManager(globalConfiguration, config).getCache(); }
@Override protected void createCacheManagers() throws Throwable { builder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); builder.clustering().cacheMode(CacheMode.DIST_SYNC).l1().disable() .locking().isolationLevel(IsolationLevel.REPEATABLE_READ) .transaction().lockingMode(LockingMode.OPTIMISTIC); amendConfig(builder); createCluster(builder, 4); waitForClusterToForm(); }
@Override protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); builder.locking().lockAcquisitionTimeout(TestingUtil.shortTimeoutMillis()); builder.invocationBatching().enable(); builder.locking().isolationLevel(IsolationLevel.READ_COMMITTED); builder.transaction().transactionManagerLookup(new EmbeddedTransactionManagerLookup()).lockingMode(lockingMode); return TestCacheManagerFactory.createCacheManager(builder); }
public void test() { final ConfigurationBuilder c = TestCacheManagerFactory.getDefaultCacheConfiguration(false); assert !c.build().transaction().transactionMode().isTransactional(); c.transaction().transactionMode(TransactionMode.TRANSACTIONAL); assert c.build().transaction().transactionMode().isTransactional(); c.transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL); assert !c.build().transaction().transactionMode().isTransactional(); }
@Override protected EmbeddedCacheManager createCacheManager() throws Exception { GlobalConfigurationBuilder global = new GlobalConfigurationBuilder(); GlobalAuthorizationConfigurationBuilder globalRoles = global.security().authorization().enable() .principalRoleMapper(new IdentityRoleMapper()); ConfigurationBuilder config = TestCacheManagerFactory.getDefaultCacheConfiguration(true); AuthorizationConfigurationBuilder authConfig = config.security().authorization().enable(); globalRoles .role("listener").permission(AuthorizationPermission.LISTEN) .role("admin").permission(AuthorizationPermission.ALL); authConfig.role("listener").role("admin"); return TestCacheManagerFactory.createCacheManager(global, config); }