From ac3f1bb339df530d6d4484f26c9ab2da17bd28df Mon Sep 17 00:00:00 2001 From: Christine Poerschke Date: Wed, 21 Dec 2016 17:18:39 +0000 Subject: [PATCH] SOLR-8542: reduce direct solrconfig-ltr.xml references in solr/contrib/ltr tests --- .../org/apache/solr/ltr/TestLTRQParserExplain.java | 2 +- .../test/org/apache/solr/ltr/TestLTRQParserPlugin.java | 5 +---- .../src/test/org/apache/solr/ltr/TestLTRWithFacet.java | 2 +- .../src/test/org/apache/solr/ltr/TestLTRWithSort.java | 2 +- .../src/test/org/apache/solr/ltr/TestRerankBase.java | 10 ++++------ .../apache/solr/ltr/TestSelectiveWeightCreation.java | 2 +- .../solr/ltr/feature/TestEdisMaxSolrFeature.java | 2 +- .../apache/solr/ltr/feature/TestExternalFeatures.java | 2 +- .../solr/ltr/feature/TestExternalValueFeatures.java | 2 +- .../apache/solr/ltr/feature/TestFeatureLogging.java | 2 +- .../solr/ltr/feature/TestFeatureLtrScoringModel.java | 2 +- .../org/apache/solr/ltr/feature/TestFeatureStore.java | 2 +- .../solr/ltr/feature/TestFieldLengthFeature.java | 2 +- .../apache/solr/ltr/feature/TestFieldValueFeature.java | 2 +- .../apache/solr/ltr/feature/TestFilterSolrFeature.java | 2 +- .../solr/ltr/feature/TestNoMatchSolrFeature.java | 2 +- .../solr/ltr/feature/TestOriginalScoreFeature.java | 2 +- .../apache/solr/ltr/feature/TestRankingFeature.java | 2 +- .../solr/ltr/feature/TestUserTermScoreWithQ.java | 2 +- .../solr/ltr/feature/TestUserTermScorerQuery.java | 2 +- .../solr/ltr/feature/TestUserTermScorereQDF.java | 2 +- .../org/apache/solr/ltr/feature/TestValueFeature.java | 2 +- .../org/apache/solr/ltr/model/TestLinearModel.java | 2 +- .../solr/ltr/model/TestMultipleAdditiveTreesModel.java | 2 +- .../apache/solr/ltr/store/rest/TestModelManager.java | 2 +- .../ltr/store/rest/TestModelManagerPersistence.java | 2 +- 26 files changed, 29 insertions(+), 34 deletions(-) diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRQParserExplain.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRQParserExplain.java index 2f90df841f9..3d7d3e599cb 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRQParserExplain.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRQParserExplain.java @@ -26,7 +26,7 @@ public class TestLTRQParserExplain extends TestRerankBase { @BeforeClass public static void setup() throws Exception { - setuptest(); + setuptest(true); loadFeatures("features-store-test-model.json"); } diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRQParserPlugin.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRQParserPlugin.java index b2b0a8d2088..d4457a0a7a2 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRQParserPlugin.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRQParserPlugin.java @@ -26,9 +26,7 @@ public class TestLTRQParserPlugin extends TestRerankBase { @BeforeClass public static void before() throws Exception { - setuptest("solrconfig-ltr.xml", "schema.xml"); - // store = getModelStore(); - bulkIndex(); + setuptest(true); loadFeatures("features-linear.json"); loadModels("linear-model.json"); @@ -37,7 +35,6 @@ public class TestLTRQParserPlugin extends TestRerankBase { @AfterClass public static void after() throws Exception { aftertest(); - // store.clear(); } @Test diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRWithFacet.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRWithFacet.java index ab519ec24ab..4026bbbfd7e 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRWithFacet.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRWithFacet.java @@ -28,7 +28,7 @@ public class TestLTRWithFacet extends TestRerankBase { @BeforeClass public static void before() throws Exception { - setuptest("solrconfig-ltr.xml", "schema.xml"); + setuptest(false); assertU(adoc("id", "1", "title", "a1", "description", "E", "popularity", "1")); diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRWithSort.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRWithSort.java index 1fbe1d5fe58..d120af1c283 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRWithSort.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestLTRWithSort.java @@ -28,7 +28,7 @@ public class TestLTRWithSort extends TestRerankBase { @BeforeClass public static void before() throws Exception { - setuptest("solrconfig-ltr.xml", "schema.xml"); + setuptest(false); assertU(adoc("id", "1", "title", "a1", "description", "E", "popularity", "1")); assertU(adoc("id", "2", "title", "a1 b1", "description", diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestRerankBase.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestRerankBase.java index 4914d28cb96..792975a112a 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestRerankBase.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestRerankBase.java @@ -75,14 +75,14 @@ public class TestRerankBase extends RestTestBase { protected static File fstorefile = null; protected static File mstorefile = null; - public static void setuptest() throws Exception { + protected static void setuptest(boolean bulkIndex) throws Exception { setuptest("solrconfig-ltr.xml", "schema.xml"); - bulkIndex(); + if (bulkIndex) bulkIndex(); } - public static void setupPersistenttest() throws Exception { + protected static void setupPersistenttest(boolean bulkIndex) throws Exception { setupPersistentTest("solrconfig-ltr.xml", "schema.xml"); - bulkIndex(); + if (bulkIndex) bulkIndex(); } public static ManagedFeatureStore getManagedFeatureStore() { @@ -178,8 +178,6 @@ public class TestRerankBase extends RestTestBase { FileUtils.deleteDirectory(tmpSolrHome); System.clearProperty("managed.schema.mutable"); // System.clearProperty("enable.update.log"); - - } public static void makeRestTestHarnessNull() { diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestSelectiveWeightCreation.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestSelectiveWeightCreation.java index b9b3d63f54f..e44d4ac5496 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestSelectiveWeightCreation.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/TestSelectiveWeightCreation.java @@ -104,7 +104,7 @@ public class TestSelectiveWeightCreation extends TestRerankBase { @BeforeClass public static void before() throws Exception { - setuptest("solrconfig-ltr.xml", "schema.xml"); + setuptest(false); assertU(adoc("id", "1", "title", "w1 w3", "description", "w1", "popularity", "1")); diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestEdisMaxSolrFeature.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestEdisMaxSolrFeature.java index cd63b5c17e2..96a1d28cce3 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestEdisMaxSolrFeature.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestEdisMaxSolrFeature.java @@ -27,7 +27,7 @@ public class TestEdisMaxSolrFeature extends TestRerankBase { @BeforeClass public static void before() throws Exception { - setuptest("solrconfig-ltr.xml", "schema.xml"); + setuptest(false); assertU(adoc("id", "1", "title", "w1", "description", "w1", "popularity", "1")); diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestExternalFeatures.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestExternalFeatures.java index 15b76338a54..e27844bba72 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestExternalFeatures.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestExternalFeatures.java @@ -27,7 +27,7 @@ public class TestExternalFeatures extends TestRerankBase { @BeforeClass public static void before() throws Exception { - setuptest("solrconfig-ltr.xml", "schema.xml"); + setuptest(false); assertU(adoc("id", "1", "title", "w1", "description", "w1", "popularity", "1")); diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestExternalValueFeatures.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestExternalValueFeatures.java index fc0ade253ff..8a09bb380c7 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestExternalValueFeatures.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestExternalValueFeatures.java @@ -27,7 +27,7 @@ public class TestExternalValueFeatures extends TestRerankBase { @BeforeClass public static void before() throws Exception { - setuptest("solrconfig-ltr.xml", "schema.xml"); + setuptest(false); assertU(adoc("id", "1", "title", "w1", "description", "w1", "popularity", "1")); diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFeatureLogging.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFeatureLogging.java index f18c6bf8f22..ad431f5a5e7 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFeatureLogging.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFeatureLogging.java @@ -29,7 +29,7 @@ public class TestFeatureLogging extends TestRerankBase { @BeforeClass public static void setup() throws Exception { - setuptest(); + setuptest(true); } @AfterClass diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFeatureLtrScoringModel.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFeatureLtrScoringModel.java index 5fcebad884b..a50e75ee97a 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFeatureLtrScoringModel.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFeatureLtrScoringModel.java @@ -29,7 +29,7 @@ public class TestFeatureLtrScoringModel extends TestRerankBase { @BeforeClass public static void setup() throws Exception { - setuptest(); + setuptest(true); store = getManagedFeatureStore(); } diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFeatureStore.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFeatureStore.java index 0ed0cdac3a2..ca58b7b4d72 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFeatureStore.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFeatureStore.java @@ -32,7 +32,7 @@ public class TestFeatureStore extends TestRerankBase { @BeforeClass public static void setup() throws Exception { - setuptest(); + setuptest(true); fstore = getManagedFeatureStore(); } diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFieldLengthFeature.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFieldLengthFeature.java index 4a0d4490a73..2e1a14d607b 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFieldLengthFeature.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFieldLengthFeature.java @@ -27,7 +27,7 @@ public class TestFieldLengthFeature extends TestRerankBase { @BeforeClass public static void before() throws Exception { - setuptest("solrconfig-ltr.xml", "schema.xml"); + setuptest(false); assertU(adoc("id", "1", "title", "w1", "description", "w1")); assertU(adoc("id", "2", "title", "w2 2asd asdd didid", "description", diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFieldValueFeature.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFieldValueFeature.java index 8295403f386..e4a132ad8f5 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFieldValueFeature.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFieldValueFeature.java @@ -30,7 +30,7 @@ public class TestFieldValueFeature extends TestRerankBase { @BeforeClass public static void before() throws Exception { - setuptest("solrconfig-ltr.xml", "schema.xml"); + setuptest(false); assertU(adoc("id", "1", "title", "w1", "description", "w1", "popularity", "1","isTrendy","true")); diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFilterSolrFeature.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFilterSolrFeature.java index a6a80bd35c2..23b7a55ea83 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFilterSolrFeature.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFilterSolrFeature.java @@ -28,7 +28,7 @@ import org.junit.Test; public class TestFilterSolrFeature extends TestRerankBase { @BeforeClass public static void before() throws Exception { - setuptest("solrconfig-ltr.xml", "schema.xml"); + setuptest(false); assertU(adoc("id", "1", "title", "w1", "description", "w1", "popularity", "1")); diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestNoMatchSolrFeature.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestNoMatchSolrFeature.java index 004e3148d2c..e6c287d3a0e 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestNoMatchSolrFeature.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestNoMatchSolrFeature.java @@ -33,7 +33,7 @@ public class TestNoMatchSolrFeature extends TestRerankBase { @BeforeClass public static void before() throws Exception { - setuptest("solrconfig-ltr.xml", "schema.xml"); + setuptest(false); assertU(adoc("id", "1", "title", "w1", "description", "w1", "popularity", "1")); diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestOriginalScoreFeature.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestOriginalScoreFeature.java index 48662e64887..d6512246896 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestOriginalScoreFeature.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestOriginalScoreFeature.java @@ -32,7 +32,7 @@ public class TestOriginalScoreFeature extends TestRerankBase { @BeforeClass public static void before() throws Exception { - setuptest("solrconfig-ltr.xml", "schema.xml"); + setuptest(false); assertU(adoc("id", "1", "title", "w1")); assertU(adoc("id", "2", "title", "w2")); diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestRankingFeature.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestRankingFeature.java index 437e10d2558..31add41fb43 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestRankingFeature.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestRankingFeature.java @@ -28,7 +28,7 @@ public class TestRankingFeature extends TestRerankBase { @BeforeClass public static void before() throws Exception { - setuptest("solrconfig-ltr.xml", "schema.xml"); + setuptest(false); assertU(adoc("id", "1", "title", "w1", "description", "w1", "popularity", "1")); diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestUserTermScoreWithQ.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestUserTermScoreWithQ.java index 754409a658c..b5c8e32ea84 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestUserTermScoreWithQ.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestUserTermScoreWithQ.java @@ -27,7 +27,7 @@ public class TestUserTermScoreWithQ extends TestRerankBase { @BeforeClass public static void before() throws Exception { - setuptest("solrconfig-ltr.xml", "schema.xml"); + setuptest(false); assertU(adoc("id", "1", "title", "w1", "description", "w1", "popularity", "1")); diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestUserTermScorerQuery.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestUserTermScorerQuery.java index c79207c644e..c0f92d220d3 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestUserTermScorerQuery.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestUserTermScorerQuery.java @@ -27,7 +27,7 @@ public class TestUserTermScorerQuery extends TestRerankBase { @BeforeClass public static void before() throws Exception { - setuptest("solrconfig-ltr.xml", "schema.xml"); + setuptest(false); assertU(adoc("id", "1", "title", "w1", "description", "w1", "popularity", "1")); diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestUserTermScorereQDF.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestUserTermScorereQDF.java index f47a883c37a..6b22cdfde23 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestUserTermScorereQDF.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestUserTermScorereQDF.java @@ -27,7 +27,7 @@ public class TestUserTermScorereQDF extends TestRerankBase { @BeforeClass public static void before() throws Exception { - setuptest("solrconfig-ltr.xml", "schema.xml"); + setuptest(false); assertU(adoc("id", "1", "title", "w1", "description", "w1", "popularity", "1")); diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestValueFeature.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestValueFeature.java index 084da4a3695..de0c9239640 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestValueFeature.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestValueFeature.java @@ -27,7 +27,7 @@ public class TestValueFeature extends TestRerankBase { @BeforeClass public static void before() throws Exception { - setuptest("solrconfig-ltr.xml", "schema.xml"); + setuptest(false); assertU(adoc("id", "1", "title", "w1")); assertU(adoc("id", "2", "title", "w2")); diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/model/TestLinearModel.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/model/TestLinearModel.java index e8ee22482cb..067bd277de8 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/model/TestLinearModel.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/model/TestLinearModel.java @@ -50,7 +50,7 @@ public class TestLinearModel extends TestRerankBase { @BeforeClass public static void setup() throws Exception { - setuptest(); + setuptest(true); // loadFeatures("features-store-test-model.json"); store = getManagedModelStore(); fstore = getManagedFeatureStore().getFeatureStore("test"); diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/model/TestMultipleAdditiveTreesModel.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/model/TestMultipleAdditiveTreesModel.java index 560437078cb..1824eb4e0a6 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/model/TestMultipleAdditiveTreesModel.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/model/TestMultipleAdditiveTreesModel.java @@ -30,7 +30,7 @@ public class TestMultipleAdditiveTreesModel extends TestRerankBase { @BeforeClass public static void before() throws Exception { - setuptest("solrconfig-ltr.xml", "schema.xml"); + setuptest(false); assertU(adoc("id", "1", "title", "w1", "description", "w1", "popularity","1")); assertU(adoc("id", "2", "title", "w2", "description", "w2", "popularity","2")); diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/store/rest/TestModelManager.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/store/rest/TestModelManager.java index 8d11a907fbc..5b43c6064a8 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/store/rest/TestModelManager.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/store/rest/TestModelManager.java @@ -34,7 +34,7 @@ public class TestModelManager extends TestRerankBase { @BeforeClass public static void init() throws Exception { - setuptest(); + setuptest(true); } @Before diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/store/rest/TestModelManagerPersistence.java b/solr/contrib/ltr/src/test/org/apache/solr/ltr/store/rest/TestModelManagerPersistence.java index 66c26fd7255..f707e55c583 100644 --- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/store/rest/TestModelManagerPersistence.java +++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/store/rest/TestModelManagerPersistence.java @@ -31,7 +31,7 @@ public class TestModelManagerPersistence extends TestRerankBase { @Before public void init() throws Exception { - setupPersistenttest(); + setupPersistenttest(true); } // executed first