[TEST] Verify the flush reponse

This commit is contained in:
Martijn van Groningen 2014-06-13 11:35:15 +02:00
parent 7fb16c783d
commit 77e0429089
1 changed files with 6 additions and 1 deletions

View File

@ -22,6 +22,7 @@ package org.elasticsearch.get;
import org.elasticsearch.ElasticsearchIllegalArgumentException; import org.elasticsearch.ElasticsearchIllegalArgumentException;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
import org.elasticsearch.action.admin.indices.flush.FlushResponse;
import org.elasticsearch.action.delete.DeleteResponse; import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.action.get.MultiGetRequest; import org.elasticsearch.action.get.MultiGetRequest;
@ -40,6 +41,8 @@ import java.util.Map;
import static org.elasticsearch.client.Requests.clusterHealthRequest; import static org.elasticsearch.client.Requests.clusterHealthRequest;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
import static org.hamcrest.Matchers.*; import static org.hamcrest.Matchers.*;
public class GetActionTests extends ElasticsearchIntegrationTest { public class GetActionTests extends ElasticsearchIntegrationTest {
@ -850,7 +853,9 @@ public class GetActionTests extends ElasticsearchIntegrationTest {
assertThat(getResponse.getField(field).getValues().get(0).toString(), equalTo("value1")); assertThat(getResponse.getField(field).getValues().get(0).toString(), equalTo("value1"));
assertThat(getResponse.getField(field).getValues().get(1).toString(), equalTo("value2")); assertThat(getResponse.getField(field).getValues().get(1).toString(), equalTo("value2"));
client().admin().indices().prepareFlush("my-index").get(); FlushResponse flushResponse = client().admin().indices().prepareFlush("my-index").get();
assertNoFailures(flushResponse);
assertAllSuccessful(flushResponse);
getResponse = client().prepareGet("my-index", "my-type1", "1").setFields(field).get(); getResponse = client().prepareGet("my-index", "my-type1", "1").setFields(field).get();
assertThat(getResponse.isExists(), equalTo(true)); assertThat(getResponse.isExists(), equalTo(true));