use of com.pany.ehcache.Test107CacheEntryListener in project ehcache3 by ehcache.
the class Eh107XmlIntegrationTest method testTemplateAddsListeners.
@Test
public void testTemplateAddsListeners() throws Exception {
CacheManager cacheManager = cachingProvider.getCacheManager(getClass().getResource("/ehcache-107-listeners.xml").toURI(), getClass().getClassLoader());
MutableConfiguration<String, String> configuration = new MutableConfiguration<>();
configuration.setTypes(String.class, String.class);
MutableCacheEntryListenerConfiguration<String, String> listenerConfiguration = new MutableCacheEntryListenerConfiguration<>(Test107CacheEntryListener::new, null, false, true);
configuration.addCacheEntryListenerConfiguration(listenerConfiguration);
Cache<String, String> cache = cacheManager.createCache("foos", configuration);
cache.put("Hello", "Bonjour");
assertThat(Test107CacheEntryListener.seen.size(), is(1));
assertThat(TestCacheEventListener.seen.size(), is(1));
}
Aggregations