mirror of https://github.com/apache/lucene.git
formatting
This commit is contained in:
parent
5aa9a02421
commit
2835d2e323
|
@ -64,7 +64,7 @@ import static org.apache.solr.common.cloud.ZkConfigManager.CONFIGS_ZKNODE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for SolrCloud tests
|
* Base class for SolrCloud tests
|
||||||
*
|
* <p>
|
||||||
* Derived tests should call {@link #configureCluster(int)} in a {@code BeforeClass}
|
* Derived tests should call {@link #configureCluster(int)} in a {@code BeforeClass}
|
||||||
* static method or {@code Before} setUp method. This configures and starts a {@link MiniSolrCloudCluster}, available
|
* static method or {@code Before} setUp method. This configures and starts a {@link MiniSolrCloudCluster}, available
|
||||||
* via the {@code cluster} variable. Cluster shutdown is handled automatically if using {@code BeforeClass}.
|
* via the {@code cluster} variable. Cluster shutdown is handled automatically if using {@code BeforeClass}.
|
||||||
|
@ -113,8 +113,10 @@ public class SolrCloudTestCase extends SolrTestCaseJ4 {
|
||||||
private Map<String, Object> clusterProperties = new HashMap<>();
|
private Map<String, Object> clusterProperties = new HashMap<>();
|
||||||
|
|
||||||
private boolean trackJettyMetrics;
|
private boolean trackJettyMetrics;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a builder
|
* Create a builder
|
||||||
|
*
|
||||||
* @param nodeCount the number of nodes in the cluster
|
* @param nodeCount the number of nodes in the cluster
|
||||||
* @param baseDir a base directory for the cluster
|
* @param baseDir a base directory for the cluster
|
||||||
*/
|
*/
|
||||||
|
@ -179,6 +181,7 @@ public class SolrCloudTestCase extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upload a collection config before tests start
|
* Upload a collection config before tests start
|
||||||
|
*
|
||||||
* @param configName the config name
|
* @param configName the config name
|
||||||
* @param configPath the path to the config files
|
* @param configPath the path to the config files
|
||||||
*/
|
*/
|
||||||
|
@ -194,6 +197,7 @@ public class SolrCloudTestCase extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a cluster property
|
* Set a cluster property
|
||||||
|
*
|
||||||
* @param propertyName the property name
|
* @param propertyName the property name
|
||||||
* @param propertyValue the property value
|
* @param propertyValue the property value
|
||||||
*/
|
*/
|
||||||
|
@ -206,8 +210,10 @@ public class SolrCloudTestCase extends SolrTestCaseJ4 {
|
||||||
this.trackJettyMetrics = trackJettyMetrics;
|
this.trackJettyMetrics = trackJettyMetrics;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure and run the {@link MiniSolrCloudCluster}
|
* Configure and run the {@link MiniSolrCloudCluster}
|
||||||
|
*
|
||||||
* @throws Exception if an error occurs on startup
|
* @throws Exception if an error occurs on startup
|
||||||
*/
|
*/
|
||||||
public MiniSolrCloudCluster configure() throws Exception {
|
public MiniSolrCloudCluster configure() throws Exception {
|
||||||
|
@ -216,6 +222,7 @@ public class SolrCloudTestCase extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure, run and return the {@link MiniSolrCloudCluster}
|
* Configure, run and return the {@link MiniSolrCloudCluster}
|
||||||
|
*
|
||||||
* @throws Exception if an error occurs on startup
|
* @throws Exception if an error occurs on startup
|
||||||
*/
|
*/
|
||||||
public MiniSolrCloudCluster build() throws Exception {
|
public MiniSolrCloudCluster build() throws Exception {
|
||||||
|
@ -259,7 +266,9 @@ public class SolrCloudTestCase extends SolrTestCaseJ4 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The cluster */
|
/**
|
||||||
|
* The cluster
|
||||||
|
*/
|
||||||
protected static volatile MiniSolrCloudCluster cluster;
|
protected static volatile MiniSolrCloudCluster cluster;
|
||||||
|
|
||||||
protected static SolrZkClient zkClient() {
|
protected static SolrZkClient zkClient() {
|
||||||
|
@ -271,7 +280,7 @@ public class SolrCloudTestCase extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call this to configure a cluster of n nodes.
|
* Call this to configure a cluster of n nodes.
|
||||||
*
|
* <p>
|
||||||
* NB you must call {@link Builder#configure()} to start the cluster
|
* NB you must call {@link Builder#configure()} to start the cluster
|
||||||
*
|
*
|
||||||
* @param nodeCount the number of nodes
|
* @param nodeCount the number of nodes
|
||||||
|
@ -308,7 +317,7 @@ public class SolrCloudTestCase extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wait for a particular collection state to appear in the cluster client's state reader
|
* Wait for a particular collection state to appear in the cluster client's state reader
|
||||||
*
|
* <p>
|
||||||
* This is a convenience method using the {@link #DEFAULT_TIMEOUT}
|
* This is a convenience method using the {@link #DEFAULT_TIMEOUT}
|
||||||
*
|
*
|
||||||
* @param message a message to report on failure
|
* @param message a message to report on failure
|
||||||
|
@ -340,8 +349,7 @@ public class SolrCloudTestCase extends SolrTestCaseJ4 {
|
||||||
return false;
|
return false;
|
||||||
if (collectionState.getSlices().size() != expectedShards)
|
if (collectionState.getSlices().size() != expectedShards)
|
||||||
return false;
|
return false;
|
||||||
if (compareActiveReplicaCountsForShards(expectedReplicas, liveNodes, collectionState)) return true;
|
return compareActiveReplicaCountsForShards(expectedReplicas, liveNodes, collectionState);
|
||||||
return false;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,8 +364,7 @@ public class SolrCloudTestCase extends SolrTestCaseJ4 {
|
||||||
log.info("active slice count: " + collectionState.getActiveSlices().size() + " expected:" + expectedShards);
|
log.info("active slice count: " + collectionState.getActiveSlices().size() + " expected:" + expectedShards);
|
||||||
if (collectionState.getActiveSlices().size() != expectedShards)
|
if (collectionState.getActiveSlices().size() != expectedShards)
|
||||||
return false;
|
return false;
|
||||||
if (compareActiveReplicaCountsForShards(expectedReplicas, liveNodes, collectionState)) return true;
|
return compareActiveReplicaCountsForShards(expectedReplicas, liveNodes, collectionState);
|
||||||
return false;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,11 +405,8 @@ public class SolrCloudTestCase extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
log.info("active replica count: " + activeReplicas + " expected replica count: " + expectedReplicas);
|
log.info("active replica count: " + activeReplicas + " expected replica count: " + expectedReplicas);
|
||||||
|
|
||||||
if (activeReplicas == expectedReplicas) {
|
return activeReplicas == expectedReplicas;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -445,7 +449,7 @@ public class SolrCloudTestCase extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the {@link CoreStatus} data for a {@link Replica}
|
* Get the {@link CoreStatus} data for a {@link Replica}
|
||||||
*
|
* <p>
|
||||||
* This assumes that the replica is hosted on a live node.
|
* This assumes that the replica is hosted on a live node.
|
||||||
*/
|
*/
|
||||||
protected static CoreStatus getCoreStatus(Replica replica) throws IOException, SolrServerException {
|
protected static CoreStatus getCoreStatus(Replica replica) throws IOException, SolrServerException {
|
||||||
|
@ -476,6 +480,7 @@ public class SolrCloudTestCase extends SolrTestCaseJ4 {
|
||||||
/**
|
/**
|
||||||
* Ensure that the given number of solr instances are running. If less instances are found then new instances are
|
* Ensure that the given number of solr instances are running. If less instances are found then new instances are
|
||||||
* started. If extra instances are found then they are stopped.
|
* started. If extra instances are found then they are stopped.
|
||||||
|
*
|
||||||
* @param nodeCount the number of Solr instances that should be running at the end of this method
|
* @param nodeCount the number of Solr instances that should be running at the end of this method
|
||||||
* @throws Exception on error
|
* @throws Exception on error
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue