Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
Signed-off-by: Peng Huo <[email protected]>
  • Loading branch information
penghuo committed Feb 6, 2024
1 parent 2cba3c8 commit 671ca08
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public enum Key {
SESSION_INACTIVITY_TIMEOUT_MILLIS(
"plugins.query.executionengine.spark.session_inactivity_timeout_millis"),

/** Async query Settings **/
/** Async query Settings * */
ASYNC_QUERY_ENABLED("plugins.query.executionengine.async_query.enabled");

@Getter private final String keyValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void asyncQueryEnabledSettingsTest() throws IOException {
String query = "select 1";
Response response = null;
try {
executeAsyncQueryToString (query);
executeAsyncQueryToString(query);
} catch (ResponseException ex) {
response = ex.getResponse();
}
Expand All @@ -60,11 +60,15 @@ protected String executeAsyncQueryToString(String query) throws IOException {
protected Request buildAsyncRequest(String query, String endpoint) {
Request request = new Request("POST", endpoint);
request.setJsonEntity(String.format(Locale.ROOT, "{\n" + " \"query\": \"%s\"\n" + "}", query));
request.setJsonEntity(String.format(Locale.ROOT, "{\n" +
" \"datasource\": \"mys3\",\n" +
" \"lang\": \"sql\",\n" +
" \"query\": \"%s\"\n" +
"}", query));
request.setJsonEntity(
String.format(
Locale.ROOT,
"{\n"
+ " \"datasource\": \"mys3\",\n"
+ " \"lang\": \"sql\",\n"
+ " \"query\": \"%s\"\n"
+ "}",
query));

RequestOptions.Builder restOptionsBuilder = RequestOptions.DEFAULT.toBuilder();
restOptionsBuilder.addHeader("Content-Type", "application/json");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@ protected void doExecute(
ActionListener<CreateAsyncQueryActionResponse> listener) {
try {
if (!(Boolean) pluginSettings.getSettingValue(Settings.Key.ASYNC_QUERY_ENABLED)) {
listener.onFailure(new IllegalAccessException(String.format(Locale.ROOT, "%s setting is " +
"false",
Settings.Key.ASYNC_QUERY_ENABLED.getKeyValue())));
listener.onFailure(
new IllegalAccessException(
String.format(
Locale.ROOT,
"%s setting is " + "false",
Settings.Key.ASYNC_QUERY_ENABLED.getKeyValue())));
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ public class TransportCreateAsyncQueryRequestActionTest {
public void setUp() {
action =
new TransportCreateAsyncQueryRequestAction(
transportService, new ActionFilters(new HashSet<>()), jobExecutorService, pluginSettings);
transportService,
new ActionFilters(new HashSet<>()),
jobExecutorService,
pluginSettings);
}

@Test
Expand Down Expand Up @@ -125,7 +128,8 @@ public void asyncQueryDisabled() {
Mockito.verify(actionListener).onFailure(exceptionArgumentCaptor.capture());
Exception exception = exceptionArgumentCaptor.getValue();
Assertions.assertTrue(exception instanceof IllegalAccessException);
Assertions.assertEquals("plugins.query.executionengine.async_query.enabled " +
"setting is false", exception.getMessage());
Assertions.assertEquals(
"plugins.query.executionengine.async_query.enabled " + "setting is false",
exception.getMessage());
}
}

0 comments on commit 671ca08

Please sign in to comment.