Search in sources :

Example 11 with XContentLocation

use of org.elasticsearch.common.xcontent.XContentLocation in project elasticsearch by elastic.

the class GreaterThanEqualToAssertion method parse.

public static GreaterThanEqualToAssertion parse(XContentParser parser) throws IOException {
    XContentLocation location = parser.getTokenLocation();
    Tuple<String, Object> stringObjectTuple = ParserUtils.parseTuple(parser);
    if (!(stringObjectTuple.v2() instanceof Comparable)) {
        throw new IllegalArgumentException("gte section can only be used with objects that support natural ordering, found " + stringObjectTuple.v2().getClass().getSimpleName());
    }
    return new GreaterThanEqualToAssertion(location, stringObjectTuple.v1(), stringObjectTuple.v2());
}
Also used : XContentLocation(org.elasticsearch.common.xcontent.XContentLocation)

Example 12 with XContentLocation

use of org.elasticsearch.common.xcontent.XContentLocation in project elasticsearch by elastic.

the class ClientYamlTestSectionTests method testAddingDoWithoutWarningWithoutSkip.

public void testAddingDoWithoutWarningWithoutSkip() {
    int lineNumber = between(1, 10000);
    ClientYamlTestSection section = new ClientYamlTestSection(new XContentLocation(0, 0), "test");
    section.setSkipSection(SkipSection.EMPTY);
    DoSection doSection = new DoSection(new XContentLocation(lineNumber, 0));
    section.addExecutableSection(doSection);
}
Also used : XContentLocation(org.elasticsearch.common.xcontent.XContentLocation)

Example 13 with XContentLocation

use of org.elasticsearch.common.xcontent.XContentLocation in project elasticsearch by elastic.

the class ClientYamlTestSectionTests method testAddingDoWithWarningWithSkip.

public void testAddingDoWithWarningWithSkip() {
    int lineNumber = between(1, 10000);
    ClientYamlTestSection section = new ClientYamlTestSection(new XContentLocation(0, 0), "test");
    section.setSkipSection(new SkipSection(null, singletonList("warnings"), null));
    DoSection doSection = new DoSection(new XContentLocation(lineNumber, 0));
    doSection.setExpectedWarningHeaders(singletonList("foo"));
    section.addExecutableSection(doSection);
}
Also used : XContentLocation(org.elasticsearch.common.xcontent.XContentLocation)

Aggregations

XContentLocation (org.elasticsearch.common.xcontent.XContentLocation)13 ParsingException (org.elasticsearch.common.ParsingException)3 IOException (java.io.IOException)2 SearchParseException (org.elasticsearch.search.SearchParseException)2 TestSearchContext (org.elasticsearch.test.TestSearchContext)2 ArrayList (java.util.ArrayList)1 Collections.emptyList (java.util.Collections.emptyList)1 Collections.singletonList (java.util.Collections.singletonList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 SearchPhaseExecutionException (org.elasticsearch.action.search.SearchPhaseExecutionException)1 ShardSearchFailure (org.elasticsearch.action.search.ShardSearchFailure)1 ClusterBlockException (org.elasticsearch.cluster.block.ClusterBlockException)1 CircuitBreakingException (org.elasticsearch.common.breaker.CircuitBreakingException)1 Tuple (org.elasticsearch.common.collect.Tuple)1 UnknownNamedObjectException (org.elasticsearch.common.xcontent.NamedXContentRegistry.UnknownNamedObjectException)1 Index (org.elasticsearch.index.Index)1 SearchShardTarget (org.elasticsearch.search.SearchShardTarget)1 SearchContext (org.elasticsearch.search.internal.SearchContext)1