geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From upthewatersp...@apache.org
Subject [3/6] incubator-geode git commit: GEODE-11: Parameterized EntryScore and TopEntries
Date Fri, 24 Jun 2016 21:55:13 GMT
GEODE-11: Parameterized EntryScore and TopEntries

Added a parameter for the type of the key for EntryScore and TopEntries.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/00101566
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/00101566
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/00101566

Branch: refs/heads/develop
Commit: 001015665c15ec99895c0ae236b56bc0e2b28986
Parents: 59d471c
Author: Aparna Dharmakkan <adharmakkan@pivotal.io>
Authored: Mon Jun 20 12:15:46 2016 -0700
Committer: Dan Smith <upthewaterspout@apache.org>
Committed: Fri Jun 24 14:41:42 2016 -0700

----------------------------------------------------------------------
 .../cache/lucene/internal/LuceneQueryImpl.java  | 14 ++++----
 .../PageableLuceneQueryResultsImpl.java         | 14 ++++----
 .../lucene/internal/distributed/EntryScore.java | 10 +++---
 .../lucene/internal/distributed/TopEntries.java | 16 +++++----
 ...PageableLuceneQueryResultsImplJUnitTest.java |  6 ++--
 .../DistributedScoringJUnitTest.java            |  8 ++---
 .../distributed/EntryScoreJUnitTest.java        |  4 +--
 .../distributed/LuceneFunctionJUnitTest.java    | 11 +++----
 .../TopEntriesCollectorJUnitTest.java           | 16 ++++-----
 .../TopEntriesFunctionCollectorJUnitTest.java   | 13 +++++---
 .../distributed/TopEntriesJUnitTest.java        | 34 ++++++++++----------
 11 files changed, 76 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/00101566/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryImpl.java
