@Override public CacheControllerDispatcher get() { final Map<CacheType, CacheController<Object, Object>> cacheControllers = new LinkedHashMap<CacheType, CacheController<Object, Object>>(); for (final String cacheName : cacheManager.getCacheNames()) { final CacheType cacheType = CacheType.findByName(cacheName); final Collection<EhCacheBasedCacheController<Object, Object>> cacheControllersForCacheName = getCacheControllersForCacheName(cacheName); // EhCache supports multiple cache loaders per type, but not Kill Bill - take the first one if (cacheControllersForCacheName.size() > 0) { final EhCacheBasedCacheController<Object, Object> ehCacheBasedCacheController = cacheControllersForCacheName.iterator().next(); cacheControllers.put(cacheType, ehCacheBasedCacheController); } } return new CacheControllerDispatcher(cacheControllers); }
@Override @BeforeMethod(groups = "fast") public void beforeMethod() throws Exception { super.beforeMethod(); final NonEntityDao nonEntityDao = Mockito.mock(NonEntityDao.class); final SubscriptionDao dao = Mockito.mock(SubscriptionDao.class); final CatalogService catalogService = new MockCatalogService(new MockCatalog()); final SubscriptionBaseApiService apiService = Mockito.mock(SubscriptionBaseApiService.class); final SubscriptionBaseTimelineApi timelineApi = Mockito.mock(SubscriptionBaseTimelineApi.class); final InternalCallContextFactory internalCallContextFactory = new InternalCallContextFactory(clock, nonEntityDao, new CacheControllerDispatcher()); transferApi = new DefaultSubscriptionBaseTransferApi(clock, dao, timelineApi, catalogService, apiService, internalCallContextFactory); }