Only use the client variable and don't use client from client() in percolator test

This commit is contained in:
Martijn van Groningen 2013-08-26 15:37:18 +02:00
parent 8b295b53d0
commit 35dcdb0b5a
1 changed files with 12 additions and 12 deletions

View File

@ -301,12 +301,12 @@ public class RecoveryPercolatorTests extends AbstractNodesTests {
final int numQueries = randomIntBetween(50, 100); final int numQueries = randomIntBetween(50, 100);
logger.info("--> register a queries"); logger.info("--> register a queries");
for (int i = 0; i < numQueries; i++) { for (int i = 0; i < numQueries; i++) {
client().prepareIndex("test", "_percolator", Integer.toString(i)) client.prepareIndex("test", "_percolator", Integer.toString(i))
.setSource(jsonBuilder().startObject().field("query", matchAllQuery()).endObject()) .setSource(jsonBuilder().startObject().field("query", matchAllQuery()).endObject())
.execute().actionGet(); .execute().actionGet();
} }
client().prepareIndex("test", "type", "1") client.prepareIndex("test", "type", "1")
.setSource(jsonBuilder().startObject().field("field", "a")) .setSource(jsonBuilder().startObject().field("field", "a"))
.execute().actionGet(); .execute().actionGet();
@ -323,7 +323,7 @@ public class RecoveryPercolatorTests extends AbstractNodesTests {
} catch (IOException e) {} } catch (IOException e) {}
while (run.get()) { while (run.get()) {
NodesInfoResponse nodesInfoResponse = client().admin().cluster().prepareNodesInfo() NodesInfoResponse nodesInfoResponse = client.admin().cluster().prepareNodesInfo()
.execute().actionGet(); .execute().actionGet();
String node2Id = null; String node2Id = null;
String node3Id = null; String node3Id = null;
@ -337,13 +337,13 @@ public class RecoveryPercolatorTests extends AbstractNodesTests {
String preference = "_prefer_node:" + (randomBoolean() ? node2Id : node3Id); String preference = "_prefer_node:" + (randomBoolean() ? node2Id : node3Id);
if (multiPercolate) { if (multiPercolate) {
MultiPercolateRequestBuilder builder = client() MultiPercolateRequestBuilder builder = client
.prepareMultiPercolate(); .prepareMultiPercolate();
int numPercolateRequest = randomIntBetween(50, 100); int numPercolateRequest = randomIntBetween(50, 100);
for (int i = 0; i < numPercolateRequest / 2; i++) { for (int i = 0; i < numPercolateRequest / 2; i++) {
builder.add( builder.add(
client().preparePercolate() client.preparePercolate()
.setPreference(preference) .setPreference(preference)
.setIndices("test").setDocumentType("type") .setIndices("test").setDocumentType("type")
.setPercolateDoc(docBuilder().setDoc(doc))); .setPercolateDoc(docBuilder().setDoc(doc)));
@ -351,7 +351,7 @@ public class RecoveryPercolatorTests extends AbstractNodesTests {
for (int i = numPercolateRequest / 2; i < numPercolateRequest; i++) { for (int i = numPercolateRequest / 2; i < numPercolateRequest; i++) {
builder.add( builder.add(
client().preparePercolate() client.preparePercolate()
.setPreference(preference) .setPreference(preference)
.setGetRequest(Requests.getRequest("test").type("type").id("1")) .setGetRequest(Requests.getRequest("test").type("type").id("1"))
.setIndices("test").setDocumentType("type") .setIndices("test").setDocumentType("type")
@ -370,13 +370,13 @@ public class RecoveryPercolatorTests extends AbstractNodesTests {
} else { } else {
PercolateResponse response; PercolateResponse response;
if (randomBoolean()) { if (randomBoolean()) {
response = client().preparePercolate() response = client.preparePercolate()
.setIndices("test").setDocumentType("type") .setIndices("test").setDocumentType("type")
.setPercolateDoc(docBuilder().setDoc(doc)) .setPercolateDoc(docBuilder().setDoc(doc))
.setPreference(preference) .setPreference(preference)
.execute().actionGet(); .execute().actionGet();
} else { } else {
response = client().preparePercolate() response = client.preparePercolate()
.setGetRequest(Requests.getRequest("test").type("type").id("1")) .setGetRequest(Requests.getRequest("test").type("type").id("1"))
.setIndices("test").setDocumentType("type") .setIndices("test").setDocumentType("type")
.setPreference(preference) .setPreference(preference)
@ -402,28 +402,28 @@ public class RecoveryPercolatorTests extends AbstractNodesTests {
try { try {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
closeNode("node3"); closeNode("node3");
client().admin().cluster().prepareHealth() client.admin().cluster().prepareHealth()
.setWaitForEvents(Priority.LANGUID) .setWaitForEvents(Priority.LANGUID)
.setWaitForYellowStatus() .setWaitForYellowStatus()
.setWaitForNodes("2") .setWaitForNodes("2")
.execute().actionGet(); .execute().actionGet();
assertThat(error.get(), nullValue()); assertThat(error.get(), nullValue());
closeNode("node2"); closeNode("node2");
client().admin().cluster().prepareHealth() client.admin().cluster().prepareHealth()
.setWaitForEvents(Priority.LANGUID) .setWaitForEvents(Priority.LANGUID)
.setWaitForYellowStatus() .setWaitForYellowStatus()
.setWaitForNodes("1") .setWaitForNodes("1")
.execute().actionGet(); .execute().actionGet();
assertThat(error.get(), nullValue()); assertThat(error.get(), nullValue());
startNode("node3"); startNode("node3");
client().admin().cluster().prepareHealth() client.admin().cluster().prepareHealth()
.setWaitForEvents(Priority.LANGUID) .setWaitForEvents(Priority.LANGUID)
.setWaitForYellowStatus() .setWaitForYellowStatus()
.setWaitForNodes("2") .setWaitForNodes("2")
.execute().actionGet(); .execute().actionGet();
assertThat(error.get(), nullValue()); assertThat(error.get(), nullValue());
startNode("node2"); startNode("node2");
client().admin().cluster().prepareHealth() client.admin().cluster().prepareHealth()
.setWaitForEvents(Priority.LANGUID) .setWaitForEvents(Priority.LANGUID)
.setWaitForYellowStatus() .setWaitForYellowStatus()
.setWaitForNodes("3") .setWaitForNodes("3")