Search in sources :

Example 11 with Cache2kBuilder

use of org.cache2k.Cache2kBuilder in project cache2k by cache2k.

the class Cache2kBuilderTest method anonymousWithoutTypes.

@Test(expected = IllegalArgumentException.class)
public void anonymousWithoutTypes() {
    Cache c = new Cache2kBuilder() {
    }.eternal(true).build();
    c.clear();
}
Also used : Cache2kBuilder(org.cache2k.Cache2kBuilder) Cache(org.cache2k.Cache) Test(org.junit.Test)

Example 12 with Cache2kBuilder

use of org.cache2k.Cache2kBuilder in project cache2k by cache2k.

the class IntegrationTest method eternal_configExpire.

@Test
public void eternal_configExpire() {
    try {
        Cache c = new Cache2kBuilder<String, String>() {
        }.manager(CacheManager.getInstance("specialCases")).name("withExpiry").eternal(true).build();
        c.close();
        fail("expect exception");
    } catch (ConfigurationException ex) {
        assertThat(ex.getMessage(), containsString("Value '2d' rejected: eternal enabled explicitly, refusing to enable expiry at"));
    }
}
Also used : Cache2kBuilder(org.cache2k.Cache2kBuilder) Cache(org.cache2k.Cache) Test(org.junit.Test)

Example 13 with Cache2kBuilder

use of org.cache2k.Cache2kBuilder in project cache2k by cache2k.

the class IntegrationTest method ignoreAnonymousCache.

@Test
public void ignoreAnonymousCache() {
    Cache c = new Cache2kBuilder<String, String>() {
    }.manager(CacheManager.getInstance("specialCases")).build();
    c.close();
}
Also used : Cache2kBuilder(org.cache2k.Cache2kBuilder) Cache(org.cache2k.Cache) Test(org.junit.Test)

Aggregations

Cache2kBuilder (org.cache2k.Cache2kBuilder)13 Test (org.junit.Test)11 Cache (org.cache2k.Cache)9 CacheManager (javax.cache.CacheManager)3 CachingProvider (javax.cache.spi.CachingProvider)3 CacheManager (org.cache2k.CacheManager)3 CopyCacheProxy (org.cache2k.jcache.provider.generic.storeByValueSimulation.CopyCacheProxy)2 BigDecimal (java.math.BigDecimal)1 Collection (java.util.Collection)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 InstanceNotFoundException (javax.management.InstanceNotFoundException)1 CacheEntry (org.cache2k.CacheEntry)1 CacheClosedListener (org.cache2k.event.CacheClosedListener)1 CacheEntryCreatedListener (org.cache2k.event.CacheEntryCreatedListener)1 ExtendedMutableConfiguration (org.cache2k.jcache.ExtendedMutableConfiguration)1 Ignore (org.junit.Ignore)1