summaryrefslogtreecommitdiff
path: root/core/src/test/java/org/elasticsearch/search/aggregations/bucket
diff options
context:
space:
mode:
authorJay Modi <jaymode@users.noreply.github.com>2017-02-17 14:45:41 -0500
committerGitHub <noreply@github.com>2017-02-17 14:45:41 -0500
commitb23464403547743e5a797b3b3d4615b9b1dbf32b (patch)
treeb9d6a2c56c58d138f01950689c53aa08dd61df81 /core/src/test/java/org/elasticsearch/search/aggregations/bucket
parent3bd1d46fc7ff49d08ccf6b0ef91acb028cc5d8e2 (diff)
Enforce Content-Type requirement on the rest layer and remove deprecated methods (#23146)
This commit enforces the requirement of Content-Type for the REST layer and removes the deprecated methods in transport requests and their usages. While doing this, it turns out that there are many places where *Entity classes are used from the apache http client libraries and many of these usages did not specify the content type. The methods that do not specify a content type explicitly have been added to forbidden apis to prevent more of these from entering our code base. Relates #19388
Diffstat (limited to 'core/src/test/java/org/elasticsearch/search/aggregations/bucket')
-rw-r--r--core/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramIT.java3
-rw-r--r--core/src/test/java/org/elasticsearch/search/aggregations/bucket/TermsDocCountErrorIT.java4
2 files changed, 5 insertions, 2 deletions
diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramIT.java b/core/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramIT.java
index 78a7fb5c17..3d0b55fdb9 100644
--- a/core/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramIT.java
+++ b/core/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramIT.java
@@ -23,6 +23,7 @@ import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.common.joda.DateMathParser;
import org.elasticsearch.common.joda.Joda;
import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.mapper.DateFieldMapper;
import org.elasticsearch.index.query.MatchNoneQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
@@ -1051,7 +1052,7 @@ public class DateHistogramIT extends ESIntegTestCase {
public void testSingleValueWithMultipleDateFormatsFromMapping() throws Exception {
String mappingJson = jsonBuilder().startObject().startObject("type").startObject("properties").startObject("date").field("type", "date").field("format", "dateOptionalTime||dd-MM-yyyy").endObject().endObject().endObject().endObject().string();
- prepareCreate("idx2").addMapping("type", mappingJson).execute().actionGet();
+ prepareCreate("idx2").addMapping("type", mappingJson, XContentType.JSON).execute().actionGet();
IndexRequestBuilder[] reqs = new IndexRequestBuilder[5];
for (int i = 0; i < reqs.length; i++) {
reqs[i] = client().prepareIndex("idx2", "type", "" + i).setSource(jsonBuilder().startObject().field("date", "10-03-2014").endObject());
diff --git a/core/src/test/java/org/elasticsearch/search/aggregations/bucket/TermsDocCountErrorIT.java b/core/src/test/java/org/elasticsearch/search/aggregations/bucket/TermsDocCountErrorIT.java
index 6bbe1dc22b..f2a030ab5e 100644
--- a/core/src/test/java/org/elasticsearch/search/aggregations/bucket/TermsDocCountErrorIT.java
+++ b/core/src/test/java/org/elasticsearch/search/aggregations/bucket/TermsDocCountErrorIT.java
@@ -23,6 +23,7 @@ import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket;
@@ -85,7 +86,8 @@ public class TermsDocCountErrorIT extends ESIntegTestCase {
.endObject()));
}
numRoutingValues = between(1,40);
- assertAcked(prepareCreate("idx_with_routing").addMapping("type", "{ \"type\" : { \"_routing\" : { \"required\" : true } } }"));
+ assertAcked(prepareCreate("idx_with_routing")
+ .addMapping("type", "{ \"type\" : { \"_routing\" : { \"required\" : true } } }", XContentType.JSON));
for (int i = 0; i < numDocs; i++) {
builders.add(client().prepareIndex("idx_single_shard", "type", "" + i)
.setRouting(String.valueOf(randomInt(numRoutingValues)))