SQL: [tests] Remove AbstractBuilderTestCase dep (#35099)

Extend directly from `EsTestCase` to speed up execution.

Fixes: #35098
This commit is contained in:
Marios Trivyzas 2018-10-30 22:31:29 +01:00 committed by GitHub
parent 086ada4c08
commit 455906d431
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 9 deletions

View File

@ -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;
@ -26,7 +26,7 @@ import java.util.TimeZone;
import static org.hamcrest.Matchers.startsWith;
public class QueryFolderTests extends AbstractBuilderTestCase {
public class QueryFolderTests extends ESTestCase {
private static SqlParser parser;
private static Analyzer analyzer;

View File

@ -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;
@ -29,13 +29,12 @@ import org.joda.time.DateTime;
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;
@ -160,7 +159,7 @@ public class QueryTranslatorTests extends AbstractBuilderTestCase {
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);
@ -170,10 +169,11 @@ public class QueryTranslatorTests extends AbstractBuilderTestCase {
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);
@ -183,7 +183,8 @@ public class QueryTranslatorTests extends AbstractBuilderTestCase {
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() {