More nocommits and some checkstyle suppressions

Original commit: elastic/x-pack-elasticsearch@003d5e3aca
This commit is contained in:
Nik Everett 2017-06-21 17:42:59 -04:00
parent 0ffc0b5662
commit ea1be31d27
6 changed files with 12 additions and 19 deletions

View File

@ -5,6 +5,12 @@
<suppressions> <suppressions>
<!-- On Windows, Checkstyle matches files using \ path separator --> <!-- On Windows, Checkstyle matches files using \ path separator -->
<!-- These files are generated by ANTLR so its silly to hold them to our rules. -->
<suppress files="plugin[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]sql[/\\]parser[/\\]SqlBase(Base(Listener|Visitor)|Lexer|Listener|Parser|Visitor).java" checks="." />
<!-- NOCOMMIT Temporary-->
<suppress files="plugin[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]sql[/\\].*.java" checks="." />
<suppress files="plugin[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]common[/\\]action[/\\]XPackDeleteByQueryAction.java" checks="LineLength" /> <suppress files="plugin[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]common[/\\]action[/\\]XPackDeleteByQueryAction.java" checks="LineLength" />
<suppress files="plugin[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]ml[/\\]action[/\\]StopDatafeedAction.java" checks="LineLength" /> <suppress files="plugin[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]ml[/\\]action[/\\]StopDatafeedAction.java" checks="LineLength" />
<suppress files="plugin[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]ml[/\\]utils[/\\]DomainSplitFunction.java" checks="LineLength" /> <suppress files="plugin[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]ml[/\\]utils[/\\]DomainSplitFunction.java" checks="LineLength" />

View File

@ -5,35 +5,18 @@
*/ */
package org.elasticsearch.xpack.sql; package org.elasticsearch.xpack.sql;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.xpack.sql.analysis.catalog.EsCatalog; import org.elasticsearch.xpack.sql.analysis.catalog.EsCatalog;
import org.elasticsearch.xpack.sql.execution.PlanExecutor; import org.elasticsearch.xpack.sql.execution.PlanExecutor;
import org.elasticsearch.xpack.sql.plugin.cli.http.CliUtils;
import org.elasticsearch.xpack.sql.session.RowSetCursor;
public class TestUtils { public class TestUtils {
// NOCOMMIT I think these may not be needed if we switch to integration tests for the protos
public static PlanExecutor planExecutor(Client client) { public static PlanExecutor planExecutor(Client client) {
PlanExecutor executor = new PlanExecutor(client, PlanExecutor executor = new PlanExecutor(client,
() -> client.admin().cluster().prepareState().get(TimeValue.timeValueMinutes(1)).getState()); () -> client.admin().cluster().prepareState().get(TimeValue.timeValueMinutes(1)).getState());
((EsCatalog) executor.catalog()).setIndexNameExpressionResolver(new IndexNameExpressionResolver(client.settings())); ((EsCatalog) executor.catalog()).setIndexNameExpressionResolver(new IndexNameExpressionResolver(client.settings()));
return executor; return executor;
} }
public static void sqlOut(PlanExecutor executor, String sql) {
executor.sql(sql, new ActionListener<RowSetCursor>() {
@Override
public void onResponse(RowSetCursor cursor) {
System.out.println(CliUtils.toString(cursor));
}
@Override
public void onFailure(Exception ex) {
throw ex instanceof RuntimeException ? (RuntimeException) ex : new SqlException(ex);
}
});
}
} }

View File

@ -15,6 +15,7 @@ import org.elasticsearch.xpack.sql.net.client.util.ObjectUtils;
// The protocol is very similar (a subset) to the JDBC driver // The protocol is very similar (a subset) to the JDBC driver
// //
// To simplify things, the protocol is NOT meant to be backwards compatible. // To simplify things, the protocol is NOT meant to be backwards compatible.
//NOCOMMIT the protocol kind of should be backwards compatible though....
// //
public interface Proto { public interface Proto {

View File

@ -26,6 +26,8 @@ import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.startsWith; import static org.hamcrest.Matchers.startsWith;
public class ProtoTests extends ESTestCase { public class ProtoTests extends ESTestCase {
// NOCOMMIT maybe this should be moved to an integration test inside the plugin
private static Client esClient; private static Client esClient;
private static CliHttpServer server; private static CliHttpServer server;
private static HttpCliClient client; private static HttpCliClient client;

View File

@ -28,6 +28,7 @@ import static java.util.Collections.emptyMap;
// The proto is based around a simple, single request-response model. // The proto is based around a simple, single request-response model.
// Note the field order is _important_. // Note the field order is _important_.
// To simplify things, the protocol is not meant to be backwards compatible. // To simplify things, the protocol is not meant to be backwards compatible.
// NOCOMMIT the protocol kind of should be backwards compatible though....
// //
public interface Proto { public interface Proto {

View File

@ -40,7 +40,7 @@ import static org.hamcrest.Matchers.startsWith;
public class ProtoTests extends ESTestCase { public class ProtoTests extends ESTestCase {
// NOCOMMIT investigate switching to ESRestTestCase and making an integration test. // NOCOMMIT maybe this should be moved to an integration test inside the plugin
private static Client esClient; private static Client esClient;
private static JdbcHttpServer server; private static JdbcHttpServer server;