protected CacheResolver getExceptionCacheResolver( @Nullable CacheResolverFactory factory, CacheMethodDetails<CacheResult> details) { if (factory != null) { javax.cache.annotation.CacheResolver cacheResolver = factory.getExceptionCacheResolver(details); return new CacheResolverAdapter(cacheResolver); } else { return getDefaultExceptionCacheResolver(); } }
protected CacheResolver getCacheResolver( @Nullable CacheResolverFactory factory, CacheMethodDetails<?> details) { if (factory != null) { javax.cache.annotation.CacheResolver cacheResolver = factory.getCacheResolver(details); return new CacheResolverAdapter(cacheResolver); } else { return getDefaultCacheResolver(); } }
protected CacheResolver getCacheResolver( @Nullable CacheResolverFactory factory, CacheMethodDetails<?> details) { if (factory != null) { javax.cache.annotation.CacheResolver cacheResolver = factory.getCacheResolver(details); return new CacheResolverAdapter(cacheResolver); } else { return getDefaultCacheResolver(); } }
protected CacheResolver getExceptionCacheResolver( @Nullable CacheResolverFactory factory, CacheMethodDetails<CacheResult> details) { if (factory != null) { javax.cache.annotation.CacheResolver cacheResolver = factory.getExceptionCacheResolver(details); return new CacheResolverAdapter(cacheResolver); } else { return getDefaultExceptionCacheResolver(); } }
@Test public void resolveSimpleCache() throws Exception { DefaultCacheInvocationContext<?> dummyContext = createDummyContext(); CacheResolverAdapter adapter = new CacheResolverAdapter(getCacheResolver(dummyContext, "testCache")); Collection<? extends Cache> caches = adapter.resolveCaches(dummyContext); assertNotNull(caches); assertEquals(1, caches.size()); assertEquals("testCache", caches.iterator().next().getName()); }
@Test public void resolveUnknownCache() throws Exception { DefaultCacheInvocationContext<?> dummyContext = createDummyContext(); CacheResolverAdapter adapter = new CacheResolverAdapter(getCacheResolver(dummyContext, null)); thrown.expect(IllegalStateException.class); adapter.resolveCaches(dummyContext); }
protected CacheResolver getCacheResolver(CacheResolverFactory factory, CacheMethodDetails<?> details) { if (factory != null) { javax.cache.annotation.CacheResolver cacheResolver = factory.getCacheResolver(details); return new CacheResolverAdapter(cacheResolver); } else { return getDefaultCacheResolver(); } }
protected CacheResolver getExceptionCacheResolver(CacheResolverFactory factory, CacheMethodDetails<CacheResult> details) { if (factory != null) { javax.cache.annotation.CacheResolver cacheResolver = factory.getExceptionCacheResolver(details); return new CacheResolverAdapter(cacheResolver); } else { return getDefaultExceptionCacheResolver(); } }