Merge pull request elastic/elasticsearch#4398 from danielmitterdorfer/xcontent_strict_duplicate_checks

Enable strict duplicate checks for all XContent types

Original commit: elastic/x-pack-elasticsearch@ad249c2e65
This commit is contained in:
Daniel Mitterdorfer 2016-12-19 09:30:19 +01:00 committed by GitHub
commit 7a652fa090
2 changed files with 10 additions and 8 deletions

View File

@ -8,6 +8,7 @@ package org.elasticsearch.xpack.notification.email.attachment;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.json.JsonXContent;
@ -115,8 +116,8 @@ public class EmailAttachmentParsersTests extends ESTestCase {
}
public void testThatTwoAttachmentsWithTheSameIdThrowError() throws Exception {
assumeFalse("Test only makes sense if JSON parser doesn't have strict duplicate checks enabled",
JsonXContent.isStrictDuplicateDetectionEnabled());
assumeFalse("Test only makes sense if XContent parser doesn't have strict duplicate checks enabled",
XContent.isStrictDuplicateDetectionEnabled());
Map<String, EmailAttachmentParser> parsers = new HashMap<>();
parsers.put("test", new TestEmailAttachmentParser());
EmailAttachmentsParser parser = new EmailAttachmentsParser(parsers);

View File

@ -6,6 +6,7 @@
package org.elasticsearch.xpack.watcher.condition;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.xcontent.XContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.json.JsonXContent;
@ -194,8 +195,8 @@ public class ArrayCompareConditionTests extends ESTestCase {
}
public void testParseContainsDuplicateOperator() throws IOException {
assumeFalse("Test only makes sense if JSON parser doesn't have strict duplicate checks enabled",
JsonXContent.isStrictDuplicateDetectionEnabled());
assumeFalse("Test only makes sense if XContent parser doesn't have strict duplicate checks enabled",
XContent.isStrictDuplicateDetectionEnabled());
ArrayCompareCondition.Op op = randomFrom(ArrayCompareCondition.Op.values());
ArrayCompareCondition.Quantifier quantifier = randomFrom(ArrayCompareCondition.Quantifier.values());
Object value = randomFrom("value", 1, null);
@ -247,8 +248,8 @@ public class ArrayCompareConditionTests extends ESTestCase {
}
public void testParseContainsDuplicateValue() throws IOException {
assumeFalse("Test only makes sense if JSON parser doesn't have strict duplicate checks enabled",
JsonXContent.isStrictDuplicateDetectionEnabled());
assumeFalse("Test only makes sense if XContent parser doesn't have strict duplicate checks enabled",
XContent.isStrictDuplicateDetectionEnabled());
ArrayCompareCondition.Op op = randomFrom(ArrayCompareCondition.Op.values());
ArrayCompareCondition.Quantifier quantifier = randomFrom(ArrayCompareCondition.Quantifier.values());
Object value = randomFrom("value", 1, null);
@ -274,8 +275,8 @@ public class ArrayCompareConditionTests extends ESTestCase {
}
public void testParseContainsDuplicateQuantifier() throws IOException {
assumeFalse("Test only makes sense if JSON parser doesn't have strict duplicate checks enabled",
JsonXContent.isStrictDuplicateDetectionEnabled());
assumeFalse("Test only makes sense if XContent parser doesn't have strict duplicate checks enabled",
XContent.isStrictDuplicateDetectionEnabled());
ArrayCompareCondition.Op op = randomFrom(ArrayCompareCondition.Op.values());
ArrayCompareCondition.Quantifier quantifier = randomFrom(ArrayCompareCondition.Quantifier.values());
Object value = randomFrom("value", 1, null);