1   package com.atlassian.user.configuration;
2   
3   import com.atlassian.cache.CacheFactory;
4   import com.atlassian.user.configuration.xml.XMLConfiguration;
5   
6   import java.io.InputStream;
7   
8   /**
9    * Testing subclass of {@link XMLConfiguration} which lets you set the cache manager component for testing
10   * caching implementations.
11   */
12  public class CachingXMLConfiguration extends XMLConfiguration
13  {
14      private final CacheFactory cacheFactory;
15  
16      public CachingXMLConfiguration(InputStream is, CacheFactory cacheFactory) throws ConfigurationException
17      {
18          super(is);
19          this.cacheFactory = cacheFactory;
20      }
21  
22      protected RepositoryAccessor configureRepository(RepositoryConfiguration config) throws ConfigurationException
23      {
24          config.addComponent(Configuration.CACHEFACTORY, cacheFactory);
25          return super.configureRepository(config);
26      }
27  }