diff --git a/core/src/test/java/org/elasticsearch/search/basic/TransportSearchFailuresIT.java b/core/src/test/java/org/elasticsearch/search/basic/TransportSearchFailuresIT.java index e9bcd2c83c3..db0b5c29012 100644 --- a/core/src/test/java/org/elasticsearch/search/basic/TransportSearchFailuresIT.java +++ b/core/src/test/java/org/elasticsearch/search/basic/TransportSearchFailuresIT.java @@ -19,28 +19,15 @@ package org.elasticsearch.search.basic; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.WriteConsistencyLevel; -import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; -import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus; -import org.elasticsearch.action.admin.indices.refresh.RefreshResponse; -import org.elasticsearch.action.search.SearchPhaseExecutionException; -import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.client.Client; import org.elasticsearch.client.Requests; -import org.elasticsearch.common.Priority; -import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.test.ESIntegTestCase; -import org.junit.Test; import java.io.IOException; -import static org.elasticsearch.client.Requests.*; -import static org.elasticsearch.common.settings.Settings.settingsBuilder; import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; -import static org.hamcrest.Matchers.*; public class TransportSearchFailuresIT extends ESIntegTestCase { @@ -49,7 +36,7 @@ public class TransportSearchFailuresIT extends ESIntegTestCase { return 1; } - // NORELEASE this needs to be done in a unit test + // NORELEASE can this still be tested? if so, how? // @Test // public void testFailedSearchWithWrongQuery() throws Exception { // logger.info("Start Testing failed search with wrong query"); diff --git a/core/src/test/java/org/elasticsearch/search/basic/TransportTwoNodesSearchIT.java b/core/src/test/java/org/elasticsearch/search/basic/TransportTwoNodesSearchIT.java index 62eb717a65f..5e6c7bc718b 100644 --- a/core/src/test/java/org/elasticsearch/search/basic/TransportTwoNodesSearchIT.java +++ b/core/src/test/java/org/elasticsearch/search/basic/TransportTwoNodesSearchIT.java @@ -20,12 +20,9 @@ package org.elasticsearch.search.basic; -import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.search.MultiSearchResponse; -import org.elasticsearch.action.search.SearchPhaseExecutionException; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.client.Requests; -import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -52,7 +49,6 @@ import static org.elasticsearch.action.search.SearchType.DFS_QUERY_AND_FETCH; import static org.elasticsearch.action.search.SearchType.DFS_QUERY_THEN_FETCH; import static org.elasticsearch.action.search.SearchType.QUERY_AND_FETCH; import static org.elasticsearch.action.search.SearchType.QUERY_THEN_FETCH; - import static org.elasticsearch.client.Requests.createIndexRequest; import static org.elasticsearch.client.Requests.searchRequest; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; @@ -64,7 +60,6 @@ import static org.elasticsearch.index.query.QueryBuilders.termQuery; import static org.elasticsearch.search.builder.SearchSourceBuilder.searchSource; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures; import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.lessThanOrEqualTo; import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.nullValue; @@ -131,7 +126,7 @@ public class TransportTwoNodesSearchIT extends ESIntegTestCase { .settings(settingsBuilder)) .actionGet(); ensureGreen(); - + // we need to have age (ie number of repeats of "test" term) high enough // to produce the same 8-bit norm for all docs here, so that // the tf is basically the entire score (assuming idf is fixed, which @@ -335,7 +330,7 @@ public class TransportTwoNodesSearchIT extends ESIntegTestCase { do { searchResponse = client().prepareSearchScroll(searchResponse.getScrollId()).setScroll("10m").get(); - + assertThat(searchResponse.getHits().totalHits(), equalTo(100l)); assertThat(searchResponse.getHits().hits().length, lessThanOrEqualTo(40)); for (int i = 0; i < searchResponse.getHits().hits().length; i++) { @@ -388,7 +383,7 @@ public class TransportTwoNodesSearchIT extends ESIntegTestCase { // // all is well // } // logger.info("Done Testing failed search"); -// } NORELEASE this needs to be tested in a unit test + // } NORELEASE can this still be tested? if so, how? @Test public void testFailedSearchWithWrongFrom() throws Exception { diff --git a/plugins/delete-by-query/src/test/java/org/elasticsearch/action/deletebyquery/TransportDeleteByQueryActionTests.java b/plugins/delete-by-query/src/test/java/org/elasticsearch/action/deletebyquery/TransportDeleteByQueryActionTests.java index d5d2e791dbf..853b6cf35e8 100644 --- a/plugins/delete-by-query/src/test/java/org/elasticsearch/action/deletebyquery/TransportDeleteByQueryActionTests.java +++ b/plugins/delete-by-query/src/test/java/org/elasticsearch/action/deletebyquery/TransportDeleteByQueryActionTests.java @@ -42,7 +42,8 @@ import org.junit.Test; import static org.elasticsearch.index.query.QueryBuilders.boolQuery; import static org.elasticsearch.index.query.QueryBuilders.rangeQuery; import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount; -import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.equalTo; public class TransportDeleteByQueryActionTests extends ESSingleNodeTestCase { @@ -58,21 +59,6 @@ public class TransportDeleteByQueryActionTests extends ESSingleNodeTestCase { assertSearchContextsClosed(); } - // NORELEASE re-implement this parsing test as a unit test -// @Test -// public void testExecuteScanFailsOnMalformedQuery() { -// createIndex("test"); -// -// DeleteByQueryRequest delete = new DeleteByQueryRequest().indices(new String[]{"test"}).query("{...}"); -// TestActionListener listener = new TestActionListener(); -// -// newAsyncAction(delete, listener).executeScan(); -// waitForCompletion("scan request should fail on malformed query", listener); -// -// assertFailure(listener, "all shards failed"); -// assertSearchContextsClosed(); -// } - @Test public void testExecuteScan() { createIndex("test");