View Javadoc

1   /***
2    *  Copyright 2003-2010 Terracotta, Inc.
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   */
16  
17  package net.sf.ehcache.search;
18  
19  import net.sf.ehcache.Ehcache;
20  import net.sf.ehcache.Element;
21  import net.sf.ehcache.search.Person.Gender;
22  
23  /***
24   * Test utilities used by multiple classes
25   *
26   * @author Greg Luck
27   */
28  public class SearchTestUtil {
29  
30      /***
31       * Used to populate the search with data
32       *
33       * @param cache
34       */
35      public static void populateData(Ehcache cache) {
36          cache.removeAll();
37          cache.put(new Element(1, new Person("Tim Eck", 35, Gender.MALE)));
38          cache.put(new Element(2, new Person("Loretta Johnson", 23, Gender.FEMALE)));
39          cache.put(new Element(3, new Person("Ari Zilka", 35, Gender.MALE)));
40          cache.put(new Element(4, new Person("Nabib El-Rahman", 30, Gender.MALE)));
41          // cache.put(new Element(5, new Person("Greg Luck", 43, Gender.MALE)));
42          // cache.put(new Element(6, new Person("Kellie Luck", 41, Gender.MALE)));
43          // cache.put(new Element(7, new Person("Curtis Luck", 9, Gender.MALE)));
44          // cache.put(new Element(8, new Person("Lewis Luck", 9, Gender.MALE)));
45      }
46  
47  }