Skip to content

Commit 7f946e2

Browse files
author
Luegg
committed
address comments
1 parent 7d5a577 commit 7f946e2

File tree

6 files changed

+54
-10
lines changed

6 files changed

+54
-10
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
package org.elasticsearch.xpack.sql.qa.jdbc.security;
9+
10+
import org.elasticsearch.common.settings.Settings;
11+
import org.elasticsearch.xpack.sql.qa.jdbc.JdbcWarningsTestCase;
12+
13+
import java.util.Properties;
14+
15+
public class JdbcWarningsIT extends JdbcWarningsTestCase {
16+
17+
@Override
18+
protected Settings restClientSettings() {
19+
return JdbcConnectionIT.securitySettings();
20+
}
21+
22+
@Override
23+
protected String getProtocol() {
24+
return JdbcConnectionIT.SSL_ENABLED ? "https" : "http";
25+
}
26+
27+
@Override
28+
protected Properties connectionProperties() {
29+
Properties properties = super.connectionProperties();
30+
properties.putAll(JdbcSecurityUtils.adminProperties());
31+
return properties;
32+
}
33+
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
package org.elasticsearch.xpack.sql.qa.jdbc.single_node;
9+
10+
import org.elasticsearch.xpack.sql.qa.jdbc.JdbcWarningsTestCase;
11+
12+
public class JdbcWarningsIT extends JdbcWarningsTestCase {}
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@
55
* 2.0.
66
*/
77

8-
package org.elasticsearch.xpack.sql.qa.single_node;
9-
10-
import org.elasticsearch.xpack.sql.qa.jdbc.JdbcIntegrationTestCase;
8+
package org.elasticsearch.xpack.sql.qa.jdbc;
119

1210
import java.sql.Connection;
1311
import java.sql.ResultSet;
1412
import java.sql.Statement;
1513

16-
public class JdbcWarningsIT extends JdbcIntegrationTestCase {
14+
public abstract class JdbcWarningsTestCase extends JdbcIntegrationTestCase {
1715

1816
public void testDeprecationWarningsDoNotReachJdbcDriver() throws Exception {
1917
index("test_data", b -> b.field("foo", 1));

x-pack/plugin/sql/qa/server/single-node/src/test/java/org/elasticsearch/xpack/sql/qa/single_node/RestSqlDeprecationIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void testFrozenSyntaxIsDeprecatedInFromClause() throws IOException {
4242
testFrozenSyntaxIsDeprecated("SELECT * FROM FROZEN test", "FROZEN");
4343
}
4444

45-
public void testFrozenSyntaxIsDeprecated(String query, String syntax) throws IOException {
45+
private void testFrozenSyntaxIsDeprecated(String query, String syntax) throws IOException {
4646
testDeprecationWarning(
4747
query(query).mode(randomMode()),
4848
"["
@@ -52,7 +52,7 @@ public void testFrozenSyntaxIsDeprecated(String query, String syntax) throws IOE
5252
);
5353
}
5454

55-
public void testDeprecationWarning(RequestObjectBuilder query, String warning) throws IOException {
55+
private void testDeprecationWarning(RequestObjectBuilder query, String warning) throws IOException {
5656
index("{\"foo\": 1}");
5757

5858
Request request = new Request("POST", SQL_QUERY_REST_ENDPOINT);

x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/parser/CommandBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public Object visitShowTables(ShowTablesContext ctx) {
122122
String index = ti != null ? ti.qualifiedIndex() : null;
123123

124124
boolean includeFrozen = ctx.FROZEN() != null;
125-
warnDeprecatedFrozenSyntax(includeFrozen, "INCLUDE FROZEN");
125+
maybeWarnDeprecatedFrozenSyntax(includeFrozen, "INCLUDE FROZEN");
126126

127127
return new ShowTables(
128128
source(ctx),
@@ -145,7 +145,7 @@ public Object visitShowColumns(ShowColumnsContext ctx) {
145145
String index = ti != null ? ti.qualifiedIndex() : null;
146146

147147
boolean includeFrozen = ctx.FROZEN() != null;
148-
warnDeprecatedFrozenSyntax(includeFrozen, "INCLUDE FROZEN");
148+
maybeWarnDeprecatedFrozenSyntax(includeFrozen, "INCLUDE FROZEN");
149149

150150
return new ShowColumns(source(ctx), string(ctx.cluster), index, visitLikePattern(ctx.tableLike), includeFrozen);
151151
}

x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/parser/LogicalPlanBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ abstract class LogicalPlanBuilder extends ExpressionBuilder {
7676
private static final String FROZEN_DEPRECATION_WARNING = "[{}] syntax is deprecated because frozen indices have been deprecated. "
7777
+ "Consider cold or frozen tiers in place of frozen indices.";
7878

79-
protected void warnDeprecatedFrozenSyntax(boolean includeFrozen, String syntax) {
79+
protected void maybeWarnDeprecatedFrozenSyntax(boolean includeFrozen, String syntax) {
8080
if (includeFrozen) {
8181
DEPRECATION_LOGGER.warn(DeprecationCategory.PARSING, "include_frozen_syntax", format(null, FROZEN_DEPRECATION_WARNING, syntax));
8282
}
@@ -282,7 +282,7 @@ public LogicalPlan visitTableName(TableNameContext ctx) {
282282
String alias = visitQualifiedName(ctx.qualifiedName());
283283
TableIdentifier tableIdentifier = visitTableIdentifier(ctx.tableIdentifier());
284284
boolean includeFrozen = ctx.FROZEN() != null;
285-
warnDeprecatedFrozenSyntax(includeFrozen, "FROZEN");
285+
maybeWarnDeprecatedFrozenSyntax(includeFrozen, "FROZEN");
286286
return new UnresolvedRelation(source(ctx), tableIdentifier, alias, includeFrozen);
287287
}
288288

0 commit comments

Comments
 (0)