Fixed minor issue in ASCT#indexExists(...)

This commit is contained in:
Martijn van Groningen 2013-06-06 21:42:11 +02:00
parent e218ead19e
commit 8016d32a0e
2 changed files with 13 additions and 19 deletions

View File

@ -18,18 +18,9 @@
*/
package org.elasticsearch.test.integration;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import com.google.common.base.Joiner;
import com.google.common.collect.Iterators;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
import java.io.IOException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder;
@ -55,8 +46,15 @@ import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import com.google.common.base.Joiner;
import com.google.common.collect.Iterators;
import java.io.IOException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
/**
* This abstract base testcase reuses a cluster instance internally and might
@ -317,7 +315,7 @@ public abstract class AbstractSharedClusterTest extends ElasticsearchTestCase {
}
protected boolean indexExists(String index) {
IndicesExistsResponse actionGet = client().admin().indices().prepareExists("test1234565").execute().actionGet();
IndicesExistsResponse actionGet = client().admin().indices().prepareExists(index).execute().actionGet();
return actionGet.isExists();
}

View File

@ -22,7 +22,6 @@ package org.elasticsearch.test.integration.document;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheResponse;
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse;
import org.elasticsearch.action.admin.indices.flush.FlushResponse;
import org.elasticsearch.action.admin.indices.optimize.OptimizeResponse;
import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
@ -35,11 +34,8 @@ import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.support.broadcast.BroadcastOperationThreading;
import org.elasticsearch.action.support.replication.ReplicationType;
import org.elasticsearch.common.Unicode;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.test.integration.AbstractSharedClusterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@ -99,7 +95,7 @@ public class DocumentActionsTests extends AbstractSharedClusterTest {
assertThat(refreshResponse.getSuccessfulShards(), equalTo(10));
logger.info("--> index exists?");
assertThat(indexExists(getConcreteIndexName()), equalTo(false));
assertThat(indexExists(getConcreteIndexName()), equalTo(true));
logger.info("--> index exists?, fake index");
assertThat(indexExists("test1234565"), equalTo(false));