use of net.sf.ehcache.CacheManager in project camel by apache.
the class DefaultCacheManagerFactoryTest method testNoProvidedConfiguration.
@Test
public void testNoProvidedConfiguration() throws Exception {
CacheManagerFactory factory = new DefaultCacheManagerFactory(getClass().getResourceAsStream("/ehcache.xml"), "/ehcache.xml");
CacheManager manager = factory.getInstance();
// CAMEL-7195
assertThat("There should be no peer providers configured", manager.getCacheManagerPeerProviders().size(), is(0));
assertThat("There should be no /ehcache.xml resource by default", getClass().getResourceAsStream("/ehcache.xml"), nullValue());
}
use of net.sf.ehcache.CacheManager in project gocd by gocd.
the class UserCacheFactory method createCacheManager.
private CacheManager createCacheManager() {
Configuration configuration = new Configuration();
configuration.setDefaultCacheConfiguration(new CacheConfiguration("cache", 10000));
return new CacheManager(configuration);
}
use of net.sf.ehcache.CacheManager in project cxf by apache.
the class EHCacheUtilsTest method testUseGlobalManager.
@Test
public void testUseGlobalManager() {
Bus bus = BusFactory.getThreadDefaultBus();
Configuration conf = ConfigurationFactory.parseConfiguration(EHCacheManagerHolder.class.getResource("/cxf-test-ehcache.xml"));
conf.setName("myGlobalConfig");
CacheManager.newInstance(conf);
CacheManager manager = EHCacheUtils.getCacheManager(bus, EHCacheManagerHolder.class.getResource("/cxf-test-ehcache.xml"));
assertFalse(manager.getName().equals("myGlobalConfig"));
EHCacheManagerHolder.releaseCacheManger(manager);
assertEquals(Status.STATUS_SHUTDOWN, manager.getStatus());
bus.setProperty(EHCacheUtils.GLOBAL_EHCACHE_MANAGER_NAME, "myGlobalConfig");
manager = EHCacheUtils.getCacheManager(bus, EHCacheManagerHolder.class.getResource("/cxf-test-ehcache.xml"));
assertEquals("myGlobalConfig", manager.getName());
EHCacheManagerHolder.releaseCacheManger(manager);
assertEquals(Status.STATUS_ALIVE, manager.getStatus());
manager.shutdown();
assertEquals(Status.STATUS_SHUTDOWN, manager.getStatus());
bus.setProperty(EHCacheUtils.GLOBAL_EHCACHE_MANAGER_NAME, "myGlobalConfigXXX");
manager = EHCacheUtils.getCacheManager(bus, EHCacheManagerHolder.class.getResource("/cxf-test-ehcache.xml"));
assertFalse(manager.getName().equals("myGlobalConfig"));
EHCacheManagerHolder.releaseCacheManger(manager);
assertEquals(Status.STATUS_SHUTDOWN, manager.getStatus());
}
use of net.sf.ehcache.CacheManager in project cxf by apache.
the class EHCacheUtils method getCacheManager.
public static CacheManager getCacheManager(Bus bus, URL configFileURL) {
CacheManager cacheManager = null;
String globalCacheManagerName = getGlobalCacheManagerName(bus);
if (globalCacheManagerName != null) {
cacheManager = CacheManager.getCacheManager(globalCacheManagerName);
}
if (cacheManager == null) {
String confName = "";
if (bus != null) {
confName = bus.getId();
}
cacheManager = EHCacheManagerHolder.getCacheManager(confName, configFileURL);
}
return cacheManager;
}
use of net.sf.ehcache.CacheManager in project jspwiki by apache.
the class AttachmentManagerTest method setUp.
@Before
public void setUp() throws Exception {
CacheManager m_cacheManager = CacheManager.getInstance();
m_cacheManager.clearAll();
m_cacheManager.removeAllCaches();
m_engine = new TestEngine(props);
m_manager = m_engine.getAttachmentManager();
m_engine.saveText(NAME1, "Foobar");
m_engine.saveText(NAMEU, "Foobar");
}
Aggregations