SOLR-6902: Use JUnit rules instead of inheritance with distributed Solr tests to allow for multiple tests without the same class

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1654256 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erick Erickson 2015-01-23 16:13:32 +00:00
parent e12dbe663a
commit 7fda449473
99 changed files with 856 additions and 1170 deletions

View File

@ -54,6 +54,10 @@ Other Changes
* SOLR-6895: Deprecated SolrServer classes have been removed (Alan Woodward,
Erik Hatcher)
* SOLR-6902Use JUnit rules instead of inheritance with distributed Solr
tests to allow for multiple tests without the same class.
(Ramkumar Aiyengar, Erick Erickson, Mike McCandless)
================== 5.1.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release

View File

@ -20,6 +20,7 @@ package org.apache.solr.handler.clustering;
import org.apache.solr.BaseDistributedSearchTestCase;
import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
import org.apache.solr.common.params.CommonParams;
import org.junit.Test;
@SuppressSSL
public class DistributedClusteringComponentTest extends
@ -30,8 +31,8 @@ public class DistributedClusteringComponentTest extends
return getFile("clustering/solr/collection1").getParent();
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
del("*:*");
int numberOfDocs = 0;
for (String[] doc : AbstractClusteringTestCase.DOCUMENTS) {
@ -47,7 +48,7 @@ public class DistributedClusteringComponentTest extends
CommonParams.Q, "*:*",
CommonParams.SORT, id + " desc",
ClusteringParams.USE_SEARCH_RESULTS, "true");
// destroy is not needed because tearDown method of base class does it.
// destroy is not needed because distribTearDown method of base class does it.
//destroyServers();
}

View File

