Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL: Remove the last remaining server dependencies from jdbc #30771

Merged
14 changes: 4 additions & 10 deletions x-pack/plugin/sql/jdbc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,20 @@ dependencies {
compile (xpackProject('plugin:sql:sql-shared-client')) {
transitive = false
}
compile (xpackProject('plugin:sql:sql-proto')) {
compile (xpackProject('plugin:sql:sql-shared-proto')) {
transitive = false
}
} else {
bundled (xpackProject('plugin:sql:sql-shared-client')) {
transitive = false
}
bundled (xpackProject('plugin:sql:sql-proto')) {
bundled (xpackProject('plugin:sql:sql-shared-proto')) {
transitive = false
}
}
compile (project(':server')) {
transitive = false
}
compile (project(':libs:x-content')) {
transitive = false
}
compile "org.apache.lucene:lucene-core:${versions.lucene}"
compile 'joda-time:joda-time:2.9.9'
compile project(':libs:elasticsearch-core')
runtime "com.fasterxml.jackson.core:jackson-core:${versions.jackson}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll want ot see about blasting these too in a followup. I think just removing the server dep is good enough for one PR.

Expand All @@ -80,15 +76,13 @@ dependencies {
}

dependencyLicenses {
mapping from: /sql-proto.*/, to: 'elasticsearch'
mapping from: /sql-shared-proto.*/, to: 'elasticsearch'
mapping from: /sql-shared-client.*/, to: 'elasticsearch'
mapping from: /jackson-.*/, to: 'jackson'
mapping from: /lucene-.*/, to: 'lucene'
mapping from: /elasticsearch-core.*/, to: 'elasticsearch'
ignoreSha 'sql-proto'
ignoreSha 'sql-shared-proto'
ignoreSha 'sql-shared-client'
ignoreSha 'elasticsearch'
ignoreSha 'elasticsearch-core'
}

/*
Expand Down
475 changes: 0 additions & 475 deletions x-pack/plugin/sql/jdbc/licenses/lucene-LICENSE.txt

This file was deleted.

192 changes: 0 additions & 192 deletions x-pack/plugin/sql/jdbc/licenses/lucene-NOTICE.txt

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.common.xcontent.json.JsonXContent;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.sql.plugin.SqlQueryResponse;
import org.elasticsearch.xpack.sql.proto.Mode;
import org.joda.time.DateTime;
import org.joda.time.ReadableDateTime;

import java.sql.JDBCType;

Expand Down Expand Up @@ -51,7 +50,11 @@ private Object convertAsNative(Object value, JDBCType type) throws Exception {
XContentBuilder builder = JsonXContent.contentBuilder();
builder.startObject();
builder.field("value");
SqlQueryResponse.value(builder, Mode.JDBC, value);
if (value instanceof ReadableDateTime) {
builder.value(((ReadableDateTime) value).getMillis());
} else {
builder.value(value);
}
builder.endObject();
builder.close();
Object copy = XContentHelper.convertToMap(BytesReference.bytes(builder), false, builder.contentType()).v2().get("value");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.elasticsearch.xpack.sql.client.HttpClient;
import org.elasticsearch.xpack.sql.client.shared.ClientException;
import org.elasticsearch.xpack.sql.client.shared.Version;
import org.elasticsearch.xpack.sql.plugin.AbstractSqlQueryRequest;
import org.elasticsearch.xpack.sql.proto.MainResponse;
import org.elasticsearch.xpack.sql.proto.Protocol;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class CliSessionTests extends ESTestCase {
public void testProperConnection() throws Exception {
HttpClient httpClient = mock(HttpClient.class);
when(httpClient.serverInfo()).thenReturn(new MainResponse(randomAlphaOfLength(5), org.elasticsearch.Version.CURRENT.toString(),
ClusterName.DEFAULT.value(), UUIDs.randomBase64UUID(), Build.CURRENT));
ClusterName.DEFAULT.value(), UUIDs.randomBase64UUID()));
CliSession cliSession = new CliSession(httpClient);
cliSession.checkConnection();
verify(httpClient, times(1)).serverInfo();
Expand Down Expand Up @@ -58,7 +58,7 @@ public void testWrongServerVersion() throws Exception {
}
when(httpClient.serverInfo()).thenReturn(new MainResponse(randomAlphaOfLength(5),
org.elasticsearch.Version.fromString(major + "." + minor + ".23").toString(),
ClusterName.DEFAULT.value(), UUIDs.randomBase64UUID(), Build.CURRENT));
ClusterName.DEFAULT.value(), UUIDs.randomBase64UUID()));
CliSession cliSession = new CliSession(httpClient);
expectThrows(ClientException.class, cliSession::checkConnection);
verify(httpClient, times(1)).serverInfo();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void testShowInfo() throws Exception {
HttpClient client = mock(HttpClient.class);
CliSession cliSession = new CliSession(client);
when(client.serverInfo()).thenReturn(new MainResponse("my_node", "1.2.3",
new ClusterName("my_cluster").value(), UUIDs.randomBase64UUID(), Build.CURRENT));
new ClusterName("my_cluster").value(), UUIDs.randomBase64UUID()));
ServerInfoCliCommand cliCommand = new ServerInfoCliCommand();
assertTrue(cliCommand.handle(testTerminal, cliSession, "info"));
assertEquals(testTerminal.toString(), "Node:<em>my_node</em> Cluster:<em>my_cluster</em> Version:<em>1.2.3</em>\n");
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugin/sql/sql-proto/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies {
compile (project(':libs:x-content')) {
transitive = false
}
compile xpackProject('plugin:sql:sql-shared-proto')
compile "org.apache.lucene:lucene-core:${versions.lucene}"
compile 'joda-time:joda-time:2.9.9'
runtime "com.fasterxml.jackson.core:jackson-core:${versions.jackson}"
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugin/sql/sql-shared-client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ apply plugin: 'elasticsearch.build'
description = 'Code shared between jdbc and cli'

dependencies {
compile xpackProject('plugin:sql:sql-proto')
compile xpackProject('plugin:sql:sql-shared-proto')
compile "com.fasterxml.jackson.core:jackson-core:${versions.jackson}"
testCompile "org.elasticsearch.test:framework:${version}"
}

dependencyLicenses {
mapping from: /jackson-.*/, to: 'jackson'
mapping from: /sql-proto.*/, to: 'elasticsearch'
mapping from: /sql-shared-proto.*/, to: 'elasticsearch'
mapping from: /elasticsearch-cli.*/, to: 'elasticsearch'
mapping from: /elasticsearch-core.*/, to: 'elasticsearch'
mapping from: /lucene-.*/, to: 'lucene'
Expand Down
Loading