View Javadoc
1   package org.apache.commons.jcs.auxiliary;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.commons.jcs.engine.behavior.ICompositeCacheManager;
23  import org.apache.commons.jcs.engine.behavior.IElementSerializer;
24  import org.apache.commons.jcs.engine.logging.behavior.ICacheEventLogger;
25  
26  /** For testing */
27  public class MockAuxiliaryCacheFactory
28      extends AbstractAuxiliaryCacheFactory
29  {
30      /** the name of the aux */
31      public String name = "MockAuxiliaryCacheFactory";
32  
33      /**
34       * Creates a mock aux.
35       * <p>
36       * @param attr
37       * @param cacheMgr
38       * @param cacheEventLogger
39       * @param elementSerializer
40       * @return AuxiliaryCache
41       */
42      @Override
43      public <K, V> AuxiliaryCache<K, V>
44          createCache( AuxiliaryCacheAttributes attr, ICompositeCacheManager cacheMgr,
45             ICacheEventLogger cacheEventLogger, IElementSerializer elementSerializer )
46      {
47          MockAuxiliaryCache<K, V> auxCache = new MockAuxiliaryCache<K, V>();
48          auxCache.setCacheEventLogger( cacheEventLogger );
49          auxCache.setElementSerializer( elementSerializer );
50          return auxCache;
51      }
52  
53      /**
54       * @return String
55       */
56      @Override
57      public String getName()
58      {
59          return name;
60      }
61  
62      /**
63       * @param s
64       */
65      @Override
66      public void setName( String s )
67      {
68          this.name = s;
69      }
70  }