From c8b406bbd7dc667d75ada1f8aff1b1f185b92bf0 Mon Sep 17 00:00:00 2001 From: MaxKsyunz Date: Fri, 17 Feb 2023 00:26:17 -0800 Subject: [PATCH] Fix checkstyle issues in tests Signed-off-by: MaxKsyunz --- .../opensearch/sql/planner/physical/RemoveOperatorTest.java | 3 +-- .../org/opensearch/sql/opensearch/executor/CursorTest.java | 4 ++-- .../opensearch/executor/OpenSearchExecutionEngineTest.java | 2 +- .../storage/script/ExpressionScriptEngineTest.java | 2 +- .../test/java/org/opensearch/sql/ppl/PPLServiceTest.java | 6 +++++- .../opensearch/sql/ppl/parser/AstStatementBuilderTest.java | 3 ++- .../test/java/org/opensearch/sql/sql/SQLServiceTest.java | 6 +++++- 7 files changed, 17 insertions(+), 9 deletions(-) diff --git a/core/src/test/java/org/opensearch/sql/planner/physical/RemoveOperatorTest.java b/core/src/test/java/org/opensearch/sql/planner/physical/RemoveOperatorTest.java index bf046bf0a6..1cc7d5532f 100644 --- a/core/src/test/java/org/opensearch/sql/planner/physical/RemoveOperatorTest.java +++ b/core/src/test/java/org/opensearch/sql/planner/physical/RemoveOperatorTest.java @@ -117,8 +117,7 @@ public void invalid_to_retrieve_schema_from_remove() { IllegalStateException exception = assertThrows(IllegalStateException.class, () -> plan.schema()); assertEquals( - "[BUG] schema can been only applied to ProjectOperator, " - + "instead of RemoveOperator(input=inputPlan, removeList=[response, referer])", + "[BUG] schema can been only applied to ProjectOperator, instead of RemoveOperator", exception.getMessage()); } } diff --git a/opensearch/src/test/java/org/opensearch/sql/opensearch/executor/CursorTest.java b/opensearch/src/test/java/org/opensearch/sql/opensearch/executor/CursorTest.java index 6b2a1a7c57..6833eb8e88 100644 --- a/opensearch/src/test/java/org/opensearch/sql/opensearch/executor/CursorTest.java +++ b/opensearch/src/test/java/org/opensearch/sql/opensearch/executor/CursorTest.java @@ -11,12 +11,12 @@ class CursorTest { @Test - void EmptyArrayIsNone() { + void emptyArrayIsNone() { Assertions.assertEquals(Cursor.None, new Cursor(new byte[]{})); } @Test - void ToStringIsArrayValue() { + void toStringIsArrayValue() { String cursorTxt = "This is a test"; Assertions.assertEquals(cursorTxt, new Cursor(cursorTxt.getBytes()).toString()); } diff --git a/opensearch/src/test/java/org/opensearch/sql/opensearch/executor/OpenSearchExecutionEngineTest.java b/opensearch/src/test/java/org/opensearch/sql/opensearch/executor/OpenSearchExecutionEngineTest.java index ff529a018f..7f01bc605b 100644 --- a/opensearch/src/test/java/org/opensearch/sql/opensearch/executor/OpenSearchExecutionEngineTest.java +++ b/opensearch/src/test/java/org/opensearch/sql/opensearch/executor/OpenSearchExecutionEngineTest.java @@ -36,10 +36,10 @@ import org.opensearch.sql.common.response.ResponseListener; import org.opensearch.sql.common.setting.Settings; import org.opensearch.sql.data.model.ExprValue; -import org.opensearch.sql.executor.PaginatedPlanCache; import org.opensearch.sql.executor.ExecutionContext; import org.opensearch.sql.executor.ExecutionEngine; import org.opensearch.sql.executor.ExecutionEngine.ExplainResponse; +import org.opensearch.sql.executor.PaginatedPlanCache; import org.opensearch.sql.opensearch.client.OpenSearchClient; import org.opensearch.sql.opensearch.data.value.OpenSearchExprValueFactory; import org.opensearch.sql.opensearch.executor.protector.OpenSearchExecutionProtector; diff --git a/opensearch/src/test/java/org/opensearch/sql/opensearch/storage/script/ExpressionScriptEngineTest.java b/opensearch/src/test/java/org/opensearch/sql/opensearch/storage/script/ExpressionScriptEngineTest.java index b106f396fb..a88d81c020 100644 --- a/opensearch/src/test/java/org/opensearch/sql/opensearch/storage/script/ExpressionScriptEngineTest.java +++ b/opensearch/src/test/java/org/opensearch/sql/opensearch/storage/script/ExpressionScriptEngineTest.java @@ -27,8 +27,8 @@ import org.opensearch.script.ScriptEngine; import org.opensearch.sql.expression.DSL; import org.opensearch.sql.expression.Expression; -import org.opensearch.sql.opensearch.storage.script.filter.ExpressionFilterScriptFactory; import org.opensearch.sql.expression.serialization.ExpressionSerializer; +import org.opensearch.sql.opensearch.storage.script.filter.ExpressionFilterScriptFactory; @DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) @ExtendWith(MockitoExtension.class) diff --git a/ppl/src/test/java/org/opensearch/sql/ppl/PPLServiceTest.java b/ppl/src/test/java/org/opensearch/sql/ppl/PPLServiceTest.java index ecac53a9c1..774143a348 100644 --- a/ppl/src/test/java/org/opensearch/sql/ppl/PPLServiceTest.java +++ b/ppl/src/test/java/org/opensearch/sql/ppl/PPLServiceTest.java @@ -26,6 +26,7 @@ import org.opensearch.sql.executor.ExecutionEngine.QueryResponse; import org.opensearch.sql.executor.PaginatedPlanCache; import org.opensearch.sql.executor.QueryService; +import org.opensearch.sql.executor.execution.PaginatedQueryService; import org.opensearch.sql.executor.execution.QueryPlanFactory; import org.opensearch.sql.opensearch.executor.Cursor; import org.opensearch.sql.ppl.antlr.PPLSyntaxParser; @@ -45,6 +46,9 @@ public class PPLServiceTest { @Mock private QueryService queryService; + @Mock + private PaginatedQueryService paginatedQueryService; + @Mock private ExecutionEngine.Schema schema; @@ -59,7 +63,7 @@ public void setUp() { queryManager = DefaultQueryManager.defaultQueryManager(); pplService = new PPLService(new PPLSyntaxParser(), queryManager, - new QueryPlanFactory(queryService, paginatedPlanCache)); + new QueryPlanFactory(queryService, paginatedQueryService, paginatedPlanCache)); } @After diff --git a/ppl/src/test/java/org/opensearch/sql/ppl/parser/AstStatementBuilderTest.java b/ppl/src/test/java/org/opensearch/sql/ppl/parser/AstStatementBuilderTest.java index cdb0e37ee5..de74e4932f 100644 --- a/ppl/src/test/java/org/opensearch/sql/ppl/parser/AstStatementBuilderTest.java +++ b/ppl/src/test/java/org/opensearch/sql/ppl/parser/AstStatementBuilderTest.java @@ -39,7 +39,8 @@ public void buildQueryStatement() { "search source=t a=1", new Query( project( - filter(relation("t"), compare("=", field("a"), intLiteral(1))), AllFields.of()), 0)); + filter(relation("t"), compare("=", field("a"), + intLiteral(1))), AllFields.of()), 0)); } @Test diff --git a/sql/src/test/java/org/opensearch/sql/sql/SQLServiceTest.java b/sql/src/test/java/org/opensearch/sql/sql/SQLServiceTest.java index 9fcf1fa098..62718800b1 100644 --- a/sql/src/test/java/org/opensearch/sql/sql/SQLServiceTest.java +++ b/sql/src/test/java/org/opensearch/sql/sql/SQLServiceTest.java @@ -28,6 +28,7 @@ import org.opensearch.sql.executor.ExecutionEngine.ExplainResponseNode; import org.opensearch.sql.executor.PaginatedPlanCache; import org.opensearch.sql.executor.QueryService; +import org.opensearch.sql.executor.execution.PaginatedQueryService; import org.opensearch.sql.executor.execution.QueryPlanFactory; import org.opensearch.sql.opensearch.executor.Cursor; import org.opensearch.sql.sql.antlr.SQLSyntaxParser; @@ -47,6 +48,9 @@ class SQLServiceTest { @Mock private QueryService queryService; + @Mock + private PaginatedQueryService paginatedQueryService; + @Mock private ExecutionEngine.Schema schema; @@ -57,7 +61,7 @@ class SQLServiceTest { public void setUp() { queryManager = DefaultQueryManager.defaultQueryManager(); sqlService = new SQLService(new SQLSyntaxParser(), queryManager, - new QueryPlanFactory(queryService, paginatedPlanCache)); + new QueryPlanFactory(queryService, paginatedQueryService, paginatedPlanCache)); } @AfterEach