@Override protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder c = TestCacheManagerFactory.getDefaultCacheConfiguration(true); return TestCacheManagerFactory.createCacheManager(c); }
@Override protected EmbeddedCacheManager createCacheManager() throws Exception { // start a single cache instance ConfigurationBuilder c = getDefaultClusteredCacheConfig(CacheMode.INVALIDATION_SYNC); return TestCacheManagerFactory.createClusteredCacheManager(c); }
public static EmbeddedCacheManager fromXml(String xmlFile, boolean keepJmxDomainName, boolean defaultParserOnly) throws IOException { InputStream is = FileLookupFactory.newInstance().lookupFileStrict( xmlFile, Thread.currentThread().getContextClassLoader()); return fromStream(is, keepJmxDomainName, defaultParserOnly, true); }
public static EmbeddedCacheManager createClusteredCacheManager(GlobalConfigurationBuilder gcb, ConfigurationBuilder defaultCacheConfig, TransportFlags flags, boolean keepJmxDomainName) { amendGlobalConfiguration(gcb, flags); amendJTA(defaultCacheConfig); return newDefaultCacheManager(true, gcb, defaultCacheConfig, keepJmxDomainName); }
private EmbeddedCacheManager createCacheManager() { ConfigurationBuilder c = TestCacheManagerFactory.getDefaultCacheConfiguration(false); c.clustering().cacheMode(CacheMode.REPL_SYNC) .transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL); GlobalConfigurationBuilder gc = GlobalConfigurationBuilder.defaultClusteredBuilder(); return TestCacheManagerFactory.createClusteredCacheManager(gc, c); }
@BeforeMethod public void setUp() { cm = TestCacheManagerFactory.createCacheManager(false); cache = cm.getCache(); }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder cfgBuilder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); cfgBuilder.transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL); createClusteredCaches(numNodes, cfgBuilder); } }
@Override protected EmbeddedCacheManager createCacheManager() throws Exception { return TestCacheManagerFactory.fromXml(FILE_NAME); }
public void testClose() { withCacheManager(new CacheManagerCallable(TestCacheManagerFactory.createCacheManager()) { @Override public void call() throws Exception { AdvancedCache<Integer, String> advCache = cm.<Integer, String>getCache().getAdvancedCache(); Cache<Integer, String> local = FunctionalJCache.create(advCache); assertFalse(local.isClosed()); local.close(); assertTrue(local.isClosed()); } }); }
@Test(expectedExceptions = CacheConfigurationException.class, expectedExceptionsMessageRegExp = ".* It is not possible for a store to be transactional when passivation is enabled. ") public void testTxStoreInPassivatedCache() { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); builder.persistence() .passivation(true) .addStore(DummyInMemoryStoreConfigurationBuilder.class) .transactional(true) .validate(); }
public void testStoppedCacheForDistributedExecutor() { ConfigurationBuilder config = TestCacheManagerFactory.getDefaultCacheConfiguration(true); config.clustering().cacheMode(CacheMode.REPL_SYNC); EmbeddedCacheManager cacheManager = TestCacheManagerFactory.createClusteredCacheManager(config); try { Cache<Object, Object> cache = cacheManager.getCache(); cache.stop(); expectException(IllegalStateException.class, () -> new DefaultExecutorService(cache)); } finally { TestingUtil.killCacheManagers(cacheManager); } }
@Test(expectedExceptions=FileNotFoundException.class) public void testFailOnUnexpectedConfigurationFile() throws IOException { TestCacheManagerFactory.fromXml("does-not-exist.xml"); }
@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; }
OneEntryCacheManagerCallable(boolean passivation) { super(TestCacheManagerFactory.createCacheManager(config(passivation))); cache = cm.getCache(); store = STORE.get(); } }
protected EmbeddedCacheManager addClusterEnabledCacheManager(GlobalConfigurationBuilder globalBuilder, ConfigurationBuilder builder, TransportFlags flags) { EmbeddedCacheManager cm = TestCacheManagerFactory.createClusteredCacheManager(false, globalBuilder, builder, flags, false); amendCacheManagerBeforeStart(cm); cacheManagers.add(cm); cm.start(); return cm; }
public static ConfigurationBuilder getDefaultClusteredCacheConfig(CacheMode mode, boolean transactional, boolean useCustomTxLookup) { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(transactional, useCustomTxLookup); builder. clustering() .cacheMode(mode) .transaction().cacheStopTimeout(0L); return builder; }
private void testInvalidConfiguration(String xmlConfiguration) throws IOException { EmbeddedCacheManager invalidCacheManager = null; try { log.infof("Creating cache manager with %s", xmlConfiguration); invalidCacheManager = TestCacheManagerFactory .fromStream(new ByteArrayInputStream(xmlConfiguration.getBytes())); } finally { if (invalidCacheManager != null) { invalidCacheManager.stop(); } } }
@Override protected EmbeddedCacheManager createCacheManager() throws Exception { cacheManager = TestCacheManagerFactory.fromXml("nrt-performance-writer-infinispandirectory.xml"); cache = cacheManager.getCache("Indexed"); return cacheManager; } }
private CacheContainer createTransactionalCacheContainer() { CacheContainer cc = TestCacheManagerFactory.createCacheManager( TestCacheManagerFactory.getDefaultCacheConfiguration(true)); TestingUtil.replaceComponent(cc, TimeService.class, timeService, true); return cc; }
@BeforeClass @Override public void createCacheStore() throws PersistenceException { cm = TestCacheManagerFactory.createCacheManager(false); marshaller = extractGlobalMarshaller(cm); super.createCacheStore(); }