Skip to content

Commit

Permalink
Fix checkstyle issues in tests
Browse files Browse the repository at this point in the history
Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
  • Loading branch information
MaxKsyunz committed Feb 17, 2023
1 parent f1108ba commit c8b406b
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion ppl/src/test/java/org/opensearch/sql/ppl/PPLServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -45,6 +46,9 @@ public class PPLServiceTest {
@Mock
private QueryService queryService;

@Mock
private PaginatedQueryService paginatedQueryService;

@Mock
private ExecutionEngine.Schema schema;

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion sql/src/test/java/org/opensearch/sql/sql/SQLServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -47,6 +48,9 @@ class SQLServiceTest {
@Mock
private QueryService queryService;

@Mock
private PaginatedQueryService paginatedQueryService;

@Mock
private ExecutionEngine.Schema schema;

Expand All @@ -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
Expand Down

0 comments on commit c8b406b

Please sign in to comment.