You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by cp...@apache.org on 2016/02/02 10:53:30 UTC

[18/21] lucene-solr git commit: LUCENE-7006: increase BaseMergePolicyTestCase use (TestNoMergePolicy and TestSortingMergePolicy now extend it, TestUpgradeIndexMergePolicy added)

LUCENE-7006: increase BaseMergePolicyTestCase use (TestNoMergePolicy and TestSortingMergePolicy now extend it, TestUpgradeIndexMergePolicy added)


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/ce0b931d
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/ce0b931d
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/ce0b931d

Branch: refs/heads/master-solr-8621
Commit: ce0b931da890bb62448ae11ed5f9c0cb41017ede
Parents: fce97a6
Author: Christine Poerschke <cp...@apache.org>
Authored: Mon Feb 1 17:51:09 2016 +0000
Committer: Christine Poerschke <cp...@apache.org>
Committed: Mon Feb 1 17:51:09 2016 +0000

----------------------------------------------------------------------
 lucene/CHANGES.txt                              |  4 +++
 .../apache/lucene/index/TestNoMergePolicy.java  |  8 ++++--
 .../index/TestUpgradeIndexMergePolicy.java      | 26 ++++++++++++++++++++
 .../lucene/index/TestSortingMergePolicy.java    |  8 ++++--
 4 files changed, 42 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ce0b931d/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 017742d..db58f4d 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -266,6 +266,10 @@ Other
 * LUCENE-7005: TieredMergePolicy tweaks (>= vs. >, @see get vs. set)
   (Christine Poerschke)
 
+* LUCENE-7006: increase BaseMergePolicyTestCase use (TestNoMergePolicy and
+  TestSortingMergePolicy now extend it, TestUpgradeIndexMergePolicy added)
+  (Christine Poerschke)
+
 ======================= Lucene 5.4.1 =======================
 
 Bug Fixes

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ce0b931d/lucene/core/src/test/org/apache/lucene/index/TestNoMergePolicy.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestNoMergePolicy.java b/lucene/core/src/test/org/apache/lucene/index/TestNoMergePolicy.java
index e345ed4..bdd83c6 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestNoMergePolicy.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestNoMergePolicy.java
@@ -25,11 +25,15 @@ import java.util.Arrays;
 import org.apache.lucene.util.LuceneTestCase;
 import org.junit.Test;
 
-public class TestNoMergePolicy extends LuceneTestCase {
+public class TestNoMergePolicy extends BaseMergePolicyTestCase {
+
+  public MergePolicy mergePolicy() {
+    return NoMergePolicy.INSTANCE;
+  }
 
   @Test
   public void testNoMergePolicy() throws Exception {
-    MergePolicy mp = NoMergePolicy.INSTANCE;
+    MergePolicy mp = mergePolicy();
     assertNull(mp.findMerges(null, (SegmentInfos)null, null));
     assertNull(mp.findForcedMerges(null, 0, null, null));
     assertNull(mp.findForcedDeletesMerges(null, null));

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ce0b931d/lucene/core/src/test/org/apache/lucene/index/TestUpgradeIndexMergePolicy.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestUpgradeIndexMergePolicy.java b/lucene/core/src/test/org/apache/lucene/index/TestUpgradeIndexMergePolicy.java
new file mode 100644
index 0000000..857bcca
--- /dev/null
+++ b/lucene/core/src/test/org/apache/lucene/index/TestUpgradeIndexMergePolicy.java
@@ -0,0 +1,26 @@
+package org.apache.lucene.index;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class TestUpgradeIndexMergePolicy extends BaseMergePolicyTestCase {
+
+  public MergePolicy mergePolicy() {
+    return new UpgradeIndexMergePolicy(newMergePolicy(random()));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ce0b931d/lucene/misc/src/test/org/apache/lucene/index/TestSortingMergePolicy.java
----------------------------------------------------------------------
diff --git a/lucene/misc/src/test/org/apache/lucene/index/TestSortingMergePolicy.java b/lucene/misc/src/test/org/apache/lucene/index/TestSortingMergePolicy.java
index 8729117..d9baf55 100644
--- a/lucene/misc/src/test/org/apache/lucene/index/TestSortingMergePolicy.java
+++ b/lucene/misc/src/test/org/apache/lucene/index/TestSortingMergePolicy.java
@@ -50,7 +50,7 @@ import org.apache.lucene.util.TestUtil;
 
 import com.carrotsearch.randomizedtesting.generators.RandomPicks;
 
-public class TestSortingMergePolicy extends LuceneTestCase {
+public class TestSortingMergePolicy extends BaseMergePolicyTestCase {
 
   private List<String> terms;
   private Directory dir1, dir2;
@@ -78,6 +78,10 @@ public class TestSortingMergePolicy extends LuceneTestCase {
     return doc;
   }
 
+  public MergePolicy mergePolicy() {
+    return newSortingMergePolicy(sort);
+  }
+
   public static SortingMergePolicy newSortingMergePolicy(Sort sort) {
     // usually create a MP with a low merge factor so that many merges happen
     MergePolicy mp;
@@ -113,7 +117,7 @@ public class TestSortingMergePolicy extends LuceneTestCase {
     final long seed = random().nextLong();
     final IndexWriterConfig iwc1 = newIndexWriterConfig(new MockAnalyzer(new Random(seed)));
     final IndexWriterConfig iwc2 = newIndexWriterConfig(new MockAnalyzer(new Random(seed)));
-    iwc2.setMergePolicy(newSortingMergePolicy(sort));
+    iwc2.setMergePolicy(mergePolicy());
     final RandomIndexWriter iw1 = new RandomIndexWriter(new Random(seed), dir1, iwc1);
     final RandomIndexWriter iw2 = new RandomIndexWriter(new Random(seed), dir2, iwc2);
     for (int i = 0; i < numDocs; ++i) {