b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryImpl.java
index b910f19..9de16dc 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryImpl.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/LuceneQueryImpl.java
@@ -67,11 +67,11 @@ public class LuceneQueryImpl<K, V> implements LuceneQuery<K,
V> {
 
   @Override
   public Collection<K> findKeys() throws LuceneQueryException {
-    TopEntries entries = findTopEntries();
-    final List<EntryScore> hits = entries.getHits();
+    TopEntries<K> entries = findTopEntries();
+    final List<EntryScore<K>> hits = entries.getHits();
 
     return hits.stream()
-      .map(hit -> (K) hit.getKey())
+      .map(hit -> hit.getKey())
       .collect(Collectors.toList());
   }
 
@@ -95,25 +95,25 @@ public class LuceneQueryImpl<K, V> implements LuceneQuery<K,
V> {
 
   private PageableLuceneQueryResults<K, V> findPages(int pageSize) throws LuceneQueryException
{
 
-    TopEntries entries = findTopEntries();
+    TopEntries<K> entries = findTopEntries();
 
     return new PageableLuceneQueryResultsImpl<K, V>(entries.getHits(), region, pageSize);
   }
 
 
 
-  private TopEntries findTopEntries() throws LuceneQueryException {
+  private TopEntries<K> findTopEntries() throws LuceneQueryException {
     TopEntriesCollectorManager manager = new TopEntriesCollectorManager(null, limit);
     LuceneFunctionContext<TopEntriesCollector> context = new LuceneFunctionContext<>(query,
indexName, manager, limit);
     TopEntriesFunctionCollector collector = new TopEntriesFunctionCollector(context);
 
-    ResultCollector<TopEntriesCollector, TopEntries> rc = (ResultCollector<TopEntriesCollector,
TopEntries>) onRegion()
+    ResultCollector<TopEntriesCollector, TopEntries<K>> rc = (ResultCollector<TopEntriesCollector,
TopEntries<K>>) onRegion()
         .withArgs(context)
         .withCollector(collector)
         .execute(LuceneFunction.ID);
 
     //TODO provide a timeout to the user?
-    TopEntries entries;
+    TopEntries<K> entries;
     try {
       entries = rc.getResult();
     } catch(FunctionException e) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/00101566/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PageableLuceneQueryResultsImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PageableLuceneQueryResultsImpl.java
b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PageableLuceneQueryResultsImpl.java
index dc2d340..487b740 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PageableLuceneQueryResultsImpl.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/PageableLuceneQueryResultsImpl.java
@@ -40,7 +40,7 @@ public class PageableLuceneQueryResultsImpl<K,V> implements PageableLuceneQueryR
   /**
    *  list of docs matching search query
    */
-  private final List<EntryScore> hits;
+  private final List<EntryScore<K>> hits;
   
   /**
    * The maximum score. Lazily evaluated
@@ -62,7 +62,7 @@ public class PageableLuceneQueryResultsImpl<K,V> implements PageableLuceneQueryR
    */
   private int pageSize;
   
-  public PageableLuceneQueryResultsImpl(List<EntryScore> hits, Region<K,V> userRegion,
int pageSize) {
+  public PageableLuceneQueryResultsImpl(List<EntryScore<K>> hits, Region<K,V>
userRegion, int pageSize) {
     this.hits = hits;
     this.userRegion = userRegion;
     this.pageSize = pageSize == 0 ? Integer.MAX_VALUE : pageSize;
@@ -76,17 +76,17 @@ public class PageableLuceneQueryResultsImpl<K,V> implements PageableLuceneQueryR
     
     int end = currentHit + pageSize;
     end = end > hits.size() ? hits.size() : end;
-    List<EntryScore> scores = hits.subList(currentHit, end);
+    List<EntryScore<K>> scores = hits.subList(currentHit, end);
     
     ArrayList<K> keys = new ArrayList<K>(hits.size());
-    for(EntryScore score : scores) {
-      keys.add((K) score.getKey());
+    for(EntryScore<K> score : scores) {
+      keys.add(score.getKey());
     }
     
     Map<K,V> values = userRegion.getAll(keys);
     
     ArrayList<LuceneResultStruct<K,V>> results = new ArrayList<LuceneResultStruct<K,V>>(hits.size());
-    for(EntryScore score : scores) {
+    for(EntryScore<K> score : scores) {
       V value = values.get(score.getKey());
       results.add(new LuceneResultStructImpl(score.getKey(), value, score.getScore()));
     }
@@ -110,7 +110,7 @@ public class PageableLuceneQueryResultsImpl<K,V> implements PageableLuceneQueryR
   @Override
   public float getMaxScore() {
     if(maxScore == Float.MIN_VALUE) {
-      for(EntryScore score : hits) {
+      for(EntryScore<K> score : hits) {
         maxScore = Math.max(maxScore, score.getScore());
       }
     }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/00101566/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/EntryScore.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/EntryScore.java
b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/EntryScore.java
index 6690342..e891156 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/EntryScore.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/EntryScore.java
@@ -29,10 +29,12 @@ import com.gemstone.gemfire.internal.Version;
 
 /**
  * Holds one entry matching search query and its metadata
+ *
+ * @param <K> the type of the key
  */
-public class EntryScore implements DataSerializableFixedID {
+public class EntryScore<K> implements DataSerializableFixedID {
   // Key of the entry matching search query
-  private Object key;
+  private K key;
 
   // The score of this document for the query.
   private float score;
@@ -40,12 +42,12 @@ public class EntryScore implements DataSerializableFixedID {
   public EntryScore() {
   }
 
-  public EntryScore(Object key, float score) {
+  public EntryScore(K key, float score) {
     this.key = key;
     this.score = score;
   }
   
-  public Object getKey() {
+  public K getKey() {
     return key;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/00101566/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntries.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntries.java
b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntries.java
index 5813d75..48a2ca9 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntries.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntries.java
@@ -33,16 +33,18 @@ import com.gemstone.gemfire.internal.Version;
 
 /**
  * Holds a ordered collection of entries matching a search query.
+ *
+ * @param <K> the type of key
  */
-public class TopEntries implements DataSerializableFixedID {
+public class TopEntries<K> implements DataSerializableFixedID {
   // ordered collection of entries
-  private List<EntryScore> hits = new ArrayList<>();
+  private List<EntryScore<K>> hits = new ArrayList<>();
 
   // the maximum number of entries stored in this
   private int limit;
 
   // comparator to order entryScore instances
-  final Comparator<EntryScore> comparator = new EntryScoreComparator();
+  final Comparator<EntryScore<K>> comparator = new EntryScoreComparator();
 
   public TopEntries() {
     this(LuceneQueryFactory.DEFAULT_LIMIT);
@@ -61,7 +63,7 @@ public class TopEntries implements DataSerializableFixedID {
    * 
    * @param entry
    */
-  public void addHit(EntryScore entry) {
+  public void addHit(EntryScore<K> entry) {
     if (hits.size() > 0) {
       EntryScore lastEntry = hits.get(hits.size() - 1);
       if (comparator.compare(lastEntry, entry) < 0) {
@@ -86,7 +88,7 @@ public class TopEntries implements DataSerializableFixedID {
   /**
    * @return The entries collection managed by this instance
    */
-  public List<EntryScore> getHits() {
+  public List<EntryScore<K>> getHits() {
     return hits;
   }
 
@@ -101,9 +103,9 @@ public class TopEntries implements DataSerializableFixedID {
    * Compares scores of two entries using natural ordering. I.e. it returns -1 if the first
entry's score is less than
    * the second one.
    */
-  class EntryScoreComparator implements Comparator<EntryScore> {
+  class EntryScoreComparator implements Comparator<EntryScore<K>> {
     @Override
-    public int compare(EntryScore o1, EntryScore o2) {
+    public int compare(EntryScore<K> o1, EntryScore<K> o2) {
       return Float.compare(o1.getScore(), o2.getScore());
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/00101566/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/PageableLuceneQueryResultsImplJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/PageableLuceneQueryResultsImplJUnitTest.java
b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/PageableLuceneQueryResultsImplJUnitTest.java
index 5047d0d..7703a74 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/PageableLuceneQueryResultsImplJUnitTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/PageableLuceneQueryResultsImplJUnitTest.java
@@ -41,13 +41,13 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest;
 @Category(UnitTest.class)
 public class PageableLuceneQueryResultsImplJUnitTest {
 
-  private List<EntryScore> hits;
+  private List<EntryScore<String>> hits;
   private List<LuceneResultStruct> expected = new ArrayList<LuceneResultStruct>();
   private Region<String, String> userRegion;
   
   @Before
   public void setUp() {
-    hits = new ArrayList<EntryScore>();
+    hits = new ArrayList<EntryScore<String>>();
     
     for(int i =0; i < 23; i++) {
       hits.add(new EntryScore("key_" + i, i));
@@ -73,7 +73,7 @@ public class PageableLuceneQueryResultsImplJUnitTest {
   
   @Test
   public void testMaxStore() {
-    hits.set(5, new EntryScore("key_5", 502));
+    hits.set(5, new EntryScore<String>("key_5", 502));
     
     PageableLuceneQueryResultsImpl<String, String> results = new PageableLuceneQueryResultsImpl<String,
String>(hits, null, 5);
     

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/00101566/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/DistributedScoringJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/DistributedScoringJUnitTest.java
b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/DistributedScoringJUnitTest.java
index 4abc97c..1f1d2c9 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/DistributedScoringJUnitTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/DistributedScoringJUnitTest.java
@@ -94,7 +94,7 @@ public class DistributedScoringJUnitTest {
 
     TopEntriesCollector collector = new TopEntriesCollector();
     singleIndexRepo.query(query, 100, collector);
-    List<EntryScore> singleResult = collector.getEntries().getHits();
+    List<EntryScore<String>> singleResult = collector.getEntries().getHits();
 
     IndexRepositoryImpl distIR1 = createIndexRepo();
     populateIndex(testStrings, distIR1, 0, testStrings.length / 3);
@@ -120,14 +120,14 @@ public class DistributedScoringJUnitTest {
     distIR3.query(query, 100, collector3);
     collectors.add(collector3);
 
-    List<EntryScore> distResult = manager.reduce(collectors).getEntries().getHits();
+    List<EntryScore<String>> distResult = manager.reduce(collectors).getEntries().getHits();
     
     Assert.assertEquals(singleResult.size(), distResult.size());
     Assert.assertTrue(singleResult.size() > 0);
     
     for (Iterator single = distResult.iterator(), dist = singleResult.iterator(); single.hasNext()
&& dist.hasNext();) {
-      EntryScore singleScore = (EntryScore) single.next();
-      EntryScore distScore = (EntryScore) dist.next();
+      EntryScore<String> singleScore = (EntryScore<String>) single.next();
+      EntryScore<String> distScore = (EntryScore<String>) dist.next();
       Assert.assertEquals(singleScore.getKey(), distScore.getKey());
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/00101566/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/EntryScoreJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/EntryScoreJUnitTest.java
b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/EntryScoreJUnitTest.java
index bcb34e2..5cb45ef 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/EntryScoreJUnitTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/EntryScoreJUnitTest.java
@@ -33,8 +33,8 @@ public class EntryScoreJUnitTest {
   @Test
   public void testSerialization() {
     LuceneServiceImpl.registerDataSerializables();
-    EntryScore entry = new EntryScore("entry", .1f);
-    EntryScore copy = CopyHelper.deepCopy(entry);
+    EntryScore<String> entry = new EntryScore<String>("entry", .1f);
+    EntryScore<String> copy = CopyHelper.deepCopy(entry);
     assertEquals("entry", copy.getKey());
     assertEquals(.1f, copy.getScore(), 0f);
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/00101566/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/LuceneFunctionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/LuceneFunctionJUnitTest.java
b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/LuceneFunctionJUnitTest.java
index 26c4d62..dc1cc01 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/LuceneFunctionJUnitTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/LuceneFunctionJUnitTest.java
@@ -40,7 +40,6 @@ import com.gemstone.gemfire.cache.lucene.internal.StringQueryProvider;
 import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository;
 import com.gemstone.gemfire.cache.lucene.internal.repository.IndexResultCollector;
 import com.gemstone.gemfire.cache.lucene.internal.repository.RepositoryManager;
-import com.gemstone.gemfire.cache.query.QueryException;
 import com.gemstone.gemfire.internal.cache.BucketNotFoundException;
 import com.gemstone.gemfire.internal.cache.InternalCache;
 import com.gemstone.gemfire.internal.cache.execute.InternalRegionFunctionContext;
@@ -60,11 +59,11 @@ public class LuceneFunctionJUnitTest {
 
   String regionPath = "/region";
   String indexName = "index";
-  final EntryScore r1_1 = new EntryScore("key-1-1", .5f);
-  final EntryScore r1_2 = new EntryScore("key-1-2", .4f);
-  final EntryScore r1_3 = new EntryScore("key-1-3", .3f);
-  final EntryScore r2_1 = new EntryScore("key-2-1", .45f);
-  final EntryScore r2_2 = new EntryScore("key-2-2", .35f);
+  final EntryScore<String> r1_1 = new EntryScore<String>("key-1-1", .5f);
+  final EntryScore<String> r1_2 = new EntryScore<String>("key-1-2", .4f);
+  final EntryScore<String> r1_3 = new EntryScore<String>("key-1-3", .3f);
+  final EntryScore<String> r2_1 = new EntryScore<String>("key-2-1", .45f);
+  final EntryScore<String> r2_2 = new EntryScore<String>("key-2-2", .35f);
 
   InternalRegionFunctionContext mockContext;
   ResultSender<TopEntriesCollector> mockResultSender;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/00101566/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesCollectorJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesCollectorJUnitTest.java
b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesCollectorJUnitTest.java
index 9e2f310..342f7b0 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesCollectorJUnitTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesCollectorJUnitTest.java
@@ -35,16 +35,16 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest;
 @Category(UnitTest.class)
 public class TopEntriesCollectorJUnitTest {
 
-  private EntryScore r1_1 = new EntryScore("1-1", .9f);
-  private EntryScore r1_2 = new EntryScore("1-2", .7f);
-  private EntryScore r1_3 = new EntryScore("1-3", .5f);
+  private EntryScore<String> r1_1 = new EntryScore<String>("1-1", .9f);
+  private EntryScore<String> r1_2 = new EntryScore<String>("1-2", .7f);
+  private EntryScore<String> r1_3 = new EntryScore<String>("1-3", .5f);
 
-  private EntryScore r2_1 = new EntryScore("2-1", .85f);
-  private EntryScore r2_2 = new EntryScore("2-2", .65f);
+  private EntryScore<String> r2_1 = new EntryScore<String>("2-1", .85f);
+  private EntryScore<String> r2_2 = new EntryScore<String>("2-2", .65f);
 
-  private EntryScore r3_1 = new EntryScore("3-1", .8f);
-  private EntryScore r3_2 = new EntryScore("3-2", .6f);
-  private EntryScore r3_3 = new EntryScore("3-3", .4f);
+  private EntryScore<String> r3_1 = new EntryScore<String>("3-1", .8f);
+  private EntryScore<String> r3_2 = new EntryScore<String>("3-2", .6f);
+  private EntryScore<String> r3_3 = new EntryScore<String>("3-3", .4f);
 
   private TopEntriesCollectorManager manager;
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/00101566/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesFunctionCollectorJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesFunctionCollectorJUnitTest.java
b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesFunctionCollectorJUnitTest.java
index 372c5a3..9e8be3c 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesFunctionCollectorJUnitTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesFunctionCollectorJUnitTest.java
@@ -42,15 +42,18 @@ import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
 @Category(UnitTest.class)
 public class TopEntriesFunctionCollectorJUnitTest {
-  EntryScore r1_1, r1_2, r2_1, r2_2;
+  EntryScore<String> r1_1;
+  EntryScore<String> r1_2;
+  EntryScore<String> r2_1;
+  EntryScore<String> r2_2;
   TopEntriesCollector result1, result2;
 
   @Before
   public void initializeCommonObjects() {
-    r1_1 = new EntryScore("3", .9f);
-    r1_2 = new EntryScore("1", .8f);
-    r2_1 = new EntryScore("2", 0.85f);
-    r2_2 = new EntryScore("4", 0.1f);
+    r1_1 = new EntryScore<String>("3", .9f);
+    r1_2 = new EntryScore<String>("1", .8f);
+    r2_1 = new EntryScore<String>("2", 0.85f);
+    r2_2 = new EntryScore<String>("4", 0.1f);
 
     result1 = new TopEntriesCollector(null);
     result1.collect(r1_1);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/00101566/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesJUnitTest.java
b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesJUnitTest.java
index 410d0ef..feeaa21 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesJUnitTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/internal/distributed/TopEntriesJUnitTest.java
@@ -41,14 +41,14 @@ public class TopEntriesJUnitTest {
 
   private Mockery mockContext;
 
-  private EntryScore r1_1 = new EntryScore("3", .9f);
-  private EntryScore r1_2 = new EntryScore("1", .8f);
-  private EntryScore r2_1 = new EntryScore("2", 0.85f);
-  private EntryScore r2_2 = new EntryScore("4", 0.1f);
+  private EntryScore<String> r1_1 = new EntryScore("3", .9f);
+  private EntryScore<String> r1_2 = new EntryScore("1", .8f);
+  private EntryScore<String> r2_1 = new EntryScore("2", 0.85f);
+  private EntryScore<String> r2_2 = new EntryScore("4", 0.1f);
 
   @Test
   public void testPopulateTopEntries() {
-    TopEntries hits = new TopEntries();
+    TopEntries<String> hits = new TopEntries<String>();
     hits.addHit(r1_1);
     hits.addHit(r2_1);
     hits.addHit(r1_2);
@@ -60,9 +60,9 @@ public class TopEntriesJUnitTest {
 
   @Test
   public void putSameScoreEntries() {
-    TopEntries hits = new TopEntries();
-    EntryScore r1 = new EntryScore("1", .8f);
-    EntryScore r2 = new EntryScore("2", .8f);
+    TopEntries<String> hits = new TopEntries<String>();
+    EntryScore<String> r1 = new EntryScore<String>("1", .8f);
+    EntryScore<String> r2 = new EntryScore<String>("2", .8f);
     hits.addHit(r1);
     hits.addHit(r2);
     
@@ -72,21 +72,21 @@ public class TopEntriesJUnitTest {
   
   @Test
   public void testInitialization() {
-    TopEntries hits = new TopEntries();
+    TopEntries<String> hits = new TopEntries<String>();
     assertEquals(LuceneQueryFactory.DEFAULT_LIMIT, hits.getLimit());
 
-    hits = new TopEntries(123);
+    hits = new TopEntries<String>(123);
     assertEquals(123, hits.getLimit());
   }
 
   @Test(expected = IllegalArgumentException.class)
   public void testInvalidLimit() {
-    new TopEntries(-1);
+    new TopEntries<String>(-1);
   }
   
   @Test
   public void enforceLimit() throws Exception {
-    TopEntries hits = new TopEntries(3);
+    TopEntries<String> hits = new TopEntries<String>(3);
     hits.addHit(r1_1);
     hits.addHit(r2_1);
     hits.addHit(r1_2);
@@ -99,13 +99,13 @@ public class TopEntriesJUnitTest {
   @Test
   public void testSerialization() {
     LuceneServiceImpl.registerDataSerializables();
-    TopEntries hits = new TopEntries(3);
+    TopEntries<String> hits = new TopEntries<String>(3);
     
-    TopEntries copy = CopyHelper.deepCopy(hits);
+    TopEntries<String> copy = CopyHelper.deepCopy(hits);
     assertEquals(3, copy.getLimit());
     assertEquals(0, copy.getHits().size());
     
-    hits = new TopEntries(3);
+    hits = new TopEntries<String>(3);
     hits.addHit(r1_1);
     hits.addHit(r2_1);
     hits.addHit(r1_2);
@@ -116,8 +116,8 @@ public class TopEntriesJUnitTest {
   }
 
   // TODO: extract to lucene test util class
-  public static void verifyResultOrder(Collection<EntryScore> list, EntryScore... expectedEntries)
{
-    Iterator<EntryScore> iter = list.iterator();
+  public static void verifyResultOrder(Collection<EntryScore<String>> list, EntryScore<String>...
expectedEntries) {
+    Iterator<EntryScore<String>> iter = list.iterator();
     for (EntryScore expectedEntry : expectedEntries) {
       if (!iter.hasNext()) {
         fail();


Mime
View raw message