You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2017/04/03 18:45:36 UTC
[30/52] [abbrv] lucene-solr:jira/solr-9959: LUCENE-7753: Make fields
static when possible.
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e80643e5/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
index dccc2c6..b0721a2 100644
--- a/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java
@@ -81,8 +81,8 @@ public class OverseerTest extends SolrTestCaseJ4 {
private List<ZkStateReader> readers = new ArrayList<>();
private List<HttpShardHandlerFactory> httpShardHandlerFactorys = new ArrayList<>();
private List<UpdateShardHandler> updateShardHandlers = new ArrayList<>();
-
- final private String collection = SolrTestCaseJ4.DEFAULT_TEST_COLLECTION_NAME;
+
+ private static final String COLLECTION = SolrTestCaseJ4.DEFAULT_TEST_COLLECTION_NAME;
public static class MockZKController{
@@ -271,17 +271,17 @@ public class OverseerTest extends SolrTestCaseJ4 {
final int numShards=6;
for (int i = 0; i < numShards; i++) {
- assertNotNull("shard got no id?", zkController.publishState(collection, "core" + (i+1), "node" + (i+1), Replica.State.ACTIVE, 3));
+ assertNotNull("shard got no id?", zkController.publishState(COLLECTION, "core" + (i+1), "node" + (i+1), Replica.State.ACTIVE, 3));
}
- final Map<String,Replica> rmap = reader.getClusterState().getSlice(collection, "shard1").getReplicasMap();
+ final Map<String,Replica> rmap = reader.getClusterState().getSlice(COLLECTION, "shard1").getReplicasMap();
assertEquals(rmap.toString(), 2, rmap.size());
- assertEquals(rmap.toString(), 2, reader.getClusterState().getSlice(collection, "shard2").getReplicasMap().size());
- assertEquals(rmap.toString(), 2, reader.getClusterState().getSlice(collection, "shard3").getReplicasMap().size());
+ assertEquals(rmap.toString(), 2, reader.getClusterState().getSlice(COLLECTION, "shard2").getReplicasMap().size());
+ assertEquals(rmap.toString(), 2, reader.getClusterState().getSlice(COLLECTION, "shard3").getReplicasMap().size());
//make sure leaders are in cloud state
- assertNotNull(reader.getLeaderUrl(collection, "shard1", 15000));
- assertNotNull(reader.getLeaderUrl(collection, "shard2", 15000));
- assertNotNull(reader.getLeaderUrl(collection, "shard3", 15000));
+ assertNotNull(reader.getLeaderUrl(COLLECTION, "shard1", 15000));
+ assertNotNull(reader.getLeaderUrl(COLLECTION, "shard2", 15000));
+ assertNotNull(reader.getLeaderUrl(COLLECTION, "shard3", 15000));
} finally {
close(zkClient);
@@ -321,17 +321,17 @@ public class OverseerTest extends SolrTestCaseJ4 {
final int numShards=3;
for (int i = 0; i < numShards; i++) {
- assertNotNull("shard got no id?", zkController.publishState(collection, "core" + (i+1), "node" + (i+1), Replica.State.ACTIVE, 3));
+ assertNotNull("shard got no id?", zkController.publishState(COLLECTION, "core" + (i+1), "node" + (i+1), Replica.State.ACTIVE, 3));
}
- assertEquals(1, reader.getClusterState().getSlice(collection, "shard1").getReplicasMap().size());
- assertEquals(1, reader.getClusterState().getSlice(collection, "shard2").getReplicasMap().size());
- assertEquals(1, reader.getClusterState().getSlice(collection, "shard3").getReplicasMap().size());
+ assertEquals(1, reader.getClusterState().getSlice(COLLECTION, "shard1").getReplicasMap().size());
+ assertEquals(1, reader.getClusterState().getSlice(COLLECTION, "shard2").getReplicasMap().size());
+ assertEquals(1, reader.getClusterState().getSlice(COLLECTION, "shard3").getReplicasMap().size());
//make sure leaders are in cloud state
- assertNotNull(reader.getLeaderUrl(collection, "shard1", 15000));
- assertNotNull(reader.getLeaderUrl(collection, "shard2", 15000));
- assertNotNull(reader.getLeaderUrl(collection, "shard3", 15000));
+ assertNotNull(reader.getLeaderUrl(COLLECTION, "shard1", 15000));
+ assertNotNull(reader.getLeaderUrl(COLLECTION, "shard2", 15000));
+ assertNotNull(reader.getLeaderUrl(COLLECTION, "shard3", 15000));
// publish a bad queue item
String emptyCollectionName = "";
@@ -408,7 +408,7 @@ public class OverseerTest extends SolrTestCaseJ4 {
final String coreName = "core" + slot;
try {
- ids[slot] = controllers[slot % nodeCount].publishState(collection, coreName, "node" + slot, Replica.State.ACTIVE, sliceCount);
+ ids[slot] = controllers[slot % nodeCount].publishState(COLLECTION, coreName, "node" + slot, Replica.State.ACTIVE, sliceCount);
} catch (Throwable e) {
e.printStackTrace();
fail("register threw exception:" + e.getClass());
@@ -429,7 +429,7 @@ public class OverseerTest extends SolrTestCaseJ4 {
for (int i = 0; i < 40; i++) {
cloudStateSliceCount = 0;
ClusterState state = reader.getClusterState();
- final Map<String,Slice> slices = state.getSlicesMap(collection);
+ final Map<String,Slice> slices = state.getSlicesMap(COLLECTION);
if (slices != null) {
for (String name : slices.keySet()) {
cloudStateSliceCount += slices.get(name).getReplicasMap().size();
@@ -483,7 +483,7 @@ public class OverseerTest extends SolrTestCaseJ4 {
//make sure leaders are in cloud state
for (int i = 0; i < sliceCount; i++) {
- assertNotNull(reader.getLeaderUrl(collection, "shard" + (i + 1), 15000));
+ assertNotNull(reader.getLeaderUrl(COLLECTION, "shard" + (i + 1), 15000));
}
} finally {
@@ -549,23 +549,23 @@ public class OverseerTest extends SolrTestCaseJ4 {
ZkNodeProps m = new ZkNodeProps(Overseer.QUEUE_OPERATION, OverseerAction.STATE.toLower(),
ZkStateReader.BASE_URL_PROP, "http://127.0.0.1/solr",
ZkStateReader.NODE_NAME_PROP, "node1",
- ZkStateReader.COLLECTION_PROP, collection,
+ ZkStateReader.COLLECTION_PROP, COLLECTION,
ZkStateReader.CORE_NAME_PROP, "core1",
ZkStateReader.ROLES_PROP, "",
ZkStateReader.STATE_PROP, Replica.State.RECOVERING.toString());
q.offer(Utils.toJSON(m));
- waitForCollections(reader, collection);
+ waitForCollections(reader, COLLECTION);
assertSame(reader.getClusterState().toString(), Replica.State.RECOVERING,
- reader.getClusterState().getSlice(collection, "shard1").getReplica("core_node1").getState());
+ reader.getClusterState().getSlice(COLLECTION, "shard1").getReplica("core_node1").getState());
//publish node state (active)
m = new ZkNodeProps(Overseer.QUEUE_OPERATION, OverseerAction.STATE.toLower(),
ZkStateReader.BASE_URL_PROP, "http://127.0.0.1/solr",
ZkStateReader.NODE_NAME_PROP, "node1",
- ZkStateReader.COLLECTION_PROP, collection,
+ ZkStateReader.COLLECTION_PROP, COLLECTION,
ZkStateReader.CORE_NAME_PROP, "core1",
ZkStateReader.ROLES_PROP, "",
ZkStateReader.STATE_PROP, Replica.State.ACTIVE.toString());
@@ -634,25 +634,25 @@ public class OverseerTest extends SolrTestCaseJ4 {
overseerClient = electNewOverseer(server.getZkAddress());
Thread.sleep(1000);
- mockController.publishState(collection, core, core_node,
+ mockController.publishState(COLLECTION, core, core_node,
Replica.State.RECOVERING, numShards);
- waitForCollections(reader, collection);
- verifyReplicaStatus(reader, collection, "shard1", "core_node1", Replica.State.RECOVERING);
+ waitForCollections(reader, COLLECTION);
+ verifyReplicaStatus(reader, COLLECTION, "shard1", "core_node1", Replica.State.RECOVERING);
int version = getClusterStateVersion(zkClient);
- mockController.publishState(collection, core, core_node, Replica.State.ACTIVE,
+ mockController.publishState(COLLECTION, core, core_node, Replica.State.ACTIVE,
numShards);
while (version == getClusterStateVersion(zkClient));
- verifyReplicaStatus(reader, collection, "shard1", "core_node1", Replica.State.ACTIVE);
+ verifyReplicaStatus(reader, COLLECTION, "shard1", "core_node1", Replica.State.ACTIVE);
version = getClusterStateVersion(zkClient);
overseerClient.close();
Thread.sleep(1000); // wait for overseer to get killed
- mockController.publishState(collection, core, core_node,
+ mockController.publishState(COLLECTION, core, core_node,
Replica.State.RECOVERING, numShards);
version = getClusterStateVersion(zkClient);
@@ -660,20 +660,20 @@ public class OverseerTest extends SolrTestCaseJ4 {
while (version == getClusterStateVersion(zkClient));
- verifyReplicaStatus(reader, collection, "shard1", "core_node1", Replica.State.RECOVERING);
+ verifyReplicaStatus(reader, COLLECTION, "shard1", "core_node1", Replica.State.RECOVERING);
assertEquals("Live nodes count does not match", 1, reader
.getClusterState().getLiveNodes().size());
assertEquals(shard+" replica count does not match", 1, reader.getClusterState()
- .getSlice(collection, shard).getReplicasMap().size());
+ .getSlice(COLLECTION, shard).getReplicasMap().size());
version = getClusterStateVersion(zkClient);
- mockController.publishState(collection, core, core_node, null, numShards);
+ mockController.publishState(COLLECTION, core, core_node, null, numShards);
while (version == getClusterStateVersion(zkClient));
Thread.sleep(500);
- assertTrue(collection+" should remain after removal of the last core", // as of SOLR-5209 core removal does not cascade to remove the slice and collection
- reader.getClusterState().hasCollection(collection));
+ assertTrue(COLLECTION +" should remain after removal of the last core", // as of SOLR-5209 core removal does not cascade to remove the slice and collection
+ reader.getClusterState().hasCollection(COLLECTION));
assertTrue(core_node+" should be gone after publishing the null state",
- null == reader.getClusterState().getCollection(collection).getReplica(core_node));
+ null == reader.getClusterState().getCollection(COLLECTION).getReplica(core_node));
} finally {
close(mockController);
close(overseerClient);
@@ -723,7 +723,7 @@ public class OverseerTest extends SolrTestCaseJ4 {
overseerElector.setup(ec);
overseerElector.joinElection(ec, false);
- mockController.publishState(collection, "core1", "core_node1", Replica.State.ACTIVE, 1);
+ mockController.publishState(COLLECTION, "core1", "core_node1", Replica.State.ACTIVE, 1);
assertNotNull(overseer.getStats());
assertTrue((overseer.getStats().getSuccessCount(OverseerAction.STATE.toLower())) > 0);
@@ -819,19 +819,19 @@ public class OverseerTest extends SolrTestCaseJ4 {
for (int i = 0; i < atLeast(4); i++) {
killCounter.incrementAndGet(); //for each round allow 1 kill
mockController = new MockZKController(server.getZkAddress(), "node1");
- mockController.publishState(collection, "core1", "node1", Replica.State.ACTIVE,1);
+ mockController.publishState(COLLECTION, "core1", "node1", Replica.State.ACTIVE,1);
if(mockController2!=null) {
mockController2.close();
mockController2 = null;
}
- mockController.publishState(collection, "core1", "node1",Replica.State.RECOVERING,1);
+ mockController.publishState(COLLECTION, "core1", "node1",Replica.State.RECOVERING,1);
mockController2 = new MockZKController(server.getZkAddress(), "node2");
- mockController.publishState(collection, "core1", "node1", Replica.State.ACTIVE,1);
- verifyShardLeader(reader, collection, "shard1", "core1");
- mockController2.publishState(collection, "core4", "node2", Replica.State.ACTIVE ,1);
+ mockController.publishState(COLLECTION, "core1", "node1", Replica.State.ACTIVE,1);
+ verifyShardLeader(reader, COLLECTION, "shard1", "core1");
+ mockController2.publishState(COLLECTION, "core4", "node2", Replica.State.ACTIVE ,1);
mockController.close();
mockController = null;
- verifyShardLeader(reader, collection, "shard1", "core4");
+ verifyShardLeader(reader, COLLECTION, "shard1", "core4");
}
} finally {
if (killer != null) {
@@ -874,18 +874,18 @@ public class OverseerTest extends SolrTestCaseJ4 {
overseerClient = electNewOverseer(server.getZkAddress());
- mockController.publishState(collection, "core1", "core_node1", Replica.State.RECOVERING, 1);
+ mockController.publishState(COLLECTION, "core1", "core_node1", Replica.State.RECOVERING, 1);
waitForCollections(reader, "collection1");
- verifyReplicaStatus(reader, collection, "shard1", "core_node1", Replica.State.RECOVERING);
+ verifyReplicaStatus(reader, COLLECTION, "shard1", "core_node1", Replica.State.RECOVERING);
mockController.close();
int version = getClusterStateVersion(controllerClient);
mockController = new MockZKController(server.getZkAddress(), "node1");
- mockController.publishState(collection, "core1", "core_node1", Replica.State.RECOVERING, 1);
+ mockController.publishState(COLLECTION, "core1", "core_node1", Replica.State.RECOVERING, 1);
while (version == reader.getClusterState().getZkClusterStateVersion()) {
Thread.sleep(100);
@@ -940,11 +940,11 @@ public class OverseerTest extends SolrTestCaseJ4 {
overseerClient = electNewOverseer(server.getZkAddress());
- mockController.publishState(collection, "core1", "node1", Replica.State.RECOVERING, 12);
+ mockController.publishState(COLLECTION, "core1", "node1", Replica.State.RECOVERING, 12);
- waitForCollections(reader, collection);
+ waitForCollections(reader, COLLECTION);
- assertEquals("Slicecount does not match", 12, reader.getClusterState().getSlices(collection).size());
+ assertEquals("Slicecount does not match", 12, reader.getClusterState().getSlices(COLLECTION).size());
} finally {
close(overseerClient);
@@ -1117,7 +1117,7 @@ public class OverseerTest extends SolrTestCaseJ4 {
ZkStateReader.BASE_URL_PROP, "http://127.0.0.1/solr",
ZkStateReader.NODE_NAME_PROP, "node1",
ZkStateReader.SHARD_ID_PROP, "s1",
- ZkStateReader.COLLECTION_PROP, collection,
+ ZkStateReader.COLLECTION_PROP, COLLECTION,
ZkStateReader.CORE_NAME_PROP, "core1",
ZkStateReader.ROLES_PROP, "",
ZkStateReader.STATE_PROP, Replica.State.RECOVERING.toString());
@@ -1126,7 +1126,7 @@ public class OverseerTest extends SolrTestCaseJ4 {
ZkStateReader.BASE_URL_PROP, "http://127.0.0.1/solr",
ZkStateReader.NODE_NAME_PROP, "node1",
ZkStateReader.SHARD_ID_PROP, "s1",
- ZkStateReader.COLLECTION_PROP, collection,
+ ZkStateReader.COLLECTION_PROP, COLLECTION,
ZkStateReader.CORE_NAME_PROP, "core2",
ZkStateReader.ROLES_PROP, "",
ZkStateReader.STATE_PROP, Replica.State.RECOVERING.toString());
@@ -1140,19 +1140,19 @@ public class OverseerTest extends SolrTestCaseJ4 {
ZkStateReader.BASE_URL_PROP, "http://127.0.0.1/solr",
ZkStateReader.NODE_NAME_PROP, "node1",
ZkStateReader.SHARD_ID_PROP, "s1",
- ZkStateReader.COLLECTION_PROP, collection,
+ ZkStateReader.COLLECTION_PROP, COLLECTION,
ZkStateReader.CORE_NAME_PROP, "core3",
ZkStateReader.ROLES_PROP, "",
ZkStateReader.STATE_PROP, Replica.State.RECOVERING.toString());
queue.offer(Utils.toJSON(m));
for(int i=0;i<100;i++) {
- Slice s = reader.getClusterState().getSlice(collection, "s1");
+ Slice s = reader.getClusterState().getSlice(COLLECTION, "s1");
if(s!=null && s.getReplicasMap().size()==3) break;
Thread.sleep(100);
}
- assertNotNull(reader.getClusterState().getSlice(collection, "s1"));
- assertEquals(3, reader.getClusterState().getSlice(collection, "s1").getReplicasMap().size());
+ assertNotNull(reader.getClusterState().getSlice(COLLECTION, "s1"));
+ assertEquals(3, reader.getClusterState().getSlice(COLLECTION, "s1").getReplicasMap().size());
} finally {
close(overseerClient);
close(zkClient);
@@ -1340,14 +1340,14 @@ public class OverseerTest extends SolrTestCaseJ4 {
{
final Integer maxShardsPerNode = numReplicas * numShards;
ZkNodeProps m = new ZkNodeProps(Overseer.QUEUE_OPERATION, CollectionParams.CollectionAction.CREATE.toLower(),
- "name", collection,
+ "name", COLLECTION,
ZkStateReader.NUM_SHARDS_PROP, numShards.toString(),
ZkStateReader.REPLICATION_FACTOR, "1",
ZkStateReader.MAX_SHARDS_PER_NODE, maxShardsPerNode.toString()
);
q.offer(Utils.toJSON(m));
}
- waitForCollections(zkStateReader, collection);
+ waitForCollections(zkStateReader, COLLECTION);
// create nodes with state recovering
for (int rr = 1; rr <= numReplicas; ++rr) {
@@ -1357,7 +1357,7 @@ public class OverseerTest extends SolrTestCaseJ4 {
ZkStateReader.BASE_URL_PROP, "http://127.0.0.1/solr",
ZkStateReader.SHARD_ID_PROP, "shard"+ss,
ZkStateReader.NODE_NAME_PROP, "node"+N,
- ZkStateReader.COLLECTION_PROP, collection,
+ ZkStateReader.COLLECTION_PROP, COLLECTION,
ZkStateReader.CORE_NAME_PROP, "core"+N,
ZkStateReader.ROLES_PROP, "",
ZkStateReader.STATE_PROP, Replica.State.RECOVERING.toString());
@@ -1369,7 +1369,7 @@ public class OverseerTest extends SolrTestCaseJ4 {
for (int rr = 1; rr <= numReplicas; ++rr) {
for (int ss = 1; ss <= numShards; ++ss) {
final int N = (numReplicas-rr)*numShards + ss;
- verifyReplicaStatus(zkStateReader, collection, "shard"+ss, "core_node"+N, Replica.State.RECOVERING);
+ verifyReplicaStatus(zkStateReader, COLLECTION, "shard"+ss, "core_node"+N, Replica.State.RECOVERING);
}
}
@@ -1380,7 +1380,7 @@ public class OverseerTest extends SolrTestCaseJ4 {
ZkNodeProps m = new ZkNodeProps(Overseer.QUEUE_OPERATION, OverseerAction.STATE.toLower(),
ZkStateReader.BASE_URL_PROP, "http://127.0.0.1/solr",
ZkStateReader.NODE_NAME_PROP, "node"+N,
- ZkStateReader.COLLECTION_PROP, collection,
+ ZkStateReader.COLLECTION_PROP, COLLECTION,
ZkStateReader.CORE_NAME_PROP, "core"+N,
ZkStateReader.ROLES_PROP, "",
ZkStateReader.STATE_PROP, Replica.State.ACTIVE.toString());
@@ -1392,7 +1392,7 @@ public class OverseerTest extends SolrTestCaseJ4 {
for (int rr = 1; rr <= numReplicas; ++rr) {
for (int ss = 1; ss <= numShards; ++ss) {
final int N = (numReplicas-rr)*numShards + ss;
- verifyReplicaStatus(zkStateReader, collection, "shard"+ss, "core_node"+N, Replica.State.ACTIVE);
+ verifyReplicaStatus(zkStateReader, COLLECTION, "shard"+ss, "core_node"+N, Replica.State.ACTIVE);
}
}
@@ -1401,7 +1401,7 @@ public class OverseerTest extends SolrTestCaseJ4 {
for (int ss = 1; ss <= numShards; ++ss) {
final int N = (numReplicas-rr)*numShards + ss;
ZkNodeProps m = new ZkNodeProps(Overseer.QUEUE_OPERATION, OverseerAction.DELETECORE.toLower(),
- ZkStateReader.COLLECTION_PROP, collection,
+ ZkStateReader.COLLECTION_PROP, COLLECTION,
ZkStateReader.CORE_NODE_NAME_PROP, "core_node"+N);
q.offer(Utils.toJSON(m));
@@ -1409,23 +1409,23 @@ public class OverseerTest extends SolrTestCaseJ4 {
{
int iterationsLeft = 100;
while (iterationsLeft-- > 0) {
- final Slice slice = zkStateReader.getClusterState().getSlice(collection, "shard"+ss);
+ final Slice slice = zkStateReader.getClusterState().getSlice(COLLECTION, "shard"+ss);
if (null == slice || null == slice.getReplicasMap().get("core_node"+N)) {
break;
}
- if (VERBOSE) log.info("still seeing {} shard{} core_node{}, rechecking in 50ms ({} iterations left)", collection, ss, N, iterationsLeft);
+ if (VERBOSE) log.info("still seeing {} shard{} core_node{}, rechecking in 50ms ({} iterations left)", COLLECTION, ss, N, iterationsLeft);
Thread.sleep(50);
}
}
- final DocCollection docCollection = zkStateReader.getClusterState().getCollection(collection);
- assertTrue("found no "+collection, (null != docCollection));
+ final DocCollection docCollection = zkStateReader.getClusterState().getCollection(COLLECTION);
+ assertTrue("found no "+ COLLECTION, (null != docCollection));
final Slice slice = docCollection.getSlice("shard"+ss);
- assertTrue("found no "+collection+" shard"+ss+" slice after removal of replica "+rr+" of "+numReplicas, (null != slice));
+ assertTrue("found no "+ COLLECTION +" shard"+ss+" slice after removal of replica "+rr+" of "+numReplicas, (null != slice));
final Collection<Replica> replicas = slice.getReplicas();
- assertEquals("wrong number of "+collection+" shard"+ss+" replicas left, replicas="+replicas, numReplicas-rr, replicas.size());
+ assertEquals("wrong number of "+ COLLECTION +" shard"+ss+" replicas left, replicas="+replicas, numReplicas-rr, replicas.size());
}
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e80643e5/solr/core/src/test/org/apache/solr/cloud/SegmentTerminateEarlyTestState.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/SegmentTerminateEarlyTestState.java b/solr/core/src/test/org/apache/solr/cloud/SegmentTerminateEarlyTestState.java
index 3fe12ed..9824e3d 100644
--- a/solr/core/src/test/org/apache/solr/cloud/SegmentTerminateEarlyTestState.java
+++ b/solr/core/src/test/org/apache/solr/cloud/SegmentTerminateEarlyTestState.java
@@ -34,14 +34,14 @@ import org.apache.solr.response.SolrQueryResponse;
class SegmentTerminateEarlyTestState {
- final String keyField = "id";
+ static final String KEY_FIELD = "id";
// for historic reasons, this is refered to as a "timestamp" field, but in actuallity is just an int
// value representing a number of "minutes" between 0-60.
// aka: I decided not to rename a million things while refactoring this test
- public static final String timestampField = "timestamp_i_dvo";
- public static final String oddField = "odd_l1"; // <dynamicField name="*_l1" type="long" indexed="true" stored="true" multiValued="false"/>
- public static final String quadField = "quad_l1"; // <dynamicField name="*_l1" type="long" indexed="true" stored="true" multiValued="false"/>
+ public static final String TIMESTAMP_FIELD = "timestamp_i_dvo";
+ public static final String ODD_FIELD = "odd_l1"; // <dynamicField name="*_l1" type="long" indexed="true" stored="true" multiValued="false"/>
+ public static final String QUAD_FIELD = "quad_l1"; // <dynamicField name="*_l1" type="long" indexed="true" stored="true" multiValued="false"/>
final Set<Integer> minTimestampDocKeys = new HashSet<>();
final Set<Integer> maxTimestampDocKeys = new HashSet<>();
@@ -63,7 +63,7 @@ class SegmentTerminateEarlyTestState {
++numDocs;
final Integer docKey = new Integer(numDocs);
SolrInputDocument doc = new SolrInputDocument();
- doc.setField(keyField, ""+docKey);
+ doc.setField(KEY_FIELD, ""+docKey);
final int MM = rand.nextInt(60); // minutes
if (minTimestampMM == null || MM <= minTimestampMM.intValue()) {
if (minTimestampMM != null && MM < minTimestampMM.intValue()) {
@@ -79,9 +79,9 @@ class SegmentTerminateEarlyTestState {
maxTimestampMM = new Integer(MM);
maxTimestampDocKeys.add(docKey);
}
- doc.setField(timestampField, (Integer)MM);
- doc.setField(oddField, ""+(numDocs % 2));
- doc.setField(quadField, ""+(numDocs % 4)+1);
+ doc.setField(TIMESTAMP_FIELD, (Integer)MM);
+ doc.setField(ODD_FIELD, ""+(numDocs % 2));
+ doc.setField(QUAD_FIELD, ""+(numDocs % 4)+1);
cloudSolrClient.add(doc);
}
cloudSolrClient.commit();
@@ -95,9 +95,9 @@ class SegmentTerminateEarlyTestState {
TestMiniSolrCloudCluster.assertFalse(maxTimestampDocKeys.isEmpty());
TestMiniSolrCloudCluster.assertTrue("numDocs="+numDocs+" is not even", (numDocs%2)==0);
final Long oddFieldValue = new Long(maxTimestampDocKeys.iterator().next().intValue()%2);
- final SolrQuery query = new SolrQuery(oddField+":"+oddFieldValue);
- query.setSort(timestampField, SolrQuery.ORDER.desc);
- query.setFields(keyField, oddField, timestampField);
+ final SolrQuery query = new SolrQuery(ODD_FIELD +":"+oddFieldValue);
+ query.setSort(TIMESTAMP_FIELD, SolrQuery.ORDER.desc);
+ query.setFields(KEY_FIELD, ODD_FIELD, TIMESTAMP_FIELD);
query.setRows(1);
// CommonParams.SEGMENT_TERMINATE_EARLY parameter intentionally absent
final QueryResponse rsp = cloudSolrClient.query(query);
@@ -106,9 +106,9 @@ class SegmentTerminateEarlyTestState {
// check correctness of the first result
if (rsp.getResults().getNumFound() > 0) {
final SolrDocument solrDocument0 = rsp.getResults().get(0);
- TestMiniSolrCloudCluster.assertTrue(keyField+" of ("+solrDocument0+") is not in maxTimestampDocKeys("+maxTimestampDocKeys+")",
- maxTimestampDocKeys.contains(solrDocument0.getFieldValue(keyField)));
- TestMiniSolrCloudCluster.assertEquals(oddField, oddFieldValue, solrDocument0.getFieldValue(oddField));
+ TestMiniSolrCloudCluster.assertTrue(KEY_FIELD +" of ("+solrDocument0+") is not in maxTimestampDocKeys("+maxTimestampDocKeys+")",
+ maxTimestampDocKeys.contains(solrDocument0.getFieldValue(KEY_FIELD)));
+ TestMiniSolrCloudCluster.assertEquals(ODD_FIELD, oddFieldValue, solrDocument0.getFieldValue(ODD_FIELD));
}
// check segmentTerminatedEarly flag
TestMiniSolrCloudCluster.assertNull("responseHeader.segmentTerminatedEarly present in "+rsp.getResponseHeader(),
@@ -119,9 +119,9 @@ class SegmentTerminateEarlyTestState {
TestMiniSolrCloudCluster.assertFalse(maxTimestampDocKeys.isEmpty());
TestMiniSolrCloudCluster.assertTrue("numDocs="+numDocs+" is not even", (numDocs%2)==0);
final Long oddFieldValue = new Long(maxTimestampDocKeys.iterator().next().intValue()%2);
- final SolrQuery query = new SolrQuery(oddField+":"+oddFieldValue);
- query.setSort(timestampField, SolrQuery.ORDER.desc);
- query.setFields(keyField, oddField, timestampField);
+ final SolrQuery query = new SolrQuery(ODD_FIELD +":"+oddFieldValue);
+ query.setSort(TIMESTAMP_FIELD, SolrQuery.ORDER.desc);
+ query.setFields(KEY_FIELD, ODD_FIELD, TIMESTAMP_FIELD);
final int rowsWanted = 1;
query.setRows(rowsWanted);
final Boolean shardsInfoWanted = (rand.nextBoolean() ? null : new Boolean(rand.nextBoolean()));
@@ -136,9 +136,9 @@ class SegmentTerminateEarlyTestState {
// check correctness of the first result
if (rsp.getResults().getNumFound() > 0) {
final SolrDocument solrDocument0 = rsp.getResults().get(0);
- TestMiniSolrCloudCluster.assertTrue(keyField+" of ("+solrDocument0+") is not in maxTimestampDocKeys("+maxTimestampDocKeys+")",
- maxTimestampDocKeys.contains(solrDocument0.getFieldValue(keyField)));
- TestMiniSolrCloudCluster.assertEquals(oddField, oddFieldValue, rsp.getResults().get(0).getFieldValue(oddField));
+ TestMiniSolrCloudCluster.assertTrue(KEY_FIELD +" of ("+solrDocument0+") is not in maxTimestampDocKeys("+maxTimestampDocKeys+")",
+ maxTimestampDocKeys.contains(solrDocument0.getFieldValue(KEY_FIELD)));
+ TestMiniSolrCloudCluster.assertEquals(ODD_FIELD, oddFieldValue, rsp.getResults().get(0).getFieldValue(ODD_FIELD));
}
// check segmentTerminatedEarly flag
TestMiniSolrCloudCluster.assertNotNull("responseHeader.segmentTerminatedEarly missing in "+rsp.getResponseHeader(),
@@ -167,9 +167,9 @@ class SegmentTerminateEarlyTestState {
TestMiniSolrCloudCluster.assertFalse(maxTimestampDocKeys.isEmpty());
TestMiniSolrCloudCluster.assertTrue("numDocs="+numDocs+" is not even", (numDocs%2)==0);
final Long oddFieldValue = new Long(maxTimestampDocKeys.iterator().next().intValue()%2);
- final SolrQuery query = new SolrQuery(oddField+":"+oddFieldValue);
- query.setSort(timestampField, SolrQuery.ORDER.desc);
- query.setFields(keyField, oddField, timestampField);
+ final SolrQuery query = new SolrQuery(ODD_FIELD +":"+oddFieldValue);
+ query.setSort(TIMESTAMP_FIELD, SolrQuery.ORDER.desc);
+ query.setFields(KEY_FIELD, ODD_FIELD, TIMESTAMP_FIELD);
query.setRows(1);
final Boolean shardsInfoWanted = (rand.nextBoolean() ? null : new Boolean(rand.nextBoolean()));
if (shardsInfoWanted != null) {
@@ -182,9 +182,9 @@ class SegmentTerminateEarlyTestState {
// check correctness of the first result
if (rsp.getResults().getNumFound() > 0) {
final SolrDocument solrDocument0 = rsp.getResults().get(0);
- TestMiniSolrCloudCluster.assertTrue(keyField+" of ("+solrDocument0+") is not in maxTimestampDocKeys("+maxTimestampDocKeys+")",
- maxTimestampDocKeys.contains(solrDocument0.getFieldValue(keyField)));
- TestMiniSolrCloudCluster.assertEquals(oddField, oddFieldValue, rsp.getResults().get(0).getFieldValue(oddField));
+ TestMiniSolrCloudCluster.assertTrue(KEY_FIELD +" of ("+solrDocument0+") is not in maxTimestampDocKeys("+maxTimestampDocKeys+")",
+ maxTimestampDocKeys.contains(solrDocument0.getFieldValue(KEY_FIELD)));
+ TestMiniSolrCloudCluster.assertEquals(ODD_FIELD, oddFieldValue, rsp.getResults().get(0).getFieldValue(ODD_FIELD));
}
// check segmentTerminatedEarly flag
TestMiniSolrCloudCluster.assertNull("responseHeader.segmentTerminatedEarly present in "+rsp.getResponseHeader(),
@@ -212,13 +212,13 @@ class SegmentTerminateEarlyTestState {
TestMiniSolrCloudCluster.assertFalse(maxTimestampDocKeys.isEmpty());
TestMiniSolrCloudCluster.assertTrue("numDocs="+numDocs+" is not even", (numDocs%2)==0);
final Long oddFieldValue = new Long(maxTimestampDocKeys.iterator().next().intValue()%2);
- final SolrQuery query = new SolrQuery(oddField+":"+oddFieldValue);
- query.setSort(timestampField, SolrQuery.ORDER.desc);
- query.setFields(keyField, oddField, timestampField);
+ final SolrQuery query = new SolrQuery(ODD_FIELD +":"+oddFieldValue);
+ query.setSort(TIMESTAMP_FIELD, SolrQuery.ORDER.desc);
+ query.setFields(KEY_FIELD, ODD_FIELD, TIMESTAMP_FIELD);
query.setRows(1);
query.set(CommonParams.SEGMENT_TERMINATE_EARLY, true);
TestMiniSolrCloudCluster.assertTrue("numDocs="+numDocs+" is not quad-able", (numDocs%4)==0);
- query.add("group.field", quadField);
+ query.add("group.field", QUAD_FIELD);
query.set("group", true);
final QueryResponse rsp = cloudSolrClient.query(query);
// check correctness of the results count
@@ -226,9 +226,9 @@ class SegmentTerminateEarlyTestState {
// check correctness of the first result
if (rsp.getGroupResponse().getValues().get(0).getMatches() > 0) {
final SolrDocument solrDocument = rsp.getGroupResponse().getValues().get(0).getValues().get(0).getResult().get(0);
- TestMiniSolrCloudCluster.assertTrue(keyField+" of ("+solrDocument+") is not in maxTimestampDocKeys("+maxTimestampDocKeys+")",
- maxTimestampDocKeys.contains(solrDocument.getFieldValue(keyField)));
- TestMiniSolrCloudCluster.assertEquals(oddField, oddFieldValue, solrDocument.getFieldValue(oddField));
+ TestMiniSolrCloudCluster.assertTrue(KEY_FIELD +" of ("+solrDocument+") is not in maxTimestampDocKeys("+maxTimestampDocKeys+")",
+ maxTimestampDocKeys.contains(solrDocument.getFieldValue(KEY_FIELD)));
+ TestMiniSolrCloudCluster.assertEquals(ODD_FIELD, oddFieldValue, solrDocument.getFieldValue(ODD_FIELD));
}
// check segmentTerminatedEarly flag
// at present segmentTerminateEarly cannot be used with grouped queries
@@ -240,9 +240,9 @@ class SegmentTerminateEarlyTestState {
TestMiniSolrCloudCluster.assertFalse(minTimestampDocKeys.isEmpty());
TestMiniSolrCloudCluster.assertTrue("numDocs="+numDocs+" is not even", (numDocs%2)==0);
final Long oddFieldValue = new Long(minTimestampDocKeys.iterator().next().intValue()%2);
- final SolrQuery query = new SolrQuery(oddField+":"+oddFieldValue);
- query.setSort(timestampField, SolrQuery.ORDER.asc); // a sort order that is _not_ compatible with the merge sort order
- query.setFields(keyField, oddField, timestampField);
+ final SolrQuery query = new SolrQuery(ODD_FIELD +":"+oddFieldValue);
+ query.setSort(TIMESTAMP_FIELD, SolrQuery.ORDER.asc); // a sort order that is _not_ compatible with the merge sort order
+ query.setFields(KEY_FIELD, ODD_FIELD, TIMESTAMP_FIELD);
query.setRows(1);
query.set(CommonParams.SEGMENT_TERMINATE_EARLY, true);
final QueryResponse rsp = cloudSolrClient.query(query);
@@ -251,9 +251,9 @@ class SegmentTerminateEarlyTestState {
// check correctness of the first result
if (rsp.getResults().getNumFound() > 0) {
final SolrDocument solrDocument0 = rsp.getResults().get(0);
- TestMiniSolrCloudCluster.assertTrue(keyField+" of ("+solrDocument0+") is not in minTimestampDocKeys("+minTimestampDocKeys+")",
- minTimestampDocKeys.contains(solrDocument0.getFieldValue(keyField)));
- TestMiniSolrCloudCluster.assertEquals(oddField, oddFieldValue, solrDocument0.getFieldValue(oddField));
+ TestMiniSolrCloudCluster.assertTrue(KEY_FIELD +" of ("+solrDocument0+") is not in minTimestampDocKeys("+minTimestampDocKeys+")",
+ minTimestampDocKeys.contains(solrDocument0.getFieldValue(KEY_FIELD)));
+ TestMiniSolrCloudCluster.assertEquals(ODD_FIELD, oddFieldValue, solrDocument0.getFieldValue(ODD_FIELD));
}
// check segmentTerminatedEarly flag
TestMiniSolrCloudCluster.assertNotNull("responseHeader.segmentTerminatedEarly missing in "+rsp.getResponseHeader(),
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e80643e5/solr/core/src/test/org/apache/solr/cloud/SolrXmlInZkTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/SolrXmlInZkTest.java b/solr/core/src/test/org/apache/solr/cloud/SolrXmlInZkTest.java
index 2642814..5e9e180 100644
--- a/solr/core/src/test/org/apache/solr/cloud/SolrXmlInZkTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/SolrXmlInZkTest.java
@@ -163,7 +163,7 @@ public class SolrXmlInZkTest extends SolrTestCaseJ4 {
// Just a random port, I'm not going to use it but just check that the Solr instance constructed from the XML
// file in ZK overrides the default port.
- private final String XML_FOR_ZK =
+ private static final String XML_FOR_ZK =
"<solr>" +
" <solrcloud>" +
" <str name=\"host\">127.0.0.1</str>" +
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e80643e5/solr/core/src/test/org/apache/solr/cloud/TestSegmentSorting.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestSegmentSorting.java b/solr/core/src/test/org/apache/solr/cloud/TestSegmentSorting.java
index 5e6283a..fa2449d 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestSegmentSorting.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestSegmentSorting.java
@@ -123,7 +123,7 @@ public class TestSegmentSorting extends SolrCloudTestCase {
public void testAtomicUpdateOfSegmentSortField() throws Exception {
final CloudSolrClient cloudSolrClient = cluster.getSolrClient();
- final String updateField = SegmentTerminateEarlyTestState.timestampField;
+ final String updateField = SegmentTerminateEarlyTestState.TIMESTAMP_FIELD;
// sanity check that updateField is in fact a DocValues only field, meaning it
// would normally be eligable for inplace updates -- if it weren't also used for merge sorting
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e80643e5/solr/core/src/test/org/apache/solr/core/OpenCloseCoreStressTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/core/OpenCloseCoreStressTest.java b/solr/core/src/test/org/apache/solr/core/OpenCloseCoreStressTest.java
index 1ebb232..b4ec29f 100644
--- a/solr/core/src/test/org/apache/solr/core/OpenCloseCoreStressTest.java
+++ b/solr/core/src/test/org/apache/solr/core/OpenCloseCoreStressTest.java
@@ -66,7 +66,7 @@ public class OpenCloseCoreStressTest extends SolrTestCaseJ4 {
final int indexingThreads = TEST_NIGHTLY ? 9 : 5;
final int queryThreads = TEST_NIGHTLY ? 9 : 5;
- final int resetInterval = 30 * 60; // minutes to report then delete everything
+ static final int RESET_INTERVAL = 30 * 60; // minutes to report then delete everything
long cumulativeDocs = 0;
String url;
@@ -165,7 +165,7 @@ public class OpenCloseCoreStressTest extends SolrTestCaseJ4 {
int secondsRemaining = secondsToRun;
do {
- int cycleSeconds = Math.min(resetInterval, secondsRemaining);
+ int cycleSeconds = Math.min(RESET_INTERVAL, secondsRemaining);
log.info(String.format(Locale.ROOT, "\n\n\n\n\nStarting a %,d second cycle, seconds left: %,d. Seconds run so far: %,d.",
cycleSeconds, secondsRemaining, secondsRun));
@@ -177,7 +177,7 @@ public class OpenCloseCoreStressTest extends SolrTestCaseJ4 {
queries.waitOnThreads();
- secondsRemaining = Math.max(secondsRemaining - resetInterval, 0);
+ secondsRemaining = Math.max(secondsRemaining - RESET_INTERVAL, 0);
checkResults(queryingClients.get(0), queries, idxer);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e80643e5/solr/core/src/test/org/apache/solr/schema/SpatialRPTFieldTypeTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/schema/SpatialRPTFieldTypeTest.java b/solr/core/src/test/org/apache/solr/schema/SpatialRPTFieldTypeTest.java
index a2afa2d..0ff9e3a 100644
--- a/solr/core/src/test/org/apache/solr/schema/SpatialRPTFieldTypeTest.java
+++ b/solr/core/src/test/org/apache/solr/schema/SpatialRPTFieldTypeTest.java
@@ -62,12 +62,12 @@ public class SpatialRPTFieldTypeTest extends AbstractBadConfigTestBase {
System.clearProperty("managed.schema.mutable");
System.clearProperty("enable.update.log");
}
-
- final String INDEXED_COORDINATES = "25,82";
- final String QUERY_COORDINATES = "24,81";
- final String DISTANCE_DEGREES = "1.3520328";
- final String DISTANCE_KILOMETERS = "150.33939";
- final String DISTANCE_MILES = "93.416565";
+
+ static final String INDEXED_COORDINATES = "25,82";
+ static final String QUERY_COORDINATES = "24,81";
+ static final String DISTANCE_DEGREES = "1.3520328";
+ static final String DISTANCE_KILOMETERS = "150.33939";
+ static final String DISTANCE_MILES = "93.416565";
public void testDistanceUnitsDegrees() throws Exception {
setupRPTField("degrees", "true");
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e80643e5/solr/core/src/test/org/apache/solr/search/TestRTGBase.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestRTGBase.java b/solr/core/src/test/org/apache/solr/search/TestRTGBase.java
index bb1b08a..b2964d8 100644
--- a/solr/core/src/test/org/apache/solr/search/TestRTGBase.java
+++ b/solr/core/src/test/org/apache/solr/search/TestRTGBase.java
@@ -47,7 +47,7 @@ public class TestRTGBase extends SolrTestCaseJ4 {
protected long snapshotCount;
protected long committedModelClock;
protected volatile int lastId;
- protected final String field = "val_l";
+ protected static final String FIELD = "val_l";
protected Object[] syncArr;
protected Object globalLock = this;
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e80643e5/solr/core/src/test/org/apache/solr/search/TestRealTimeGet.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestRealTimeGet.java b/solr/core/src/test/org/apache/solr/search/TestRealTimeGet.java
index 28ecaa3..4ee4cb7 100644
--- a/solr/core/src/test/org/apache/solr/search/TestRealTimeGet.java
+++ b/solr/core/src/test/org/apache/solr/search/TestRealTimeGet.java
@@ -667,7 +667,7 @@ public class TestRealTimeGet extends TestRTGBase {
}
Long version = null;
- SolrInputDocument sd = sdoc("id", Integer.toString(id), field, Long.toString(nextVal));
+ SolrInputDocument sd = sdoc("id", Integer.toString(id), FIELD, Long.toString(nextVal));
if (opt) {
if (correct) {
@@ -762,7 +762,7 @@ public class TestRealTimeGet extends TestRTGBase {
// This is also correct when filteredOut==true
} else {
assertEquals(1, doclist.size());
- long foundVal = (Long)(((Map)doclist.get(0)).get(field));
+ long foundVal = (Long)(((Map)doclist.get(0)).get(FIELD));
long foundVer = (Long)(((Map)doclist.get(0)).get("_version_"));
if (filteredOut || foundVal < Math.abs(info.val)
|| (foundVer == info.version && foundVal != info.val) ) { // if the version matches, the val must
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e80643e5/solr/core/src/test/org/apache/solr/search/TestReloadDeadlock.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestReloadDeadlock.java b/solr/core/src/test/org/apache/solr/search/TestReloadDeadlock.java
index 383070c..32c91db 100644
--- a/solr/core/src/test/org/apache/solr/search/TestReloadDeadlock.java
+++ b/solr/core/src/test/org/apache/solr/search/TestReloadDeadlock.java
@@ -197,7 +197,7 @@ public class TestReloadDeadlock extends TestRTGBase {
private void addDoc(int id, long nextVal, long version) throws Exception {
ifVerbose("adding id", id, "val=", nextVal, "version", version);
- Long returnedVersion = addAndGetVersion(sdoc("id", Integer.toString(id), field, Long.toString(nextVal),
+ Long returnedVersion = addAndGetVersion(sdoc("id", Integer.toString(id), FIELD, Long.toString(nextVal),
"_version_", Long.toString(version)), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
if (returnedVersion != null) {
assertEquals(version, returnedVersion.longValue());
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e80643e5/solr/core/src/test/org/apache/solr/search/TestStressLucene.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestStressLucene.java b/solr/core/src/test/org/apache/solr/search/TestStressLucene.java
index 779be43..af2ef1d 100644
--- a/solr/core/src/test/org/apache/solr/search/TestStressLucene.java
+++ b/solr/core/src/test/org/apache/solr/search/TestStressLucene.java
@@ -226,7 +226,7 @@ public class TestStressLucene extends TestRTGBase {
if (tombstones) {
Document d = new Document();
d.add(new Field("id","-"+Integer.toString(id), idFt));
- d.add(new Field(field, Long.toString(nextVal), ft2));
+ d.add(new Field(FIELD, Long.toString(nextVal), ft2));
verbose("adding tombstone for id",id,"val=",nextVal);
writer.updateDocument(new Term("id", "-"+Integer.toString(id)), d);
}
@@ -243,7 +243,7 @@ public class TestStressLucene extends TestRTGBase {
if (tombstones) {
Document d = new Document();
d.add(new Field("id","-"+Integer.toString(id), idFt));
- d.add(new Field(field, Long.toString(nextVal), ft2));
+ d.add(new Field(FIELD, Long.toString(nextVal), ft2));
verbose("adding tombstone for id",id,"val=",nextVal);
writer.updateDocument(new Term("id", "-"+Integer.toString(id)), d);
}
@@ -258,7 +258,7 @@ public class TestStressLucene extends TestRTGBase {
// assertU(adoc("id",Integer.toString(id), field, Long.toString(nextVal)));
Document d = new Document();
d.add(new Field("id",Integer.toString(id), idFt));
- d.add(new Field(field, Long.toString(nextVal), ft2));
+ d.add(new Field(FIELD, Long.toString(nextVal), ft2));
verbose("adding id",id,"val=",nextVal);
writer.updateDocument(new Term("id", Integer.toString(id)), d);
if (tombstones) {
@@ -337,7 +337,7 @@ public class TestStressLucene extends TestRTGBase {
}
assertTrue(docid >= 0); // we should have found the document, or its tombstone
Document doc = r.document(docid);
- long foundVal = Long.parseLong(doc.get(field));
+ long foundVal = Long.parseLong(doc.get(FIELD));
if (foundVal < Math.abs(val)) {
verbose("ERROR: id",id,"model_val=",val," foundVal=",foundVal,"reader=",reader);
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e80643e5/solr/core/src/test/org/apache/solr/search/TestStressRecovery.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestStressRecovery.java b/solr/core/src/test/org/apache/solr/search/TestStressRecovery.java
index b6ecc2e..933700d 100644
--- a/solr/core/src/test/org/apache/solr/search/TestStressRecovery.java
+++ b/solr/core/src/test/org/apache/solr/search/TestStressRecovery.java
@@ -228,7 +228,7 @@ public class TestStressRecovery extends TestRTGBase {
} else {
verbose("adding id", id, "val=", nextVal,"version",version);
- Long returnedVersion = addAndGetVersion(sdoc("id", Integer.toString(id), field, Long.toString(nextVal), "_version_",Long.toString(version)), params(DISTRIB_UPDATE_PARAM,FROM_LEADER));
+ Long returnedVersion = addAndGetVersion(sdoc("id", Integer.toString(id), FIELD, Long.toString(nextVal), "_version_",Long.toString(version)), params(DISTRIB_UPDATE_PARAM,FROM_LEADER));
if (returnedVersion != null) {
assertEquals(version, returnedVersion.longValue());
}
@@ -310,7 +310,7 @@ public class TestStressRecovery extends TestRTGBase {
// there's no info we can get back with a delete, so not much we can check without further synchronization
} else {
assertEquals(1, doclist.size());
- long foundVal = (Long)(((Map)doclist.get(0)).get(field));
+ long foundVal = (Long)(((Map)doclist.get(0)).get(FIELD));
long foundVer = (Long)(((Map)doclist.get(0)).get("_version_"));
if (foundVer < Math.abs(info.version)
|| (foundVer == info.version && foundVal != info.val) ) { // if the version matches, the val must
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e80643e5/solr/core/src/test/org/apache/solr/search/TestStressReorder.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestStressReorder.java b/solr/core/src/test/org/apache/solr/search/TestStressReorder.java
index bce1d75..e53fed0 100644
--- a/solr/core/src/test/org/apache/solr/search/TestStressReorder.java
+++ b/solr/core/src/test/org/apache/solr/search/TestStressReorder.java
@@ -223,7 +223,7 @@ public class TestStressReorder extends TestRTGBase {
} else {
verbose("adding id", id, "val=", nextVal,"version",version);
- Long returnedVersion = addAndGetVersion(sdoc("id", Integer.toString(id), field, Long.toString(nextVal), "_version_",Long.toString(version)), params(DISTRIB_UPDATE_PARAM,FROM_LEADER));
+ Long returnedVersion = addAndGetVersion(sdoc("id", Integer.toString(id), FIELD, Long.toString(nextVal), "_version_",Long.toString(version)), params(DISTRIB_UPDATE_PARAM,FROM_LEADER));
if (returnedVersion != null) {
assertEquals(version, returnedVersion.longValue());
}
@@ -301,7 +301,7 @@ public class TestStressReorder extends TestRTGBase {
// there's no info we can get back with a delete, so not much we can check without further synchronization
} else {
assertEquals(1, doclist.size());
- long foundVal = (Long)(((Map)doclist.get(0)).get(field));
+ long foundVal = (Long)(((Map)doclist.get(0)).get(FIELD));
long foundVer = (Long)(((Map)doclist.get(0)).get("_version_"));
if (foundVer < Math.abs(info.version)
|| (foundVer == info.version && foundVal != info.val) ) { // if the version matches, the val must
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e80643e5/solr/core/src/test/org/apache/solr/search/TestStressUserVersions.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestStressUserVersions.java b/solr/core/src/test/org/apache/solr/search/TestStressUserVersions.java
index 4eea434..5272734 100644
--- a/solr/core/src/test/org/apache/solr/search/TestStressUserVersions.java
+++ b/solr/core/src/test/org/apache/solr/search/TestStressUserVersions.java
@@ -203,7 +203,7 @@ public class TestStressUserVersions extends TestRTGBase {
} else {
verbose("adding id", id, "val=", nextVal,"version",version);
- Long returnedVersion = addAndGetVersion(sdoc("id", Integer.toString(id), field, Long.toString(nextVal), vfield, Long.toString(version)), null);
+ Long returnedVersion = addAndGetVersion(sdoc("id", Integer.toString(id), FIELD, Long.toString(nextVal), vfield, Long.toString(version)), null);
// only update model if the version is newer
synchronized (model) {
@@ -282,7 +282,7 @@ public class TestStressUserVersions extends TestRTGBase {
long foundVer = (Long)(((Map)doclist.get(0)).get(vfield));
if (isLive) {
- long foundVal = (Long)(((Map)doclist.get(0)).get(field));
+ long foundVal = (Long)(((Map)doclist.get(0)).get(FIELD));
if (foundVer < Math.abs(info.version)
|| (foundVer == info.version && foundVal != info.val) ) { // if the version matches, the val must
log.error("ERROR, id=" + id + " found=" + response + " model" + info);
@@ -290,7 +290,7 @@ public class TestStressUserVersions extends TestRTGBase {
}
} else {
// if the doc is deleted (via tombstone), it shouldn't have a value on it.
- assertNull( ((Map)doclist.get(0)).get(field) );
+ assertNull( ((Map)doclist.get(0)).get(FIELD) );
if (foundVer < Math.abs(info.version)) {
log.error("ERROR, id=" + id + " found=" + response + " model" + info);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e80643e5/solr/core/src/test/org/apache/solr/search/TestStressVersions.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestStressVersions.java b/solr/core/src/test/org/apache/solr/search/TestStressVersions.java
index ed51ae5..15b0c68 100644
--- a/solr/core/src/test/org/apache/solr/search/TestStressVersions.java
+++ b/solr/core/src/test/org/apache/solr/search/TestStressVersions.java
@@ -172,7 +172,7 @@ public class TestStressVersions extends TestRTGBase {
verbose("adding id", id, "val=", nextVal);
// assertU(adoc("id",Integer.toString(id), field, Long.toString(nextVal)));
- Long version = addAndGetVersion(sdoc("id", Integer.toString(id), field, Long.toString(nextVal)), null);
+ Long version = addAndGetVersion(sdoc("id", Integer.toString(id), FIELD, Long.toString(nextVal)), null);
assertTrue(version > 0);
// only update model if the version is newer
@@ -247,7 +247,7 @@ public class TestStressVersions extends TestRTGBase {
// there's no info we can get back with a delete, so not much we can check without further synchronization
} else {
assertEquals(1, doclist.size());
- long foundVal = (Long)(((Map)doclist.get(0)).get(field));
+ long foundVal = (Long)(((Map)doclist.get(0)).get(FIELD));
long foundVer = (Long)(((Map)doclist.get(0)).get("_version_"));
if (foundVer < Math.abs(info.version)
|| (foundVer == info.version && foundVal != info.val) ) { // if the version matches, the val must
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e80643e5/solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java b/solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java
index e2229c5..16ace15 100644
--- a/solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java
+++ b/solr/solrj/src/test/org/apache/solr/common/util/TestJavaBinCodec.java
@@ -47,10 +47,10 @@ import org.noggit.CharArr;
public class TestJavaBinCodec extends SolrTestCaseJ4 {
private static final String SOLRJ_JAVABIN_BACKCOMPAT_BIN = "/solrj/javabin_backcompat.bin";
- private final String BIN_FILE_LOCATION = "./solr/solrj/src/test-files/solrj/javabin_backcompat.bin";
+ private static final String BIN_FILE_LOCATION = "./solr/solrj/src/test-files/solrj/javabin_backcompat.bin";
private static final String SOLRJ_JAVABIN_BACKCOMPAT_BIN_CHILD_DOCS = "/solrj/javabin_backcompat_child_docs.bin";
- private final String BIN_FILE_LOCATION_CHILD_DOCS = "./solr/solrj/src/test-files/solrj/javabin_backcompat_child_docs.bin";
+ private static final String BIN_FILE_LOCATION_CHILD_DOCS = "./solr/solrj/src/test-files/solrj/javabin_backcompat_child_docs.bin";
public void testStrings() throws Exception {
for (int i = 0; i < 10000 * RANDOM_MULTIPLIER; i++) {