@ -71,9 +71,7 @@ import org.apache.solr.common.util.NamedList;
import org.apache.solr.hadoop.hack.MiniMRClientCluster;
import org.apache.solr.hadoop.hack.MiniMRClientClusterFactory;
import org.apache.solr.morphlines.solr.AbstractSolrMorphlineTestBase;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@ -120,10 +118,9 @@ public class MorphlineGoLiveMiniMRTest extends AbstractFullDistribZkTestBase {
this.inputAvroFile1 = "sample-statuses-20120521-100919.avro";
this.inputAvroFile2 = "sample-statuses-20120906-141433.avro";
this.inputAvroFile3 = "sample-statuses-20120906-141433-medium.avro";
fixShardCount = true;
sliceCount = TEST_NIGHTLY ? 7 : 3;
shardCount = TEST_NIGHTLY ? 7 : 3;
fixShardCount(TEST_NIGHTLY ? 7 : 3);
}
@BeforeClass
@ -197,9 +194,8 @@ public class MorphlineGoLiveMiniMRTest extends AbstractFullDistribZkTestBase {
}
@Override
@Before
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
System.setProperty("host", "127.0.0.1");
System.setProperty("numShards", Integer.toString(sliceCount));
URI uri = dfsCluster.getFileSystem().getUri();
@ -208,9 +204,8 @@ public class MorphlineGoLiveMiniMRTest extends AbstractFullDistribZkTestBase {
}
@Override
@After
public void tearDown() throws Exception {
super.tearDown();
public void distribTearDown() throws Exception {
super.distribTearDown();
System.clearProperty("host");
System.clearProperty("numShards");
System.clearProperty("solr.hdfs.home");
@ -242,12 +237,6 @@ public class MorphlineGoLiveMiniMRTest extends AbstractFullDistribZkTestBase {
return jobConf;
}
@Test
@Override
public void testDistribSearch() throws Exception {
super.testDistribSearch();
}
@Test
public void testBuildShardUrls() throws Exception {
// 2x3
@ -350,9 +339,9 @@ public class MorphlineGoLiveMiniMRTest extends AbstractFullDistribZkTestBase {
};
return concat(head, args);
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
waitForRecoveriesToFinish(false);
@ -691,7 +680,7 @@ public class MorphlineGoLiveMiniMRTest extends AbstractFullDistribZkTestBase {
}
private void getShardUrlArgs(List<String> args) {
for (int i = 0; i < shardCount; i++) {
for (int i = 0; i < getShardCount(); i++) {
args.add("--shard-url");
args.add(cloudJettys.get(i).url);
}

View File

@ -27,10 +27,7 @@ import org.apache.solr.cloud.AbstractFullDistribZkTestBase;
import org.apache.solr.cloud.AbstractZkTestCase;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.cloud.SolrZkClient;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.kitesdk.morphline.api.Collector;
import org.kitesdk.morphline.api.Command;
import org.kitesdk.morphline.api.MorphlineContext;
@ -61,9 +58,8 @@ public abstract class AbstractSolrMorphlineZkTestBase extends AbstractFullDistri
}
public AbstractSolrMorphlineZkTestBase() {
fixShardCount = true;
sliceCount = 3;
shardCount = 3;
fixShardCount(3);
}
@BeforeClass
@ -76,9 +72,8 @@ public abstract class AbstractSolrMorphlineZkTestBase extends AbstractFullDistri
}
@Override
@Before
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
System.setProperty("host", "127.0.0.1");
System.setProperty("numShards", Integer.toString(sliceCount));
uploadConfFiles();
@ -86,19 +81,12 @@ public abstract class AbstractSolrMorphlineZkTestBase extends AbstractFullDistri
}
@Override
@After
public void tearDown() throws Exception {
super.tearDown();
public void distribTearDown() throws Exception {
super.distribTearDown();
System.clearProperty("host");
System.clearProperty("numShards");
}
@Test
@Override
public void testDistribSearch() throws Exception {
super.testDistribSearch();
}
@Override
protected void commit() throws Exception {
Notifications.notifyCommitTransaction(morphline);

View File

@ -33,6 +33,7 @@ import org.apache.solr.common.params.CollectionParams.CollectionAction;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.NamedList;
import org.junit.BeforeClass;
import org.junit.Test;
import org.kitesdk.morphline.api.Record;
import org.kitesdk.morphline.base.Fields;
import org.kitesdk.morphline.base.Notifications;
@ -48,8 +49,9 @@ import java.util.Iterator;
@Slow
public class SolrMorphlineZkAliasTest extends AbstractSolrMorphlineZkTestBase {
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
waitForRecoveriesToFinish(false);

View File

@ -35,6 +35,8 @@ import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.junit.BeforeClass;
import org.junit.Test;
import org.kitesdk.morphline.api.Record;
import org.kitesdk.morphline.base.Fields;
import org.kitesdk.morphline.base.Notifications;
@ -53,8 +55,9 @@ import java.util.List;
@Slow
public class SolrMorphlineZkAvroTest extends AbstractSolrMorphlineZkTestBase {
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
Joiner joiner = Joiner.on(File.separator);
File file = new File(joiner.join(RESOURCES_DIR, "test-documents", "sample-statuses-20120906-141433-medium.avro"));

View File

@ -28,6 +28,7 @@ import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.junit.BeforeClass;
import org.junit.Test;
import org.kitesdk.morphline.api.Record;
import org.kitesdk.morphline.base.Fields;
import org.kitesdk.morphline.base.Notifications;
@ -42,8 +43,9 @@ import java.util.Iterator;
@Slow
public class SolrMorphlineZkTest extends AbstractSolrMorphlineZkTestBase {
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
waitForRecoveriesToFinish(false);

View File

@ -10,6 +10,7 @@ import org.apache.solr.client.solrj.response.IntervalFacet.Count;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.junit.BeforeClass;
import org.junit.Test;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -37,8 +38,8 @@ public class DistributedIntervalFacetingTest extends
configString = "solrconfig-basic.xml";
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
del("*:*");
commit();
testRandom();

View File

@ -24,6 +24,7 @@ import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.NamedList;
import org.junit.Test;
/**
* TODO? perhaps use:
@ -43,8 +44,8 @@ public class TestDistributedGrouping extends BaseDistributedSearchTestCase {
String tdate_b = "b_n_tdt";
String oddField="oddField_s";
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
del("*:*");
commit();

View File

@ -19,6 +19,7 @@ package org.apache.solr;
import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.junit.Test;
/**
* Tests sortMissingFirst and sortMissingLast in distributed sort
@ -37,8 +38,8 @@ public class TestDistributedMissingSort extends BaseDistributedSearchTestCase {
String string1_ml = "five_s1_ml"; // StringField, sortMissingLast=true, multiValued=false
String string1_mf = "six_s1_mf"; // StringField, sortMissingFirst=true, multiValued=false
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
index();
testSortMissingLast();
testSortMissingFirst();

View File

@ -37,6 +37,7 @@ import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.ShardParams;
import org.apache.solr.common.util.NamedList;
import org.junit.Test;
/**
* TODO? perhaps use:
@ -61,8 +62,8 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {
String missingField="ignore_exception__missing_but_valid_field_t";
String invalidField="ignore_exception__invalid_field_not_in_schema";
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
QueryResponse rsp = null;
int backupStress = stress; // make a copy so we can restore

View File

@ -17,11 +17,11 @@
package org.apache.solr;
import org.apache.lucene.util.TestUtil;
import org.apache.lucene.util.TestUtil;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrInputDocument;
import org.junit.Test;
import java.io.IOException;
@ -35,14 +35,9 @@ public class TestHighlightDedupGrouping extends BaseDistributedSearchTestCase {
private static final String group_ti1 = "group_ti1";
private static final String shard_i1 = "shard_i1";
public TestHighlightDedupGrouping() {
super();
fixShardCount = true;
shardCount = 2;
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 2)
public void test() throws Exception {
basicTest();
randomizedTest();
}
@ -57,7 +52,7 @@ public class TestHighlightDedupGrouping extends BaseDistributedSearchTestCase {
int docid = 1;
int group = 5;
for (int shard = 0 ; shard < shardCount ; ++shard) {
for (int shard = 0 ; shard < getShardCount(); ++shard) {
addDoc(docid, group, shard); // add the same doc to both shards
clients.get(shard).commit();
}
@ -67,7 +62,7 @@ public class TestHighlightDedupGrouping extends BaseDistributedSearchTestCase {
"shards", shards,
"group", "true",
"group.field", id_s1,
"group.limit", Integer.toString(shardCount),
"group.limit", Integer.toString(getShardCount()),
"hl", "true",
"hl.fl", id_s1
));
@ -93,15 +88,15 @@ public class TestHighlightDedupGrouping extends BaseDistributedSearchTestCase {
++docsInGroup[group];
boolean makeDuplicate = 0 == TestUtil.nextInt(random(), 0, numDocs / percentDuplicates);
if (makeDuplicate) {
for (int shard = 0 ; shard < shardCount ; ++shard) {
for (int shard = 0 ; shard < getShardCount(); ++shard) {
addDoc(docid, group, shard);
}
} else {
int shard = TestUtil.nextInt(random(), 0, shardCount - 1);
int shard = TestUtil.nextInt(random(), 0, getShardCount() - 1);
addDoc(docid, group, shard);
}
}
for (int shard = 0 ; shard < shardCount ; ++shard) {
for (int shard = 0 ; shard < getShardCount(); ++shard) {
clients.get(shard).commit();
}

View File

@ -37,12 +37,11 @@ import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.params.CollectionParams.CollectionAction;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.junit.Test;
/**
* Test sync phase that occurs when Leader goes down and a new Leader is
@ -62,28 +61,20 @@ public class AliasIntegrationTest extends AbstractFullDistribZkTestBase {
}
@Before
@Override
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
System.setProperty("numShards", Integer.toString(sliceCount));
}
@Override
@After
public void tearDown() throws Exception {
super.tearDown();
resetExceptionIgnores();
}
public AliasIntegrationTest() {
super();
sliceCount = 1;
shardCount = random().nextBoolean() ? 3 : 4;
fixShardCount(random().nextBoolean() ? 3 : 4);
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
handle.clear();
handle.put("timestamp", SKIPVAL);

View File

@ -24,7 +24,7 @@ import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.common.params.CollectionParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.NamedList;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
@ -36,13 +36,8 @@ public class AsyncMigrateRouteKeyTest extends MigrateRouteKeyTest {
private static final int MAX_WAIT_SECONDS = 2 * 60;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
}
public void doTest() throws Exception {
@Test
public void test() throws Exception {
waitForThingsToLevelOut(15);
multipleShardMigrateTest();

View File

@ -38,6 +38,7 @@ import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.handler.ReplicationHandler;
import org.junit.Test;
import java.io.File;
import java.io.FilenameFilter;
@ -58,21 +59,12 @@ public class BasicDistributedZk2Test extends AbstractFullDistribZkTestBase {
public BasicDistributedZk2Test() {
super();
fixShardCount = true;
sliceCount = 2;
shardCount = 4;
}
/*
* (non-Javadoc)
*
* @see org.apache.solr.BaseDistributedSearchTestCase#doTest()
*
* Create 3 shards, each with one replica
*/
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 4)
public void test() throws Exception {
boolean testFinished = false;
try {
handle.clear();

View File

@ -50,8 +50,8 @@ import org.apache.solr.common.params.UpdateParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.update.DirectUpdateHandler2;
import org.apache.solr.util.DefaultSolrThreadFactory;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.IOException;
import java.util.ArrayList;
@ -106,20 +106,16 @@ public class BasicDistributedZkTest extends AbstractFullDistribZkTestBase {
public static void beforeThisClass2() throws Exception {
}
@Before
@Override
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
System.setProperty("numShards", Integer.toString(sliceCount));
System.setProperty("solr.xml.persist", "true");
}
public BasicDistributedZkTest() {
fixShardCount = true;
sliceCount = 2;
shardCount = 4;
completionService = new ExecutorCompletionService<>(executor);
pending = new HashSet<>();
@ -133,7 +129,7 @@ public class BasicDistributedZkTest extends AbstractFullDistribZkTestBase {
} else {
// use shard ids rather than physical locations
StringBuilder sb = new StringBuilder();
for (int i = 0; i < shardCount; i++) {
for (int i = 0; i < getShardCount(); i++) {
if (i > 0)
sb.append(',');
sb.append("shard" + (i + 3));
@ -141,9 +137,10 @@ public class BasicDistributedZkTest extends AbstractFullDistribZkTestBase {
params.set("shards", sb.toString());
}
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 4)
public void test() throws Exception {
// setLoggingLevel(null);
ZkStateReader zkStateReader = cloudClient.getZkStateReader();
@ -1160,8 +1157,8 @@ public class BasicDistributedZkTest extends AbstractFullDistribZkTestBase {
}
@Override
public void tearDown() throws Exception {
super.tearDown();
public void distribTearDown() throws Exception {
super.distribTearDown();
if (commondCloudSolrClient != null) {
commondCloudSolrClient.shutdown();
}
@ -1175,9 +1172,8 @@ public class BasicDistributedZkTest extends AbstractFullDistribZkTestBase {
otherCollectionClients = null;
List<Runnable> tasks = executor.shutdownNow();
assertTrue(tasks.isEmpty());
System.clearProperty("numShards");
System.clearProperty("zkHost");
System.clearProperty("solr.xml.persist");
// insurance

View File

@ -18,7 +18,6 @@ package org.apache.solr.cloud;
*/
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering;
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
@ -33,10 +32,9 @@ import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.util.IOUtils;
import org.apache.solr.core.Diagnostics;
import org.apache.solr.update.SolrCmdDistributor;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -88,10 +86,9 @@ public class ChaosMonkeyNothingIsSafeTest extends AbstractFullDistribZkTestBase
return randVals;
}
@Before
@Override
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
// can help to hide this when testing and looking at logs
//ignoreException("shard update error");
System.setProperty("numShards", Integer.toString(sliceCount));
@ -99,28 +96,27 @@ public class ChaosMonkeyNothingIsSafeTest extends AbstractFullDistribZkTestBase
}
@Override
@After
public void tearDown() throws Exception {
public void distribTearDown() throws Exception {
System.clearProperty("numShards");
super.tearDown();
resetExceptionIgnores();
super.distribTearDown();
}
public ChaosMonkeyNothingIsSafeTest() {
super();
sliceCount = Integer.parseInt(System.getProperty("solr.tests.cloud.cm.slicecount", "-1"));
shardCount = Integer.parseInt(System.getProperty("solr.tests.cloud.cm.shardcount", "-1"));
if (sliceCount == -1) {
sliceCount = random().nextInt(TEST_NIGHTLY ? 5 : 3) + 1;
}
if (shardCount == -1) {
shardCount = sliceCount + random().nextInt(TEST_NIGHTLY ? 12 : 2);
int numShards = Integer.parseInt(System.getProperty("solr.tests.cloud.cm.shardcount", "-1"));
if (numShards == -1) {
numShards = sliceCount + random().nextInt(TEST_NIGHTLY ? 12 : 2);
}
fixShardCount(numShards);
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
boolean testsSuccesful = false;
try {
handle.clear();

View File

@ -28,10 +28,9 @@ import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.core.Diagnostics;
import org.apache.solr.update.SolrCmdDistributor;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@Slow
public class ChaosMonkeySafeLeaderTest extends AbstractFullDistribZkTestBase {
@ -69,39 +68,37 @@ public class ChaosMonkeySafeLeaderTest extends AbstractFullDistribZkTestBase {
return randVals;
}
@Before
@Override
public void setUp() throws Exception {
public void distribSetUp() throws Exception {
useFactory("solr.StandardDirectoryFactory");
super.setUp();
super.distribSetUp();
System.setProperty("numShards", Integer.toString(sliceCount));
}
@Override
@After
public void tearDown() throws Exception {
public void distribTearDown() throws Exception {
System.clearProperty("numShards");
super.tearDown();
resetExceptionIgnores();
super.distribTearDown();
}
public ChaosMonkeySafeLeaderTest() {
super();
sliceCount = Integer.parseInt(System.getProperty("solr.tests.cloud.cm.slicecount", "-1"));
shardCount = Integer.parseInt(System.getProperty("solr.tests.cloud.cm.shardcount", "-1"));
if (sliceCount == -1) {
sliceCount = random().nextInt(TEST_NIGHTLY ? 5 : 3) + 1;
}
if (shardCount == -1) {
shardCount = sliceCount + random().nextInt(TEST_NIGHTLY ? 12 : 2);
int numShards = Integer.parseInt(System.getProperty("solr.tests.cloud.cm.shardcount", "-1"));
if (numShards == -1) {
numShards = sliceCount + random().nextInt(TEST_NIGHTLY ? 12 : 2);
}
fixShardCount(numShards);
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
handle.clear();
handle.put("timestamp", SKIPVAL);

View File

@ -31,9 +31,8 @@ import org.apache.solr.handler.component.HttpShardHandlerFactory;
import org.apache.solr.update.UpdateShardHandler;
import org.apache.solr.util.MockConfigSolr;
import org.apache.zookeeper.KeeperException;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import java.io.IOException;
import java.util.Collection;
@ -50,20 +49,8 @@ public class ChaosMonkeyShardSplitTest extends ShardSplitTest {
static final int TIMEOUT = 10000;
private AtomicInteger killCounter = new AtomicInteger();
@Before
@Override
public void setUp() throws Exception {
super.setUp();
}
@Override
@After
public void tearDown() throws Exception {
super.tearDown();
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
waitForThingsToLevelOut(15);
ClusterState clusterState = cloudClient.getZkStateReader().getClusterState();

View File

@ -22,6 +22,7 @@ import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.lucene.util.TestUtil;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -43,8 +44,8 @@ public class CloudExitableDirectoryReaderTest extends AbstractFullDistribZkTestB
return configString;
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
handle.clear();
handle.put("timestamp", SKIPVAL);
waitForRecoveriesToFinish(false);

View File

@ -28,7 +28,7 @@ import org.apache.solr.client.solrj.request.CollectionAdminRequest.SplitShard;
import org.apache.solr.client.solrj.response.CollectionAdminResponse;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.update.DirectUpdateHandler2;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
@ -40,10 +40,9 @@ public class CollectionsAPIAsyncDistributedZkTest extends AbstractFullDistribZkT
private static final int MAX_TIMEOUT_SECONDS = 60;
private static final boolean DEBUG = false;
@Before
@Override
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
useJettyDataDir = false;
@ -52,23 +51,12 @@ public class CollectionsAPIAsyncDistributedZkTest extends AbstractFullDistribZkT
}
public CollectionsAPIAsyncDistributedZkTest() {
fixShardCount = true;
sliceCount = 1;
shardCount = 1;
}
@Override
public void doTest() throws Exception {
testSolrJAPICalls();
if (DEBUG) {
super.printLayout();
}
}
private void testSolrJAPICalls() throws Exception {
@Test
@ShardsFixed(num = 1)
public void testSolrJAPICalls() throws Exception {
SolrClient client = createNewSolrClient("", getBaseUrl((HttpSolrClient) clients.get(0)));
try {
Create createCollectionRequest = new Create();
@ -115,6 +103,10 @@ public class CollectionsAPIAsyncDistributedZkTest extends AbstractFullDistribZkT
} finally {
client.shutdown();
}
if (DEBUG) {
printLayout();
}
}
private String getRequestStateAfterCompletion(String requestId, int waitForSeconds, SolrClient client)
@ -141,10 +133,9 @@ public class CollectionsAPIAsyncDistributedZkTest extends AbstractFullDistribZkT
}
@Override
public void tearDown() throws Exception {
super.tearDown();
public void distribTearDown() throws Exception {
super.distribTearDown();
System.clearProperty("numShards");
System.clearProperty("zkHost");
System.clearProperty("solr.xml.persist");
// insurance

View File

@ -57,8 +57,8 @@ import org.apache.solr.core.SolrInfoMBean.Category;
import org.apache.solr.servlet.SolrDispatchFilter;
import org.apache.solr.update.DirectUpdateHandler2;
import org.apache.solr.util.DefaultSolrThreadFactory;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
@ -117,10 +117,9 @@ public class CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBa
}
@Before
@Override
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
useJettyDataDir = false;
@ -161,10 +160,7 @@ public class CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBa
public CollectionsAPIDistributedZkTest() {
fixShardCount = true;
sliceCount = 2;
shardCount = 4;
completionService = new ExecutorCompletionService<>(executor);
pending = new HashSet<>();
checkCreatedVsState = false;
@ -179,7 +175,7 @@ public class CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBa
} else {
// use shard ids rather than physical locations
StringBuilder sb = new StringBuilder();
for (int i = 0; i < shardCount; i++) {
for (int i = 0; i < getShardCount(); i++) {
if (i > 0)
sb.append(',');
sb.append("shard" + (i + 3));
@ -187,9 +183,10 @@ public class CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBa
params.set("shards", sb.toString());
}
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 4)
public void test() throws Exception {
testNodesUsedByCreate();
testCollectionsAPI();
testCollectionsAPIAddRemoveStress();
@ -600,7 +597,7 @@ public class CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBa
int cnt = random().nextInt(TEST_NIGHTLY ? 6 : 1) + 1;
for (int i = 0; i < cnt; i++) {
int numShards = TestUtil.nextInt(random(), 0, shardCount) + 1;
int numShards = TestUtil.nextInt(random(), 0, getShardCount()) + 1;
int replicationFactor = TestUtil.nextInt(random(), 0, 3) + 1;
int maxShardsPerNode = (((numShards * replicationFactor) / getCommonCloudSolrClient()
.getZkStateReader().getClusterState().getLiveNodes().size())) + 1;
@ -896,7 +893,7 @@ public class CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBa
for (int i = 0; i < cnt; i++) {
String collectionName = "awholynewstresscollection_" + name + "_" + i;
int numShards = TestUtil.nextInt(random(), 0, shardCount * 2) + 1;
int numShards = TestUtil.nextInt(random(), 0, getShardCount() * 2) + 1;
int replicationFactor = TestUtil.nextInt(random(), 0, 3) + 1;
int maxShardsPerNode = (((numShards * 2 * replicationFactor) / getCommonCloudSolrClient()
.getZkStateReader().getClusterState().getLiveNodes().size())) + 1;
@ -1202,10 +1199,9 @@ public class CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBa
}
@Override
public void tearDown() throws Exception {
super.tearDown();
public void distribTearDown() throws Exception {
super.distribTearDown();
System.clearProperty("numShards");
System.clearProperty("zkHost");
System.clearProperty("solr.xml.persist");
// insurance

View File

@ -34,6 +34,7 @@ import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.CoreAdminParams;
import org.apache.solr.common.util.NamedList;
import org.apache.zookeeper.KeeperException;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
@ -49,9 +50,9 @@ import static org.apache.solr.cloud.ReplicaPropertiesBase.verifyUniqueAcrossColl
@LuceneTestCase.Slow
public class CollectionsAPISolrJTests extends AbstractFullDistribZkTestBase {
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
testCreateAndDeleteCollection();
testCreateAndDeleteShard();
testReloadCollection();
@ -67,19 +68,6 @@ public class CollectionsAPISolrJTests extends AbstractFullDistribZkTestBase {
testBalanceShardUnique();
}
public void tearDown() throws Exception {
if (controlClient != null) {
controlClient.shutdown();
}
if (cloudClient != null) {
cloudClient.shutdown();
}
if (controlClientCloud != null) {
controlClientCloud.shutdown();
}
super.tearDown();
}
protected void testCreateAndDeleteCollection() throws Exception {
String collectionName = "solrj_test";
CollectionAdminRequest.Create createCollectionRequest = new CollectionAdminRequest.Create();

View File

@ -60,8 +60,8 @@ import org.apache.solr.common.params.CollectionParams.CollectionAction;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.update.DirectUpdateHandler2;
import org.apache.solr.util.DefaultSolrThreadFactory;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
/**
* Tests the Custom Sharding API.
@ -84,10 +84,9 @@ public class CustomCollectionTest extends AbstractFullDistribZkTestBase {
public static void beforeThisClass2() throws Exception {
}
@Before
@Override
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
System.setProperty("numShards", Integer.toString(sliceCount));
System.setProperty("solr.xml.persist", "true");
}
@ -98,10 +97,7 @@ public class CustomCollectionTest extends AbstractFullDistribZkTestBase {
public CustomCollectionTest() {
fixShardCount = true;
sliceCount = 2;
shardCount = 4;
completionService = new ExecutorCompletionService<>(executor);
pending = new HashSet<>();
checkCreatedVsState = false;
@ -116,7 +112,7 @@ public class CustomCollectionTest extends AbstractFullDistribZkTestBase {
} else {
// use shard ids rather than physical locations
StringBuilder sb = new StringBuilder();
for (int i = 0; i < shardCount; i++) {
for (int i = 0; i < getShardCount(); i++) {
if (i > 0)
sb.append(',');
sb.append("shard" + (i + 3));
@ -125,8 +121,9 @@ public class CustomCollectionTest extends AbstractFullDistribZkTestBase {
}
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 4)
public void test() throws Exception {
testCustomCollectionsAPI();
testRouteFieldForHashRouter();
testCreateShardRepFactor();
@ -492,10 +489,9 @@ public class CustomCollectionTest extends AbstractFullDistribZkTestBase {
}
@Override
public void tearDown() throws Exception {
super.tearDown();
public void distribTearDown() throws Exception {
super.distribTearDown();
System.clearProperty("numShards");
System.clearProperty("zkHost");
System.clearProperty("solr.xml.persist");
// insurance

View File

@ -29,8 +29,7 @@ import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.CoreAdminParams;
import org.apache.solr.common.params.MapSolrParams;
import org.apache.solr.common.util.NamedList;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.net.URL;
import java.util.Map;
@ -41,22 +40,8 @@ import static org.apache.solr.common.cloud.ZkNodeProps.makeMap;
//@Ignore("Not currently valid see SOLR-5580")
public class DeleteInactiveReplicaTest extends DeleteReplicaTest{
@Override
public void doTest() throws Exception {
deleteInactiveReplicaTest();
}
@Before
public void setUp() throws Exception {
super.setUp();
}
@After
public void tearDown() throws Exception {
super.tearDown();
}
private void deleteInactiveReplicaTest() throws Exception {
@Test
public void deleteInactiveReplicaTest() throws Exception {
CloudSolrClient client = createCloudClient(null);
String collectionName = "delDeadColl";

View File

@ -27,10 +27,9 @@ import org.apache.solr.common.cloud.Replica;
import org.apache.solr.common.cloud.ZkNodeProps;
import org.apache.solr.common.params.MapSolrParams;
import org.apache.solr.common.params.SolrParams;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import java.io.IOException;
import java.util.HashMap;
@ -53,18 +52,17 @@ public class DeleteLastCustomShardedReplicaTest extends AbstractFullDistribZkTes
}
@Before
@Override
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
System.setProperty("numShards", Integer.toString(sliceCount));
System.setProperty("solr.xml.persist", "true");
client = createCloudClient(null);
}
@After
public void tearDown() throws Exception {
super.tearDown();
@Override
public void distribTearDown() throws Exception {
super.distribTearDown();
client.shutdown();
}
@ -73,16 +71,13 @@ public class DeleteLastCustomShardedReplicaTest extends AbstractFullDistribZkTes
}
public DeleteLastCustomShardedReplicaTest() {
fixShardCount = true;
sliceCount = 2;
shardCount = 2;
checkCreatedVsState = false;
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 2)
public void test() throws Exception {
int replicationFactor = 1;
int maxShardsPerNode = 5;

View File

@ -32,9 +32,8 @@ import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.MapSolrParams;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.NamedList;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
@ -56,18 +55,17 @@ public class DeleteReplicaTest extends AbstractFullDistribZkTestBase {
}
@Before
@Override
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
System.setProperty("numShards", Integer.toString(sliceCount));
System.setProperty("solr.xml.persist", "true");
client = createCloudClient(null);
}
@After
public void tearDown() throws Exception {
super.tearDown();
@Override
public void distribTearDown() throws Exception {
super.distribTearDown();
client.shutdown();
}
@ -76,20 +74,13 @@ public class DeleteReplicaTest extends AbstractFullDistribZkTestBase {
}
public DeleteReplicaTest() {
fixShardCount = true;
sliceCount = 2;
shardCount = 4;
checkCreatedVsState = false;
}
@Override
public void doTest() throws Exception {
deleteLiveReplicaTest();
}
private void deleteLiveReplicaTest() throws Exception {
@Test
@ShardsFixed(num = 4)
public void deleteLiveReplicaTest() throws Exception {
String collectionName = "delLiveColl";
CloudSolrClient client = createCloudClient(null);
try {

View File

@ -30,8 +30,7 @@ import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.CollectionParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.zookeeper.KeeperException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
import java.util.HashMap;
@ -41,46 +40,28 @@ public class DeleteShardTest extends AbstractFullDistribZkTestBase {
public DeleteShardTest() {
super();
fixShardCount = true;
shardCount = 2;
sliceCount = 2;
}
@Override
@Before
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
System.setProperty("numShards", "2");
System.setProperty("solr.xml.persist", "true");
}
@Override
@After
public void tearDown() throws Exception {
super.tearDown();
if (VERBOSE || printLayoutOnTearDown) {
super.printLayout();
}
if (controlClient != null) {
controlClient.shutdown();
}
if (cloudClient != null) {
cloudClient.shutdown();
}
if (controlClientCloud != null) {
controlClientCloud.shutdown();
}
super.tearDown();
public void distribTearDown() throws Exception {
super.distribTearDown();
System.clearProperty("numShards");
System.clearProperty("solr.xml.persist");
}
// TODO: Custom hash slice deletion test
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 2)
public void test() throws Exception {
ClusterState clusterState = cloudClient.getZkStateReader().getClusterState();
Slice slice1 = clusterState.getSlice(AbstractDistribZkTestBase.DEFAULT_COLLECTION, SHARD1);

View File

@ -37,6 +37,7 @@ import static org.apache.solr.common.params.CursorMarkParams.CURSOR_MARK_NEXT;
import static org.apache.solr.common.params.CursorMarkParams.CURSOR_MARK_START;
import org.apache.solr.search.CursorMark; //jdoc
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -69,8 +70,8 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {
return configString;
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
boolean testFinished = false;
try {
handle.clear();

View File

@ -26,6 +26,7 @@ import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.update.processor.DocExpirationUpdateProcessorFactory; // jdoc
import org.apache.solr.update.processor.DocExpirationUpdateProcessorFactoryTest;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -52,8 +53,8 @@ public class DistribDocExpirationUpdateProcessorTest extends AbstractFullDistrib
return configString;
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
assertTrue("only one shard?!?!?!", 1 < shardToJetty.keySet().size());
log.info("number of shards: {}", shardToJetty.keySet().size());

View File

@ -27,30 +27,22 @@ import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.handler.BlobHandler;
import org.apache.solr.handler.TestBlobHandler;
import org.apache.zookeeper.data.Stat;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
public class ExternalCollectionsTest extends AbstractFullDistribZkTestBase {
private CloudSolrClient client;
@BeforeClass
public static void beforeThisClass2() throws Exception {
}
@Before
@Override
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
System.setProperty("numShards", Integer.toString(sliceCount));
System.setProperty("solr.xml.persist", "true");
client = createCloudClient(null);
}
@After
public void tearDown() throws Exception {
super.tearDown();
@Override
public void distribTearDown() throws Exception {
super.distribTearDown();
client.shutdown();
}
@ -59,17 +51,13 @@ public class ExternalCollectionsTest extends AbstractFullDistribZkTestBase {
}
public ExternalCollectionsTest() {
fixShardCount = true;
sliceCount = 2;
shardCount = 4;
checkCreatedVsState = false;
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 4)
public void test() throws Exception {
testZkNodeLocation();
testConfNameAndCollectionNameSame();
}

View File

@ -39,6 +39,7 @@ import org.apache.solr.update.VersionInfo;
import org.apache.solr.update.processor.DistributedUpdateProcessor;
import org.apache.zookeeper.CreateMode;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.IOException;
import java.util.ArrayList;
@ -58,13 +59,12 @@ public class FullSolrCloudDistribCmdsTest extends AbstractFullDistribZkTestBase
public FullSolrCloudDistribCmdsTest() {
super();
fixShardCount = true;
shardCount = 6;
sliceCount = 3;
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 6)
public void test() throws Exception {
handle.clear();
handle.put("timestamp", SKIPVAL);
@ -499,11 +499,6 @@ public class FullSolrCloudDistribCmdsTest extends AbstractFullDistribZkTestBase
return client.query(query);
}
@Override
public void tearDown() throws Exception {
super.tearDown();
}
protected SolrInputDocument addRandFields(SolrInputDocument sdoc) {
return sdoc;
}

View File

@ -36,8 +36,7 @@ import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.servlet.SolrDispatchFilter;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -73,26 +72,15 @@ public class HttpPartitionTest extends AbstractFullDistribZkTestBase {
public HttpPartitionTest() {
super();
sliceCount = 2;
shardCount = 3;
fixShardCount(3);
}
@Before
@Override
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
System.setProperty("numShards", Integer.toString(sliceCount));
}
@Override
@After
public void tearDown() throws Exception {
try {
super.tearDown();
} catch (Exception exc) {}
resetExceptionIgnores();
}
/**
* Overrides the parent implementation to install a SocketProxy in-front of the Jetty server.
*/
@ -104,8 +92,8 @@ public class HttpPartitionTest extends AbstractFullDistribZkTestBase {
return createProxiedJetty(solrHome, dataDir, shardList, solrConfigOverride, schemaOverride);
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
waitForThingsToLevelOut(30000);
testLeaderInitiatedRecoveryCRUD();

View File

@ -28,6 +28,7 @@ import org.apache.solr.client.solrj.embedded.JettySolrRunner;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.common.cloud.Replica;
import org.junit.Test;
/**
* Tests leader-initiated recovery scenarios after a leader node fails
@ -42,8 +43,8 @@ public class LeaderFailoverAfterPartitionTest extends HttpPartitionTest {
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
waitForThingsToLevelOut(30000);
// kill a leader and make sure recovery occurs as expected

View File

@ -22,8 +22,7 @@ import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.common.cloud.Replica;
import org.apache.solr.common.cloud.ZkCoreNodeProps;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.io.File;
import java.util.List;
@ -35,29 +34,22 @@ public class LeaderInitiatedRecoveryOnCommitTest extends BasicDistributedZkTest
public LeaderInitiatedRecoveryOnCommitTest() {
super();
sliceCount = 1;
shardCount = 4;
fixShardCount(4);
}
@Before
@Override
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
System.setProperty("numShards", Integer.toString(sliceCount));
}
@Override
@After
public void tearDown() throws Exception {
public void distribTearDown() throws Exception {
System.clearProperty("numShards");
try {
super.tearDown();
} catch (Exception exc) {
}
super.distribTearDown();
resetExceptionIgnores();
// close socket proxies after super.tearDown
// close socket proxies after super.distribTearDown
if (!proxies.isEmpty()) {
for (SocketProxy proxy : proxies.values()) {
proxy.close();
@ -65,8 +57,8 @@ public class LeaderInitiatedRecoveryOnCommitTest extends BasicDistributedZkTest
}
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
oneShardTest();
multiShardTest();
}
@ -171,4 +163,4 @@ public class LeaderInitiatedRecoveryOnCommitTest extends BasicDistributedZkTest
return createProxiedJetty(solrHome, dataDir, shardList, solrConfigOverride, schemaOverride);
}
}
}

View File

@ -33,8 +33,7 @@ import org.apache.solr.common.cloud.ZkNodeProps;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.update.DirectUpdateHandler2;
import org.apache.zookeeper.KeeperException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
import java.util.HashMap;
@ -52,31 +51,15 @@ public class MigrateRouteKeyTest extends BasicDistributedZkTest {
}
@Override
@Before
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
System.setProperty("numShards", Integer.toString(sliceCount));
System.setProperty("solr.xml.persist", "true");
}
@Override
@After
public void tearDown() throws Exception {
super.tearDown();
if (VERBOSE || printLayoutOnTearDown) {
super.printLayout();
}
if (controlClient != null) {
controlClient.shutdown();
}
if (cloudClient != null) {
cloudClient.shutdown();
}
if (controlClientCloud != null) {
controlClientCloud.shutdown();
}
super.tearDown();
public void distribTearDown() throws Exception {
super.distribTearDown();
System.clearProperty("zkHost");
System.clearProperty("numShards");
@ -86,8 +69,8 @@ public class MigrateRouteKeyTest extends BasicDistributedZkTest {
DirectUpdateHandler2.commitOnClose = true;
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
waitForThingsToLevelOut(15);
if (usually()) {

View File

@ -30,7 +30,7 @@ import org.apache.solr.common.params.CollectionParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.update.DirectUpdateHandler2;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -49,10 +49,9 @@ public class MultiThreadedOCPTest extends AbstractFullDistribZkTestBase {
private static final int NUM_COLLECTIONS = 4;
@Before
@Override
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
useJettyDataDir = false;
@ -61,13 +60,12 @@ public class MultiThreadedOCPTest extends AbstractFullDistribZkTestBase {
}
public MultiThreadedOCPTest() {
fixShardCount = true;
sliceCount = 2;
shardCount = 4;
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 4)
public void test() throws Exception {
testParallelCollectionAPICalls();
testTaskExclusivity();
@ -311,10 +309,9 @@ public class MultiThreadedOCPTest extends AbstractFullDistribZkTestBase {
}
@Override
public void tearDown() throws Exception {
super.tearDown();
public void distribTearDown() throws Exception {
super.distribTearDown();
System.clearProperty("numShards");
System.clearProperty("zkHost");
System.clearProperty("solr.xml.persist");
// insurance

View File

@ -46,9 +46,8 @@ import org.apache.solr.common.params.CollectionParams.CollectionAction;
import org.apache.solr.common.params.MapSolrParams;
import org.apache.solr.common.params.SolrParams;
import org.apache.zookeeper.data.Stat;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@LuceneTestCase.Slow
@SuppressSSL // See SOLR-5776
@ -60,18 +59,17 @@ public class OverseerRolesTest extends AbstractFullDistribZkTestBase{
}
@Before
@Override
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
System.setProperty("numShards", Integer.toString(sliceCount));
System.setProperty("solr.xml.persist", "true");
client = createCloudClient(null);
}
@After
public void tearDown() throws Exception {
super.tearDown();
@Override
public void distribTearDown() throws Exception {
super.distribTearDown();
client.shutdown();
}
@ -80,16 +78,14 @@ public class OverseerRolesTest extends AbstractFullDistribZkTestBase{
}
public OverseerRolesTest() {
fixShardCount = true;
sliceCount = 2;
shardCount = TEST_NIGHTLY ? 6 : 2;
fixShardCount(TEST_NIGHTLY ? 6 : 2);
checkCreatedVsState = false;
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
testQuitCommand();
testOverseerRole();
}

View File

@ -17,20 +17,11 @@ package org.apache.solr.cloud;
* limitations under the License.
*/
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.client.solrj.response.CollectionAdminResponse;
import org.apache.solr.common.cloud.DocRouter;
import org.apache.solr.common.params.CollectionParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SimpleOrderedMap;
import org.junit.After;
import org.junit.Before;
import java.io.IOException;
import org.junit.Test;
public class OverseerStatusTest extends BasicDistributedZkTest {
@ -39,33 +30,14 @@ public class OverseerStatusTest extends BasicDistributedZkTest {
}
@Override
@Before
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
System.setProperty("numShards", Integer.toString(sliceCount));
System.setProperty("solr.xml.persist", "true");
}
@Override
@After
public void tearDown() throws Exception {
if (VERBOSE || printLayoutOnTearDown) {
super.printLayout();
}
if (controlClient != null) {
controlClient.shutdown();
}
if (cloudClient != null) {
cloudClient.shutdown();
}
if (controlClientCloud != null) {
controlClientCloud.shutdown();
}
super.tearDown();
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
waitForThingsToLevelOut(15);
// find existing command counts because collection may be created by base test class too

View File

@ -28,15 +28,15 @@ import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.cloud.Replica;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
// See SOLR-6640
@SolrTestCaseJ4.SuppressSSL
public class RecoveryAfterSoftCommitTest extends AbstractFullDistribZkTestBase {
public RecoveryAfterSoftCommitTest() {
fixShardCount = true;
sliceCount = 1;
shardCount = 2;
fixShardCount(2);
}
@BeforeClass
@ -60,8 +60,8 @@ public class RecoveryAfterSoftCommitTest extends AbstractFullDistribZkTestBase {
return createProxiedJetty(solrHome, dataDir, shardList, solrConfigOverride, schemaOverride);
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
// flush twice
for (int i=0; i<4; i++) {
SolrInputDocument document = new SolrInputDocument();

View File

@ -25,6 +25,7 @@ import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.cloud.ZkStateReader;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -39,7 +40,7 @@ public class RecoveryZkTest extends AbstractFullDistribZkTestBase {
public RecoveryZkTest() {
super();
sliceCount = 1;
shardCount = 2;
fixShardCount(2);
schemaString = "schema15.xml"; // we need a string id
}
@ -54,8 +55,8 @@ public class RecoveryZkTest extends AbstractFullDistribZkTestBase {
return randVals;
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
handle.clear();
handle.put("timestamp", SKIPVAL);
@ -148,7 +149,7 @@ public class RecoveryZkTest extends AbstractFullDistribZkTestBase {
@Override
public void tearDown() throws Exception {
public void distribTearDown() throws Exception {
// make sure threads have been stopped...
indexThread.safeStop();
indexThread2.safeStop();
@ -156,7 +157,7 @@ public class RecoveryZkTest extends AbstractFullDistribZkTestBase {
indexThread.join();
indexThread2.join();
super.tearDown();
super.distribTearDown();
}
// skip the randoms - they can deadlock...

View File

@ -21,6 +21,7 @@ import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrInputDocument;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
@ -36,11 +37,11 @@ public class RemoteQueryErrorTest extends AbstractFullDistribZkTestBase {
public RemoteQueryErrorTest() {
super();
sliceCount = 1;
shardCount = random().nextBoolean() ? 3 : 4;
fixShardCount(random().nextBoolean() ? 3 : 4);
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
handle.clear();
handle.put("timestamp", SKIPVAL);
@ -70,4 +71,4 @@ public class RemoteQueryErrorTest extends AbstractFullDistribZkTestBase {
}
}
}
}
}

View File

@ -19,15 +19,10 @@ package org.apache.solr.cloud;
import java.io.File;
import java.net.ServerSocket;
import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.apache.lucene.util.LuceneTestCase.AwaitsFix;
import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
@ -36,10 +31,8 @@ import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.cloud.Replica;
import org.apache.solr.common.cloud.ZkCoreNodeProps;
import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.util.NamedList;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -59,31 +52,25 @@ public class ReplicationFactorTest extends AbstractFullDistribZkTestBase {
public ReplicationFactorTest() {
super();
sliceCount = 3;
shardCount = 3;
fixShardCount(3);
}
@Before
@Override
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
System.setProperty("numShards", Integer.toString(sliceCount));
}
@Override
@After
public void tearDown() throws Exception {
public void distribTearDown() throws Exception {
log.info("tearing down replicationFactorTest!");
System.clearProperty("numShards");
try {
super.tearDown();
} catch (Exception exc) {}
resetExceptionIgnores();
log.info("super.tearDown complete, closing all socket proxies");
super.distribTearDown();
log.info("super.distribTearDown complete, closing all socket proxies");
if (!proxies.isEmpty()) {
for (SocketProxy proxy : proxies.values()) {
proxy.close();
@ -111,10 +98,10 @@ public class ReplicationFactorTest extends AbstractFullDistribZkTestBase {
port = s.getLocalPort();
}
return port;
}
@Override
public void doTest() throws Exception {
}
@Test
public void test() throws Exception {
log.info("replication factor test running");
waitForThingsToLevelOut(30000);

View File

@ -21,8 +21,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.solr.common.cloud.SolrZkClient;
import org.apache.solr.common.params.CollectionParams;
import org.apache.zookeeper.KeeperException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -36,29 +35,25 @@ public class RollingRestartTest extends AbstractFullDistribZkTestBase {
private static final long MAX_WAIT_TIME = TimeUnit.NANOSECONDS.convert(300, TimeUnit.SECONDS);
public RollingRestartTest() {
fixShardCount = true;
sliceCount = 2;
shardCount = TEST_NIGHTLY ? 16 : 2;
fixShardCount(TEST_NIGHTLY ? 16 : 2);
}
@Before
@Override
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
System.setProperty("numShards", Integer.toString(sliceCount));
useFactory("solr.StandardDirectoryFactory");
}
@Override
@After
public void tearDown() throws Exception {
public void distribTearDown() throws Exception {
System.clearProperty("numShards");
super.tearDown();
resetExceptionIgnores();
super.distribTearDown();
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
waitForRecoveriesToFinish(false);
restartWithRolesTest();
@ -75,11 +70,11 @@ public class RollingRestartTest extends AbstractFullDistribZkTestBase {
cloudClient.getZkStateReader().getZkClient().printLayoutToStdOut();
int numDesignateOverseers = TEST_NIGHTLY ? 16 : 2;
numDesignateOverseers = Math.max(shardCount, numDesignateOverseers);
numDesignateOverseers = Math.max(getShardCount(), numDesignateOverseers);
List<String> designates = new ArrayList<>();
List<CloudJettyRunner> designateJettys = new ArrayList<>();
for (int i = 0; i < numDesignateOverseers; i++) {
int n = random().nextInt(shardCount);
int n = random().nextInt(getShardCount());
String nodeName = cloudJettys.get(n).nodeName;
log.info("Chose {} as overseer designate", nodeName);
invokeCollectionApi(CollectionParams.ACTION, CollectionParams.CollectionAction.ADDROLE.toLower(), "role", "overseer", "node", nodeName);

View File

@ -41,6 +41,7 @@ import org.apache.solr.common.params.SolrParams;
import org.apache.solr.util.SSLTestConfig;
import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
import org.apache.lucene.util.LuceneTestCase.Slow;
import org.junit.Test;
/**
* We want to make sure that when migrating between http and https modes the
@ -51,9 +52,9 @@ import org.apache.lucene.util.LuceneTestCase.Slow;
@SuppressSSL
@BadApple(bugUrl = "https://issues.apache.org/jira/browse/SOLR-6213")
public class SSLMigrationTest extends AbstractFullDistribZkTestBase {
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
//Migrate from HTTP -> HTTPS -> HTTP
assertReplicaInformation("http");
testMigrateSSL(new SSLTestConfig(true, false));
@ -118,4 +119,4 @@ public class SSLMigrationTest extends AbstractFullDistribZkTestBase {
new LBHttpSolrClient(urls.toArray(new String[]{})).request(request);
}
}
}

View File

@ -18,6 +18,7 @@ package org.apache.solr.cloud;
*/
import org.junit.BeforeClass;
import org.junit.Test;
public class ShardRoutingCustomTest extends AbstractFullDistribZkTestBase {
@ -34,8 +35,8 @@ public class ShardRoutingCustomTest extends AbstractFullDistribZkTestBase {
sliceCount = 0;
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
boolean testFinished = false;
try {
doCustomSharding();

View File

@ -23,6 +23,7 @@ import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.params.ShardParams;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.List;
import java.util.Map;
@ -49,8 +50,6 @@ public class ShardRoutingTest extends AbstractFullDistribZkTestBase {
public ShardRoutingTest() {
schemaString = "schema15.xml"; // we need a string id
super.sliceCount = 4;
super.shardCount = 8;
super.fixShardCount = true; // we only want to test with exactly 4 slices.
// from negative to positive, the upper bits of the hash ranges should be
// shard1: top bits:10 80000000:bfffffff
@ -92,8 +91,9 @@ public class ShardRoutingTest extends AbstractFullDistribZkTestBase {
***/
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 8)
public void test() throws Exception {
boolean testFinished = false;
try {
handle.clear();

View File

@ -39,8 +39,7 @@ import org.apache.solr.common.cloud.ZkNodeProps;
import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.CollectionParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
import java.util.ArrayList;
@ -66,33 +65,14 @@ public class ShardSplitTest extends BasicDistributedZkTest {
}
@Override
@Before
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
System.setProperty("numShards", Integer.toString(sliceCount));
System.setProperty("solr.xml.persist", "true");
}
@Override
@After
public void tearDown() throws Exception {
if (VERBOSE || printLayoutOnTearDown) {
super.printLayout();
}
if (controlClient != null) {
controlClient.shutdown();
}
if (cloudClient != null) {
cloudClient.shutdown();
}
if (controlClientCloud != null) {
controlClientCloud.shutdown();
}
super.tearDown();
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
waitForThingsToLevelOut(15);
if (usually()) {

View File

@ -49,6 +49,7 @@ import org.apache.solr.util.DefaultSolrThreadFactory;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.apache.solr.common.cloud.ZkNodeProps.makeMap;
@ -80,10 +81,9 @@ public class SharedFSAutoReplicaFailoverTest extends AbstractFullDistribZkTestBa
dfsCluster = null;
}
@Before
@Override
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
useJettyDataDir = false;
System.setProperty("solr.xml.persist", "true");
}
@ -94,18 +94,16 @@ public class SharedFSAutoReplicaFailoverTest extends AbstractFullDistribZkTestBa
public SharedFSAutoReplicaFailoverTest() {
fixShardCount = true;
sliceCount = 2;
shardCount = 4;
completionService = new ExecutorCompletionService<>(executor);
pending = new HashSet<>();
checkCreatedVsState = false;
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 4)
public void test() throws Exception {
try {
testBasics();
} finally {
@ -238,8 +236,8 @@ public class SharedFSAutoReplicaFailoverTest extends AbstractFullDistribZkTestBa
}
@Override
public void tearDown() throws Exception {
super.tearDown();
public void distribTearDown() throws Exception {
super.distribTearDown();
System.clearProperty("solr.xml.persist");
}
}

View File

@ -22,17 +22,17 @@ import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.NamedList;
import org.junit.Test;
public class SimpleCollectionCreateDeleteTest extends AbstractFullDistribZkTestBase {
public SimpleCollectionCreateDeleteTest() {
fixShardCount = true;
sliceCount = 1;
shardCount = 1;
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 1)
public void test() throws Exception {
String overseerNode = OverseerCollectionProcessor.getLeaderNode(cloudClient.getZkStateReader().getZkClient());
String notOverseerNode = null;
for (CloudJettyRunner cloudJetty : cloudJettys) {

View File

@ -32,10 +32,9 @@ import org.apache.solr.common.cloud.Slice;
import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.CollectionParams.CollectionAction;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.IOException;
import java.util.ArrayList;
@ -61,33 +60,30 @@ public class SyncSliceTest extends AbstractFullDistribZkTestBase {
}
@Before
@Override
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
// we expect this time of exception as shards go up and down...
//ignoreException(".*");
System.setProperty("numShards", Integer.toString(sliceCount));
}
@Override
@After
public void tearDown() throws Exception {
public void distribTearDown() throws Exception {
if (!success) {
printLayoutOnTearDown = true;
}
super.tearDown();
resetExceptionIgnores();
super.distribTearDown();
}
public SyncSliceTest() {
super();
sliceCount = 1;
shardCount = TEST_NIGHTLY ? 7 : 4;
fixShardCount(TEST_NIGHTLY ? 7 : 4);
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
handle.clear();
handle.put("timestamp", SKIPVAL);
@ -160,7 +156,7 @@ public class SyncSliceTest extends AbstractFullDistribZkTestBase {
Set<CloudJettyRunner> jetties = new HashSet<>();
jetties.addAll(shardToJetty.get("shard1"));
jetties.remove(leaderJetty);
assertEquals(shardCount - 1, jetties.size());
assertEquals(getShardCount() - 1, jetties.size());
chaosMonkey.killJetty(leaderJetty);
@ -224,7 +220,7 @@ public class SyncSliceTest extends AbstractFullDistribZkTestBase {
jetties = new HashSet<>();
jetties.addAll(shardToJetty.get("shard1"));
jetties.remove(leaderJetty);
assertEquals(shardCount - 1, jetties.size());
assertEquals(getShardCount() - 1, jetties.size());
// kill the current leader

View File

@ -16,8 +16,6 @@
*/
package org.apache.solr.cloud;
import org.apache.commons.collections.CollectionUtils;
import org.apache.lucene.util.CollectionUtil;
import org.apache.lucene.util.TestUtil;
import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
import org.apache.solr.client.solrj.SolrServerException;
@ -38,6 +36,7 @@ import org.apache.commons.lang.StringUtils;
import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -95,8 +94,8 @@ public class TestCloudPivotFacet extends AbstractFullDistribZkTestBase {
log.info("init'ing useFieldRandomizedFactor = {}", useFieldRandomizedFactor);
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
sanityCheckAssertDoubles();

View File

@ -33,7 +33,7 @@ import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.ShardParams;
import org.apache.solr.common.util.NamedList;
import org.apache.zookeeper.KeeperException;
import org.junit.Before;
import org.junit.Test;
import static org.apache.solr.cloud.OverseerCollectionProcessor.SHARD_UNIQUE;
@ -54,16 +54,14 @@ public class TestCollectionAPI extends ReplicaPropertiesBase {
}
@Override
@Before
public void setUp() throws Exception {
fixShardCount = true;
public void distribSetUp() throws Exception {
sliceCount = 2;
shardCount = 2;
super.setUp();
super.distribSetUp();
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 2)
public void test() throws Exception {
CloudSolrClient client = createCloudClient(null);
try {
createCollection(null, COLLECTION_NAME, 2, 2, 2, client, null, "conf1");

View File

@ -24,6 +24,7 @@ import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.util.StrUtils;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.HashMap;
import java.util.HashSet;
@ -53,8 +54,6 @@ public class TestDistribDocBasedVersion extends AbstractFullDistribZkTestBase {
public TestDistribDocBasedVersion() {
schemaString = "schema15.xml"; // we need a string id
super.sliceCount = 2;
super.shardCount = 4;
super.fixShardCount = true; // we only want to test with exactly 2 slices.
/***
@ -87,8 +86,9 @@ public class TestDistribDocBasedVersion extends AbstractFullDistribZkTestBase {
***/
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 4)
public void test() throws Exception {
boolean testFinished = false;
try {
handle.clear();
@ -346,10 +346,4 @@ public class TestDistribDocBasedVersion extends AbstractFullDistribZkTestBase {
req.setParams(params(reqParams));
req.process(cloudClient);
}
@Override
public void tearDown() throws Exception {
super.tearDown();
}
}

View File

@ -27,7 +27,7 @@ import org.apache.solr.common.params.CollectionParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.zookeeper.KeeperException;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
import java.util.ArrayList;
@ -42,15 +42,7 @@ public class TestRebalanceLeaders extends AbstractFullDistribZkTestBase {
public TestRebalanceLeaders() {
schemaString = "schema15.xml"; // we need a string id
}
@Override
@Before
public void setUp() throws Exception {
fixShardCount = true;
sliceCount = 4;
shardCount = 4;
super.setUp();
}
int reps = 10;
@ -60,8 +52,9 @@ public class TestRebalanceLeaders extends AbstractFullDistribZkTestBase {
Map<String, Replica> expected = new HashMap<>();
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 4)
public void test() throws Exception {
CloudSolrClient client = createCloudClient(null);
reps = random().nextInt(9) + 1; // make sure and do at least one.
try {

View File

@ -36,7 +36,7 @@ import org.apache.solr.common.params.CollectionParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.zookeeper.KeeperException;
import org.junit.Before;
import org.junit.Test;
@Slow
public class TestReplicaProperties extends ReplicaPropertiesBase {
@ -45,19 +45,12 @@ public class TestReplicaProperties extends ReplicaPropertiesBase {
public TestReplicaProperties() {
schemaString = "schema15.xml"; // we need a string id
}
@Override
@Before
public void setUp() throws Exception {
fixShardCount = true;
sliceCount = 2;
shardCount = 4;
super.setUp();
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 4)
public void test() throws Exception {
CloudSolrClient client = createCloudClient(null);
try {
// Mix up a bunch of different combinations of shards and replicas in order to exercise boundary cases.

View File

@ -24,7 +24,7 @@ import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.common.params.CollectionParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.NamedList;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
@ -36,14 +36,8 @@ public class TestRequestStatusCollectionAPI extends BasicDistributedZkTest {
schemaString = "schema15.xml"; // we need a string id
}
@Override
@Before
public void setUp() throws Exception {
super.setUp();
}
public void doTest() {
@Test
public void test() throws Exception {
ModifiableSolrParams params = new ModifiableSolrParams();
params.set(CollectionParams.ACTION, CollectionParams.CollectionAction.CREATE.toString());

View File

@ -23,18 +23,18 @@ import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.cloud.Replica;
import org.apache.solr.common.params.ShardParams;
import org.apache.solr.common.util.NamedList;
import org.junit.Test;
public class TestShortCircuitedRequests extends AbstractFullDistribZkTestBase {
public TestShortCircuitedRequests() {
schemaString = "schema15.xml"; // we need a string id
super.sliceCount = 4;
super.shardCount = 4;
super.fixShardCount = true; // we only want to test with exactly 4 slices.
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 4)
public void test() throws Exception {
waitForRecoveriesToFinish(false);
assertEquals(4, cloudClient.getZkStateReader().getClusterState().getCollection(DEFAULT_COLLECTION).getSlices().size());
index("id", "a!doc1"); // shard3

View File

@ -21,6 +21,7 @@ import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.HashMap;
import java.util.HashSet;
@ -47,14 +48,12 @@ public class TriLevelCompositeIdRoutingTest extends ShardRoutingTest {
public TriLevelCompositeIdRoutingTest() {
schemaString = "schema15.xml"; // we need a string id
super.sliceCount = TEST_NIGHTLY ? 12 : 2; // a lot of slices for more ranges and buckets
super.shardCount = TEST_NIGHTLY ? 24 : 3;
super.fixShardCount = true;
sliceCount = TEST_NIGHTLY ? 12 : 2; // a lot of slices for more ranges and buckets
fixShardCount(TEST_NIGHTLY ? 24 : 3);
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
boolean testFinished = false;
try {
handle.clear();
@ -74,7 +73,6 @@ public class TriLevelCompositeIdRoutingTest extends ShardRoutingTest {
}
}
private void doTriLevelHashingTest() throws Exception {
log.info("### STARTING doTriLevelHashingTest");
// for now, we know how ranges will be distributed to shards.
@ -153,10 +151,4 @@ public class TriLevelCompositeIdRoutingTest extends ShardRoutingTest {
private String getKey(String id) {
return id.substring(0, id.lastIndexOf('!'));
}
@Override
public void tearDown() throws Exception {
super.tearDown();
}
}

View File

@ -31,8 +31,7 @@ import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.update.DirectUpdateHandler2;
import org.apache.solr.util.DefaultSolrThreadFactory;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
@ -48,17 +47,6 @@ import java.util.concurrent.TimeUnit;
@Slow
@SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-5776")
public class UnloadDistributedZkTest extends BasicDistributedZkTest {
@BeforeClass
public static void beforeThisClass3() throws Exception {
}
@Before
@Override
public void setUp() throws Exception {
super.setUp();
}
protected String getSolrXml() {
return "solr-no-core.xml";
@ -68,9 +56,9 @@ public class UnloadDistributedZkTest extends BasicDistributedZkTest {
super();
checkCreatedVsState = false;
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
testCoreUnloadAndLeaders(); // long
testUnloadLotsOfCores(); // long
@ -427,13 +415,4 @@ public class UnloadDistributedZkTest extends BasicDistributedZkTest {
executor.awaitTermination(120, TimeUnit.SECONDS);
adminClient.shutdown();
}
@Override
public void tearDown() throws Exception {
super.tearDown();
}
}

View File

@ -23,7 +23,6 @@ import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.solr.cloud.ChaosMonkeySafeLeaderTest;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import com.carrotsearch.randomizedtesting.annotations.Nightly;
@ -47,10 +46,9 @@ public class HdfsChaosMonkeySafeLeaderTest extends ChaosMonkeySafeLeaderTest {
dfsCluster = null;
}
@Before
@Override
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
// super class may hard code directory
useFactory("org.apache.solr.core.HdfsDirectoryFactory");

View File

@ -23,7 +23,6 @@ import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.solr.cloud.SyncSliceTest;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import com.carrotsearch.randomizedtesting.annotations.Nightly;
@ -46,14 +45,7 @@ public class HdfsSyncSliceTest extends SyncSliceTest {
HdfsTestUtil.teardownClass(dfsCluster);
dfsCluster = null;
}
@Before
@Override
public void setUp() throws Exception {
super.setUp();
}
@Override
protected String getDataDir(String dataDir) throws IOException {
return HdfsTestUtil.getDataDir(dfsCluster, dataDir);

View File

@ -40,6 +40,7 @@ import org.apache.solr.store.blockcache.Cache;
import org.apache.solr.util.RefCounted;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.IOException;
import java.util.ArrayList;
@ -77,15 +78,15 @@ public class HdfsWriteToMultipleCollectionsTest extends BasicDistributedZkTest {
public HdfsWriteToMultipleCollectionsTest() {
super();
sliceCount = 1;
shardCount = 3;
fixShardCount(3);
}
protected String getSolrXml() {
return "solr-no-core.xml";
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
int docCount = random().nextInt(1313) + 1;
int cnt = random().nextInt(4) + 1;
for (int i = 0; i < cnt; i++) {

View File

@ -48,6 +48,7 @@ import org.junit.BeforeClass;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope.Scope;
import org.junit.Test;
@Slow
@ThreadLeakScope(Scope.NONE) // hdfs client currently leaks thread(s)
@ -80,16 +81,16 @@ public class StressHdfsTest extends BasicDistributedZkTest {
public StressHdfsTest() {
super();
sliceCount = 1;
shardCount = TEST_NIGHTLY ? 7 : random().nextInt(2) + 1;
fixShardCount(TEST_NIGHTLY ? 7 : random().nextInt(2) + 1);
testRestartIntoSafeMode = random().nextBoolean();
}
protected String getSolrXml() {
return "solr-no-core.xml";
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
randomlyEnableAutoSoftCommit();
int cnt = random().nextInt(2) + 1;
@ -138,11 +139,11 @@ public class StressHdfsTest extends BasicDistributedZkTest {
int nShards;
int maxReplicasPerNode;
if (overshard) {
nShards = shardCount * 2;
nShards = getShardCount() * 2;
maxReplicasPerNode = 8;
rep = 1;
} else {
nShards = shardCount / 2;
nShards = getShardCount() / 2;
maxReplicasPerNode = 1;
rep = 2;
if (nShards == 0) nShards = 1;

View File

@ -26,7 +26,7 @@ import org.apache.solr.handler.TestBlobHandler;
import org.apache.solr.util.RESTfulServerProvider;
import org.apache.solr.util.RestTestHarness;
import org.apache.solr.util.SimplePostTool;
import org.junit.After;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -57,21 +57,17 @@ public class TestDynamicLoading extends AbstractFullDistribZkTestBase {
}
}
@After
public void testDown() throws Exception {
super.tearDown();
@Override
public void distribTearDown() throws Exception {
super.distribTearDown();
for (RestTestHarness r : restTestHarnesses) {
r.close();
}
}
@Override
public void doTest() throws Exception {
setupHarnesses();
dynamicLoading();
}
private void dynamicLoading() throws Exception {
@Test
public void testDynamicLoading() throws Exception {
setupHarnesses();
String payload = "{\n" +
"'create-requesthandler' : { 'name' : '/test1', 'class': 'org.apache.solr.core.BlobStoreTestRequestHandler' , 'lib':'test','version':'1'}\n" +
"}";

View File

@ -37,6 +37,7 @@ import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.core.ConfigOverlay;
import org.apache.solr.update.DirectUpdateHandler2;
import org.apache.solr.util.SimplePostTool;
import org.junit.Test;
import org.noggit.JSONParser;
import org.noggit.ObjectBuilder;
import org.slf4j.Logger;
@ -48,17 +49,16 @@ import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import static org.apache.solr.core.ConfigOverlay.getObjectByPath;
public class TestBlobHandler extends AbstractFullDistribZkTestBase {
static final Logger log = LoggerFactory.getLogger(TestBlobHandler.class);
private void doBlobHandlerTest() throws Exception {
@Test
public void doBlobHandlerTest() throws Exception {
SolrClient client = createNewSolrClient("", getBaseUrl((HttpSolrClient) clients.get(0)));
try {
CollectionAdminResponse response1;
@ -116,8 +116,8 @@ public class TestBlobHandler extends AbstractFullDistribZkTestBase {
}
@Override
public void tearDown() throws Exception {
super.tearDown();
public void distribTearDown() throws Exception {
super.distribTearDown();
System.clearProperty("numShards");
System.clearProperty("zkHost");
@ -194,10 +194,4 @@ public class TestBlobHandler extends AbstractFullDistribZkTestBase {
httpPost.releaseConnection();
}
}
@Override
public void doTest() throws Exception {
doBlobHandlerTest();
}
}

View File

@ -47,7 +47,7 @@ import org.apache.solr.util.RestTestHarness;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.data.Stat;
import org.junit.After;
import org.junit.Test;
import org.noggit.JSONParser;
import org.noggit.ObjectBuilder;
import org.slf4j.Logger;
@ -71,16 +71,16 @@ public class TestConfigReload extends AbstractFullDistribZkTestBase {
}
}
@After
public void tearDown() throws Exception {
super.tearDown();
@Override
public void distribTearDown() throws Exception {
super.distribTearDown();
for (RestTestHarness h : restTestHarnesses) {
h.close();
}
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
setupHarnesses();
try {
reloadTest();

View File

@ -20,7 +20,6 @@ package org.apache.solr.handler;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@ -37,7 +36,7 @@ import org.apache.solr.core.RequestParams;
import org.apache.solr.core.TestSolrConfigHandler;
import org.apache.solr.util.RESTfulServerProvider;
import org.apache.solr.util.RestTestHarness;
import org.junit.After;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -59,17 +58,17 @@ public class TestSolrConfigHandlerCloud extends AbstractFullDistribZkTestBase {
restTestHarnesses.add(harness);
}
}
@After
public void tearDown() throws Exception {
super.tearDown();
@Override
public void distribTearDown() throws Exception {
super.distribTearDown();
for (RestTestHarness r : restTestHarnesses) {
r.close();
}
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
setupHarnesses();
testReqHandlerAPIs();
testReqParams();

View File

@ -46,7 +46,7 @@ import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.core.ConfigOverlay;
import org.apache.solr.util.RESTfulServerProvider;
import org.apache.solr.util.RestTestHarness;
import org.junit.After;
import org.junit.Test;
import org.noggit.JSONParser;
import org.noggit.ObjectBuilder;
import org.slf4j.Logger;
@ -70,17 +70,17 @@ public class TestSolrConfigHandlerConcurrent extends AbstractFullDistribZkTestBa
restTestHarnesses.add(harness);
}
}
@After
public void tearDown() throws Exception {
super.tearDown();
@Override
public void distribTearDown() throws Exception {
super.distribTearDown();
for (RestTestHarness h : restTestHarnesses) {
h.close();
}
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
Map editable_prop_map = (Map) new ObjectBuilder(new JSONParser(new StringReader(
ConfigOverlay.MAPPING))).getObject();
Map caches = (Map) editable_prop_map.get("query");

View File

@ -21,12 +21,10 @@ import org.apache.solr.BaseDistributedSearchTestCase;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.NamedList;
import org.junit.BeforeClass;
import org.junit.Test;
import java.nio.ByteBuffer;
import java.util.Map;
import java.util.Iterator;
@ -38,8 +36,6 @@ import java.util.Iterator;
public class DistributedExpandComponentTest extends BaseDistributedSearchTestCase {
public DistributedExpandComponentTest() {
fixShardCount = true;
shardCount = 3;
stress = 0;
}
@ -48,8 +44,9 @@ public class DistributedExpandComponentTest extends BaseDistributedSearchTestCas
initCore("solrconfig-collapseqparser.xml", "schema11.xml");
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 3)
public void test() throws Exception {
final String group = (random().nextBoolean() ? "group_s" : "group_s_dv");
del("*:*");

View File

@ -32,18 +32,15 @@ import org.apache.solr.common.params.FacetParams;
import org.apache.solr.common.params.SolrParams;
import junit.framework.AssertionFailedError;
import org.junit.Test;
public class DistributedFacetPivotLargeTest extends BaseDistributedSearchTestCase {
public static final String SPECIAL = "";
public DistributedFacetPivotLargeTest() {
this.fixShardCount = true;
this.shardCount = 4; // we leave one empty as an edge case
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 4)
public void test() throws Exception {
this.stress = 0 ;
handle.clear();
handle.put("QTime", SKIPVAL);

View File

@ -26,6 +26,7 @@ import org.apache.solr.client.solrj.response.PivotField;
import org.apache.solr.common.params.FacetParams;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.junit.Test;
/**
* test demonstrating how overrequesting helps finds top-terms in the "long tail"
@ -39,11 +40,6 @@ import org.apache.solr.common.params.ModifiableSolrParams;
*/
public class DistributedFacetPivotLongTailTest extends BaseDistributedSearchTestCase {
public DistributedFacetPivotLongTailTest(){
this.fixShardCount = true;
this.shardCount = 3;
}
private int docNumber = 0;
public int getDocNum() {
@ -51,8 +47,9 @@ public class DistributedFacetPivotLongTailTest extends BaseDistributedSearchTest
return docNumber;
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 3)
public void test() throws Exception {
final SolrClient shard0 = clients.get(0);
final SolrClient shard1 = clients.get(1);

View File

@ -25,6 +25,7 @@ import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.params.FacetParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.SolrParams;
import org.junit.Test;
import java.util.List;
@ -37,13 +38,9 @@ import java.util.List;
*/
public class DistributedFacetPivotSmallAdvancedTest extends BaseDistributedSearchTestCase {
public DistributedFacetPivotSmallAdvancedTest() {
this.fixShardCount = true;
this.shardCount = 2;
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 2)
public void test() throws Exception {
del("*:*");
final SolrClient shard0 = clients.get(0);

View File

@ -32,16 +32,13 @@ import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import junit.framework.AssertionFailedError;
import org.junit.Test;
public class DistributedFacetPivotSmallTest extends BaseDistributedSearchTestCase {
public DistributedFacetPivotSmallTest() {
this.fixShardCount = true;
this.shardCount = 4;
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 4)
public void test() throws Exception {
del("*:*");

View File

@ -22,18 +22,15 @@ import org.apache.solr.client.solrj.response.PivotField;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.SolrParams;
import org.junit.Test;
import java.util.List;
public class DistributedFacetPivotWhiteBoxTest extends BaseDistributedSearchTestCase {
public DistributedFacetPivotWhiteBoxTest() {
this.fixShardCount = true;
this.shardCount = 4;
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 4)
public void test() throws Exception {
del("*:*");

View File

@ -20,8 +20,8 @@ package org.apache.solr.handler.component;
import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.solr.BaseDistributedSearchTestCase;
import org.apache.solr.common.params.MoreLikeThisParams;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
/**
* Test for distributed MoreLikeThisComponent's
@ -38,29 +38,18 @@ public class DistributedMLTComponentTest extends BaseDistributedSearchTestCase {
public DistributedMLTComponentTest()
{
fixShardCount=true;
shardCount=3;
stress=0;
}
@BeforeClass
public static void beforeClass() throws Exception {
}
@Override
public void setUp() throws Exception {
public void distribSetUp() throws Exception {
requestHandlerName = "mltrh";
super.setUp();
super.distribSetUp();
}
@Override
public void tearDown() throws Exception {
super.tearDown();
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 3)
public void test() throws Exception {
del("*:*");
index(id, "1", "lowerfilt", "toyota");
index(id, "2", "lowerfilt", "chevrolet");

View File

@ -19,9 +19,8 @@ package org.apache.solr.handler.component;
import org.apache.solr.BaseDistributedSearchTestCase;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
import org.junit.BeforeClass;
import org.junit.Test;
import java.nio.ByteBuffer;
@ -33,8 +32,6 @@ import java.nio.ByteBuffer;
public class DistributedQueryComponentCustomSortTest extends BaseDistributedSearchTestCase {
public DistributedQueryComponentCustomSortTest() {
fixShardCount = true;
shardCount = 3;
stress = 0;
}
@ -43,8 +40,9 @@ public class DistributedQueryComponentCustomSortTest extends BaseDistributedSear
initCore("solrconfig.xml", "schema-custom-field.xml");
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 3)
public void test() throws Exception {
del("*:*");
index(id, "1", "text", "a", "payload", ByteBuffer.wrap(new byte[] { 0x12, 0x62, 0x15 }), // 2

View File

@ -20,11 +20,11 @@ package org.apache.solr.handler.component;
import org.apache.solr.BaseDistributedSearchTestCase;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.cloud.AbstractFullDistribZkTestBase;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.ShardParams;
import org.apache.solr.common.util.SimpleOrderedMap;
import org.junit.BeforeClass;
import org.junit.Test;
import java.nio.ByteBuffer;
import java.util.Map;
@ -40,8 +40,6 @@ import java.util.Map;
public class DistributedQueryComponentOptimizationTest extends BaseDistributedSearchTestCase {
public DistributedQueryComponentOptimizationTest() {
fixShardCount = true;
shardCount = 3;
stress = 0;
}
@ -50,8 +48,9 @@ public class DistributedQueryComponentOptimizationTest extends BaseDistributedSe
initCore("solrconfig.xml", "schema-custom-field.xml");
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 3)
public void test() throws Exception {
del("*:*");
index(id, "1", "text", "a", "test_sS", "21", "payload", ByteBuffer.wrap(new byte[] { 0x12, 0x62, 0x15 }), // 2

View File

@ -26,6 +26,7 @@ import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.params.CommonParams;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
/**
*
@ -39,8 +40,6 @@ public class DistributedQueryElevationComponentTest extends BaseDistributedSearc
}
public DistributedQueryElevationComponentTest() {
fixShardCount = true;
shardCount = 3;
stress = 0;
// TODO: a better way to do this?
@ -59,8 +58,9 @@ public class DistributedQueryElevationComponentTest extends BaseDistributedSearc
System.clearProperty("elevate.data.file");
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 3)
public void test() throws Exception {
del("*:*");

View File

@ -32,6 +32,7 @@ import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.SpellingParams;
import org.apache.solr.common.util.NamedList;
import org.junit.BeforeClass;
import org.junit.Test;
/**
* Test for SpellCheckComponent's distributed querying
@ -57,16 +58,6 @@ public class DistributedSpellCheckComponentTest extends BaseDistributedSearchTes
useFactory(null); // need an FS factory
}
@Override
public void setUp() throws Exception {
super.setUp();
}
@Override
public void tearDown() throws Exception {
super.tearDown();
}
private void q(Object... q) throws Exception {
final ModifiableSolrParams params = new ModifiableSolrParams();
@ -95,9 +86,9 @@ public class DistributedSpellCheckComponentTest extends BaseDistributedSearchTes
Assert.fail("Control data did not return any suggestions.");
}
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
del("*:*");
index(id, "1", "lowerfilt", "toyota");
index(id, "2", "lowerfilt", "chevrolet");

View File

@ -31,6 +31,7 @@ import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SimpleOrderedMap;
import org.apache.solr.spelling.suggest.SuggesterParams;
import org.junit.BeforeClass;
import org.junit.Test;
/**
* Test for SuggestComponent's distributed querying
@ -54,16 +55,6 @@ public class DistributedSuggestComponentTest extends BaseDistributedSearchTestCa
useFactory(null); // need an FS factory
}
@Override
public void setUp() throws Exception {
super.setUp();
}
@Override
public void tearDown() throws Exception {
super.tearDown();
}
@Override
public void validateControlData(QueryResponse control) throws Exception
{
@ -74,10 +65,10 @@ public class DistributedSuggestComponentTest extends BaseDistributedSearchTestCa
if(sc.size() == 0 && command == null) {
Assert.fail("Control data did not return any suggestions or execute any command");
}
}
@Override
public void doTest() throws Exception {
}
@Test
public void test() throws Exception {
del("*:*");
index(id, "1", "cat", "This is another title", "price", "10", "weight", "10");
index(id, "2", "cat", "Yet another", "price", "15", "weight", "10");

View File

@ -18,6 +18,7 @@ package org.apache.solr.handler.component;
*/
import org.apache.solr.BaseDistributedSearchTestCase;
import org.junit.Test;
/**
* Test for TermsComponent distributed querying
@ -27,8 +28,8 @@ import org.apache.solr.BaseDistributedSearchTestCase;
*/
public class DistributedTermsComponentTest extends BaseDistributedSearchTestCase {
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
del("*:*");
index(id, 18, "b_t", "snake spider shark snail slug seal");
index(id, 19, "b_t", "snake spider shark snail slug");

View File

@ -22,6 +22,7 @@ import org.apache.lucene.util.Constants;
import org.apache.solr.BaseDistributedSearchTestCase;
import org.apache.solr.common.params.TermVectorParams;
import org.junit.BeforeClass;
import org.junit.Test;
public class TermVectorComponentDistributedTest extends BaseDistributedSearchTestCase {
@BeforeClass
@ -30,8 +31,8 @@ public class TermVectorComponentDistributedTest extends BaseDistributedSearchTes
Constants.JAVA_VENDOR.startsWith("IBM"));
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
handle.clear();
handle.put("timestamp", SKIPVAL);

View File

@ -38,8 +38,8 @@ import org.apache.solr.cloud.AbstractFullDistribZkTestBase;
import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.util.RESTfulServerProvider;
import org.apache.solr.util.RestTestHarness;
import org.junit.After;
import org.junit.BeforeClass;
import org.junit.Test;
import org.noggit.JSONParser;
import org.noggit.ObjectBuilder;
import org.slf4j.Logger;
@ -70,17 +70,17 @@ public class TestBulkSchemaConcurrent extends AbstractFullDistribZkTestBase {
restTestHarnesses.add(harness);
}
}
@After
public void tearDown() throws Exception {
super.tearDown();
@Override
public void distribTearDown() throws Exception {
super.distribTearDown();
for (RestTestHarness r : restTestHarnesses) {
r.close();
}
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
final int threadCount = 5;
setupHarnesses();

View File

@ -26,6 +26,7 @@ import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.zookeeper.KeeperException;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@ -47,9 +48,9 @@ public class TestCloudManagedSchema extends AbstractFullDistribZkTestBase {
protected String getCloudSolrConfig() {
return "solrconfig-managed-schema.xml";
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
ModifiableSolrParams params = new ModifiableSolrParams();
params.set(CoreAdminParams.ACTION, CoreAdminParams.CoreAdminAction.STATUS.toString());
QueryRequest request = new QueryRequest(params);

View File

@ -36,8 +36,8 @@ import org.apache.solr.util.RESTfulServerProvider;
import org.apache.solr.util.RestTestHarness;
import org.apache.zookeeper.data.Stat;
import org.eclipse.jetty.servlet.ServletHolder;
import org.junit.After;
import org.junit.BeforeClass;
import org.junit.Test;
import org.restlet.ext.servlet.ServerServlet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -54,10 +54,7 @@ public class TestCloudManagedSchemaConcurrent extends AbstractFullDistribZkTestB
public TestCloudManagedSchemaConcurrent() {
super();
fixShardCount = true;
sliceCount = 4;
shardCount = 8;
}
@BeforeClass
@ -65,10 +62,10 @@ public class TestCloudManagedSchemaConcurrent extends AbstractFullDistribZkTestB
System.setProperty("managed.schema.mutable", "true");
System.setProperty("enable.update.log", "true");
}
@After
public void tearDown() throws Exception {
super.tearDown();
@Override
public void distribTearDown() throws Exception {
super.distribTearDown();
for (RestTestHarness h : restTestHarnesses) {
h.close();
}
@ -245,10 +242,11 @@ public class TestCloudManagedSchemaConcurrent extends AbstractFullDistribZkTestB
return expectedAddFieldTypes;
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 8)
public void test() throws Exception {
verifyWaitForSchemaUpdateToPropagate();
setupHarnesses();
concurrentOperationsTest();

View File

@ -29,7 +29,7 @@ import org.apache.solr.util.RestTestHarness;
import org.eclipse.jetty.servlet.ServletHolder;
import org.junit.After;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.Test;
import org.restlet.ext.servlet.ServerServlet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -49,11 +49,10 @@ public class TestCloudSchemaless extends AbstractFullDistribZkTestBase {
private static final Logger log = LoggerFactory.getLogger(TestCloudManagedSchemaConcurrent.class);
private static final String SUCCESS_XPATH = "/response/lst[@name='responseHeader']/int[@name='status'][.='0']";
@Before
@Override
public void setUp() throws Exception {
public void distribSetUp() throws Exception {
super.setUp();
super.distribSetUp();
useJettyDataDir = false;
@ -70,10 +69,7 @@ public class TestCloudSchemaless extends AbstractFullDistribZkTestBase {
public TestCloudSchemaless() {
schemaString = "schema-add-schema-fields-update-processor.xml";
fixShardCount = true;
sliceCount = 4;
shardCount = 8;
}
@BeforeClass
@ -122,8 +118,9 @@ public class TestCloudSchemaless extends AbstractFullDistribZkTestBase {
return expectedAddFields;
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 8)
public void test() throws Exception {
setupHarnesses();
// First, add a bunch of documents in a single update with the same new field.

View File

@ -22,6 +22,7 @@ import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.NamedList;
import org.junit.BeforeClass;
import org.junit.Test;
/**
* Test for QueryComponent's distributed querying
@ -31,8 +32,6 @@ import org.junit.BeforeClass;
public class AnalyticsMergeStrategyTest extends BaseDistributedSearchTestCase {
public AnalyticsMergeStrategyTest() {
fixShardCount = true;
shardCount = 3;
stress = 0;
}
@ -41,8 +40,9 @@ public class AnalyticsMergeStrategyTest extends BaseDistributedSearchTestCase {
initCore("solrconfig-analytics-query.xml", "schema15.xml");
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 3)
public void test() throws Exception {
del("*:*");
index_specific(0,"id","1", "sort_i", "5");

View File

@ -21,13 +21,12 @@ import org.apache.solr.BaseDistributedSearchTestCase;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.handler.component.MergeStrategy;
import org.apache.solr.handler.component.ResponseBuilder;
import org.apache.solr.handler.component.ShardRequest;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.Arrays;
@ -39,8 +38,6 @@ import java.util.Arrays;
public class MergeStrategyTest extends BaseDistributedSearchTestCase {
public MergeStrategyTest() {
fixShardCount = true;
shardCount = 3;
stress = 0;
}
@ -49,8 +46,9 @@ public class MergeStrategyTest extends BaseDistributedSearchTestCase {
initCore("solrconfig-plugcollector.xml", "schema15.xml");
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 3)
public void test() throws Exception {
del("*:*");
index_specific(0,"id","1", "sort_i", "5");

View File

@ -23,6 +23,7 @@ import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -35,8 +36,6 @@ public class CloudMLTQParserTest extends AbstractFullDistribZkTestBase {
static Logger log = LoggerFactory.getLogger(CloudMLTQParserTest.class);
public CloudMLTQParserTest() {
fixShardCount = true;
shardCount = 2;
sliceCount = 2;
configString = "solrconfig.xml";
@ -47,8 +46,10 @@ public class CloudMLTQParserTest extends AbstractFullDistribZkTestBase {
protected String getCloudSolrConfig() {
return configString;
}
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 2)
public void test() throws Exception {
waitForRecoveriesToFinish(false);

View File

@ -30,13 +30,13 @@ public abstract class TestBaseStatsCache extends TestDefaultStatsCache {
protected abstract String getStatsCacheClassName();
@Override
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
System.setProperty("solr.statsCache", getStatsCacheClassName());
}
public void tearDown() throws Exception {
super.tearDown();
public void distribTearDown() throws Exception {
super.distribTearDown();
System.clearProperty("solr.statsCache");
}

View File

@ -22,23 +22,24 @@ import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.junit.Test;
public class TestDefaultStatsCache extends BaseDistributedSearchTestCase {
private int docId = 0;
@Override
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
System.setProperty("solr.statsCache", LocalStatsCache.class.getName());
}
public void tearDown() throws Exception {
super.tearDown();
public void distribTearDown() throws Exception {
super.distribTearDown();
System.clearProperty("solr.statsCache");
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
del("*:*");
for (int i = 0; i < clients.size(); i++) {
int shard = i + 1;

View File

@ -25,6 +25,7 @@ import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.StrUtils;
import org.junit.Test;
import java.io.IOException;
import java.util.Arrays;
@ -41,18 +42,16 @@ public class PeerSyncTest extends BaseDistributedSearchTestCase {
params(DISTRIB_UPDATE_PARAM, FROM_LEADER);
public PeerSyncTest() {
fixShardCount = true;
shardCount = 3;
stress = 0;
// TODO: a better way to do this?
configString = "solrconfig-tlog.xml";
schemaString = "schema.xml";
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 3)
public void test() throws Exception {
handle.clear();
handle.put("timestamp", SKIPVAL);
handle.put("score", SKIPVAL);

View File

@ -48,6 +48,7 @@ import org.apache.solr.update.SolrCmdDistributor.RetryNode;
import org.apache.solr.update.SolrCmdDistributor.StdNode;
import org.apache.solr.update.processor.DistributedUpdateProcessor;
import org.junit.BeforeClass;
import org.junit.Test;
import org.xml.sax.SAXException;
import javax.xml.parsers.ParserConfigurationException;
@ -90,8 +91,6 @@ public class SolrCmdDistributorTest extends BaseDistributedSearchTestCase {
}
});
fixShardCount = true;
shardCount = 4;
stress = 0;
}
@ -136,9 +135,10 @@ public class SolrCmdDistributorTest extends BaseDistributedSearchTestCase {
shards = sb.toString();
}
@Override
public void doTest() throws Exception {
@Test
@ShardsFixed(num = 4)
public void test() throws Exception {
del("*:*");
SolrCmdDistributor cmdDistrib = new SolrCmdDistributor(updateShardHandler);
@ -320,7 +320,7 @@ public class SolrCmdDistributorTest extends BaseDistributedSearchTestCase {
cmdDistrib.finish();
assertEquals(shardCount, commits.get());
assertEquals(getShardCount(), commits.get());
for (SolrClient c : clients) {
NamedList<Object> resp = c.request(new LukeRequest());
@ -517,14 +517,9 @@ public class SolrCmdDistributorTest extends BaseDistributedSearchTestCase {
}
@Override
public void setUp() throws Exception {
super.setUp();
}
@Override
public void tearDown() throws Exception {
public void distribTearDown() throws Exception {
updateShardHandler.close();
super.tearDown();
super.distribTearDown();
}
private void testDistribOpenSearcher() {

View File

@ -21,7 +21,6 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.solr.client.solrj.SolrQuery;
@ -46,10 +45,9 @@ import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.ShardParams;
import org.apache.solr.common.util.NamedList;
import org.apache.zookeeper.KeeperException;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -97,31 +95,23 @@ public class CloudSolrClientTest extends AbstractFullDistribZkTestBase {
return SOLR_HOME;
}
@Before
@Override
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
// we expect this time of exception as shards go up and down...
//ignoreException(".*");
System.setProperty("numShards", Integer.toString(sliceCount));
}
@Override
@After
public void tearDown() throws Exception {
super.tearDown();
resetExceptionIgnores();
}
public CloudSolrClientTest() {
super();
sliceCount = 2;
shardCount = 3;
fixShardCount(3);
}
@Override
public void doTest() throws Exception {
@Test
public void test() throws Exception {
allTests();
stateVersionParamTest();
customHttpClientTest();

View File

@ -39,12 +39,19 @@ import org.apache.solr.schema.TrieDateField;
import org.eclipse.jetty.servlet.ServletHolder;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.Rule;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
@ -63,6 +70,20 @@ import java.util.concurrent.atomic.AtomicInteger;
/**
* Helper base class for distributed search test cases
*
* By default, all tests in sub-classes will be executed with
* 1, 2, ... DEFAULT_MAX_SHARD_COUNT number of shards set up repeatedly.
*
* In general, it's preferable to annotate the tests in sub-classes with a
* {@literal @}ShardsFixed(num = N) or a {@literal @}ShardsRepeat(min = M, max = N)
* to indicate whether the test should be called once, with a fixed number of shards,
* or called repeatedly for number of shards = M to N.
*
* In some cases though, if the number of shards has to be fixed, but the number
* itself is dynamic, or if it has to be set as a default for all sub-classes
* of a sub-class, there's a fixShardCount(N) available, which is identical to
* {@literal @}ShardsFixed(num = N) for all tests without annotations in that class
* hierarchy. Ideally this function should be retired in favour of better annotations..
*
* @since solr 1.5
*/
public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
@ -174,16 +195,19 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
"[ff01::213]:33332" + context};
}
protected int shardCount = 4; // the actual number of solr cores that will be created in the cluster
private final static int DEFAULT_MAX_SHARD_COUNT = 3;
/**
* Sub classes can set this flag in their constructor to true if they
* want to fix the number of shards to 'shardCount'
*
* The default is false which means that test will be executed with
* 1, 2, 3, ....shardCount number of shards repeatedly
*/
protected boolean fixShardCount = false;
private int shardCount = -1; // the actual number of solr cores that will be created in the cluster
public int getShardCount() {
return shardCount;
}
private boolean isShardCountFixed = false;
public void fixShardCount(int count) {
isShardCountFixed = true;
shardCount = count;
}
protected JettySolrRunner controlJetty;
protected List<SolrClient> clients = new ArrayList<>();
@ -245,13 +269,6 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
public static RandVal rdate = new RandDate();
/**
* Perform the actual tests here
*
* @throws Exception on error
*/
public abstract void doTest() throws Exception;
public static String[] fieldNames = new String[]{"n_ti1", "n_f1", "n_tf1", "n_d1", "n_td1", "n_l1", "n_tl1", "n_dt1", "n_tdt1"};
public static RandVal[] randVals = new RandVal[]{rint, rfloat, rfloat, rdouble, rdouble, rlong, rlong, rdate, rdate};
@ -270,20 +287,20 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
public String getSolrHome() {
return SolrTestCaseJ4.TEST_HOME();
}
@Override
public void setUp() throws Exception {
private boolean distribSetUpCalled = false;
public void distribSetUp() throws Exception {
distribSetUpCalled = true;
SolrTestCaseJ4.resetExceptionIgnores(); // ignore anything with ignore_exception in it
super.setUp();
System.setProperty("solr.test.sys.prop1", "propone");
System.setProperty("solr.test.sys.prop2", "proptwo");
testDir = createTempDir().toFile();
}
@Override
public void tearDown() throws Exception {
private boolean distribTearDownCalled = false;
public void distribTearDown() throws Exception {
distribTearDownCalled = true;
destroyServers();
super.tearDown();
}
protected JettySolrRunner createControlJetty() throws Exception {
@ -870,23 +887,107 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
compareSolrResponses(a, b);
}
@Test
public void testDistribSearch() throws Exception {
if (fixShardCount) {
createServers(shardCount);
RandVal.uniqueValues = new HashSet(); //reset random values
doTest();
destroyServers();
} else {
for (int nServers = 1; nServers < shardCount; nServers++) {
createServers(nServers);
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ShardsRepeat {
public abstract int min() default 1;
public abstract int max() default DEFAULT_MAX_SHARD_COUNT;
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ShardsFixed {
public abstract int num();
}
public class ShardsRepeatRule implements TestRule {
private abstract class ShardsStatement extends Statement {
abstract protected void callStatement() throws Throwable;
@Override
public void evaluate() throws Throwable {
distribSetUp();
if (! distribSetUpCalled) {
Assert.fail("One of the overrides of distribSetUp does not propagate the call.");
}
try {
callStatement();
} finally {
distribTearDown();
if (! distribTearDownCalled) {
Assert.fail("One of the overrides of distribTearDown does not propagate the call.");
}
}
}
}
private class ShardsFixedStatement extends ShardsStatement {
private final int numShards;
private final Statement statement;
private ShardsFixedStatement(int numShards, Statement statement) {
this.numShards = numShards;
this.statement = statement;
}
@Override
public void callStatement() throws Throwable {
fixShardCount(numShards);
createServers(numShards);
RandVal.uniqueValues = new HashSet(); //reset random values
doTest();
statement.evaluate();
destroyServers();
}
}
private class ShardsRepeatStatement extends ShardsStatement {
private final int min;
private final int max;
private final Statement statement;
private ShardsRepeatStatement(int min, int max, Statement statement) {
this.min = min;
this.max = max;
this.statement = statement;
}
@Override
public void callStatement() throws Throwable {
for (shardCount = min; shardCount <= max; shardCount++) {
createServers(shardCount);
RandVal.uniqueValues = new HashSet(); //reset random values
statement.evaluate();
destroyServers();
}
}
}
@Override
public Statement apply(Statement statement, Description description) {
ShardsFixed fixed = description.getAnnotation(ShardsFixed.class);
ShardsRepeat repeat = description.getAnnotation(ShardsRepeat.class);
if (fixed != null && repeat != null) {
throw new RuntimeException("ShardsFixed and ShardsRepeat annotations can't coexist");
}
else if (fixed != null) {
return new ShardsFixedStatement(fixed.num(), statement);
}
else if (repeat != null) {
return new ShardsRepeatStatement(repeat.min(), repeat.max(), statement);
}
else {
return (isShardCountFixed ? new ShardsFixedStatement(shardCount, statement) :
new ShardsRepeatStatement(1, DEFAULT_MAX_SHARD_COUNT, statement));
}
}
}
@Rule
public ShardsRepeatRule repeatRule = new ShardsRepeatRule();
public static Object[] getRandFields(String[] fields, RandVal[] randVals) {
Object[] o = new Object[fields.length * 2];
for (int i = 0; i < fields.length; i++) {

View File

@ -33,8 +33,6 @@ import org.apache.solr.core.Diagnostics;
import org.apache.solr.core.MockDirectoryFactory;
import org.apache.solr.servlet.SolrDispatchFilter;
import org.apache.zookeeper.KeeperException;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
public abstract class AbstractDistribZkTestBase extends BaseDistributedSearchTestCase {
@ -54,11 +52,9 @@ public abstract class AbstractDistribZkTestBase extends BaseDistributedSearchTes
//useFactory(null);
}
@Before
@Override
public void setUp() throws Exception {
super.setUp();
public void distribSetUp() throws Exception {
super.distribSetUp();
String zkDir = testDir.getAbsolutePath() + File.separator
+ "zookeeper/server1/data";
@ -212,8 +208,7 @@ public abstract class AbstractDistribZkTestBase extends BaseDistributedSearchTes
}
@Override
@After
public void tearDown() throws Exception {
public void distribTearDown() throws Exception {
if (DEBUG) {
printLayout();
}
@ -228,7 +223,7 @@ public abstract class AbstractDistribZkTestBase extends BaseDistributedSearchTes
System.clearProperty(MockDirectoryFactory.SOLR_TESTS_ALLOW_READING_FILES_STILL_OPEN_FOR_WRITE);
resetExceptionIgnores();
super.tearDown();
super.distribTearDown();
zkServer.shutdown();
}

View File

@ -424,7 +424,7 @@ public class ZkTestServer {
public void run() throws InterruptedException {
log.info("STARTING ZK TEST SERVER");
// we don't call super.setUp
// we don't call super.distribSetUp
zooThread = new Thread() {
@Override