Skip to content

Commit

Permalink
Fix test compile after merge from main.
Browse files Browse the repository at this point in the history
  • Loading branch information
afoucret committed Nov 22, 2024
1 parent abad995 commit d096e9e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.elasticsearch.xpack.core.enrich.EnrichPolicy;
import org.elasticsearch.xpack.esql.EsqlTestUtils;
import org.elasticsearch.xpack.esql.EsqlTestUtils.TestSearchStats;
import org.elasticsearch.xpack.esql.action.EsqlCapabilities;
import org.elasticsearch.xpack.esql.analysis.Analyzer;
import org.elasticsearch.xpack.esql.analysis.AnalyzerContext;
import org.elasticsearch.xpack.esql.analysis.EnrichResolution;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package org.elasticsearch.xpack.esql.querydsl.query;

import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.esql.core.expression.predicate.fulltext.StringQueryPredicate;
import org.elasticsearch.xpack.esql.core.tree.Source;
import org.elasticsearch.xpack.esql.core.tree.SourceTests;
import org.elasticsearch.xpack.esql.core.util.StringUtils;
Expand Down Expand Up @@ -111,25 +110,24 @@ private static Map<String, String> mutateOption(Map<String, String> options, Str
}

public void testQueryBuilding() {
KqlQueryBuilder qb = getBuilder("case_insensitive=false");
KqlQueryBuilder qb = getBuilder(Map.of("case_insensitive", "false"));
assertThat(qb.caseInsensitive(), equalTo(false));

qb = getBuilder("case_insensitive=false;time_zone=UTC;default_field=foo");
qb = getBuilder(Map.of("case_insensitive", "false", "time_zone", "UTC", "default_field", "foo"));
assertThat(qb.caseInsensitive(), equalTo(false));
assertThat(qb.timeZone(), equalTo(ZoneId.of("UTC")));
assertThat(qb.defaultField(), equalTo("foo"));

Exception e = expectThrows(IllegalArgumentException.class, () -> getBuilder("pizza=yummy"));
Exception e = expectThrows(IllegalArgumentException.class, () -> getBuilder(Map.of("pizza", "yummy")));
assertThat(e.getMessage(), equalTo("illegal kql query option [pizza]"));

e = expectThrows(ZoneRulesException.class, () -> getBuilder("time_zone=aoeu"));
e = expectThrows(ZoneRulesException.class, () -> getBuilder(Map.of("time_zone", "aoeu")));
assertThat(e.getMessage(), equalTo("Unknown time-zone ID: aoeu"));
}

private static KqlQueryBuilder getBuilder(String options) {
private static KqlQueryBuilder getBuilder(Map<String, String> options) {
final Source source = new Source(1, 1, StringUtils.EMPTY);
final StringQueryPredicate predicate = new StringQueryPredicate(source, "eggplant", options);
final KqlQuery kqlQuery = new KqlQuery(source, "eggplant", predicate.optionMap());
final KqlQuery kqlQuery = new KqlQuery(source, "eggplant", options);
return (KqlQueryBuilder) kqlQuery.asBuilder();
}

Expand Down

0 comments on commit d096e9e

Please sign in to comment.