test_class.declarator: cacheResolver
test_class.original_string: CacheResolver cacheResolver;
test_class.type: CacheResolver
test_class.var_name: cacheResolver
test_class.declarator: mockContext
test_class.original_string: CacheKeyInvocationContext mockContext;
test_class.type: CacheKeyInvocationContext
test_class.var_name: mockContext
test_class.file: guja-core/src/test/java/com/wadpam/guja/cache/annotations/DefaultCacheResolverTest.java
test_class.identifier: DefaultCacheResolverTest
test_case.body: @Test
    public void testResolveCache() throws Exception {
  
      expect(mockContext.getCacheName()).andReturn("name").times(2);
  
      replay(mockContext);
  
      Cache cache1 = cacheResolver.resolveCache(mockContext, Optional.<CacheConfig>absent());
      Cache cache2 = cacheResolver.resolveCache(mockContext, Optional.<CacheConfig>absent());
  
      assertTrue(cache1.equals(cache2));
  
    }
test_case.class_method_signature: DefaultCacheResolverTest.testResolveCache()
test_case.full_signature: @Test public void testResolveCache()
test_case.identifier: testResolveCache
test_case.invocations: times andReturn expect getCacheName replay resolveCache absent resolveCache absent assertTrue equals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testResolveCache()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(DefaultCacheResolver.class)
focal_class.modifier: static final
focal_class.original_string: static final Logger LOGGER = LoggerFactory.getLogger(DefaultCacheResolver.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: namespaces = new ConcurrentHashMap<>()
focal_class.modifier: private final
focal_class.original_string: private final ConcurrentMap<String, Cache<GeneratedCacheKey, Optional<?>>> namespaces = new ConcurrentHashMap<>();
focal_class.type: ConcurrentMap<String, Cache<GeneratedCacheKey, Optional<?>>>
focal_class.var_name: namespaces
focal_class.declarator: cacheBuilderProvider
focal_class.modifier: private final
focal_class.original_string: private final Provider<CacheBuilder> cacheBuilderProvider;
focal_class.type: Provider<CacheBuilder>
focal_class.var_name: cacheBuilderProvider
focal_class.file: guja-core/src/main/java/com/wadpam/guja/cache/annotations/DefaultCacheResolver.java
focal_class.identifier: DefaultCacheResolver
focal_class.interfaces: implements CacheResolver
focal_class.class_method_signature: DefaultCacheResolver.DefaultCacheResolver(Provider<CacheBuilder> cacheBuilderProvider)
focal_class.full_signature: @Inject public  DefaultCacheResolver(Provider<CacheBuilder> cacheBuilderProvider)
focal_class.identifier: DefaultCacheResolver
focal_class.modifiers: @Inject public
focal_class.parameters: (Provider<CacheBuilder> cacheBuilderProvider)
focal_class.signature:  DefaultCacheResolver(Provider<CacheBuilder> cacheBuilderProvider)
focal_class.class_method_signature: DefaultCacheResolver.resolveCache(CacheInvocationContext<? extends Annotation> cacheInvocationContext,
                                                              Optional<CacheConfig> cacheConfig)
focal_class.full_signature: @Override public Cache<GeneratedCacheKey, Optional<?>> resolveCache(CacheInvocationContext<? extends Annotation> cacheInvocationContext,
                                                              Optional<CacheConfig> cacheConfig)
focal_class.identifier: resolveCache
focal_class.modifiers: @Override public
focal_class.parameters: (CacheInvocationContext<? extends Annotation> cacheInvocationContext,
                                                              Optional<CacheConfig> cacheConfig)
focal_class.return: Cache<GeneratedCacheKey, Optional<?>>
focal_class.signature: Cache<GeneratedCacheKey, Optional<?>> resolveCache(CacheInvocationContext<? extends Annotation> cacheInvocationContext,
                                                              Optional<CacheConfig> cacheConfig)
focal_method.body: @Override
    public Cache<GeneratedCacheKey, Optional<?>> resolveCache(CacheInvocationContext<? extends Annotation> cacheInvocationContext,
                                                              Optional<CacheConfig> cacheConfig) {
  
      final String cacheName = cacheInvocationContext.getCacheName();
      Cache<GeneratedCacheKey, Optional<?>> cache = namespaces.get(cacheName);
      if (null == cache) {
        LOGGER.debug("Build new dao cache for name {}", cacheName);
  
        CacheBuilder<GeneratedCacheKey, Optional<?>> cacheBuilder = cacheBuilderProvider.get().name(cacheName);
        if (cacheConfig.isPresent()) {
          if (cacheConfig.get().size() > 0) {
            cacheBuilder.maximumSize(cacheConfig.get().size());
          }
          if (cacheConfig.get().expiresAfterSeconds() > 0) {
            cacheBuilder.expireAfterWrite(cacheConfig.get().expiresAfterSeconds());
          }
        }
        cache = cacheBuilder.build();
  
        Cache<GeneratedCacheKey, Optional<?>> existingCache = namespaces.putIfAbsent(cacheName, cache);
        if (null != existingCache) {
          cache = existingCache;
        }
  
      }
  
      return cache;
    }
focal_method.class_method_signature: DefaultCacheResolver.resolveCache(CacheInvocationContext<? extends Annotation> cacheInvocationContext,
                                                              Optional<CacheConfig> cacheConfig)
focal_method.full_signature: @Override public Cache<GeneratedCacheKey, Optional<?>> resolveCache(CacheInvocationContext<? extends Annotation> cacheInvocationContext,
                                                              Optional<CacheConfig> cacheConfig)
focal_method.identifier: resolveCache
focal_method.invocations: getCacheName get debug name get isPresent size get maximumSize size get expiresAfterSeconds get expireAfterWrite expiresAfterSeconds get build putIfAbsent
focal_method.modifiers: @Override public
focal_method.parameters: (CacheInvocationContext<? extends Annotation> cacheInvocationContext,
                                                              Optional<CacheConfig> cacheConfig)
focal_method.return: Cache<GeneratedCacheKey, Optional<?>>
focal_method.signature: Cache<GeneratedCacheKey, Optional<?>> resolveCache(CacheInvocationContext<? extends Annotation> cacheInvocationContext,
                                                              Optional<CacheConfig> cacheConfig)