diff options
Diffstat (limited to 'core/src/test/java/org/elasticsearch/cluster')
-rw-r--r-- | core/src/test/java/org/elasticsearch/cluster/NoMasterNodeIT.java | 3 | ||||
-rw-r--r-- | core/src/test/java/org/elasticsearch/cluster/SimpleDataNodesIT.java | 10 |
2 files changed, 9 insertions, 4 deletions
diff --git a/core/src/test/java/org/elasticsearch/cluster/NoMasterNodeIT.java b/core/src/test/java/org/elasticsearch/cluster/NoMasterNodeIT.java index 73598c3eff..c799969a3c 100644 --- a/core/src/test/java/org/elasticsearch/cluster/NoMasterNodeIT.java +++ b/core/src/test/java/org/elasticsearch/cluster/NoMasterNodeIT.java @@ -24,6 +24,7 @@ import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; import org.elasticsearch.action.bulk.BulkRequestBuilder; import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.action.search.SearchResponse; +import org.elasticsearch.client.Requests; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.settings.Settings; @@ -236,7 +237,7 @@ public class NoMasterNodeIT extends ESIntegTestCase { TimeValue timeout = TimeValue.timeValueMillis(200); long now = System.currentTimeMillis(); try { - client().prepareUpdate("test1", "type1", "1").setDoc("field", "value2").setTimeout(timeout).get(); + client().prepareUpdate("test1", "type1", "1").setDoc(Requests.INDEX_CONTENT_TYPE, "field", "value2").setTimeout(timeout).get(); fail("Expected ClusterBlockException"); } catch (ClusterBlockException e) { assertThat(System.currentTimeMillis() - now, greaterThan(timeout.millis() - 50)); diff --git a/core/src/test/java/org/elasticsearch/cluster/SimpleDataNodesIT.java b/core/src/test/java/org/elasticsearch/cluster/SimpleDataNodesIT.java index a0a0025681..c2f6c3b64f 100644 --- a/core/src/test/java/org/elasticsearch/cluster/SimpleDataNodesIT.java +++ b/core/src/test/java/org/elasticsearch/cluster/SimpleDataNodesIT.java @@ -25,6 +25,7 @@ import org.elasticsearch.action.support.ActiveShardCount; import org.elasticsearch.client.Requests; import org.elasticsearch.common.Priority; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.node.Node; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; @@ -40,7 +41,8 @@ public class SimpleDataNodesIT extends ESIntegTestCase { internalCluster().startNode(Settings.builder().put(Node.NODE_DATA_SETTING.getKey(), false).build()); client().admin().indices().create(createIndexRequest("test").waitForActiveShards(ActiveShardCount.NONE)).actionGet(); try { - client().index(Requests.indexRequest("test").type("type1").id("1").source(source("1", "test")).timeout(timeValueSeconds(1))).actionGet(); + client().index(Requests.indexRequest("test").type("type1").id("1").source(source("1", "test"), XContentType.JSON) + .timeout(timeValueSeconds(1))).actionGet(); fail("no allocation should happen"); } catch (UnavailableShardsException e) { // all is well @@ -51,7 +53,8 @@ public class SimpleDataNodesIT extends ESIntegTestCase { // still no shard should be allocated try { - client().index(Requests.indexRequest("test").type("type1").id("1").source(source("1", "test")).timeout(timeValueSeconds(1))).actionGet(); + client().index(Requests.indexRequest("test").type("type1").id("1").source(source("1", "test"), XContentType.JSON) + .timeout(timeValueSeconds(1))).actionGet(); fail("no allocation should happen"); } catch (UnavailableShardsException e) { // all is well @@ -61,7 +64,8 @@ public class SimpleDataNodesIT extends ESIntegTestCase { internalCluster().startNode(Settings.builder().put(Node.NODE_DATA_SETTING.getKey(), true).build()); assertThat(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForNodes("3").setLocal(true).execute().actionGet().isTimedOut(), equalTo(false)); - IndexResponse indexResponse = client().index(Requests.indexRequest("test").type("type1").id("1").source(source("1", "test"))).actionGet(); + IndexResponse indexResponse = client().index(Requests.indexRequest("test").type("type1").id("1") + .source(source("1", "test"), XContentType.JSON)).actionGet(); assertThat(indexResponse.getId(), equalTo("1")); assertThat(indexResponse.getType(), equalTo("type1")); } |