Remove some checkstyle suppressions
Original commit: elastic/x-pack-elasticsearch@a1d89e2916
This commit is contained in:
parent
cd1c78feaf
commit
3d70d7b64e
|
@ -9,7 +9,9 @@
|
||||||
<suppress files="sql[/\\]server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]sql[/\\]parser[/\\]SqlBase(Base(Listener|Visitor)|Lexer|Listener|Parser|Visitor).java" checks="." />
|
<suppress files="sql[/\\]server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]sql[/\\]parser[/\\]SqlBase(Base(Listener|Visitor)|Lexer|Listener|Parser|Visitor).java" checks="." />
|
||||||
|
|
||||||
<!-- NOCOMMIT Temporary-->
|
<!-- NOCOMMIT Temporary-->
|
||||||
<suppress files="sql[/\\].*.java" checks="LineLength" />
|
<suppress files="sql[/\\]jdbc[/\\].*.java" checks="LineLength" />
|
||||||
|
<suppress files="sql[/\\]jdbc-proto[/\\].*.java" checks="LineLength" />
|
||||||
|
<suppress files="sql[/\\]server[/\\].*.java" checks="LineLength" />
|
||||||
<suppress files="sql[/\\]server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]sql[/\\]expression[/\\].*.java" checks="EqualsHashCode" />
|
<suppress files="sql[/\\]server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]sql[/\\]expression[/\\].*.java" checks="EqualsHashCode" />
|
||||||
|
|
||||||
<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" />
|
||||||
|
|
|
@ -52,7 +52,7 @@ class HttpClient {
|
||||||
try {
|
try {
|
||||||
return AccessController.doPrivileged((PrivilegedAction<Bytes>) () -> {
|
return AccessController.doPrivileged((PrivilegedAction<Bytes>) () -> {
|
||||||
return JreHttpUrlConnection.http(url(path), cfg, con -> {
|
return JreHttpUrlConnection.http(url(path), cfg, con -> {
|
||||||
return con.put(os);
|
return con.post(os);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (ClientException ex) {
|
} catch (ClientException ex) {
|
||||||
|
|
|
@ -27,7 +27,8 @@ class CliProtoHandler extends ProtoHandler<Response> {
|
||||||
|
|
||||||
CliProtoHandler(Client client) {
|
CliProtoHandler(Client client) {
|
||||||
super(client, in -> null, CliServerProtoUtils::write);
|
super(client, in -> null, CliServerProtoUtils::write);
|
||||||
this.server = new CliServer(TestUtils.planExecutor(client), clusterName, () -> info.getNode().getName(), info.getVersion(), info.getBuild());
|
this.server = new CliServer(TestUtils.planExecutor(client), clusterName, () -> info.getNode().getName(), info.getVersion(),
|
||||||
|
info.getBuild());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -105,11 +105,13 @@ public class ProtoTests extends ESTestCase {
|
||||||
"SELECT salary s, EXP(LOG(salary)) m FROM emp.emp LIMIT 5",
|
"SELECT salary s, EXP(LOG(salary)) m FROM emp.emp LIMIT 5",
|
||||||
"SELECT salary s, ROUND(EXP(LOG(salary))) m FROM emp.emp LIMIT 5",
|
"SELECT salary s, ROUND(EXP(LOG(salary))) m FROM emp.emp LIMIT 5",
|
||||||
"SELECT salary s, ROUND(EXP(LOG(salary))) m FROM emp.emp ORDER BY ROUND(LOG(emp_no)) LIMIT 5",
|
"SELECT salary s, ROUND(EXP(LOG(salary))) m FROM emp.emp ORDER BY ROUND(LOG(emp_no)) LIMIT 5",
|
||||||
"SELECT year(birth_date) year, last_name l, first_name f FROM emp.emp WHERE year(birth_date) <=1960 AND tenure < 25 ORDER BY year LIMIT 5",
|
"SELECT year(birth_date) year, last_name l, first_name f "
|
||||||
|
+ "FROM emp.emp WHERE year(birth_date) <=1960 AND tenure < 25 ORDER BY year LIMIT 5",
|
||||||
"SELECT COUNT(*) FROM emp.emp",
|
"SELECT COUNT(*) FROM emp.emp",
|
||||||
"SELECT COUNT(*) FROM emp.emp WHERE emp_no >= 10010",
|
"SELECT COUNT(*) FROM emp.emp WHERE emp_no >= 10010",
|
||||||
"SELECT tenure, COUNT(*) count, MIN(salary) min, AVG(salary) avg, MAX(salary) max FROM emp.emp GROUP BY tenure",
|
"SELECT tenure, COUNT(*) count, MIN(salary) min, AVG(salary) avg, MAX(salary) max FROM emp.emp GROUP BY tenure",
|
||||||
"SELECT YEAR(birth_date) born, COUNT(*) count, MIN(salary) min, AVG(salary) avg, MAX(salary) max FROM emp.emp GROUP BY born",
|
"SELECT YEAR(birth_date) born, COUNT(*) count, MIN(salary) min, AVG(salary) avg, MAX(salary) max "
|
||||||
|
+ "FROM emp.emp GROUP BY born",
|
||||||
"SELECT tenure, gender, COUNT(tenure) count, AVG(salary) avg FROM emp.emp GROUP BY tenure, gender HAVING avg > 50000",
|
"SELECT tenure, gender, COUNT(tenure) count, AVG(salary) avg FROM emp.emp GROUP BY tenure, gender HAVING avg > 50000",
|
||||||
"SELECT gender, tenure, AVG(salary) avg FROM emp.emp GROUP BY gender, tenure HAVING avg > 50000 ORDER BY tenure DESC",
|
"SELECT gender, tenure, AVG(salary) avg FROM emp.emp GROUP BY gender, tenure HAVING avg > 50000 ORDER BY tenure DESC",
|
||||||
// nested docs
|
// nested docs
|
||||||
|
@ -117,7 +119,8 @@ public class ProtoTests extends ESTestCase {
|
||||||
"SELECT dep FROM emp.emp",
|
"SELECT dep FROM emp.emp",
|
||||||
"SELECT dep.dept_name, first_name, last_name FROM emp.emp WHERE emp_no = 10020",
|
"SELECT dep.dept_name, first_name, last_name FROM emp.emp WHERE emp_no = 10020",
|
||||||
"SELECT first_name f, last_name l, dep.from_date FROM emp.emp WHERE dep.dept_name = 'Production' ORDER BY dep.from_date",
|
"SELECT first_name f, last_name l, dep.from_date FROM emp.emp WHERE dep.dept_name = 'Production' ORDER BY dep.from_date",
|
||||||
"SELECT first_name f, last_name l, YEAR(dep.from_date) start FROM emp.emp WHERE dep.dept_name = 'Production' AND tenure > 30 ORDER BY start"
|
"SELECT first_name f, last_name l, YEAR(dep.from_date) start "
|
||||||
|
+ "FROM emp.emp WHERE dep.dept_name = 'Production' AND tenure > 30 ORDER BY start"
|
||||||
);
|
);
|
||||||
|
|
||||||
for (String c : commands) {
|
for (String c : commands) {
|
||||||
|
|
|
@ -66,7 +66,7 @@ class HttpClient {
|
||||||
try {
|
try {
|
||||||
return AccessController.doPrivileged((PrivilegedAction<BytesArray>) () -> {
|
return AccessController.doPrivileged((PrivilegedAction<BytesArray>) () -> {
|
||||||
return JreHttpUrlConnection.http(url(path), cfg, con -> {
|
return JreHttpUrlConnection.http(url(path), cfg, con -> {
|
||||||
return new BytesArray(con.put(os));
|
return new BytesArray(con.post(os));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (ClientException ex) {
|
} catch (ClientException ex) {
|
||||||
|
|
|
@ -21,6 +21,11 @@ import java.util.function.Function;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
public class JreHttpUrlConnection implements Closeable {
|
public class JreHttpUrlConnection implements Closeable {
|
||||||
|
public static <R> R http(URL url, ConnectionConfiguration cfg, Function<JreHttpUrlConnection, R> handler) {
|
||||||
|
try (JreHttpUrlConnection con = new JreHttpUrlConnection(url, cfg)) {
|
||||||
|
return handler.apply(con);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean closed = false;
|
private boolean closed = false;
|
||||||
final HttpURLConnection con;
|
final HttpURLConnection con;
|
||||||
|
@ -56,7 +61,7 @@ public class JreHttpUrlConnection implements Closeable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bytes put(CheckedConsumer<DataOutput, IOException> doc) throws ClientException { // NOCOMMIT why is this called put when it is a post?
|
public Bytes post(CheckedConsumer<DataOutput, IOException> doc) throws ClientException {
|
||||||
try {
|
try {
|
||||||
con.setRequestMethod("POST");
|
con.setRequestMethod("POST");
|
||||||
con.setDoOutput(true);
|
con.setDoOutput(true);
|
||||||
|
@ -65,10 +70,12 @@ public class JreHttpUrlConnection implements Closeable {
|
||||||
doc.accept(new DataOutputStream(out));
|
doc.accept(new DataOutputStream(out));
|
||||||
}
|
}
|
||||||
if (con.getResponseCode() >= 500) {
|
if (con.getResponseCode() >= 500) {
|
||||||
throw new ClientException("Server error: %s(%d;%s)", con.getResponseMessage(), con.getResponseCode(), IOUtils.asBytes(getStream(con, con.getErrorStream())).toString());
|
throw new ClientException("Server error: %s(%d;%s)", con.getResponseMessage(), con.getResponseCode(),
|
||||||
|
IOUtils.asBytes(getStream(con, con.getErrorStream())).toString());
|
||||||
}
|
}
|
||||||
if (con.getResponseCode() >= 400) {
|
if (con.getResponseCode() >= 400) {
|
||||||
throw new ClientException("Client error: %s(%d;%s)", con.getResponseMessage(), con.getResponseCode(), IOUtils.asBytes(getStream(con, con.getErrorStream())).toString());
|
throw new ClientException("Client error: %s(%d;%s)", con.getResponseMessage(), con.getResponseCode(),
|
||||||
|
IOUtils.asBytes(getStream(con, con.getErrorStream())).toString());
|
||||||
}
|
}
|
||||||
return IOUtils.asBytes(getStream(con, con.getInputStream()));
|
return IOUtils.asBytes(getStream(con, con.getInputStream()));
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
|
@ -128,14 +135,4 @@ public class JreHttpUrlConnection implements Closeable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// main call class
|
|
||||||
//
|
|
||||||
|
|
||||||
public static <R> R http(URL url, ConnectionConfiguration cfg, Function<JreHttpUrlConnection, R> handler) {
|
|
||||||
try (JreHttpUrlConnection con = new JreHttpUrlConnection(url, cfg)) {
|
|
||||||
return handler.apply(con);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue