Skip to content
This repository has been archived by the owner on Sep 24, 2019. It is now read-only.

Commit

Permalink
SQL: [tests] Remove AbstractBuilderTestCase dep (elastic#35099)
Browse files Browse the repository at this point in the history
Extend directly from `EsTestCase` to speed up execution.

Fixes: elastic#35098
  • Loading branch information
Marios Trivyzas authored and matriv committed Oct 30, 2018
1 parent 6cf5b42 commit 47f9c4c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
package org.elasticsearch.xpack.sql.planner;

import org.elasticsearch.test.AbstractBuilderTestCase;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.sql.analysis.analyzer.Analyzer;
import org.elasticsearch.xpack.sql.analysis.index.EsIndex;
import org.elasticsearch.xpack.sql.analysis.index.IndexResolution;
Expand All @@ -26,7 +26,7 @@

import static org.hamcrest.Matchers.startsWith;

public class QueryFolderTests extends AbstractBuilderTestCase {
public class QueryFolderTests extends ESTestCase {

private static SqlParser parser;
private static Analyzer analyzer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
package org.elasticsearch.xpack.sql.planner;

import org.elasticsearch.test.AbstractBuilderTestCase;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.sql.SqlIllegalArgumentException;
import org.elasticsearch.xpack.sql.analysis.analyzer.Analyzer;
import org.elasticsearch.xpack.sql.analysis.index.EsIndex;
Expand All @@ -29,13 +29,12 @@
import org.junit.AfterClass;
import org.junit.BeforeClass;

import java.io.IOException;
import java.util.Map;
import java.util.TimeZone;

import static org.hamcrest.core.StringStartsWith.startsWith;

public class QueryTranslatorTests extends AbstractBuilderTestCase {
public class QueryTranslatorTests extends ESTestCase {

private static SqlParser parser;
private static Analyzer analyzer;
Expand Down Expand Up @@ -160,7 +159,7 @@ public void testLikeConstructsNotSupported() {
assertEquals("Scalar function (LTRIM(keyword)) not allowed (yet) as arguments for LIKE", ex.getMessage());
}

public void testTranslateInExpression_WhereClause() throws IOException {
public void testTranslateInExpression_WhereClause() {
LogicalPlan p = plan("SELECT * FROM test WHERE keyword IN ('foo', 'bar', 'lala', 'foo', concat('la', 'la'))");
assertTrue(p instanceof Project);
assertTrue(p.children().get(0) instanceof Filter);
Expand All @@ -170,10 +169,11 @@ public void testTranslateInExpression_WhereClause() throws IOException {
Query query = translation.query;
assertTrue(query instanceof TermsQuery);
TermsQuery tq = (TermsQuery) query;
assertEquals("keyword:(bar foo lala)", tq.asBuilder().toQuery(createShardContext()).toString());
assertEquals("{\"terms\":{\"keyword\":[\"foo\",\"bar\",\"lala\"],\"boost\":1.0}}",
tq.asBuilder().toString().replaceAll("\\s", ""));
}

public void testTranslateInExpression_WhereClauseAndNullHandling() throws IOException {
public void testTranslateInExpression_WhereClauseAndNullHandling() {
LogicalPlan p = plan("SELECT * FROM test WHERE keyword IN ('foo', null, 'lala', null, 'foo', concat('la', 'la'))");
assertTrue(p instanceof Project);
assertTrue(p.children().get(0) instanceof Filter);
Expand All @@ -183,7 +183,8 @@ public void testTranslateInExpression_WhereClauseAndNullHandling() throws IOExce
Query query = translation.query;
assertTrue(query instanceof TermsQuery);
TermsQuery tq = (TermsQuery) query;
assertEquals("keyword:(foo lala)", tq.asBuilder().toQuery(createShardContext()).toString());
assertEquals("{\"terms\":{\"keyword\":[\"foo\",\"lala\"],\"boost\":1.0}}",
tq.asBuilder().toString().replaceAll("\\s", ""));
}

public void testTranslateInExpressionInvalidValues_WhereClause() {
Expand Down

0 comments on commit 47f9c4c

Please sign in to comment.