diff --git a/benchmarks/build.gradle b/benchmarks/build.gradle
index bd80deda89c6f..e7ee5a059ab37 100644
--- a/benchmarks/build.gradle
+++ b/benchmarks/build.gradle
@@ -30,7 +30,7 @@ buildscript {
apply plugin: 'elasticsearch.build'
-// order of this seciont matters, see: https://github.com/johnrengelman/shadow/issues/336
+// order of this section matters, see: https://github.com/johnrengelman/shadow/issues/336
apply plugin: 'application' // have the shadow plugin provide the runShadow task
mainClassName = 'org.openjdk.jmh.Main'
apply plugin: 'com.github.johnrengelman.shadow' // build an uberjar with all benchmarks
diff --git a/build.gradle b/build.gradle
index 9bb08cf29dbbc..862943b50f5eb 100644
--- a/build.gradle
+++ b/build.gradle
@@ -326,6 +326,9 @@ gradle.projectsEvaluated {
// :test:framework:test cannot run before and after :server:test
return
}
+ if (tasks.findByPath('test') != null && tasks.findByPath('integTest') != null) {
+ integTest.mustRunAfter test
+ }
configurations.all { Configuration configuration ->
/*
* The featureAwarePlugin configuration has a dependency on x-pack:plugin:core and x-pack:plugin:core has a dependency on the
@@ -575,3 +578,28 @@ gradle.projectsEvaluated {
}
}
}
+
+if (System.properties.get("build.compare") != null) {
+ apply plugin: 'compare-gradle-builds'
+ compareGradleBuilds {
+ ext.referenceProject = System.properties.get("build.compare")
+ doFirst {
+ if (file(referenceProject).exists() == false) {
+ throw new GradleException(
+ "Use git worktree to check out a version to compare against to ../elasticsearch_build_reference"
+ )
+ }
+ }
+ sourceBuild {
+ gradleVersion = "4.7" // does not default to gradle weapper of project dir, but current version
+ projectDir = referenceProject
+ tasks = ["clean", "assemble"]
+ arguments = ["-Dbuild.compare_friendly=true"]
+ }
+ targetBuild {
+ tasks = ["clean", "assemble"]
+ // use -Dorg.gradle.java.home= to alter jdk versions
+ arguments = ["-Dbuild.compare_friendly=true"]
+ }
+ }
+}
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
index 5256968b6ca3e..9ae86a661cea2 100644
--- a/buildSrc/build.gradle
+++ b/buildSrc/build.gradle
@@ -17,11 +17,13 @@
* under the License.
*/
-import java.nio.file.Files
-import org.gradle.util.GradleVersion
+import java.nio.file.Files
-apply plugin: 'groovy'
+plugins {
+ id 'java-gradle-plugin'
+ id 'groovy'
+}
group = 'org.elasticsearch.gradle'
@@ -83,9 +85,10 @@ repositories {
}
dependencies {
- compile gradleApi()
compile localGroovy()
compile "com.carrotsearch.randomizedtesting:junit4-ant:${props.getProperty('randomizedrunner')}"
+ compile "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${props.getProperty('randomizedrunner')}"
+
compile("junit:junit:${props.getProperty('junit')}") {
transitive = false
}
@@ -97,8 +100,10 @@ dependencies {
compile 'de.thetaphi:forbiddenapis:2.5'
compile 'org.apache.rat:apache-rat:0.11'
compile "org.elasticsearch:jna:4.5.1"
+ testCompile "junit:junit:${props.getProperty('junit')}"
}
+
// Gradle 2.14+ removed ProgressLogger(-Factory) classes from the public APIs
// Use logging dependency instead
// Gradle 4.3.1 stopped releasing the logging jars to jcenter, just use the last available one
@@ -106,7 +111,6 @@ GradleVersion logVersion = GradleVersion.current() > GradleVersion.version('4.3'
dependencies {
compileOnly "org.gradle:gradle-logging:${logVersion.getVersion()}"
- compile 'ru.vyarus:gradle-animalsniffer-plugin:1.2.0' // Gradle 2.14 requires a version > 1.0.1
}
/*****************************************************************************
@@ -114,14 +118,12 @@ dependencies {
*****************************************************************************/
// this will only happen when buildSrc is built on its own during build init
if (project == rootProject) {
-
repositories {
if (System.getProperty("repos.mavenLocal") != null) {
mavenLocal()
}
mavenCentral()
}
- test.exclude 'org/elasticsearch/test/NamingConventionsCheckBadClasses*'
}
/*****************************************************************************
@@ -146,9 +148,6 @@ if (project != rootProject) {
jarHell.enabled = false
thirdPartyAudit.enabled = false
- // test for elasticsearch.build tries to run with ES...
- test.enabled = false
-
// TODO: re-enable once randomizedtesting gradle code is published and removed from here
licenseHeaders.enabled = false
@@ -159,14 +158,7 @@ if (project != rootProject) {
}
namingConventions {
- testClass = 'org.elasticsearch.test.NamingConventionsCheckBadClasses$UnitTestCase'
- integTestClass = 'org.elasticsearch.test.NamingConventionsCheckBadClasses$IntegTestCase'
- }
-
- task namingConventionsMain(type: org.elasticsearch.gradle.precommit.NamingConventionsTask) {
- checkForTestsInMain = true
- testClass = namingConventions.testClass
- integTestClass = namingConventions.integTestClass
+ testClass = 'org.elasticsearch.gradle.test.GradleUnitTestCase'
+ integTestClass = 'org.elasticsearch.gradle.test.GradleIntegrationTestCase'
}
- precommit.dependsOn namingConventionsMain
}
diff --git a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
index c375f773bf9b5..24b66efbcef2c 100644
--- a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
+++ b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingPlugin.groovy
@@ -1,20 +1,44 @@
package com.carrotsearch.gradle.junit4
import com.carrotsearch.ant.tasks.junit4.JUnit4
-import org.gradle.api.AntBuilder
+import org.gradle.api.GradleException
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.Task
+import org.gradle.api.UnknownTaskException
import org.gradle.api.plugins.JavaBasePlugin
import org.gradle.api.tasks.TaskContainer
+import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.testing.Test
+import java.util.concurrent.atomic.AtomicBoolean
+
class RandomizedTestingPlugin implements Plugin {
+ static private AtomicBoolean sanityCheckConfigured = new AtomicBoolean(false)
+
void apply(Project project) {
setupSeed(project)
replaceTestTask(project.tasks)
configureAnt(project.ant)
+ configureSanityCheck(project)
+ }
+
+ private static void configureSanityCheck(Project project) {
+ // Check the task graph to confirm tasks were indeed replaced
+ // https://github.com/elastic/elasticsearch/issues/31324
+ if (sanityCheckConfigured.getAndSet(true) == false) {
+ project.rootProject.getGradle().getTaskGraph().whenReady {
+ List nonConforming = project.getGradle().getTaskGraph().allTasks
+ .findAll { it.name == "test" }
+ .findAll { (it instanceof RandomizedTestingTask) == false}
+ .collect { "${it.path} -> ${it.class}" }
+ if (nonConforming.isEmpty() == false) {
+ throw new GradleException("Found the ${nonConforming.size()} `test` tasks:" +
+ "\n ${nonConforming.join("\n ")}")
+ }
+ }
+ }
}
/**
@@ -45,29 +69,32 @@ class RandomizedTestingPlugin implements Plugin {
}
static void replaceTestTask(TaskContainer tasks) {
- Test oldTestTask = tasks.findByPath('test')
- if (oldTestTask == null) {
+ // Gradle 4.8 introduced lazy tasks, thus we deal both with the `test` task as well as it's provider
+ // https://github.com/gradle/gradle/issues/5730#issuecomment-398822153
+ // since we can't be sure if the task was ever realized, we remove both the provider and the task
+ TaskProvider oldTestProvider
+ try {
+ oldTestProvider = tasks.getByNameLater(Test, 'test')
+ } catch (UnknownTaskException unused) {
// no test task, ok, user will use testing task on their own
return
}
- tasks.remove(oldTestTask)
+ Test oldTestTask = oldTestProvider.get()
- Map properties = [
- name: 'test',
- type: RandomizedTestingTask,
- dependsOn: oldTestTask.dependsOn,
- group: JavaBasePlugin.VERIFICATION_GROUP,
- description: 'Runs unit tests with the randomized testing framework'
- ]
- RandomizedTestingTask newTestTask = tasks.create(properties)
- newTestTask.classpath = oldTestTask.classpath
- newTestTask.testClassesDir = oldTestTask.project.sourceSets.test.output.classesDir
- // since gradle 4.5, tasks immutable dependencies are "hidden" (do not show up in dependsOn)
- // so we must explicitly add a dependency on generating the test classpath
- newTestTask.dependsOn('testClasses')
+ // we still have to use replace here despite the remove above because the task container knows about the provider
+ // by the same name
+ RandomizedTestingTask newTestTask = tasks.replace('test', RandomizedTestingTask)
+ newTestTask.configure{
+ group = JavaBasePlugin.VERIFICATION_GROUP
+ description = 'Runs unit tests with the randomized testing framework'
+ dependsOn oldTestTask.dependsOn, 'testClasses'
+ classpath = oldTestTask.classpath
+ testClassesDirs = oldTestTask.project.sourceSets.test.output.classesDirs
+ }
// hack so check task depends on custom test
- Task checkTask = tasks.findByPath('check')
+ Task checkTask = tasks.getByName('check')
+ checkTask.dependsOn.remove(oldTestProvider)
checkTask.dependsOn.remove(oldTestTask)
checkTask.dependsOn.add(newTestTask)
}
diff --git a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingTask.groovy b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingTask.groovy
index 1817ea57e7abe..2b61165608d2d 100644
--- a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingTask.groovy
+++ b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingTask.groovy
@@ -6,18 +6,20 @@ import groovy.xml.NamespaceBuilder
import groovy.xml.NamespaceBuilderSupport
import org.apache.tools.ant.BuildException
import org.apache.tools.ant.DefaultLogger
+import org.apache.tools.ant.Project
import org.apache.tools.ant.RuntimeConfigurable
import org.apache.tools.ant.UnknownElement
+import org.elasticsearch.gradle.BuildPlugin
import org.gradle.api.DefaultTask
import org.gradle.api.InvalidUserDataException
import org.gradle.api.file.FileCollection
import org.gradle.api.file.FileTreeElement
-import org.gradle.api.internal.tasks.options.Option
import org.gradle.api.specs.Spec
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.TaskAction
+import org.gradle.api.tasks.options.Option
import org.gradle.api.tasks.util.PatternFilterable
import org.gradle.api.tasks.util.PatternSet
import org.gradle.internal.logging.progress.ProgressLoggerFactory
@@ -43,8 +45,8 @@ class RandomizedTestingTask extends DefaultTask {
@Input
String parallelism = '1'
- @InputDirectory
- File testClassesDir
+ @Input
+ FileCollection testClassesDirs
@Optional
@Input
@@ -220,7 +222,7 @@ class RandomizedTestingTask extends DefaultTask {
listener = new DefaultLogger(
errorPrintStream: System.err,
outputPrintStream: System.out,
- messageOutputLevel: org.apache.tools.ant.Project.MSG_INFO)
+ messageOutputLevel: Project.MSG_INFO)
} else {
// we want to buffer the info, and emit it if the test fails
antLoggingBuffer = new ByteArrayOutputStream()
@@ -228,7 +230,7 @@ class RandomizedTestingTask extends DefaultTask {
listener = new DefaultLogger(
errorPrintStream: stream,
outputPrintStream: stream,
- messageOutputLevel: org.apache.tools.ant.Project.MSG_INFO)
+ messageOutputLevel: Project.MSG_INFO)
}
project.ant.project.addBuildListener(listener)
}
@@ -251,12 +253,10 @@ class RandomizedTestingTask extends DefaultTask {
if (argLine != null) {
jvmarg(line: argLine)
}
- fileset(dir: testClassesDir) {
- for (String includePattern : patternSet.getIncludes()) {
- include(name: includePattern)
- }
- for (String excludePattern : patternSet.getExcludes()) {
- exclude(name: excludePattern)
+ testClassesDirs.each { testClassDir ->
+ fileset(dir: testClassDir) {
+ patternSet.getIncludes().each { include(name: it) }
+ patternSet.getExcludes().each { exclude(name: it) }
}
}
for (Map.Entry prop : systemProperties) {
diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy
index eb3cd1dc8c6da..8a2b1b798e163 100644
--- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy
@@ -348,7 +348,9 @@ class BuildPlugin implements Plugin {
// just a self contained test-fixture configuration, likely transitive and hellacious
return
}
- configuration.resolutionStrategy.failOnVersionConflict()
+ configuration.resolutionStrategy {
+ failOnVersionConflict()
+ }
})
// force all dependencies added directly to compile/testCompile to be non-transitive, except for ES itself
@@ -475,13 +477,17 @@ class BuildPlugin implements Plugin {
}
}
- project.tasks.withType(GenerateMavenPom.class) { GenerateMavenPom t ->
- // place the pom next to the jar it is for
- t.destination = new File(project.buildDir, "distributions/${project.archivesBaseName}-${project.version}.pom")
- // build poms with assemble (if the assemble task exists)
- Task assemble = project.tasks.findByName('assemble')
- if (assemble) {
- assemble.dependsOn(t)
+ // Work around Gradle 4.8 issue until we `enableFeaturePreview('STABLE_PUBLISHING')`
+ // https://github.com/gradle/gradle/issues/5696#issuecomment-396965185
+ project.getGradle().getTaskGraph().whenReady {
+ project.tasks.withType(GenerateMavenPom.class) { GenerateMavenPom t ->
+ // place the pom next to the jar it is for
+ t.destination = new File(project.buildDir, "distributions/${project.archivesBaseName}-${project.version}.pom")
+ // build poms with assemble (if the assemble task exists)
+ Task assemble = project.tasks.findByName('assemble')
+ if (assemble) {
+ assemble.dependsOn(t)
+ }
}
}
}
@@ -625,6 +631,10 @@ class BuildPlugin implements Plugin {
jarTask.manifest.attributes('Change': shortHash)
}
}
+ // Force manifest entries that change by nature to a constant to be able to compare builds more effectively
+ if (System.properties.getProperty("build.compare_friendly", "false") == "true") {
+ jarTask.manifest.getAttributes().clear()
+ }
}
// add license/notice files
project.afterEvaluate {
@@ -741,7 +751,7 @@ class BuildPlugin implements Plugin {
project.extensions.add('additionalTest', { String name, Closure config ->
RandomizedTestingTask additionalTest = project.tasks.create(name, RandomizedTestingTask.class)
additionalTest.classpath = test.classpath
- additionalTest.testClassesDir = test.testClassesDir
+ additionalTest.testClassesDirs = test.testClassesDirs
additionalTest.configure(commonTestConfig(project))
additionalTest.configure(config)
additionalTest.dependsOn(project.tasks.testClasses)
diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/LoggedExec.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/LoggedExec.groovy
deleted file mode 100644
index b1b04a2ded684..0000000000000
--- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/LoggedExec.groovy
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to Elasticsearch under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.elasticsearch.gradle
-
-import org.gradle.api.GradleException
-import org.gradle.api.tasks.Exec
-
-/**
- * A wrapper around gradle's Exec task to capture output and log on error.
- */
-class LoggedExec extends Exec {
-
- protected ByteArrayOutputStream output = new ByteArrayOutputStream()
-
- LoggedExec() {
- if (logger.isInfoEnabled() == false) {
- standardOutput = output
- errorOutput = output
- ignoreExitValue = true
- doLast {
- if (execResult.exitValue != 0) {
- output.toString('UTF-8').eachLine { line -> logger.error(line) }
- throw new GradleException("Process '${executable} ${args.join(' ')}' finished with non-zero exit value ${execResult.exitValue}")
- }
- }
- }
- }
-}
diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/LoggedExec.java b/buildSrc/src/main/groovy/org/elasticsearch/gradle/LoggedExec.java
new file mode 100644
index 0000000000000..7f51c4fb3987d
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/LoggedExec.java
@@ -0,0 +1,41 @@
+package org.elasticsearch.gradle;
+
+import groovy.lang.Closure;
+import org.gradle.api.GradleException;
+import org.gradle.api.Task;
+import org.gradle.api.tasks.Exec;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.stream.Collectors;
+
+/**
+ * A wrapper around gradle's Exec task to capture output and log on error.
+ */
+public class LoggedExec extends Exec {
+
+ protected ByteArrayOutputStream output = new ByteArrayOutputStream();
+
+ public LoggedExec() {
+ if (getLogger().isInfoEnabled() == false) {
+ setStandardOutput(output);
+ setErrorOutput(output);
+ setIgnoreExitValue(true);
+ doLast(new Closure(this, this) {
+ public void doCall(Task it) throws IOException {
+ if (getExecResult().getExitValue() != 0) {
+ for (String line : output.toString("UTF-8").split("\\R")) {
+ getLogger().error(line);
+ }
+ throw new GradleException(
+ "Process \'" + getExecutable() + " " +
+ getArgs().stream().collect(Collectors.joining(" "))+
+ "\' finished with non-zero exit value " +
+ String.valueOf(getExecResult().getExitValue())
+ );
+ }
+ }
+ });
+ }
+ }
+}
diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/VersionProperties.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/VersionProperties.groovy
deleted file mode 100644
index 6983d12872f23..0000000000000
--- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/VersionProperties.groovy
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to Elasticsearch under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.elasticsearch.gradle
-
-/**
- * Accessor for shared dependency versions used by elasticsearch, namely the elasticsearch and lucene versions.
- */
-class VersionProperties {
- static final Version elasticsearch
- static final String lucene
- static final Map versions = new HashMap<>()
- static {
- Properties props = new Properties()
- InputStream propsStream = VersionProperties.class.getResourceAsStream('/version.properties')
- if (propsStream == null) {
- throw new RuntimeException('/version.properties resource missing')
- }
- props.load(propsStream)
- elasticsearch = Version.fromString(props.getProperty('elasticsearch'))
- lucene = props.getProperty('lucene')
- for (String property : props.stringPropertyNames()) {
- versions.put(property, props.getProperty(property))
- }
- }
-}
diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/VersionProperties.java b/buildSrc/src/main/groovy/org/elasticsearch/gradle/VersionProperties.java
new file mode 100644
index 0000000000000..9ee597eb25ad8
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/VersionProperties.java
@@ -0,0 +1,50 @@
+package org.elasticsearch.gradle;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * Accessor for shared dependency versions used by elasticsearch, namely the elasticsearch and lucene versions.
+ */
+public class VersionProperties {
+ public static Version getElasticsearch() {
+ return elasticsearch;
+ }
+
+ public static String getLucene() {
+ return lucene;
+ }
+
+ public static Map getVersions() {
+ return versions;
+ }
+
+ private static final Version elasticsearch;
+ private static final String lucene;
+ private static final Map versions = new HashMap();
+ static {
+ Properties props = getVersionProperties();
+ elasticsearch = Version.fromString(props.getProperty("elasticsearch"));
+ lucene = props.getProperty("lucene");
+ for (String property : props.stringPropertyNames()) {
+ versions.put(property, props.getProperty(property));
+ }
+ }
+
+ private static Properties getVersionProperties() {
+ Properties props = new Properties();
+ InputStream propsStream = VersionProperties.class.getResourceAsStream("/version.properties");
+ if (propsStream == null) {
+ throw new RuntimeException("/version.properties resource missing");
+ }
+ try {
+ props.load(propsStream);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ return props;
+ }
+}
diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/RestTestsFromSnippetsTask.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/RestTestsFromSnippetsTask.groovy
index 3c056a5528b5e..f2105086f2553 100644
--- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/RestTestsFromSnippetsTask.groovy
+++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/RestTestsFromSnippetsTask.groovy
@@ -237,6 +237,18 @@ public class RestTestsFromSnippetsTask extends SnippetsTask {
current.println(" - stash_in_path")
current.println(" - stash_path_replace")
current.println(" - warnings")
+ if (test.testEnv != null) {
+ switch (test.testEnv) {
+ case 'basic':
+ case 'gold':
+ case 'platinum':
+ current.println(" - xpack")
+ break;
+ default:
+ throw new InvalidUserDataException('Unsupported testEnv: '
+ + test.testEnv)
+ }
+ }
}
if (test.skipTest) {
if (test.continued) {
diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/SnippetsTask.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/SnippetsTask.groovy
index 7132361e16361..ec012633f0893 100644
--- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/SnippetsTask.groovy
+++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/SnippetsTask.groovy
@@ -84,6 +84,7 @@ public class SnippetsTask extends DefaultTask {
Snippet snippet = null
StringBuilder contents = null
List substitutions = null
+ String testEnv = null
Closure emit = {
snippet.contents = contents.toString()
contents = null
@@ -143,10 +144,14 @@ public class SnippetsTask extends DefaultTask {
}
file.eachLine('UTF-8') { String line, int lineNumber ->
Matcher matcher
+ matcher = line =~ /\[testenv="([^"]+)"\]\s*/
+ if (matcher.matches()) {
+ testEnv = matcher.group(1)
+ }
if (line ==~ /-{4,}\s*/) { // Four dashes looks like a snippet
if (snippet == null) {
Path path = docs.dir.toPath().relativize(file.toPath())
- snippet = new Snippet(path: path, start: lineNumber)
+ snippet = new Snippet(path: path, start: lineNumber, testEnv: testEnv)
if (lastLanguageLine == lineNumber - 1) {
snippet.language = lastLanguage
}
@@ -297,6 +302,7 @@ public class SnippetsTask extends DefaultTask {
int start
int end = NOT_FINISHED
String contents
+ String testEnv
Boolean console = null
boolean test = false
@@ -321,6 +327,9 @@ public class SnippetsTask extends DefaultTask {
}
if (test) {
result += '// TEST'
+ if (testEnv != null) {
+ result += "[testenv=$testEnv]"
+ }
if (catchPart) {
result += "[catch: $catchPart]"
}
diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/LoggerUsageTask.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/LoggerUsageTask.groovy
index 87b73795604ab..ac1e12620af87 100644
--- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/LoggerUsageTask.groovy
+++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/LoggerUsageTask.groovy
@@ -50,11 +50,11 @@ public class LoggerUsageTask extends LoggedExec {
List files = []
// But only if the source sets that will make them exist
if (project.sourceSets.findByName("main")) {
- files.add(project.sourceSets.main.output.classesDir)
+ files.addAll(project.sourceSets.main.output.classesDirs.getFiles())
dependsOn project.tasks.classes
}
if (project.sourceSets.findByName("test")) {
- files.add(project.sourceSets.test.output.classesDir)
+ files.addAll(project.sourceSets.test.output.classesDirs.getFiles())
dependsOn project.tasks.testClasses
}
/* In an extra twist, it isn't good enough that the source set
diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/NamingConventionsTask.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/NamingConventionsTask.groovy
deleted file mode 100644
index 6050d4e278dd6..0000000000000
--- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/NamingConventionsTask.groovy
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to Elasticsearch under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.elasticsearch.gradle.precommit
-
-import org.elasticsearch.gradle.LoggedExec
-import org.elasticsearch.gradle.VersionProperties
-import org.gradle.api.artifacts.Dependency
-import org.gradle.api.file.FileCollection
-import org.gradle.api.tasks.Input
-import org.gradle.api.tasks.InputFiles
-import org.gradle.api.tasks.OutputFile
-/**
- * Runs NamingConventionsCheck on a classpath/directory combo to verify that
- * tests are named according to our conventions so they'll be picked up by
- * gradle. Read the Javadoc for NamingConventionsCheck to learn more.
- */
-public class NamingConventionsTask extends LoggedExec {
- /**
- * We use a simple "marker" file that we touch when the task succeeds
- * as the task output. This is compared against the modified time of the
- * inputs (ie the jars/class files).
- */
- @OutputFile
- File successMarker = new File(project.buildDir, "markers/${this.name}")
-
- /**
- * Should we skip the integ tests in disguise tests? Defaults to true because only core names its
- * integ tests correctly.
- */
- @Input
- boolean skipIntegTestInDisguise = false
-
- /**
- * Superclass for all tests.
- */
- @Input
- String testClass = 'org.apache.lucene.util.LuceneTestCase'
-
- /**
- * Superclass for all integration tests.
- */
- @Input
- String integTestClass = 'org.elasticsearch.test.ESIntegTestCase'
-
- /**
- * Should the test also check the main classpath for test classes instead of
- * doing the usual checks to the test classpath.
- */
- @Input
- boolean checkForTestsInMain = false;
-
- public NamingConventionsTask() {
- // Extra classpath contains the actual test
- if (false == project.configurations.names.contains('namingConventions')) {
- project.configurations.create('namingConventions')
- Dependency buildToolsDep = project.dependencies.add('namingConventions',
- "org.elasticsearch.gradle:build-tools:${VersionProperties.elasticsearch}")
- buildToolsDep.transitive = false // We don't need gradle in the classpath. It conflicts.
- }
- FileCollection classpath = project.files(project.configurations.namingConventions,
- project.sourceSets.test.compileClasspath,
- project.sourceSets.test.output)
- dependsOn(classpath)
- inputs.files(classpath)
- description = "Tests that test classes aren't misnamed or misplaced"
- executable = new File(project.runtimeJavaHome, 'bin/java')
- if (false == checkForTestsInMain) {
- /* This task is created by default for all subprojects with this
- * setting and there is no point in running it if the files don't
- * exist. */
- onlyIf { project.sourceSets.test.output.classesDir.exists() }
- }
-
- /*
- * We build the arguments in a funny afterEvaluate/doFirst closure so that we can wait for the classpath to be
- * ready for us. Strangely neither one on their own are good enough.
- */
- project.afterEvaluate {
- doFirst {
- args('-Djna.nosys=true')
- args('-cp', classpath.asPath, 'org.elasticsearch.test.NamingConventionsCheck')
- args('--test-class', testClass)
- if (skipIntegTestInDisguise) {
- args('--skip-integ-tests-in-disguise')
- } else {
- args('--integ-test-class', integTestClass)
- }
- /*
- * The test framework has classes that fail the checks to validate that the checks fail properly.
- * Since these would cause the build to fail we have to ignore them with this parameter. The
- * process of ignoring them lets us validate that they were found so this ignore parameter acts
- * as the test for the NamingConventionsCheck.
- */
- if (':build-tools'.equals(project.path)) {
- args('--self-test')
- }
- if (checkForTestsInMain) {
- args('--main')
- args('--')
- args(project.sourceSets.main.output.classesDir.absolutePath)
- } else {
- args('--')
- args(project.sourceSets.test.output.classesDir.absolutePath)
- }
- }
- }
- doLast { successMarker.setText("", 'UTF-8') }
- }
-}
diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/NamingConventionsTask.java b/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/NamingConventionsTask.java
new file mode 100644
index 0000000000000..7b63899de31ee
--- /dev/null
+++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/NamingConventionsTask.java
@@ -0,0 +1,185 @@
+package org.elasticsearch.gradle.precommit;
+
+import groovy.lang.Closure;
+import org.codehaus.groovy.runtime.ResourceGroovyMethods;
+import org.elasticsearch.gradle.LoggedExec;
+import org.elasticsearch.test.NamingConventionsCheck;
+import org.gradle.api.GradleException;
+import org.gradle.api.Project;
+import org.gradle.api.Task;
+import org.gradle.api.file.FileCollection;
+import org.gradle.api.plugins.ExtraPropertiesExtension;
+import org.gradle.api.plugins.JavaPluginConvention;
+import org.gradle.api.tasks.AbstractExecTask;
+import org.gradle.api.tasks.Input;
+import org.gradle.api.tasks.OutputFile;
+import org.gradle.api.tasks.SourceSetContainer;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Objects;
+
+/**
+ * Runs NamingConventionsCheck on a classpath/directory combo to verify that
+ * tests are named according to our conventions so they'll be picked up by
+ * gradle. Read the Javadoc for NamingConventionsCheck to learn more.
+ */
+public class NamingConventionsTask extends LoggedExec {
+ public NamingConventionsTask() {
+ setDescription("Tests that test classes aren't misnamed or misplaced");
+ final Project project = getProject();
+
+ SourceSetContainer sourceSets = getJavaSourceSets();
+ final FileCollection classpath = project.files(
+ // This works because the class only depends on one class from junit that will be available from the
+ // tests compile classpath. It's the most straight forward way of telling Java where to find the main
+ // class.
+ NamingConventionsCheck.class.getProtectionDomain().getCodeSource().getLocation().getPath(),
+ // the tests to be loaded
+ checkForTestsInMain ? sourceSets.getByName("main").getRuntimeClasspath() : project.files(),
+ sourceSets.getByName("test").getCompileClasspath(),
+ sourceSets.getByName("test").getOutput()
+ );
+ dependsOn(project.getTasks().matching(it -> "testCompileClasspath".equals(it.getName())));
+ getInputs().files(classpath);
+
+ setExecutable(new File(
+ Objects.requireNonNull(
+ project.getExtensions().getByType(ExtraPropertiesExtension.class).get("runtimeJavaHome")
+ ).toString(),
+ "bin/java")
+ );
+
+ if (checkForTestsInMain == false) {
+ /* This task is created by default for all subprojects with this
+ * setting and there is no point in running it if the files don't
+ * exist. */
+ onlyIf((unused) -> getExistingClassesDirs().isEmpty() == false);
+ }
+
+ /*
+ * We build the arguments in a funny afterEvaluate/doFirst closure so that we can wait for the classpath to be
+ * ready for us. Strangely neither one on their own are good enough.
+ */
+ project.afterEvaluate(new Closure(this, this) {
+ public Task doCall(Project it) {
+ return doFirst(new Closure(NamingConventionsTask.this, NamingConventionsTask.this) {
+ public AbstractExecTask doCall(Task it) {
+ args("-Djna.nosys=true");
+ args("-cp", classpath.getAsPath(), "org.elasticsearch.test.NamingConventionsCheck");
+ args("--test-class", getTestClass());
+ if (skipIntegTestInDisguise) {
+ args("--skip-integ-tests-in-disguise");
+ } else {
+ args("--integ-test-class", getIntegTestClass());
+ }
+ if (getCheckForTestsInMain()) {
+ args("--main");
+ args("--");
+ } else {
+ args("--");
+ }
+ return args(getExistingClassesDirs().getAsPath());
+ }
+ });
+ }
+ });
+ doLast(new Closure
*
* -------------------------------------------------
* |Bit 8|Bit 7|Bit 6|Bit 5|Bit 4|Bit 3|Bit 2|Bit 1|
@@ -192,7 +193,6 @@ public boolean isConstructed() {
* For constructed field, return a parser for its content.
*
* @return A parser for the construct.
- * @throws IOException
*/
public DerParser getParser() throws IOException {
if (!isConstructed())
@@ -205,7 +205,6 @@ public DerParser getParser() throws IOException {
* Get the value as integer
*
* @return BigInteger
- * @throws IOException
*/
public BigInteger getInteger() throws IOException {
if (type != DerParser.INTEGER)
diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/PemUtils.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/PemUtils.java
index 9ff44d0135ffa..d959c017e0a35 100644
--- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/PemUtils.java
+++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/PemUtils.java
@@ -108,7 +108,6 @@ public static PrivateKey readPrivateKey(Path keyPath, Supplier passwordS
* Removes the EC Headers that OpenSSL adds to EC private keys as the information in them
* is redundant
*
- * @param bReader
* @throws IOException if the EC Parameter footer is missing
*/
private static BufferedReader removeECHeaders(BufferedReader bReader) throws IOException {
@@ -133,7 +132,6 @@ private static BufferedReader removeECHeaders(BufferedReader bReader) throws IOE
* Removes the DSA Params Headers that OpenSSL adds to DSA private keys as the information in them
* is redundant
*
- * @param bReader
* @throws IOException if the EC Parameter footer is missing
*/
private static BufferedReader removeDsaHeaders(BufferedReader bReader) throws IOException {
diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/RestrictedTrustManager.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/RestrictedTrustManager.java
index c49692dda98c1..8a82694785a28 100644
--- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/RestrictedTrustManager.java
+++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/RestrictedTrustManager.java
@@ -132,7 +132,7 @@ private Set readCommonNames(X509Certificate certificate) throws Certific
* Decodes the otherName CN from the certificate
*
* @param value The DER Encoded Subject Alternative Name
- * @param certificate
+ * @param certificate The certificate
* @return the CN or null if it could not be parsed
*/
private String decodeDerValue(byte[] value, X509Certificate certificate) {
diff --git a/x-pack/plugin/ml/build.gradle b/x-pack/plugin/ml/build.gradle
index 8b991555c0670..4c3cc9eef9313 100644
--- a/x-pack/plugin/ml/build.gradle
+++ b/x-pack/plugin/ml/build.gradle
@@ -99,7 +99,7 @@ task internalClusterTest(type: RandomizedTestingTask,
dependsOn: test.dependsOn) {
configure(BuildPlugin.commonTestConfig(project))
classpath = project.test.classpath
- testClassesDir = project.test.testClassesDir
+ testClassesDirs = project.test.testClassesDirs
include '**/*IT.class'
systemProperty 'es.set.netty.runtime.available.processors', 'false'
}
diff --git a/x-pack/plugin/monitoring/build.gradle b/x-pack/plugin/monitoring/build.gradle
index fbdb388e78e19..3fde6cd8c3775 100644
--- a/x-pack/plugin/monitoring/build.gradle
+++ b/x-pack/plugin/monitoring/build.gradle
@@ -62,7 +62,7 @@ task internalClusterTest(type: RandomizedTestingTask,
dependsOn: test.dependsOn) {
configure(BuildPlugin.commonTestConfig(project))
classpath = project.test.classpath
- testClassesDir = project.test.testClassesDir
+ testClassesDirs = project.test.testClassesDirs
include '**/*IT.class'
systemProperty 'es.set.netty.runtime.available.processors', 'false'
}
diff --git a/x-pack/plugin/rollup/build.gradle b/x-pack/plugin/rollup/build.gradle
index d8ce1ca304763..18ef7abee5c64 100644
--- a/x-pack/plugin/rollup/build.gradle
+++ b/x-pack/plugin/rollup/build.gradle
@@ -42,7 +42,7 @@ task internalClusterTest(type: RandomizedTestingTask,
dependsOn: test.dependsOn) {
configure(BuildPlugin.commonTestConfig(project))
classpath = project.test.classpath
- testClassesDir = project.test.testClassesDir
+ testClassesDirs = project.test.testClassesDirs
include '**/*IT.class'
systemProperty 'es.set.netty.runtime.available.processors', 'false'
}
diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/job/RollupIndexer.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/job/RollupIndexer.java
index 5abd701ce4b2e..a07f1e7d32e7c 100644
--- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/job/RollupIndexer.java
+++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/job/RollupIndexer.java
@@ -405,7 +405,8 @@ private CompositeAggregationBuilder createCompositeBuilder(RollupJobConfig confi
}
/**
- * Creates the range query that limits the search to documents that appear before the maximum allowed time (see {@link this#maxBoundary}
+ * Creates the range query that limits the search to documents that appear before the maximum allowed time
+ * (see {@link #maxBoundary}
* and on or after the last processed time.
* @param position The current position of the pagination
* @return The range query to execute
diff --git a/x-pack/plugin/security/build.gradle b/x-pack/plugin/security/build.gradle
index 12533a389b5f1..4a9df6c9ccc5f 100644
--- a/x-pack/plugin/security/build.gradle
+++ b/x-pack/plugin/security/build.gradle
@@ -17,7 +17,7 @@ dependencies {
compileOnly project(path: ':plugins:transport-nio', configuration: 'runtime')
testCompile project(path: xpackModule('monitoring'))
- testCompile project(path: xpackModule('sql:sql-proto'))
+ testCompile project(path: xpackModule('sql:sql-action'))
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/RestorableContextClassLoader.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/RestorableContextClassLoader.java
index f2e36ebf98273..95c68eab9c28a 100644
--- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/RestorableContextClassLoader.java
+++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/support/RestorableContextClassLoader.java
@@ -12,7 +12,7 @@
import org.elasticsearch.SpecialPermission;
/**
- * A try-with-resource compatible object for configuring a thread {@link Thread#contextClassLoader}.
+ * A try-with-resource compatible object for configuring a thread {@link Thread#getContextClassLoader()}.
* On construction this class will set the current (or provided) thread's context class loader.
* On {@link #close()}, it restores the previous value of the class loader.
*/
diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/saml/SamlTestCase.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/saml/SamlTestCase.java
index 51a6d8732a5b3..adaba34a73aa3 100644
--- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/saml/SamlTestCase.java
+++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/saml/SamlTestCase.java
@@ -64,7 +64,6 @@ public static void restoreLocale() throws Exception {
* Generates signed certificate and associates with generated key pair.
* @see #readRandomKeyPair(String)
* @return X509Certificate a signed certificate, it's PrivateKey {@link Tuple}
- * @throws Exception
*/
protected static Tuple readRandomKeyPair() throws Exception {
return readRandomKeyPair("RSA");
@@ -73,9 +72,7 @@ protected static Tuple readRandomKeyPair() throws E
/**
* Reads a key pair and associated certificate for given algorithm and key length
* For testing, for "EC" algorithm 256 key size is used, others use 2048 as default.
- * @param algorithm
- * @return X509Certificate a signed certificate, it's PrivateKey {@link Tuple}
- * @throws Exception
+ * @return X509Certificate a signed certificate, it's PrivateKey
*/
protected static Tuple readRandomKeyPair(String algorithm) throws Exception {
int keySize;
diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authz/AuthorizationServiceTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authz/AuthorizationServiceTests.java
index 11ee0a6a0012e..9e33e145e24fe 100644
--- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authz/AuthorizationServiceTests.java
+++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authz/AuthorizationServiceTests.java
@@ -122,8 +122,8 @@
import org.elasticsearch.xpack.security.audit.AuditTrailService;
import org.elasticsearch.xpack.security.authc.esnative.ReservedRealm;
import org.elasticsearch.xpack.security.authz.store.CompositeRolesStore;
-import org.elasticsearch.xpack.sql.plugin.SqlQueryAction;
-import org.elasticsearch.xpack.sql.plugin.SqlQueryRequest;
+import org.elasticsearch.xpack.sql.action.SqlQueryAction;
+import org.elasticsearch.xpack.sql.action.SqlQueryRequest;
import org.junit.Before;
import org.mockito.Mockito;
diff --git a/x-pack/plugin/sql/build.gradle b/x-pack/plugin/sql/build.gradle
index 19dd1a08ec6f6..436837e85b4f0 100644
--- a/x-pack/plugin/sql/build.gradle
+++ b/x-pack/plugin/sql/build.gradle
@@ -24,7 +24,7 @@ dependencies {
// exclude ASM to not affect featureAware task on Java 10+
exclude group: "org.ow2.asm"
}
- compile project('sql-proto')
+ compile project('sql-action')
compile "org.elasticsearch.plugin:aggs-matrix-stats-client:${version}"
compile "org.antlr:antlr4-runtime:4.5.3"
testCompile "org.elasticsearch.test:framework:${version}"
diff --git a/x-pack/plugin/sql/jdbc/build.gradle b/x-pack/plugin/sql/jdbc/build.gradle
index e383e71cd4c76..ca8d966a031cf 100644
--- a/x-pack/plugin/sql/jdbc/build.gradle
+++ b/x-pack/plugin/sql/jdbc/build.gradle
@@ -24,10 +24,10 @@ forbiddenApisMain {
}
dependencies {
- compile (xpackProject('plugin:sql:sql-shared-client')) {
+ compile (xpackProject('plugin:sql:sql-client')) {
transitive = false
}
- compile (xpackProject('plugin:sql:sql-shared-proto')) {
+ compile (xpackProject('plugin:sql:sql-proto')) {
transitive = false
}
compile (project(':libs:x-content')) {
@@ -39,12 +39,12 @@ dependencies {
}
dependencyLicenses {
- mapping from: /sql-shared-proto.*/, to: 'elasticsearch'
- mapping from: /sql-shared-client.*/, to: 'elasticsearch'
+ mapping from: /sql-proto.*/, to: 'elasticsearch'
+ mapping from: /sql-client.*/, to: 'elasticsearch'
mapping from: /jackson-.*/, to: 'jackson'
mapping from: /elasticsearch-core.*/, to: 'elasticsearch'
- ignoreSha 'sql-shared-proto'
- ignoreSha 'sql-shared-client'
+ ignoreSha 'sql-proto'
+ ignoreSha 'sql-client'
ignoreSha 'elasticsearch'
}
diff --git a/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/debug/Debug.java b/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/debug/Debug.java
index 41bc80c104052..ccba7429a4bb2 100644
--- a/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/debug/Debug.java
+++ b/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/debug/Debug.java
@@ -5,7 +5,7 @@
*/
package org.elasticsearch.xpack.sql.jdbc.debug;
-import org.elasticsearch.xpack.sql.client.shared.SuppressForbidden;
+import org.elasticsearch.xpack.sql.client.SuppressForbidden;
import org.elasticsearch.xpack.sql.jdbc.JdbcException;
import org.elasticsearch.xpack.sql.jdbc.jdbc.JdbcConfiguration;
@@ -39,10 +39,10 @@
* being global and not working well with encoding (hence why {@link DriverManager#getLogWriter()} was introduced)
* and was changed again through {@link DataSource#getLogWriter()}.
* However by then the damage was done and most drivers don't use either and have their own logging implementation.
- *
+ *
* This class tries to cater to both audiences - use the legacy, Writer way if needed though strive to use the
* proper typical approach, that of specifying intention and output (file) in the URL.
- *
+ *
* For this reason the {@link System#out} and {@link System#err} are being refered in this class though are used only
* when needed.
*/
@@ -65,7 +65,7 @@ public final class Debug {
* {@link DriverManager#setLogWriter(PrintWriter)} and {@link DataSource#setLogWriter(PrintWriter)}.
* The former is the 'legacy' way, having a global impact on all drivers while the latter allows per
* instance configuration.
- *
+ *
* As both approaches are not widely used, Debug will take the principle of least surprise and pick its
* own configuration first; if that does not exist it will fallback to the managed approaches (assuming they
* are specified, otherwise logging is simply disabled).
@@ -235,4 +235,4 @@ private static PrintStream stdout() {
private static PrintStream stderr() {
return System.err;
}
-}
\ No newline at end of file
+}
diff --git a/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/debug/DebugLog.java b/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/debug/DebugLog.java
index 28444c1f8ee0c..e0962c5dcc1a6 100644
--- a/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/debug/DebugLog.java
+++ b/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/debug/DebugLog.java
@@ -5,7 +5,7 @@
*/
package org.elasticsearch.xpack.sql.jdbc.debug;
-import org.elasticsearch.xpack.sql.client.shared.StringUtils;
+import org.elasticsearch.xpack.sql.client.StringUtils;
import java.io.PrintWriter;
import java.lang.reflect.Array;
@@ -56,16 +56,16 @@ void logException(Method m, Object[] args, Throwable t) {
t.printStackTrace(print);
print.flush();
}
-
+
private static String array(Object[] a) {
if (a == null || a.length == 0) {
- return StringUtils.EMPTY;
+ return StringUtils.EMPTY;
}
if (a.length == 1) {
return handleArray(a[0]);
}
-
+
StringBuilder b = new StringBuilder();
int iMax = a.length - 1;
for (int i = 0; ; i++) {
@@ -97,4 +97,4 @@ private static String handleArray(Object o) {
}
return String.valueOf(o);
}
-}
\ No newline at end of file
+}
diff --git a/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/JdbcConfiguration.java b/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/JdbcConfiguration.java
index 1d90c8c08ca89..a2ab9060b5aa3 100644
--- a/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/JdbcConfiguration.java
+++ b/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/JdbcConfiguration.java
@@ -5,9 +5,9 @@
*/
package org.elasticsearch.xpack.sql.jdbc.jdbc;
-import org.elasticsearch.xpack.sql.client.shared.ConnectionConfiguration;
-import org.elasticsearch.xpack.sql.client.shared.StringUtils;
-import org.elasticsearch.xpack.sql.client.shared.Version;
+import org.elasticsearch.xpack.sql.client.ConnectionConfiguration;
+import org.elasticsearch.xpack.sql.client.StringUtils;
+import org.elasticsearch.xpack.sql.client.Version;
import org.elasticsearch.xpack.sql.jdbc.JdbcSQLException;
import java.net.URI;
@@ -22,8 +22,8 @@
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;
-import static org.elasticsearch.xpack.sql.client.shared.UriUtils.parseURI;
-import static org.elasticsearch.xpack.sql.client.shared.UriUtils.removeQuery;
+import static org.elasticsearch.xpack.sql.client.UriUtils.parseURI;
+import static org.elasticsearch.xpack.sql.client.UriUtils.removeQuery;
/**
/ Supports the following syntax
diff --git a/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/JdbcDatabaseMetaData.java b/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/JdbcDatabaseMetaData.java
index fbbb030bc4973..5cb63a3376348 100644
--- a/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/JdbcDatabaseMetaData.java
+++ b/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/JdbcDatabaseMetaData.java
@@ -5,8 +5,8 @@
*/
package org.elasticsearch.xpack.sql.jdbc.jdbc;
-import org.elasticsearch.xpack.sql.client.shared.ObjectUtils;
-import org.elasticsearch.xpack.sql.client.shared.Version;
+import org.elasticsearch.xpack.sql.client.ObjectUtils;
+import org.elasticsearch.xpack.sql.client.Version;
import org.elasticsearch.xpack.sql.jdbc.JdbcSQLException;
import org.elasticsearch.xpack.sql.jdbc.net.client.Cursor;
import org.elasticsearch.xpack.sql.jdbc.net.protocol.ColumnInfo;
diff --git a/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/JdbcDriver.java b/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/JdbcDriver.java
index 3fdb002a0aa94..2b68026b67816 100644
--- a/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/JdbcDriver.java
+++ b/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/JdbcDriver.java
@@ -5,7 +5,7 @@
*/
package org.elasticsearch.xpack.sql.jdbc.jdbc;
-import org.elasticsearch.xpack.sql.client.shared.Version;
+import org.elasticsearch.xpack.sql.client.Version;
import org.elasticsearch.xpack.sql.jdbc.JdbcSQLException;
import org.elasticsearch.xpack.sql.jdbc.debug.Debug;
@@ -127,4 +127,4 @@ public Logger getParentLogger() throws SQLFeatureNotSupportedException {
private void close() {
Debug.close();
}
-}
\ No newline at end of file
+}
diff --git a/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/JdbcPreparedStatement.java b/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/JdbcPreparedStatement.java
index 5ace03ff8a33e..bae4260ac2b69 100644
--- a/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/JdbcPreparedStatement.java
+++ b/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/JdbcPreparedStatement.java
@@ -5,6 +5,8 @@
*/
package org.elasticsearch.xpack.sql.jdbc.jdbc;
+import org.elasticsearch.xpack.sql.type.DataType;
+
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
@@ -21,13 +23,24 @@
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.RowId;
+import java.sql.SQLDataException;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.sql.SQLXML;
+import java.sql.Struct;
import java.sql.Time;
import java.sql.Timestamp;
import java.sql.Types;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.OffsetDateTime;
+import java.time.OffsetTime;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Calendar;
+import java.util.List;
+import java.util.Locale;
class JdbcPreparedStatement extends JdbcStatement implements PreparedStatement {
final PreparedQuery query;
@@ -74,67 +87,67 @@ public void setNull(int parameterIndex, int sqlType) throws SQLException {
@Override
public void setBoolean(int parameterIndex, boolean x) throws SQLException {
- setParam(parameterIndex, x, Types.BOOLEAN);
+ setObject(parameterIndex, x, Types.BOOLEAN);
}
@Override
public void setByte(int parameterIndex, byte x) throws SQLException {
- setParam(parameterIndex, x, Types.TINYINT);
+ setObject(parameterIndex, x, Types.TINYINT);
}
@Override
public void setShort(int parameterIndex, short x) throws SQLException {
- setParam(parameterIndex, x, Types.SMALLINT);
+ setObject(parameterIndex, x, Types.SMALLINT);
}
@Override
public void setInt(int parameterIndex, int x) throws SQLException {
- setParam(parameterIndex, x, Types.INTEGER);
+ setObject(parameterIndex, x, Types.INTEGER);
}
@Override
public void setLong(int parameterIndex, long x) throws SQLException {
- setParam(parameterIndex, x, Types.BIGINT);
+ setObject(parameterIndex, x, Types.BIGINT);
}
@Override
public void setFloat(int parameterIndex, float x) throws SQLException {
- setParam(parameterIndex, x, Types.REAL);
+ setObject(parameterIndex, x, Types.REAL);
}
@Override
public void setDouble(int parameterIndex, double x) throws SQLException {
- setParam(parameterIndex, x, Types.DOUBLE);
+ setObject(parameterIndex, x, Types.DOUBLE);
}
@Override
public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException {
- throw new SQLFeatureNotSupportedException("BigDecimal not supported");
+ setObject(parameterIndex, x, Types.BIGINT);
}
@Override
public void setString(int parameterIndex, String x) throws SQLException {
- setParam(parameterIndex, x, Types.VARCHAR);
+ setObject(parameterIndex, x, Types.VARCHAR);
}
@Override
public void setBytes(int parameterIndex, byte[] x) throws SQLException {
- throw new UnsupportedOperationException("Bytes not implemented yet");
+ setObject(parameterIndex, x, Types.VARBINARY);
}
@Override
public void setDate(int parameterIndex, Date x) throws SQLException {
- throw new UnsupportedOperationException("Date/Time not implemented yet");
+ setObject(parameterIndex, x, Types.TIMESTAMP);
}
@Override
public void setTime(int parameterIndex, Time x) throws SQLException {
- throw new UnsupportedOperationException("Date/Time not implemented yet");
+ setObject(parameterIndex, x, Types.TIMESTAMP);
}
@Override
public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException {
- throw new UnsupportedOperationException("Date/Time not implemented yet");
+ setObject(parameterIndex, x, Types.TIMESTAMP);
}
@Override
@@ -161,12 +174,22 @@ public void clearParameters() throws SQLException {
@Override
public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException {
- throw new UnsupportedOperationException("Object not implemented yet");
+ // the value of scaleOrLength parameter doesn't matter, as it's not used in the called method below
+ setObject(parameterIndex, x, targetSqlType, 0);
}
@Override
public void setObject(int parameterIndex, Object x) throws SQLException {
- throw new SQLFeatureNotSupportedException("CharacterStream not supported");
+ if (x == null) {
+ setParam(parameterIndex, null, Types.NULL);
+ return;
+ }
+
+ // check also here the unsupported types so that any unsupported interfaces ({@code java.sql.Struct},
+ // {@code java.sql.Array} etc) will generate the correct exception message. Otherwise, the method call
+ // {@code TypeConverter.fromJavaToJDBC(x.getClass())} will report the implementing class as not being supported.
+ checkKnownUnsupportedTypes(x);
+ setObject(parameterIndex, x, TypeConverter.fromJavaToJDBC(x.getClass()).getVendorTypeNumber(), 0);
}
@Override
@@ -181,22 +204,22 @@ public void setCharacterStream(int parameterIndex, Reader reader, int length) th
@Override
public void setRef(int parameterIndex, Ref x) throws SQLException {
- throw new SQLFeatureNotSupportedException("Ref not supported");
+ setObject(parameterIndex, x);
}
@Override
public void setBlob(int parameterIndex, Blob x) throws SQLException {
- throw new SQLFeatureNotSupportedException("Blob not supported");
+ setObject(parameterIndex, x);
}
@Override
public void setClob(int parameterIndex, Clob x) throws SQLException {
- throw new SQLFeatureNotSupportedException("Clob not supported");
+ setObject(parameterIndex, x);
}
@Override
public void setArray(int parameterIndex, Array x) throws SQLException {
- throw new SQLFeatureNotSupportedException("Array not supported");
+ setObject(parameterIndex, x);
}
@Override
@@ -206,17 +229,44 @@ public ResultSetMetaData getMetaData() throws SQLException {
@Override
public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException {
- throw new UnsupportedOperationException("Dates not implemented yet");
+ if (cal == null) {
+ setObject(parameterIndex, x, Types.TIMESTAMP);
+ return;
+ }
+ if (x == null) {
+ setNull(parameterIndex, Types.TIMESTAMP);
+ return;
+ }
+ // converting to UTC since this is what ES is storing internally
+ setObject(parameterIndex, new Date(TypeConverter.convertFromCalendarToUTC(x.getTime(), cal)), Types.TIMESTAMP);
}
@Override
public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException {
- throw new UnsupportedOperationException("Dates not implemented yet");
+ if (cal == null) {
+ setObject(parameterIndex, x, Types.TIMESTAMP);
+ return;
+ }
+ if (x == null) {
+ setNull(parameterIndex, Types.TIMESTAMP);
+ return;
+ }
+ // converting to UTC since this is what ES is storing internally
+ setObject(parameterIndex, new Time(TypeConverter.convertFromCalendarToUTC(x.getTime(), cal)), Types.TIMESTAMP);
}
@Override
public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException {
- throw new UnsupportedOperationException("Dates not implemented yet");
+ if (cal == null) {
+ setObject(parameterIndex, x, Types.TIMESTAMP);
+ return;
+ }
+ if (x == null) {
+ setNull(parameterIndex, Types.TIMESTAMP);
+ return;
+ }
+ // converting to UTC since this is what ES is storing internally
+ setObject(parameterIndex, new Timestamp(TypeConverter.convertFromCalendarToUTC(x.getTime(), cal)), Types.TIMESTAMP);
}
@Override
@@ -226,7 +276,7 @@ public void setNull(int parameterIndex, int sqlType, String typeName) throws SQL
@Override
public void setURL(int parameterIndex, URL x) throws SQLException {
- throw new SQLFeatureNotSupportedException("Datalink not supported");
+ setObject(parameterIndex, x);
}
@Override
@@ -236,7 +286,7 @@ public ParameterMetaData getParameterMetaData() throws SQLException {
@Override
public void setRowId(int parameterIndex, RowId x) throws SQLException {
- throw new SQLFeatureNotSupportedException("RowId not supported");
+ setObject(parameterIndex, x);
}
@Override
@@ -251,7 +301,7 @@ public void setNCharacterStream(int parameterIndex, Reader value, long length) t
@Override
public void setNClob(int parameterIndex, NClob value) throws SQLException {
- throw new SQLFeatureNotSupportedException("NClob not supported");
+ setObject(parameterIndex, value);
}
@Override
@@ -271,12 +321,108 @@ public void setNClob(int parameterIndex, Reader reader, long length) throws SQLE
@Override
public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException {
- throw new SQLFeatureNotSupportedException("SQLXML not supported");
+ setObject(parameterIndex, xmlObject);
}
-
+
@Override
public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException {
- throw new UnsupportedOperationException("Object not implemented yet");
+ checkOpen();
+
+ JDBCType targetJDBCType;
+ try {
+ // this is also a way to check early for the validity of the desired sql type
+ targetJDBCType = JDBCType.valueOf(targetSqlType);
+ } catch (IllegalArgumentException e) {
+ throw new SQLDataException(e.getMessage());
+ }
+
+ // set the null value on the type and exit
+ if (x == null) {
+ setParam(parameterIndex, null, targetSqlType);
+ return;
+ }
+
+ checkKnownUnsupportedTypes(x);
+ if (x instanceof byte[]) {
+ if (targetJDBCType != JDBCType.VARBINARY) {
+ throw new SQLFeatureNotSupportedException(
+ "Conversion from type byte[] to " + targetJDBCType + " not supported");
+ }
+ setParam(parameterIndex, x, Types.VARBINARY);
+ return;
+ }
+
+ if (x instanceof Timestamp
+ || x instanceof Calendar
+ || x instanceof Date
+ || x instanceof LocalDateTime
+ || x instanceof Time
+ || x instanceof java.util.Date)
+ {
+ if (targetJDBCType == JDBCType.TIMESTAMP) {
+ // converting to {@code java.util.Date} because this is the type supported by {@code XContentBuilder} for serialization
+ java.util.Date dateToSet;
+ if (x instanceof Timestamp) {
+ dateToSet = new java.util.Date(((Timestamp) x).getTime());
+ } else if (x instanceof Calendar) {
+ dateToSet = ((Calendar) x).getTime();
+ } else if (x instanceof Date) {
+ dateToSet = new java.util.Date(((Date) x).getTime());
+ } else if (x instanceof LocalDateTime){
+ LocalDateTime ldt = (LocalDateTime) x;
+ Calendar cal = getDefaultCalendar();
+ cal.set(ldt.getYear(), ldt.getMonthValue() - 1, ldt.getDayOfMonth(), ldt.getHour(), ldt.getMinute(), ldt.getSecond());
+
+ dateToSet = cal.getTime();
+ } else if (x instanceof Time) {
+ dateToSet = new java.util.Date(((Time) x).getTime());
+ } else {
+ dateToSet = (java.util.Date) x;
+ }
+
+ setParam(parameterIndex, dateToSet, Types.TIMESTAMP);
+ return;
+ } else if (targetJDBCType == JDBCType.VARCHAR) {
+ setParam(parameterIndex, String.valueOf(x), Types.VARCHAR);
+ return;
+ }
+ // anything else other than VARCHAR and TIMESTAMP is not supported in this JDBC driver
+ throw new SQLFeatureNotSupportedException(
+ "Conversion from type " + x.getClass().getName() + " to " + targetJDBCType + " not supported");
+ }
+
+ if (x instanceof Boolean
+ || x instanceof Byte
+ || x instanceof Short
+ || x instanceof Integer
+ || x instanceof Long
+ || x instanceof Float
+ || x instanceof Double
+ || x instanceof String) {
+ setParam(parameterIndex,
+ TypeConverter.convert(x, TypeConverter.fromJavaToJDBC(x.getClass()), DataType.fromJdbcTypeToJava(targetJDBCType)),
+ targetSqlType);
+ return;
+ }
+
+ throw new SQLFeatureNotSupportedException(
+ "Conversion from type " + x.getClass().getName() + " to " + targetJDBCType + " not supported");
+ }
+
+ private void checkKnownUnsupportedTypes(Object x) throws SQLFeatureNotSupportedException {
+ List> unsupportedTypes = new ArrayList>(Arrays.asList(Struct.class, Array.class, SQLXML.class,
+ RowId.class, Ref.class, Blob.class, NClob.class, Clob.class, LocalDate.class, LocalTime.class,
+ OffsetTime.class, OffsetDateTime.class, URL.class, BigDecimal.class));
+
+ for (Class> clazz:unsupportedTypes) {
+ if (clazz.isAssignableFrom(x.getClass())) {
+ throw new SQLFeatureNotSupportedException("Objects of type " + clazz.getName() + " are not supported");
+ }
+ }
+ }
+
+ private Calendar getDefaultCalendar() {
+ return Calendar.getInstance(cfg.timeZone(), Locale.ROOT);
}
@Override
diff --git a/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/JdbcResultSet.java b/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/JdbcResultSet.java
index c92ac9c5ac91c..351ac73a88f28 100644
--- a/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/JdbcResultSet.java
+++ b/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/JdbcResultSet.java
@@ -359,14 +359,6 @@ private T convert(int columnIndex, Class type) throws SQLException {
return null;
}
- if (type != null && type.isInstance(val)) {
- try {
- return type.cast(val);
- } catch (ClassCastException cce) {
- throw new SQLException("unable to convert column " + columnIndex + " to " + type, cce);
- }
- }
-
JDBCType columnType = cursor.columns().get(columnIndex - 1).type;
return TypeConverter.convert(val, columnType, type);
diff --git a/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/TypeConverter.java b/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/TypeConverter.java
index a1fa04ef1afd0..1e24a03c8b31c 100644
--- a/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/TypeConverter.java
+++ b/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbc/TypeConverter.java
@@ -10,7 +10,9 @@
import java.sql.Date;
import java.sql.JDBCType;
+import java.sql.SQLDataException;
import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
import java.sql.Time;
import java.sql.Timestamp;
import java.time.LocalDate;
@@ -18,10 +20,17 @@
import java.time.LocalTime;
import java.time.OffsetDateTime;
import java.time.OffsetTime;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.util.Arrays;
import java.util.Calendar;
+import java.util.Collections;
import java.util.GregorianCalendar;
import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
import java.util.function.Function;
+import java.util.stream.Collectors;
import static java.lang.String.format;
import static java.util.Calendar.DAY_OF_MONTH;
@@ -48,6 +57,22 @@ private TypeConverter() {
}
private static final long DAY_IN_MILLIS = 60 * 60 * 24;
+ private static final Map, JDBCType> javaToJDBC;
+
+ static {
+ Map, JDBCType> aMap = Arrays.stream(DataType.values())
+ .filter(dataType -> dataType.javaClass() != null
+ && dataType != DataType.HALF_FLOAT
+ && dataType != DataType.SCALED_FLOAT
+ && dataType != DataType.TEXT)
+ .collect(Collectors.toMap(dataType -> dataType.javaClass(), dataType -> dataType.jdbcType));
+ // apart from the mappings in {@code DataType} three more Java classes can be mapped to a {@code JDBCType.TIMESTAMP}
+ // according to B-4 table from the jdbc4.2 spec
+ aMap.put(Calendar.class, JDBCType.TIMESTAMP);
+ aMap.put(java.util.Date.class, JDBCType.TIMESTAMP);
+ aMap.put(LocalDateTime.class, JDBCType.TIMESTAMP);
+ javaToJDBC = Collections.unmodifiableMap(aMap);
+ }
/**
* Converts millisecond after epoc to date
@@ -94,6 +119,20 @@ private static T dateTimeConvert(Long millis, Calendar c, Function T convert(Object val, JDBCType columnType, Class type) throws SQLE
if (type == null) {
return (T) convert(val, columnType);
}
+
+ if (type.isInstance(val)) {
+ try {
+ return type.cast(val);
+ } catch (ClassCastException cce) {
+ throw new SQLDataException("Unable to convert " + val.getClass().getName() + " to " + columnType, cce);
+ }
+ }
+
if (type == String.class) {
return (T) asString(convert(val, columnType));
}
@@ -174,10 +222,10 @@ public static String classNameOf(JDBCType jdbcType) throws JdbcSQLException {
// Convert unsupported exception to JdbcSQLException
throw new JdbcSQLException(ex, ex.getMessage());
}
- if (dataType.javaName == null) {
+ if (dataType.javaClass() == null) {
throw new JdbcSQLException("Unsupported JDBC type [" + jdbcType + "]");
}
- return dataType.javaName;
+ return dataType.javaClass().getName();
}
/**
@@ -228,6 +276,18 @@ static boolean isSigned(JDBCType jdbcType) throws SQLException {
}
return dataType.isSigned();
}
+
+
+ static JDBCType fromJavaToJDBC(Class> clazz) throws SQLException {
+ for (Entry, JDBCType> e : javaToJDBC.entrySet()) {
+ // java.util.Calendar from {@code javaToJDBC} is an abstract class and this method can be used with concrete classes as well
+ if (e.getKey().isAssignableFrom(clazz)) {
+ return e.getValue();
+ }
+ }
+
+ throw new SQLFeatureNotSupportedException("Objects of type " + clazz.getName() + " are not supported");
+ }
private static Double doubleValue(Object v) {
if (v instanceof String) {
@@ -275,7 +335,7 @@ private static Boolean asBoolean(Object val, JDBCType columnType) throws SQLExce
case REAL:
case FLOAT:
case DOUBLE:
- return Boolean.valueOf(Integer.signum(((Number) val).intValue()) == 0);
+ return Boolean.valueOf(Integer.signum(((Number) val).intValue()) != 0);
default:
throw new SQLException("Conversion from type [" + columnType + "] to [Boolean] not supported");
@@ -454,28 +514,28 @@ private static long utcMillisRemoveDate(long l) {
private static byte safeToByte(long x) throws SQLException {
if (x > Byte.MAX_VALUE || x < Byte.MIN_VALUE) {
- throw new SQLException(format(Locale.ROOT, "Numeric %d out of range", Long.toString(x)));
+ throw new SQLException(format(Locale.ROOT, "Numeric %s out of range", Long.toString(x)));
}
return (byte) x;
}
private static short safeToShort(long x) throws SQLException {
if (x > Short.MAX_VALUE || x < Short.MIN_VALUE) {
- throw new SQLException(format(Locale.ROOT, "Numeric %d out of range", Long.toString(x)));
+ throw new SQLException(format(Locale.ROOT, "Numeric %s out of range", Long.toString(x)));
}
return (short) x;
}
private static int safeToInt(long x) throws SQLException {
if (x > Integer.MAX_VALUE || x < Integer.MIN_VALUE) {
- throw new SQLException(format(Locale.ROOT, "Numeric %d out of range", Long.toString(x)));
+ throw new SQLException(format(Locale.ROOT, "Numeric %s out of range", Long.toString(x)));
}
return (int) x;
}
private static long safeToLong(double x) throws SQLException {
if (x > Long.MAX_VALUE || x < Long.MIN_VALUE) {
- throw new SQLException(format(Locale.ROOT, "Numeric %d out of range", Double.toString(x)));
+ throw new SQLException(format(Locale.ROOT, "Numeric %s out of range", Double.toString(x)));
}
return Math.round(x);
}
diff --git a/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbcx/JdbcDataSource.java b/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbcx/JdbcDataSource.java
index 595cd893ebc76..bd2776e133503 100644
--- a/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbcx/JdbcDataSource.java
+++ b/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/jdbcx/JdbcDataSource.java
@@ -5,11 +5,11 @@
*/
package org.elasticsearch.xpack.sql.jdbc.jdbcx;
-import org.elasticsearch.xpack.sql.client.shared.ConnectionConfiguration;
+import org.elasticsearch.xpack.sql.client.ConnectionConfiguration;
import org.elasticsearch.xpack.sql.jdbc.debug.Debug;
import org.elasticsearch.xpack.sql.jdbc.jdbc.JdbcConfiguration;
import org.elasticsearch.xpack.sql.jdbc.jdbc.JdbcConnection;
-import org.elasticsearch.xpack.sql.client.shared.Version;
+import org.elasticsearch.xpack.sql.client.Version;
import java.io.PrintWriter;
import java.sql.Connection;
@@ -117,4 +117,4 @@ public T unwrap(Class iface) throws SQLException {
}
throw new SQLException();
}
-}
\ No newline at end of file
+}
diff --git a/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/net/client/JdbcHttpClient.java b/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/net/client/JdbcHttpClient.java
index 17afc34efffe6..e32aadcd7fa2b 100644
--- a/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/net/client/JdbcHttpClient.java
+++ b/x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/net/client/JdbcHttpClient.java
@@ -8,7 +8,7 @@
import org.elasticsearch.common.collect.Tuple;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.xpack.sql.client.HttpClient;
-import org.elasticsearch.xpack.sql.client.shared.Version;
+import org.elasticsearch.xpack.sql.client.Version;
import org.elasticsearch.xpack.sql.jdbc.jdbc.JdbcConfiguration;
import org.elasticsearch.xpack.sql.jdbc.net.protocol.ColumnInfo;
import org.elasticsearch.xpack.sql.jdbc.net.protocol.InfoResponse;
@@ -23,7 +23,7 @@
import java.util.List;
import java.util.stream.Collectors;
-import static org.elasticsearch.xpack.sql.client.shared.StringUtils.EMPTY;
+import static org.elasticsearch.xpack.sql.client.StringUtils.EMPTY;
/**
* JDBC specific HTTP client.
diff --git a/x-pack/plugin/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/JdbcConfigurationTests.java b/x-pack/plugin/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/JdbcConfigurationTests.java
index e15d011e387e3..c7f2b50ace019 100644
--- a/x-pack/plugin/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/JdbcConfigurationTests.java
+++ b/x-pack/plugin/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/JdbcConfigurationTests.java
@@ -11,8 +11,8 @@
import java.sql.SQLException;
import java.util.Properties;
-import static org.elasticsearch.xpack.sql.client.shared.ConnectionConfiguration.CONNECT_TIMEOUT;
-import static org.elasticsearch.xpack.sql.client.shared.ConnectionConfiguration.PAGE_TIMEOUT;
+import static org.elasticsearch.xpack.sql.client.ConnectionConfiguration.CONNECT_TIMEOUT;
+import static org.elasticsearch.xpack.sql.client.ConnectionConfiguration.PAGE_TIMEOUT;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
diff --git a/x-pack/plugin/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/VersionTests.java b/x-pack/plugin/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/VersionTests.java
index 82cd623f11599..03986e595442a 100644
--- a/x-pack/plugin/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/VersionTests.java
+++ b/x-pack/plugin/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/VersionTests.java
@@ -6,7 +6,7 @@
package org.elasticsearch.xpack.sql.jdbc;
import org.elasticsearch.test.ESTestCase;
-import org.elasticsearch.xpack.sql.client.shared.Version;
+import org.elasticsearch.xpack.sql.client.Version;
public class VersionTests extends ESTestCase {
public void testVersionIsCurrent() {
diff --git a/x-pack/plugin/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/jdbc/JdbcPreparedStatementTests.java b/x-pack/plugin/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/jdbc/JdbcPreparedStatementTests.java
new file mode 100644
index 0000000000000..ad96825896e1a
--- /dev/null
+++ b/x-pack/plugin/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/jdbc/JdbcPreparedStatementTests.java
@@ -0,0 +1,582 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+package org.elasticsearch.xpack.sql.jdbc.jdbc;
+
+import org.elasticsearch.test.ESTestCase;
+
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.sql.JDBCType;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.sql.Struct;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.sql.Types;
+import java.time.Clock;
+import java.time.LocalDateTime;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
+import java.util.Map;
+
+import static java.sql.JDBCType.BIGINT;
+import static java.sql.JDBCType.BOOLEAN;
+import static java.sql.JDBCType.DOUBLE;
+import static java.sql.JDBCType.FLOAT;
+import static java.sql.JDBCType.INTEGER;
+import static java.sql.JDBCType.REAL;
+import static java.sql.JDBCType.SMALLINT;
+import static java.sql.JDBCType.TIMESTAMP;
+import static java.sql.JDBCType.TINYINT;
+import static java.sql.JDBCType.VARBINARY;
+import static java.sql.JDBCType.VARCHAR;
+
+public class JdbcPreparedStatementTests extends ESTestCase {
+
+ public void testSettingBooleanValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+
+ jps.setBoolean(1, true);
+ assertEquals(true, value(jps));
+ assertEquals(BOOLEAN, jdbcType(jps));
+
+ jps.setObject(1, false);
+ assertEquals(false, value(jps));
+ assertEquals(BOOLEAN, jdbcType(jps));
+
+ jps.setObject(1, true, Types.BOOLEAN);
+ assertEquals(true, value(jps));
+ assertEquals(BOOLEAN, jdbcType(jps));
+ assertTrue(value(jps) instanceof Boolean);
+
+ jps.setObject(1, true, Types.INTEGER);
+ assertEquals(1, value(jps));
+ assertEquals(INTEGER, jdbcType(jps));
+
+ jps.setObject(1, true, Types.VARCHAR);
+ assertEquals("true", value(jps));
+ assertEquals(VARCHAR, jdbcType(jps));
+ }
+
+ public void testThrownExceptionsWhenSettingBooleanValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+
+ SQLException sqle = expectThrows(SQLException.class, () -> jps.setObject(1, true, Types.TIMESTAMP));
+ assertEquals("Conversion from type [BOOLEAN] to [Timestamp] not supported", sqle.getMessage());
+ }
+
+ public void testSettingStringValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+
+ jps.setString(1, "foo bar");
+ assertEquals("foo bar", value(jps));
+ assertEquals(VARCHAR, jdbcType(jps));
+
+ jps.setObject(1, "foo bar");
+ assertEquals("foo bar", value(jps));
+ assertEquals(VARCHAR, jdbcType(jps));
+
+ jps.setObject(1, "foo bar", Types.VARCHAR);
+ assertEquals("foo bar", value(jps));
+ assertEquals(VARCHAR, jdbcType(jps));
+ assertTrue(value(jps) instanceof String);
+ }
+
+ public void testThrownExceptionsWhenSettingStringValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+
+ SQLException sqle = expectThrows(SQLException.class, () -> jps.setObject(1, "foo bar", Types.INTEGER));
+ assertEquals("Conversion from type [VARCHAR] to [Integer] not supported", sqle.getMessage());
+ }
+
+ public void testSettingByteTypeValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+
+ jps.setByte(1, (byte) 6);
+ assertEquals((byte) 6, value(jps));
+ assertEquals(TINYINT, jdbcType(jps));
+
+ jps.setObject(1, (byte) 6);
+ assertEquals((byte) 6, value(jps));
+ assertEquals(TINYINT, jdbcType(jps));
+ assertTrue(value(jps) instanceof Byte);
+
+ jps.setObject(1, (byte) 0, Types.BOOLEAN);
+ assertEquals(false, value(jps));
+ assertEquals(BOOLEAN, jdbcType(jps));
+
+ jps.setObject(1, (byte) 123, Types.BOOLEAN);
+ assertEquals(true, value(jps));
+ assertEquals(BOOLEAN, jdbcType(jps));
+
+ jps.setObject(1, (byte) 123, Types.INTEGER);
+ assertEquals(123, value(jps));
+ assertEquals(INTEGER, jdbcType(jps));
+
+ jps.setObject(1, (byte) -128, Types.DOUBLE);
+ assertEquals(-128.0, value(jps));
+ assertEquals(DOUBLE, jdbcType(jps));
+ }
+
+ public void testThrownExceptionsWhenSettingByteTypeValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+
+ SQLException sqle = expectThrows(SQLException.class, () -> jps.setObject(1, (byte) 6, Types.TIMESTAMP));
+ assertEquals("Conversion from type [TINYINT] to [Timestamp] not supported", sqle.getMessage());
+ }
+
+ public void testSettingShortTypeValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+
+ short someShort = randomShort();
+ jps.setShort(1, someShort);
+ assertEquals(someShort, value(jps));
+ assertEquals(SMALLINT, jdbcType(jps));
+
+ jps.setObject(1, someShort);
+ assertEquals(someShort, value(jps));
+ assertEquals(SMALLINT, jdbcType(jps));
+ assertTrue(value(jps) instanceof Short);
+
+ jps.setObject(1, (short) 1, Types.BOOLEAN);
+ assertEquals(true, value(jps));
+ assertEquals(BOOLEAN, jdbcType(jps));
+
+ jps.setObject(1, (short) -32700, Types.DOUBLE);
+ assertEquals(-32700.0, value(jps));
+ assertEquals(DOUBLE, jdbcType(jps));
+
+ jps.setObject(1, someShort, Types.INTEGER);
+ assertEquals((int) someShort, value(jps));
+ assertEquals(INTEGER, jdbcType(jps));
+ }
+
+ public void testThrownExceptionsWhenSettingShortTypeValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+
+ SQLException sqle = expectThrows(SQLException.class, () -> jps.setObject(1, (short) 6, Types.TIMESTAMP));
+ assertEquals("Conversion from type [SMALLINT] to [Timestamp] not supported", sqle.getMessage());
+
+ sqle = expectThrows(SQLException.class, () -> jps.setObject(1, 256, Types.TINYINT));
+ assertEquals("Numeric " + 256 + " out of range", sqle.getMessage());
+ }
+
+ public void testSettingIntegerValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+
+ int someInt = randomInt();
+ jps.setInt(1, someInt);
+ assertEquals(someInt, value(jps));
+ assertEquals(INTEGER, jdbcType(jps));
+
+ jps.setObject(1, someInt);
+ assertEquals(someInt, value(jps));
+ assertEquals(INTEGER, jdbcType(jps));
+ assertTrue(value(jps) instanceof Integer);
+
+ jps.setObject(1, someInt, Types.VARCHAR);
+ assertEquals(String.valueOf(someInt), value(jps));
+ assertEquals(VARCHAR, jdbcType(jps));
+
+ jps.setObject(1, someInt, Types.FLOAT);
+ assertEquals(Double.valueOf(someInt), value(jps));
+ assertTrue(value(jps) instanceof Double);
+ assertEquals(FLOAT, jdbcType(jps));
+ }
+
+ public void testThrownExceptionsWhenSettingIntegerValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+ int someInt = randomInt();
+
+ SQLException sqle = expectThrows(SQLException.class, () -> jps.setObject(1, someInt, Types.TIMESTAMP));
+ assertEquals("Conversion from type [INTEGER] to [Timestamp] not supported", sqle.getMessage());
+
+ Integer randomIntNotShort = randomIntBetween(32768, Integer.MAX_VALUE);
+ sqle = expectThrows(SQLException.class, () -> jps.setObject(1, randomIntNotShort, Types.SMALLINT));
+ assertEquals("Numeric " + randomIntNotShort + " out of range", sqle.getMessage());
+
+ sqle = expectThrows(SQLException.class, () -> jps.setObject(1, randomIntNotShort, Types.TINYINT));
+ assertEquals("Numeric " + randomIntNotShort + " out of range", sqle.getMessage());
+ }
+
+ public void testSettingLongValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+
+ long someLong = randomLong();
+ jps.setLong(1, someLong);
+ assertEquals(someLong, value(jps));
+ assertEquals(BIGINT, jdbcType(jps));
+
+ jps.setObject(1, someLong);
+ assertEquals(someLong, value(jps));
+ assertEquals(BIGINT, jdbcType(jps));
+ assertTrue(value(jps) instanceof Long);
+
+ jps.setObject(1, someLong, Types.VARCHAR);
+ assertEquals(String.valueOf(someLong), value(jps));
+ assertEquals(VARCHAR, jdbcType(jps));
+
+ jps.setObject(1, someLong, Types.DOUBLE);
+ assertEquals((double) someLong, value(jps));
+ assertEquals(DOUBLE, jdbcType(jps));
+
+ jps.setObject(1, someLong, Types.FLOAT);
+ assertEquals((double) someLong, value(jps));
+ assertEquals(FLOAT, jdbcType(jps));
+ }
+
+ public void testThrownExceptionsWhenSettingLongValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+ long someLong = randomLong();
+
+ SQLException sqle = expectThrows(SQLException.class, () -> jps.setObject(1, someLong, Types.TIMESTAMP));
+ assertEquals("Conversion from type [BIGINT] to [Timestamp] not supported", sqle.getMessage());
+
+ Long randomLongNotShort = randomLongBetween(Integer.MAX_VALUE + 1, Long.MAX_VALUE);
+ sqle = expectThrows(SQLException.class, () -> jps.setObject(1, randomLongNotShort, Types.INTEGER));
+ assertEquals("Numeric " + randomLongNotShort + " out of range", sqle.getMessage());
+
+ sqle = expectThrows(SQLException.class, () -> jps.setObject(1, randomLongNotShort, Types.SMALLINT));
+ assertEquals("Numeric " + randomLongNotShort + " out of range", sqle.getMessage());
+ }
+
+ public void testSettingFloatValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+
+ float someFloat = randomFloat();
+ jps.setFloat(1, someFloat);
+ assertEquals(someFloat, value(jps));
+ assertEquals(REAL, jdbcType(jps));
+
+ jps.setObject(1, someFloat);
+ assertEquals(someFloat, value(jps));
+ assertEquals(REAL, jdbcType(jps));
+ assertTrue(value(jps) instanceof Float);
+
+ jps.setObject(1, someFloat, Types.VARCHAR);
+ assertEquals(String.valueOf(someFloat), value(jps));
+ assertEquals(VARCHAR, jdbcType(jps));
+
+ jps.setObject(1, someFloat, Types.DOUBLE);
+ assertEquals((double) someFloat, value(jps));
+ assertEquals(DOUBLE, jdbcType(jps));
+
+ jps.setObject(1, someFloat, Types.FLOAT);
+ assertEquals((double) someFloat, value(jps));
+ assertEquals(FLOAT, jdbcType(jps));
+ }
+
+ public void testThrownExceptionsWhenSettingFloatValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+ float someFloat = randomFloat();
+
+ SQLException sqle = expectThrows(SQLException.class, () -> jps.setObject(1, someFloat, Types.TIMESTAMP));
+ assertEquals("Conversion from type [REAL] to [Timestamp] not supported", sqle.getMessage());
+
+ Float floatNotInt = 5_155_000_000f;
+ sqle = expectThrows(SQLException.class, () -> jps.setObject(1, floatNotInt, Types.INTEGER));
+ assertEquals(String.format(Locale.ROOT, "Numeric %s out of range",
+ Long.toString(Math.round(floatNotInt.doubleValue()))), sqle.getMessage());
+
+ sqle = expectThrows(SQLException.class, () -> jps.setObject(1, floatNotInt, Types.SMALLINT));
+ assertEquals(String.format(Locale.ROOT, "Numeric %s out of range",
+ Long.toString(Math.round(floatNotInt.doubleValue()))), sqle.getMessage());
+ }
+
+ public void testSettingDoubleValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+
+ double someDouble = randomDouble();
+ jps.setDouble(1, someDouble);
+ assertEquals(someDouble, value(jps));
+ assertEquals(DOUBLE, jdbcType(jps));
+
+ jps.setObject(1, someDouble);
+ assertEquals(someDouble, value(jps));
+ assertEquals(DOUBLE, jdbcType(jps));
+ assertTrue(value(jps) instanceof Double);
+
+ jps.setObject(1, someDouble, Types.VARCHAR);
+ assertEquals(String.valueOf(someDouble), value(jps));
+ assertEquals(VARCHAR, jdbcType(jps));
+
+ jps.setObject(1, someDouble, Types.REAL);
+ assertEquals(new Float(someDouble), value(jps));
+ assertEquals(REAL, jdbcType(jps));
+ }
+
+ public void testThrownExceptionsWhenSettingDoubleValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+ double someDouble = randomDouble();
+
+ SQLException sqle = expectThrows(SQLException.class, () -> jps.setObject(1, someDouble, Types.TIMESTAMP));
+ assertEquals("Conversion from type [DOUBLE] to [Timestamp] not supported", sqle.getMessage());
+
+ Double doubleNotInt = 5_155_000_000d;
+ sqle = expectThrows(SQLException.class, () -> jps.setObject(1, doubleNotInt, Types.INTEGER));
+ assertEquals(String.format(Locale.ROOT, "Numeric %s out of range",
+ Long.toString(((Number) doubleNotInt).longValue())), sqle.getMessage());
+ }
+
+ public void testUnsupportedClasses() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+ SQLFeatureNotSupportedException sfnse = expectThrows(SQLFeatureNotSupportedException.class, () -> jps.setObject(1, new Struct() {
+ @Override
+ public String getSQLTypeName() throws SQLException {
+ return null;
+ }
+ @Override
+ public Object[] getAttributes(Map> map) throws SQLException {
+ return null;
+ }
+ @Override
+ public Object[] getAttributes() throws SQLException {
+ return null;
+ }
+ }));
+ assertEquals("Objects of type java.sql.Struct are not supported", sfnse.getMessage());
+
+ sfnse = expectThrows(SQLFeatureNotSupportedException.class, () -> jps.setObject(1, new URL("http://test")));
+ assertEquals("Objects of type java.net.URL are not supported", sfnse.getMessage());
+
+ sfnse = expectThrows(SQLFeatureNotSupportedException.class, () -> jps.setURL(1, new URL("http://test")));
+ assertEquals("Objects of type java.net.URL are not supported", sfnse.getMessage());
+
+ sfnse = expectThrows(SQLFeatureNotSupportedException.class, () -> jps.setObject(1, this, Types.TIMESTAMP));
+ assertEquals("Conversion from type " + this.getClass().getName() + " to TIMESTAMP not supported", sfnse.getMessage());
+
+ SQLException se = expectThrows(SQLException.class, () -> jps.setObject(1, this, 1_000_000));
+ assertEquals("Type:1000000 is not a valid Types.java value.", se.getMessage());
+
+ IllegalArgumentException iae = expectThrows(IllegalArgumentException.class, () -> jps.setObject(1, randomShort(), Types.CHAR));
+ assertEquals("Unsupported JDBC type [CHAR]", iae.getMessage());
+ }
+
+ public void testSettingTimestampValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+
+ Timestamp someTimestamp = new Timestamp(randomMillisSinceEpoch());
+ jps.setTimestamp(1, someTimestamp);
+ assertEquals(someTimestamp.getTime(), ((Date)value(jps)).getTime());
+ assertEquals(TIMESTAMP, jdbcType(jps));
+
+ Calendar nonDefaultCal = randomCalendar();
+ // February 29th, 2016. 01:17:55 GMT = 1456708675000 millis since epoch
+ jps.setTimestamp(1, new Timestamp(1456708675000L), nonDefaultCal);
+ assertEquals(1456708675000L, convertFromUTCtoCalendar(((Date)value(jps)), nonDefaultCal));
+ assertEquals(TIMESTAMP, jdbcType(jps));
+
+ long beforeEpochTime = -randomMillisSinceEpoch();
+ jps.setTimestamp(1, new Timestamp(beforeEpochTime), nonDefaultCal);
+ assertEquals(beforeEpochTime, convertFromUTCtoCalendar(((Date)value(jps)), nonDefaultCal));
+ assertTrue(value(jps) instanceof java.util.Date);
+
+ jps.setObject(1, someTimestamp, Types.VARCHAR);
+ assertEquals(someTimestamp.toString(), value(jps).toString());
+ assertEquals(VARCHAR, jdbcType(jps));
+ }
+
+ public void testThrownExceptionsWhenSettingTimestampValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+ Timestamp someTimestamp = new Timestamp(randomMillisSinceEpoch());
+
+ SQLException sqle = expectThrows(SQLFeatureNotSupportedException.class, () -> jps.setObject(1, someTimestamp, Types.INTEGER));
+ assertEquals("Conversion from type java.sql.Timestamp to INTEGER not supported", sqle.getMessage());
+ }
+
+ public void testSettingTimeValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+
+ Time time = new Time(4675000);
+ Calendar nonDefaultCal = randomCalendar();
+ jps.setTime(1, time, nonDefaultCal);
+ assertEquals(4675000, convertFromUTCtoCalendar(((Date)value(jps)), nonDefaultCal));
+ assertEquals(TIMESTAMP, jdbcType(jps));
+ assertTrue(value(jps) instanceof java.util.Date);
+
+ jps.setObject(1, time, Types.VARCHAR);
+ assertEquals(time.toString(), value(jps).toString());
+ assertEquals(VARCHAR, jdbcType(jps));
+ }
+
+ public void testThrownExceptionsWhenSettingTimeValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+ Time time = new Time(4675000);
+
+ SQLException sqle = expectThrows(SQLFeatureNotSupportedException.class, () -> jps.setObject(1, time, Types.INTEGER));
+ assertEquals("Conversion from type java.sql.Time to INTEGER not supported", sqle.getMessage());
+ }
+
+ public void testSettingSqlDateValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+
+ java.sql.Date someSqlDate = new java.sql.Date(randomMillisSinceEpoch());
+ jps.setDate(1, someSqlDate);
+ assertEquals(someSqlDate.getTime(), ((Date)value(jps)).getTime());
+ assertEquals(TIMESTAMP, jdbcType(jps));
+
+ someSqlDate = new java.sql.Date(randomMillisSinceEpoch());
+ Calendar nonDefaultCal = randomCalendar();
+ jps.setDate(1, someSqlDate, nonDefaultCal);
+ assertEquals(someSqlDate.getTime(), convertFromUTCtoCalendar(((Date)value(jps)), nonDefaultCal));
+ assertEquals(TIMESTAMP, jdbcType(jps));
+ assertTrue(value(jps) instanceof java.util.Date);
+
+ jps.setObject(1, someSqlDate, Types.VARCHAR);
+ assertEquals(someSqlDate.toString(), value(jps).toString());
+ assertEquals(VARCHAR, jdbcType(jps));
+ }
+
+ public void testThrownExceptionsWhenSettingSqlDateValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+ java.sql.Date someSqlDate = new java.sql.Date(randomMillisSinceEpoch());
+
+ SQLException sqle = expectThrows(SQLFeatureNotSupportedException.class,
+ () -> jps.setObject(1, new java.sql.Date(randomMillisSinceEpoch()), Types.DOUBLE));
+ assertEquals("Conversion from type " + someSqlDate.getClass().getName() + " to DOUBLE not supported", sqle.getMessage());
+ }
+
+ public void testSettingCalendarValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+ Calendar someCalendar = randomCalendar();
+ someCalendar.setTimeInMillis(randomMillisSinceEpoch());
+
+ jps.setObject(1, someCalendar);
+ assertEquals(someCalendar.getTime(), (Date) value(jps));
+ assertEquals(TIMESTAMP, jdbcType(jps));
+ assertTrue(value(jps) instanceof java.util.Date);
+
+ jps.setObject(1, someCalendar, Types.VARCHAR);
+ assertEquals(someCalendar.toString(), value(jps).toString());
+ assertEquals(VARCHAR, jdbcType(jps));
+
+ Calendar nonDefaultCal = randomCalendar();
+ jps.setObject(1, nonDefaultCal);
+ assertEquals(nonDefaultCal.getTime(), (Date) value(jps));
+ assertEquals(TIMESTAMP, jdbcType(jps));
+ }
+
+ public void testThrownExceptionsWhenSettingCalendarValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+ Calendar someCalendar = randomCalendar();
+
+ SQLException sqle = expectThrows(SQLFeatureNotSupportedException.class, () -> jps.setObject(1, someCalendar, Types.DOUBLE));
+ assertEquals("Conversion from type " + someCalendar.getClass().getName() + " to DOUBLE not supported", sqle.getMessage());
+ }
+
+ public void testSettingDateValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+ Date someDate = new Date(randomMillisSinceEpoch());
+
+ jps.setObject(1, someDate);
+ assertEquals(someDate, (Date) value(jps));
+ assertEquals(TIMESTAMP, jdbcType(jps));
+ assertTrue(value(jps) instanceof java.util.Date);
+
+ jps.setObject(1, someDate, Types.VARCHAR);
+ assertEquals(someDate.toString(), value(jps).toString());
+ assertEquals(VARCHAR, jdbcType(jps));
+ }
+
+ public void testThrownExceptionsWhenSettingDateValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+ Date someDate = new Date(randomMillisSinceEpoch());
+
+ SQLException sqle = expectThrows(SQLFeatureNotSupportedException.class, () -> jps.setObject(1, someDate, Types.BIGINT));
+ assertEquals("Conversion from type " + someDate.getClass().getName() + " to BIGINT not supported", sqle.getMessage());
+ }
+
+ public void testSettingLocalDateTimeValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+ LocalDateTime ldt = LocalDateTime.now(Clock.systemDefaultZone());
+
+ jps.setObject(1, ldt);
+ assertEquals(Date.class, value(jps).getClass());
+ assertEquals(TIMESTAMP, jdbcType(jps));
+ assertTrue(value(jps) instanceof java.util.Date);
+
+ jps.setObject(1, ldt, Types.VARCHAR);
+ assertEquals(ldt.toString(), value(jps).toString());
+ assertEquals(VARCHAR, jdbcType(jps));
+ }
+
+ public void testThrownExceptionsWhenSettingLocalDateTimeValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+ LocalDateTime ldt = LocalDateTime.now(Clock.systemDefaultZone());
+
+ SQLException sqle = expectThrows(SQLFeatureNotSupportedException.class, () -> jps.setObject(1, ldt, Types.BIGINT));
+ assertEquals("Conversion from type " + ldt.getClass().getName() + " to BIGINT not supported", sqle.getMessage());
+ }
+
+ public void testSettingByteArrayValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+
+ byte[] buffer = "some data".getBytes(StandardCharsets.UTF_8);
+ jps.setBytes(1, buffer);
+ assertEquals(byte[].class, value(jps).getClass());
+ assertEquals(VARBINARY, jdbcType(jps));
+
+ jps.setObject(1, buffer);
+ assertEquals(byte[].class, value(jps).getClass());
+ assertEquals(VARBINARY, jdbcType(jps));
+ assertTrue(value(jps) instanceof byte[]);
+
+ jps.setObject(1, buffer, Types.VARBINARY);
+ assertEquals((byte[]) value(jps), buffer);
+ assertEquals(VARBINARY, jdbcType(jps));
+
+ SQLException sqle = expectThrows(SQLFeatureNotSupportedException.class, () -> jps.setObject(1, buffer, Types.VARCHAR));
+ assertEquals("Conversion from type byte[] to VARCHAR not supported", sqle.getMessage());
+
+ sqle = expectThrows(SQLFeatureNotSupportedException.class, () -> jps.setObject(1, buffer, Types.DOUBLE));
+ assertEquals("Conversion from type byte[] to DOUBLE not supported", sqle.getMessage());
+ }
+
+ public void testThrownExceptionsWhenSettingByteArrayValues() throws SQLException {
+ JdbcPreparedStatement jps = createJdbcPreparedStatement();
+ byte[] buffer = "foo".getBytes(StandardCharsets.UTF_8);
+
+ SQLException sqle = expectThrows(SQLFeatureNotSupportedException.class, () -> jps.setObject(1, buffer, Types.VARCHAR));
+ assertEquals("Conversion from type byte[] to VARCHAR not supported", sqle.getMessage());
+
+ sqle = expectThrows(SQLFeatureNotSupportedException.class, () -> jps.setObject(1, buffer, Types.DOUBLE));
+ assertEquals("Conversion from type byte[] to DOUBLE not supported", sqle.getMessage());
+ }
+
+ private long randomMillisSinceEpoch() {
+ return randomLongBetween(0, System.currentTimeMillis());
+ }
+
+ private JdbcPreparedStatement createJdbcPreparedStatement() throws SQLException {
+ return new JdbcPreparedStatement(null, JdbcConfiguration.create("jdbc:es://l:1", null, 0), "?");
+ }
+
+ private JDBCType jdbcType(JdbcPreparedStatement jps) throws SQLException {
+ return jps.query.getParam(1).type;
+ }
+
+ private Object value(JdbcPreparedStatement jps) throws SQLException {
+ return jps.query.getParam(1).value;
+ }
+
+ private Calendar randomCalendar() {
+ return Calendar.getInstance(randomTimeZone(), Locale.ROOT);
+ }
+
+ /*
+ * Converts from UTC to the provided Calendar.
+ * Helps checking if the converted date/time values using Calendars in set*(...,Calendar) methods did convert
+ * the values correctly to UTC.
+ */
+ private long convertFromUTCtoCalendar(Date date, Calendar nonDefaultCal) throws SQLException {
+ return ZonedDateTime.ofInstant(date.toInstant(), ZoneOffset.UTC)
+ .withZoneSameLocal(nonDefaultCal.getTimeZone().toZoneId())
+ .toInstant().toEpochMilli();
+ }
+}
diff --git a/x-pack/plugin/sql/sql-action/build.gradle b/x-pack/plugin/sql/sql-action/build.gradle
new file mode 100644
index 0000000000000..d8805d2e3db51
--- /dev/null
+++ b/x-pack/plugin/sql/sql-action/build.gradle
@@ -0,0 +1,152 @@
+
+/*
+ * This project contains transport-level requests and responses that are shared between x-pack plugin and qa tests
+ */
+
+import org.elasticsearch.gradle.precommit.PrecommitTasks
+
+apply plugin: 'elasticsearch.build'
+
+description = 'Request and response objects shared by the cli, jdbc ' +
+ 'and the Elasticsearch plugin'
+
+dependencies {
+ /* We'd like to just depend on xcontent but there are some bits of
+ * :server that we rely on.... */
+ compile (project(':server')) {
+ transitive = false
+ }
+ compile (project(':libs:core')) {
+ transitive = false
+ }
+ compile (project(':libs:x-content')) {
+ transitive = false
+ }
+ compile xpackProject('plugin:sql:sql-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}"
+ runtime "org.apache.logging.log4j:log4j-api:${versions.log4j}"
+ runtime "org.apache.logging.log4j:log4j-core:${versions.log4j}"
+
+ testCompile "org.elasticsearch.test:framework:${version}"
+}
+
+forbiddenApisMain {
+ //sql does not depend on server, so only jdk signatures should be checked
+ signaturesURLs = [PrecommitTasks.getResource('/forbidden/jdk-signatures.txt')]
+}
+
+dependencyLicenses {
+ mapping from: /elasticsearch-core.*/, to: 'elasticsearch'
+ mapping from: /jackson-.*/, to: 'jackson'
+ mapping from: /lucene-.*/, to: 'lucene'
+ ignoreSha 'elasticsearch'
+ ignoreSha 'elasticsearch-core'
+}
+
+thirdPartyAudit.excludes = [
+ 'com.fasterxml.jackson.dataformat.yaml.YAMLFactory',
+ 'com.fasterxml.jackson.dataformat.yaml.YAMLMapper',
+
+ // from com.fasterxml.jackson.dataformat.yaml.YAMLMapper (jackson-dataformat-yaml)
+ 'com.fasterxml.jackson.databind.ObjectMapper',
+ 'org.fusesource.jansi.Ansi',
+ 'org.fusesource.jansi.AnsiRenderer$Code',
+
+ // from log4j
+ 'com.conversantmedia.util.concurrent.DisruptorBlockingQueue',
+ 'com.conversantmedia.util.concurrent.SpinPolicy',
+ 'com.fasterxml.jackson.annotation.JsonInclude$Include',
+ 'com.fasterxml.jackson.databind.DeserializationContext',
+ 'com.fasterxml.jackson.databind.DeserializationFeature',
+ 'com.fasterxml.jackson.databind.JsonMappingException',
+ 'com.fasterxml.jackson.databind.JsonNode',
+ 'com.fasterxml.jackson.databind.Module$SetupContext',
+ 'com.fasterxml.jackson.databind.ObjectReader',
+ 'com.fasterxml.jackson.databind.ObjectWriter',
+ 'com.fasterxml.jackson.databind.SerializerProvider',
+ 'com.fasterxml.jackson.databind.deser.std.StdDeserializer',
+ 'com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer',
+ 'com.fasterxml.jackson.databind.module.SimpleModule',
+ 'com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter',
+ 'com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider',
+ 'com.fasterxml.jackson.databind.ser.std.StdScalarSerializer',
+ 'com.fasterxml.jackson.databind.ser.std.StdSerializer',
+ 'com.fasterxml.jackson.dataformat.xml.JacksonXmlModule',
+ 'com.fasterxml.jackson.dataformat.xml.XmlMapper',
+ 'com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter',
+ 'com.fasterxml.jackson.databind.node.JsonNodeFactory',
+ 'com.fasterxml.jackson.databind.node.ObjectNode',
+ 'com.lmax.disruptor.BlockingWaitStrategy',
+ 'com.lmax.disruptor.BusySpinWaitStrategy',
+ 'com.lmax.disruptor.EventFactory',
+ 'com.lmax.disruptor.EventTranslator',
+ 'com.lmax.disruptor.EventTranslatorTwoArg',
+ 'com.lmax.disruptor.EventTranslatorVararg',
+ 'com.lmax.disruptor.ExceptionHandler',
+ 'com.lmax.disruptor.LifecycleAware',
+ 'com.lmax.disruptor.RingBuffer',
+ 'com.lmax.disruptor.Sequence',
+ 'com.lmax.disruptor.SequenceReportingEventHandler',
+ 'com.lmax.disruptor.SleepingWaitStrategy',
+ 'com.lmax.disruptor.TimeoutBlockingWaitStrategy',
+ 'com.lmax.disruptor.WaitStrategy',
+ 'com.lmax.disruptor.YieldingWaitStrategy',
+ 'com.lmax.disruptor.dsl.Disruptor',
+ 'com.lmax.disruptor.dsl.ProducerType',
+ 'javax.jms.Connection',
+ 'javax.jms.ConnectionFactory',
+ 'javax.jms.Destination',
+ 'javax.jms.JMSException',
+ 'javax.jms.MapMessage',
+ 'javax.jms.Message',
+ 'javax.jms.MessageConsumer',
+ 'javax.jms.MessageProducer',
+ 'javax.jms.Session',
+ 'javax.mail.Authenticator',
+ 'javax.mail.Message$RecipientType',
+ 'javax.mail.PasswordAuthentication',
+ 'javax.mail.Session',
+ 'javax.mail.Transport',
+ 'javax.mail.internet.InternetAddress',
+ 'javax.mail.internet.InternetHeaders',
+ 'javax.mail.internet.MimeBodyPart',
+ 'javax.mail.internet.MimeMessage',
+ 'javax.mail.internet.MimeMultipart',
+ 'javax.mail.internet.MimeUtility',
+ 'javax.mail.util.ByteArrayDataSource',
+ 'javax.persistence.AttributeConverter',
+ 'javax.persistence.EntityManager',
+ 'javax.persistence.EntityManagerFactory',
+ 'javax.persistence.EntityTransaction',
+ 'javax.persistence.Persistence',
+ 'javax.persistence.PersistenceException',
+ 'org.apache.commons.compress.compressors.CompressorStreamFactory',
+ 'org.apache.commons.compress.utils.IOUtils',
+ 'org.apache.commons.csv.CSVFormat',
+ 'org.apache.commons.csv.QuoteMode',
+ 'org.apache.kafka.clients.producer.Callback',
+ 'org.apache.kafka.clients.producer.KafkaProducer',
+ 'org.apache.kafka.clients.producer.Producer',
+ 'org.apache.kafka.clients.producer.ProducerRecord',
+ 'org.apache.kafka.clients.producer.RecordMetadata',
+ 'org.codehaus.stax2.XMLStreamWriter2',
+ 'org.jctools.queues.MessagePassingQueue$Consumer',
+ 'org.jctools.queues.MpscArrayQueue',
+ 'org.osgi.framework.AdaptPermission',
+ 'org.osgi.framework.AdminPermission',
+ 'org.osgi.framework.Bundle',
+ 'org.osgi.framework.BundleActivator',
+ 'org.osgi.framework.BundleContext',
+ 'org.osgi.framework.BundleEvent',
+ 'org.osgi.framework.BundleReference',
+ 'org.osgi.framework.FrameworkUtil',
+ 'org.osgi.framework.ServiceRegistration',
+ 'org.osgi.framework.SynchronousBundleListener',
+ 'org.osgi.framework.wiring.BundleWire',
+ 'org.osgi.framework.wiring.BundleWiring',
+ 'org.zeromq.ZMQ$Context',
+ 'org.zeromq.ZMQ$Socket',
+ 'org.zeromq.ZMQ'
+]
diff --git a/x-pack/plugin/sql/sql-shared-client/licenses/jackson-LICENSE b/x-pack/plugin/sql/sql-action/licenses/jackson-LICENSE
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-client/licenses/jackson-LICENSE
rename to x-pack/plugin/sql/sql-action/licenses/jackson-LICENSE
diff --git a/x-pack/plugin/sql/sql-shared-client/licenses/jackson-NOTICE b/x-pack/plugin/sql/sql-action/licenses/jackson-NOTICE
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-client/licenses/jackson-NOTICE
rename to x-pack/plugin/sql/sql-action/licenses/jackson-NOTICE
diff --git a/x-pack/plugin/sql/sql-shared-client/licenses/jackson-core-2.8.10.jar.sha1 b/x-pack/plugin/sql/sql-action/licenses/jackson-core-2.8.10.jar.sha1
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-client/licenses/jackson-core-2.8.10.jar.sha1
rename to x-pack/plugin/sql/sql-action/licenses/jackson-core-2.8.10.jar.sha1
diff --git a/x-pack/plugin/sql/sql-shared-proto/licenses/joda-time-2.9.9.jar.sha1 b/x-pack/plugin/sql/sql-action/licenses/joda-time-2.9.9.jar.sha1
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-proto/licenses/joda-time-2.9.9.jar.sha1
rename to x-pack/plugin/sql/sql-action/licenses/joda-time-2.9.9.jar.sha1
diff --git a/x-pack/plugin/sql/sql-shared-proto/licenses/joda-time-LICENSE.txt b/x-pack/plugin/sql/sql-action/licenses/joda-time-LICENSE.txt
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-proto/licenses/joda-time-LICENSE.txt
rename to x-pack/plugin/sql/sql-action/licenses/joda-time-LICENSE.txt
diff --git a/x-pack/plugin/sql/sql-shared-proto/licenses/joda-time-NOTICE.txt b/x-pack/plugin/sql/sql-action/licenses/joda-time-NOTICE.txt
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-proto/licenses/joda-time-NOTICE.txt
rename to x-pack/plugin/sql/sql-action/licenses/joda-time-NOTICE.txt
diff --git a/x-pack/plugin/sql/sql-proto/licenses/log4j-api-2.9.1.jar.sha1 b/x-pack/plugin/sql/sql-action/licenses/log4j-api-2.9.1.jar.sha1
similarity index 100%
rename from x-pack/plugin/sql/sql-proto/licenses/log4j-api-2.9.1.jar.sha1
rename to x-pack/plugin/sql/sql-action/licenses/log4j-api-2.9.1.jar.sha1
diff --git a/x-pack/plugin/sql/sql-proto/licenses/log4j-api-LICENSE.txt b/x-pack/plugin/sql/sql-action/licenses/log4j-api-LICENSE.txt
similarity index 100%
rename from x-pack/plugin/sql/sql-proto/licenses/log4j-api-LICENSE.txt
rename to x-pack/plugin/sql/sql-action/licenses/log4j-api-LICENSE.txt
diff --git a/x-pack/plugin/sql/sql-proto/licenses/log4j-api-NOTICE.txt b/x-pack/plugin/sql/sql-action/licenses/log4j-api-NOTICE.txt
similarity index 100%
rename from x-pack/plugin/sql/sql-proto/licenses/log4j-api-NOTICE.txt
rename to x-pack/plugin/sql/sql-action/licenses/log4j-api-NOTICE.txt
diff --git a/x-pack/plugin/sql/sql-proto/licenses/log4j-core-2.9.1.jar.sha1 b/x-pack/plugin/sql/sql-action/licenses/log4j-core-2.9.1.jar.sha1
similarity index 100%
rename from x-pack/plugin/sql/sql-proto/licenses/log4j-core-2.9.1.jar.sha1
rename to x-pack/plugin/sql/sql-action/licenses/log4j-core-2.9.1.jar.sha1
diff --git a/x-pack/plugin/sql/sql-proto/licenses/log4j-core-LICENSE.txt b/x-pack/plugin/sql/sql-action/licenses/log4j-core-LICENSE.txt
similarity index 100%
rename from x-pack/plugin/sql/sql-proto/licenses/log4j-core-LICENSE.txt
rename to x-pack/plugin/sql/sql-action/licenses/log4j-core-LICENSE.txt
diff --git a/x-pack/plugin/sql/sql-proto/licenses/log4j-core-NOTICE.txt b/x-pack/plugin/sql/sql-action/licenses/log4j-core-NOTICE.txt
similarity index 100%
rename from x-pack/plugin/sql/sql-proto/licenses/log4j-core-NOTICE.txt
rename to x-pack/plugin/sql/sql-action/licenses/log4j-core-NOTICE.txt
diff --git a/x-pack/plugin/sql/sql-proto/licenses/lucene-LICENSE.txt b/x-pack/plugin/sql/sql-action/licenses/lucene-LICENSE.txt
similarity index 100%
rename from x-pack/plugin/sql/sql-proto/licenses/lucene-LICENSE.txt
rename to x-pack/plugin/sql/sql-action/licenses/lucene-LICENSE.txt
diff --git a/x-pack/plugin/sql/sql-proto/licenses/lucene-NOTICE.txt b/x-pack/plugin/sql/sql-action/licenses/lucene-NOTICE.txt
similarity index 100%
rename from x-pack/plugin/sql/sql-proto/licenses/lucene-NOTICE.txt
rename to x-pack/plugin/sql/sql-action/licenses/lucene-NOTICE.txt
diff --git a/x-pack/plugin/sql/sql-proto/licenses/lucene-core-7.4.0.jar.sha1 b/x-pack/plugin/sql/sql-action/licenses/lucene-core-7.4.0.jar.sha1
similarity index 100%
rename from x-pack/plugin/sql/sql-proto/licenses/lucene-core-7.4.0.jar.sha1
rename to x-pack/plugin/sql/sql-action/licenses/lucene-core-7.4.0.jar.sha1
diff --git a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/AbstractSqlQueryRequest.java b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/AbstractSqlQueryRequest.java
similarity index 99%
rename from x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/AbstractSqlQueryRequest.java
rename to x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/AbstractSqlQueryRequest.java
index dcb210ca68d9b..5ca956404be66 100644
--- a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/AbstractSqlQueryRequest.java
+++ b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/AbstractSqlQueryRequest.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.plugin;
+package org.elasticsearch.xpack.sql.action;
import org.elasticsearch.action.CompositeIndicesRequest;
import org.elasticsearch.common.Nullable;
diff --git a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/AbstractSqlRequest.java b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/AbstractSqlRequest.java
similarity index 98%
rename from x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/AbstractSqlRequest.java
rename to x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/AbstractSqlRequest.java
index 2cb23f796d609..ba513fed7da24 100644
--- a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/AbstractSqlRequest.java
+++ b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/AbstractSqlRequest.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.plugin;
+package org.elasticsearch.xpack.sql.action;
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionRequestValidationException;
diff --git a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/CliFormatter.java b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/CliFormatter.java
similarity index 99%
rename from x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/CliFormatter.java
rename to x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/CliFormatter.java
index 359652fa4f203..c773e75aa18be 100644
--- a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/CliFormatter.java
+++ b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/CliFormatter.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.plugin;
+package org.elasticsearch.xpack.sql.action;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
diff --git a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlClearCursorAction.java b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlClearCursorAction.java
similarity index 94%
rename from x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlClearCursorAction.java
rename to x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlClearCursorAction.java
index 0908af76bebee..ee824fc04e9f5 100644
--- a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlClearCursorAction.java
+++ b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlClearCursorAction.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.plugin;
+package org.elasticsearch.xpack.sql.action;
import org.elasticsearch.action.Action;
diff --git a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlClearCursorRequest.java b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlClearCursorRequest.java
similarity index 98%
rename from x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlClearCursorRequest.java
rename to x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlClearCursorRequest.java
index 45dda28588726..7a1f72dd74a80 100644
--- a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlClearCursorRequest.java
+++ b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlClearCursorRequest.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.plugin;
+package org.elasticsearch.xpack.sql.action;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.common.ParseField;
diff --git a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlClearCursorRequestBuilder.java b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlClearCursorRequestBuilder.java
similarity index 94%
rename from x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlClearCursorRequestBuilder.java
rename to x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlClearCursorRequestBuilder.java
index b7a1f383a2f8b..40ce4f8dcf355 100644
--- a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlClearCursorRequestBuilder.java
+++ b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlClearCursorRequestBuilder.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.plugin;
+package org.elasticsearch.xpack.sql.action;
import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
diff --git a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlClearCursorResponse.java b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlClearCursorResponse.java
similarity index 98%
rename from x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlClearCursorResponse.java
rename to x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlClearCursorResponse.java
index 3bb3df9a47ffd..ba9e4193d9907 100644
--- a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlClearCursorResponse.java
+++ b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlClearCursorResponse.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.plugin;
+package org.elasticsearch.xpack.sql.action;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.common.io.stream.StreamInput;
diff --git a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlQueryAction.java b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlQueryAction.java
similarity index 93%
rename from x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlQueryAction.java
rename to x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlQueryAction.java
index 5b9a5b1c3ef47..f25eef31d3dc3 100644
--- a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlQueryAction.java
+++ b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlQueryAction.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.plugin;
+package org.elasticsearch.xpack.sql.action;
import org.elasticsearch.action.Action;
diff --git a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlQueryRequest.java b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlQueryRequest.java
similarity index 98%
rename from x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlQueryRequest.java
rename to x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlQueryRequest.java
index 16c3cbf9c39c7..a7166f56790c0 100644
--- a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlQueryRequest.java
+++ b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlQueryRequest.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.plugin;
+package org.elasticsearch.xpack.sql.action;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.common.ParseField;
diff --git a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlQueryRequestBuilder.java b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlQueryRequestBuilder.java
similarity index 98%
rename from x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlQueryRequestBuilder.java
rename to x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlQueryRequestBuilder.java
index 812b72473ad14..b1c6c310f7ade 100644
--- a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlQueryRequestBuilder.java
+++ b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlQueryRequestBuilder.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.plugin;
+package org.elasticsearch.xpack.sql.action;
import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
diff --git a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlQueryResponse.java b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlQueryResponse.java
similarity index 99%
rename from x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlQueryResponse.java
rename to x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlQueryResponse.java
index 118ba81f82df0..1dc356f9fba5f 100644
--- a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlQueryResponse.java
+++ b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlQueryResponse.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.plugin;
+package org.elasticsearch.xpack.sql.action;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.common.Nullable;
diff --git a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlTranslateAction.java b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlTranslateAction.java
similarity index 94%
rename from x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlTranslateAction.java
rename to x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlTranslateAction.java
index 978a11fbbb645..2431ecc1edf8c 100644
--- a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlTranslateAction.java
+++ b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlTranslateAction.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.plugin;
+package org.elasticsearch.xpack.sql.action;
import org.elasticsearch.action.Action;
@@ -23,4 +23,4 @@ private SqlTranslateAction() {
public SqlTranslateResponse newResponse() {
return new SqlTranslateResponse();
}
-}
\ No newline at end of file
+}
diff --git a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlTranslateRequest.java b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlTranslateRequest.java
similarity index 93%
rename from x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlTranslateRequest.java
rename to x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlTranslateRequest.java
index 103bfe5fddd69..73187a02856e0 100644
--- a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlTranslateRequest.java
+++ b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlTranslateRequest.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.plugin;
+package org.elasticsearch.xpack.sql.action;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.common.Strings;
@@ -15,6 +15,7 @@
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.xpack.sql.proto.Mode;
import org.elasticsearch.xpack.sql.proto.SqlTypedParamValue;
+import org.elasticsearch.xpack.sql.proto.SqlQueryRequest;
import java.io.IOException;
import java.util.List;
@@ -63,7 +64,7 @@ public static SqlTranslateRequest fromXContent(XContentParser parser, Mode mode)
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
// This is needed just to test parsing of SqlTranslateRequest, so we can reuse SqlQuerySerialization
- return new org.elasticsearch.xpack.sql.proto.SqlQueryRequest(mode(), query(), params(), timeZone(), fetchSize(),
+ return new SqlQueryRequest(mode(), query(), params(), timeZone(), fetchSize(),
requestTimeout(), pageTimeout(), filter(), null).toXContent(builder, params);
}
diff --git a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlTranslateRequestBuilder.java b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlTranslateRequestBuilder.java
similarity index 97%
rename from x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlTranslateRequestBuilder.java
rename to x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlTranslateRequestBuilder.java
index 9b9b00ebde9f1..22af91be67ddc 100644
--- a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlTranslateRequestBuilder.java
+++ b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlTranslateRequestBuilder.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.plugin;
+package org.elasticsearch.xpack.sql.action;
import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
diff --git a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlTranslateResponse.java b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlTranslateResponse.java
similarity index 97%
rename from x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlTranslateResponse.java
rename to x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlTranslateResponse.java
index a19f8d1fc3cba..e2efd4b46b674 100644
--- a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlTranslateResponse.java
+++ b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlTranslateResponse.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.plugin;
+package org.elasticsearch.xpack.sql.action;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.common.io.stream.StreamInput;
diff --git a/x-pack/plugin/sql/sql-proto/src/test/java/org/elasticsearch/xpack/sql/plugin/SqlClearCursorRequestTests.java b/x-pack/plugin/sql/sql-action/src/test/java/org/elasticsearch/xpack/sql/action/SqlClearCursorRequestTests.java
similarity index 97%
rename from x-pack/plugin/sql/sql-proto/src/test/java/org/elasticsearch/xpack/sql/plugin/SqlClearCursorRequestTests.java
rename to x-pack/plugin/sql/sql-action/src/test/java/org/elasticsearch/xpack/sql/action/SqlClearCursorRequestTests.java
index e479ae8b4f1ea..e9c7043519b4c 100644
--- a/x-pack/plugin/sql/sql-proto/src/test/java/org/elasticsearch/xpack/sql/plugin/SqlClearCursorRequestTests.java
+++ b/x-pack/plugin/sql/sql-action/src/test/java/org/elasticsearch/xpack/sql/action/SqlClearCursorRequestTests.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.plugin;
+package org.elasticsearch.xpack.sql.action;
import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.common.xcontent.XContentParser;
diff --git a/x-pack/plugin/sql/sql-proto/src/test/java/org/elasticsearch/xpack/sql/plugin/SqlClearCursorResponseTests.java b/x-pack/plugin/sql/sql-action/src/test/java/org/elasticsearch/xpack/sql/action/SqlClearCursorResponseTests.java
similarity index 96%
rename from x-pack/plugin/sql/sql-proto/src/test/java/org/elasticsearch/xpack/sql/plugin/SqlClearCursorResponseTests.java
rename to x-pack/plugin/sql/sql-action/src/test/java/org/elasticsearch/xpack/sql/action/SqlClearCursorResponseTests.java
index 94964428bb4f3..9e9f200abac52 100644
--- a/x-pack/plugin/sql/sql-proto/src/test/java/org/elasticsearch/xpack/sql/plugin/SqlClearCursorResponseTests.java
+++ b/x-pack/plugin/sql/sql-action/src/test/java/org/elasticsearch/xpack/sql/action/SqlClearCursorResponseTests.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.plugin;
+package org.elasticsearch.xpack.sql.action;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractStreamableXContentTestCase;
diff --git a/x-pack/plugin/sql/sql-proto/src/test/java/org/elasticsearch/xpack/sql/plugin/SqlQueryRequestTests.java b/x-pack/plugin/sql/sql-action/src/test/java/org/elasticsearch/xpack/sql/action/SqlQueryRequestTests.java
similarity index 96%
rename from x-pack/plugin/sql/sql-proto/src/test/java/org/elasticsearch/xpack/sql/plugin/SqlQueryRequestTests.java
rename to x-pack/plugin/sql/sql-action/src/test/java/org/elasticsearch/xpack/sql/action/SqlQueryRequestTests.java
index 0e4a183ab1626..84f361cabc7fc 100644
--- a/x-pack/plugin/sql/sql-proto/src/test/java/org/elasticsearch/xpack/sql/plugin/SqlQueryRequestTests.java
+++ b/x-pack/plugin/sql/sql-action/src/test/java/org/elasticsearch/xpack/sql/action/SqlQueryRequestTests.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.plugin;
+package org.elasticsearch.xpack.sql.action;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.io.stream.Writeable;
@@ -25,8 +25,8 @@
import java.util.function.Consumer;
import java.util.function.Supplier;
-import static org.elasticsearch.xpack.sql.plugin.SqlTestUtils.randomFilter;
-import static org.elasticsearch.xpack.sql.plugin.SqlTestUtils.randomFilterOrNull;
+import static org.elasticsearch.xpack.sql.action.SqlTestUtils.randomFilter;
+import static org.elasticsearch.xpack.sql.action.SqlTestUtils.randomFilterOrNull;
public class SqlQueryRequestTests extends AbstractSerializingTestCase {
diff --git a/x-pack/plugin/sql/sql-proto/src/test/java/org/elasticsearch/xpack/sql/plugin/SqlQueryResponseTests.java b/x-pack/plugin/sql/sql-action/src/test/java/org/elasticsearch/xpack/sql/action/SqlQueryResponseTests.java
similarity index 99%
rename from x-pack/plugin/sql/sql-proto/src/test/java/org/elasticsearch/xpack/sql/plugin/SqlQueryResponseTests.java
rename to x-pack/plugin/sql/sql-action/src/test/java/org/elasticsearch/xpack/sql/action/SqlQueryResponseTests.java
index bc5e5ae2a0180..0957b4c5202c1 100644
--- a/x-pack/plugin/sql/sql-proto/src/test/java/org/elasticsearch/xpack/sql/plugin/SqlQueryResponseTests.java
+++ b/x-pack/plugin/sql/sql-action/src/test/java/org/elasticsearch/xpack/sql/action/SqlQueryResponseTests.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.plugin;
+package org.elasticsearch.xpack.sql.action;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesReference;
diff --git a/x-pack/plugin/sql/sql-proto/src/test/java/org/elasticsearch/xpack/sql/plugin/SqlTestUtils.java b/x-pack/plugin/sql/sql-action/src/test/java/org/elasticsearch/xpack/sql/action/SqlTestUtils.java
similarity index 96%
rename from x-pack/plugin/sql/sql-proto/src/test/java/org/elasticsearch/xpack/sql/plugin/SqlTestUtils.java
rename to x-pack/plugin/sql/sql-action/src/test/java/org/elasticsearch/xpack/sql/action/SqlTestUtils.java
index 05a164c1c94b7..0aee6aade9623 100644
--- a/x-pack/plugin/sql/sql-proto/src/test/java/org/elasticsearch/xpack/sql/plugin/SqlTestUtils.java
+++ b/x-pack/plugin/sql/sql-action/src/test/java/org/elasticsearch/xpack/sql/action/SqlTestUtils.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.plugin;
+package org.elasticsearch.xpack.sql.action;
import com.carrotsearch.randomizedtesting.generators.RandomStrings;
import org.elasticsearch.index.query.QueryBuilder;
diff --git a/x-pack/plugin/sql/sql-proto/src/test/java/org/elasticsearch/xpack/sql/plugin/SqlTranslateRequestTests.java b/x-pack/plugin/sql/sql-action/src/test/java/org/elasticsearch/xpack/sql/action/SqlTranslateRequestTests.java
similarity index 95%
rename from x-pack/plugin/sql/sql-proto/src/test/java/org/elasticsearch/xpack/sql/plugin/SqlTranslateRequestTests.java
rename to x-pack/plugin/sql/sql-action/src/test/java/org/elasticsearch/xpack/sql/action/SqlTranslateRequestTests.java
index 2eb3d71bbf410..cd022746baeef 100644
--- a/x-pack/plugin/sql/sql-proto/src/test/java/org/elasticsearch/xpack/sql/plugin/SqlTranslateRequestTests.java
+++ b/x-pack/plugin/sql/sql-action/src/test/java/org/elasticsearch/xpack/sql/action/SqlTranslateRequestTests.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.plugin;
+package org.elasticsearch.xpack.sql.action;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.io.stream.Writeable;
@@ -21,8 +21,8 @@
import java.util.Collections;
import java.util.function.Consumer;
-import static org.elasticsearch.xpack.sql.plugin.SqlTestUtils.randomFilter;
-import static org.elasticsearch.xpack.sql.plugin.SqlTestUtils.randomFilterOrNull;
+import static org.elasticsearch.xpack.sql.action.SqlTestUtils.randomFilter;
+import static org.elasticsearch.xpack.sql.action.SqlTestUtils.randomFilterOrNull;
public class SqlTranslateRequestTests extends AbstractSerializingTestCase {
diff --git a/x-pack/plugin/sql/sql-proto/src/test/java/org/elasticsearch/xpack/sql/plugin/SqlTranslateResponseTests.java b/x-pack/plugin/sql/sql-action/src/test/java/org/elasticsearch/xpack/sql/action/SqlTranslateResponseTests.java
similarity index 94%
rename from x-pack/plugin/sql/sql-proto/src/test/java/org/elasticsearch/xpack/sql/plugin/SqlTranslateResponseTests.java
rename to x-pack/plugin/sql/sql-action/src/test/java/org/elasticsearch/xpack/sql/action/SqlTranslateResponseTests.java
index 76f73fada0663..647bb90952073 100644
--- a/x-pack/plugin/sql/sql-proto/src/test/java/org/elasticsearch/xpack/sql/plugin/SqlTranslateResponseTests.java
+++ b/x-pack/plugin/sql/sql-action/src/test/java/org/elasticsearch/xpack/sql/action/SqlTranslateResponseTests.java
@@ -3,11 +3,12 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.plugin;
+package org.elasticsearch.xpack.sql.action;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.fetch.subphase.DocValueFieldsContext;
import org.elasticsearch.test.AbstractStreamableTestCase;
+import org.elasticsearch.xpack.sql.action.SqlTranslateResponse;
import java.io.IOException;
diff --git a/x-pack/plugin/sql/sql-cli/build.gradle b/x-pack/plugin/sql/sql-cli/build.gradle
index 06eb24c743ad8..b90b07abad3d1 100644
--- a/x-pack/plugin/sql/sql-cli/build.gradle
+++ b/x-pack/plugin/sql/sql-cli/build.gradle
@@ -16,8 +16,8 @@ description = 'Command line interface to Elasticsearch that speaks SQL'
dependencies {
compile "org.jline:jline:3.6.0"
- compile xpackProject('plugin:sql:sql-shared-client')
- compile xpackProject('plugin:sql:sql-proto')
+ compile xpackProject('plugin:sql:sql-client')
+ compile xpackProject('plugin:sql:sql-action')
compile "org.elasticsearch:elasticsearch-cli:${version}"
runtime "org.fusesource.jansi:jansi:1.16"
@@ -31,13 +31,13 @@ dependencyLicenses {
mapping from: /elasticsearch-core.*/, to: 'elasticsearch'
mapping from: /jackson-.*/, to: 'jackson'
mapping from: /lucene-.*/, to: 'lucene'
- mapping from: /sql-proto.*/, to: 'elasticsearch'
- mapping from: /sql-shared-client.*/, to: 'elasticsearch'
+ mapping from: /sql-action.*/, to: 'elasticsearch'
+ mapping from: /sql-client.*/, to: 'elasticsearch'
ignoreSha 'elasticsearch-cli'
ignoreSha 'elasticsearch-core'
ignoreSha 'elasticsearch'
- ignoreSha 'sql-proto'
- ignoreSha 'sql-shared-client'
+ ignoreSha 'sql-action'
+ ignoreSha 'sql-client'
}
/*
diff --git a/x-pack/plugin/sql/sql-cli/src/main/java/org/elasticsearch/xpack/sql/cli/Cli.java b/x-pack/plugin/sql/sql-cli/src/main/java/org/elasticsearch/xpack/sql/cli/Cli.java
index d1f59c97e5ab1..357a4bcb5a770 100644
--- a/x-pack/plugin/sql/sql-cli/src/main/java/org/elasticsearch/xpack/sql/cli/Cli.java
+++ b/x-pack/plugin/sql/sql-cli/src/main/java/org/elasticsearch/xpack/sql/cli/Cli.java
@@ -21,9 +21,9 @@
import org.elasticsearch.xpack.sql.cli.command.ServerInfoCliCommand;
import org.elasticsearch.xpack.sql.cli.command.ServerQueryCliCommand;
import org.elasticsearch.xpack.sql.client.HttpClient;
-import org.elasticsearch.xpack.sql.client.shared.ClientException;
-import org.elasticsearch.xpack.sql.client.shared.ConnectionConfiguration;
-import org.elasticsearch.xpack.sql.client.shared.Version;
+import org.elasticsearch.xpack.sql.client.ClientException;
+import org.elasticsearch.xpack.sql.client.ConnectionConfiguration;
+import org.elasticsearch.xpack.sql.client.Version;
import org.jline.terminal.TerminalBuilder;
import java.io.IOException;
import java.net.ConnectException;
diff --git a/x-pack/plugin/sql/sql-cli/src/main/java/org/elasticsearch/xpack/sql/cli/ConnectionBuilder.java b/x-pack/plugin/sql/sql-cli/src/main/java/org/elasticsearch/xpack/sql/cli/ConnectionBuilder.java
index dbd0e230043ce..9033133a0efc2 100644
--- a/x-pack/plugin/sql/sql-cli/src/main/java/org/elasticsearch/xpack/sql/cli/ConnectionBuilder.java
+++ b/x-pack/plugin/sql/sql-cli/src/main/java/org/elasticsearch/xpack/sql/cli/ConnectionBuilder.java
@@ -8,7 +8,7 @@
import org.elasticsearch.cli.ExitCodes;
import org.elasticsearch.cli.SuppressForbidden;
import org.elasticsearch.cli.UserException;
-import org.elasticsearch.xpack.sql.client.shared.ConnectionConfiguration;
+import org.elasticsearch.xpack.sql.client.ConnectionConfiguration;
import java.net.URI;
import java.nio.file.Files;
@@ -16,8 +16,8 @@
import java.nio.file.Paths;
import java.util.Properties;
-import static org.elasticsearch.xpack.sql.client.shared.UriUtils.parseURI;
-import static org.elasticsearch.xpack.sql.client.shared.UriUtils.removeQuery;
+import static org.elasticsearch.xpack.sql.client.UriUtils.parseURI;
+import static org.elasticsearch.xpack.sql.client.UriUtils.removeQuery;
/**
* Connection Builder. Can interactively ask users for the password if it is not provided
diff --git a/x-pack/plugin/sql/sql-cli/src/main/java/org/elasticsearch/xpack/sql/cli/command/CliSession.java b/x-pack/plugin/sql/sql-cli/src/main/java/org/elasticsearch/xpack/sql/cli/command/CliSession.java
index 82a2a8817f41d..f5b91704aeae9 100644
--- a/x-pack/plugin/sql/sql-cli/src/main/java/org/elasticsearch/xpack/sql/cli/command/CliSession.java
+++ b/x-pack/plugin/sql/sql-cli/src/main/java/org/elasticsearch/xpack/sql/cli/command/CliSession.java
@@ -6,8 +6,8 @@
package org.elasticsearch.xpack.sql.cli.command;
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.client.ClientException;
+import org.elasticsearch.xpack.sql.client.Version;
import org.elasticsearch.xpack.sql.proto.MainResponse;
import org.elasticsearch.xpack.sql.proto.Protocol;
diff --git a/x-pack/plugin/sql/sql-cli/src/main/java/org/elasticsearch/xpack/sql/cli/command/ServerQueryCliCommand.java b/x-pack/plugin/sql/sql-cli/src/main/java/org/elasticsearch/xpack/sql/cli/command/ServerQueryCliCommand.java
index aa8bc499cd29e..1eb982c814c64 100644
--- a/x-pack/plugin/sql/sql-cli/src/main/java/org/elasticsearch/xpack/sql/cli/command/ServerQueryCliCommand.java
+++ b/x-pack/plugin/sql/sql-cli/src/main/java/org/elasticsearch/xpack/sql/cli/command/ServerQueryCliCommand.java
@@ -7,8 +7,8 @@
import org.elasticsearch.xpack.sql.cli.CliTerminal;
import org.elasticsearch.xpack.sql.client.HttpClient;
-import org.elasticsearch.xpack.sql.client.shared.JreHttpUrlConnection;
-import org.elasticsearch.xpack.sql.plugin.CliFormatter;
+import org.elasticsearch.xpack.sql.client.JreHttpUrlConnection;
+import org.elasticsearch.xpack.sql.action.CliFormatter;
import org.elasticsearch.xpack.sql.proto.SqlQueryResponse;
import java.sql.SQLException;
diff --git a/x-pack/plugin/sql/sql-cli/src/test/java/org/elasticsearch/xpack/sql/cli/CliSessionTests.java b/x-pack/plugin/sql/sql-cli/src/test/java/org/elasticsearch/xpack/sql/cli/CliSessionTests.java
index 8b0138865ce20..295ebe1fb0792 100644
--- a/x-pack/plugin/sql/sql-cli/src/test/java/org/elasticsearch/xpack/sql/cli/CliSessionTests.java
+++ b/x-pack/plugin/sql/sql-cli/src/test/java/org/elasticsearch/xpack/sql/cli/CliSessionTests.java
@@ -10,8 +10,8 @@
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.sql.cli.command.CliSession;
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.client.ClientException;
+import org.elasticsearch.xpack.sql.client.Version;
import org.elasticsearch.xpack.sql.proto.MainResponse;
import java.sql.SQLException;
diff --git a/x-pack/plugin/sql/sql-cli/src/test/java/org/elasticsearch/xpack/sql/cli/ConnectionBuilderTests.java b/x-pack/plugin/sql/sql-cli/src/test/java/org/elasticsearch/xpack/sql/cli/ConnectionBuilderTests.java
index 69b77931ff0d8..d825b99230063 100644
--- a/x-pack/plugin/sql/sql-cli/src/test/java/org/elasticsearch/xpack/sql/cli/ConnectionBuilderTests.java
+++ b/x-pack/plugin/sql/sql-cli/src/test/java/org/elasticsearch/xpack/sql/cli/ConnectionBuilderTests.java
@@ -7,8 +7,8 @@
import org.elasticsearch.cli.UserException;
import org.elasticsearch.test.ESTestCase;
-import org.elasticsearch.xpack.sql.client.shared.ConnectionConfiguration;
-import org.elasticsearch.xpack.sql.client.shared.SslConfig;
+import org.elasticsearch.xpack.sql.client.ConnectionConfiguration;
+import org.elasticsearch.xpack.sql.client.SslConfig;
import java.net.URI;
import java.nio.file.Path;
import java.util.Properties;
diff --git a/x-pack/plugin/sql/sql-cli/src/test/java/org/elasticsearch/xpack/sql/cli/VersionTests.java b/x-pack/plugin/sql/sql-cli/src/test/java/org/elasticsearch/xpack/sql/cli/VersionTests.java
index 0f1effc446389..5be8bdd4df025 100644
--- a/x-pack/plugin/sql/sql-cli/src/test/java/org/elasticsearch/xpack/sql/cli/VersionTests.java
+++ b/x-pack/plugin/sql/sql-cli/src/test/java/org/elasticsearch/xpack/sql/cli/VersionTests.java
@@ -6,7 +6,7 @@
package org.elasticsearch.xpack.sql.cli;
import org.elasticsearch.test.ESTestCase;
-import org.elasticsearch.xpack.sql.client.shared.Version;
+import org.elasticsearch.xpack.sql.client.Version;
public class VersionTests extends ESTestCase {
public void testVersionIsCurrent() {
diff --git a/x-pack/plugin/sql/sql-shared-client/build.gradle b/x-pack/plugin/sql/sql-client/build.gradle
similarity index 80%
rename from x-pack/plugin/sql/sql-shared-client/build.gradle
rename to x-pack/plugin/sql/sql-client/build.gradle
index f7f5efec7af3f..fbc411e44596d 100644
--- a/x-pack/plugin/sql/sql-shared-client/build.gradle
+++ b/x-pack/plugin/sql/sql-client/build.gradle
@@ -1,8 +1,6 @@
/*
- * This project is named sql-shared-client because it is in the
- * "org.elasticsearch.plugin" group and it'd be super confusing for it to just
- * be called "shared-client" there.
+ * The minimal dependencies REST-based SQL client that is used by CLI and JDBC
*/
apply plugin: 'elasticsearch.build'
@@ -10,18 +8,18 @@ apply plugin: 'elasticsearch.build'
description = 'Code shared between jdbc and cli'
dependencies {
- compile xpackProject('plugin:sql:sql-shared-proto')
+ compile xpackProject('plugin:sql:sql-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-shared-proto.*/, to: 'elasticsearch'
+ mapping from: /sql-proto.*/, to: 'elasticsearch'
mapping from: /elasticsearch-cli.*/, to: 'elasticsearch'
mapping from: /elasticsearch-core.*/, to: 'elasticsearch'
mapping from: /lucene-.*/, to: 'lucene'
- ignoreSha 'sql-proto'
+ ignoreSha 'sql-action'
ignoreSha 'elasticsearch'
ignoreSha 'elasticsearch-core'
}
diff --git a/x-pack/plugin/sql/sql-shared-proto/licenses/jackson-LICENSE b/x-pack/plugin/sql/sql-client/licenses/jackson-LICENSE
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-proto/licenses/jackson-LICENSE
rename to x-pack/plugin/sql/sql-client/licenses/jackson-LICENSE
diff --git a/x-pack/plugin/sql/sql-shared-proto/licenses/jackson-NOTICE b/x-pack/plugin/sql/sql-client/licenses/jackson-NOTICE
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-proto/licenses/jackson-NOTICE
rename to x-pack/plugin/sql/sql-client/licenses/jackson-NOTICE
diff --git a/x-pack/plugin/sql/sql-shared-proto/licenses/jackson-core-2.8.10.jar.sha1 b/x-pack/plugin/sql/sql-client/licenses/jackson-core-2.8.10.jar.sha1
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-proto/licenses/jackson-core-2.8.10.jar.sha1
rename to x-pack/plugin/sql/sql-client/licenses/jackson-core-2.8.10.jar.sha1
diff --git a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/Bytes.java b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/Bytes.java
similarity index 93%
rename from x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/Bytes.java
rename to x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/Bytes.java
index 0e0a3af56339f..4d5e78d91dbd8 100644
--- a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/Bytes.java
+++ b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/Bytes.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.client.shared;
+package org.elasticsearch.xpack.sql.client;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
diff --git a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/CheckedBiFunction.java b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/CheckedBiFunction.java
similarity index 91%
rename from x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/CheckedBiFunction.java
rename to x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/CheckedBiFunction.java
index ba16da3bfd313..afe1ad14eed97 100644
--- a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/CheckedBiFunction.java
+++ b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/CheckedBiFunction.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.client.shared;
+package org.elasticsearch.xpack.sql.client;
import java.util.function.BiFunction;
diff --git a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/CheckedConsumer.java b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/CheckedConsumer.java
similarity index 91%
rename from x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/CheckedConsumer.java
rename to x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/CheckedConsumer.java
index 62258eebefaaa..12aa32addaa90 100644
--- a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/CheckedConsumer.java
+++ b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/CheckedConsumer.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.client.shared;
+package org.elasticsearch.xpack.sql.client;
import java.util.function.Consumer;
diff --git a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/CheckedFunction.java b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/CheckedFunction.java
similarity index 91%
rename from x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/CheckedFunction.java
rename to x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/CheckedFunction.java
index 67e174ffd7075..35a0a22f0598d 100644
--- a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/CheckedFunction.java
+++ b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/CheckedFunction.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.client.shared;
+package org.elasticsearch.xpack.sql.client;
import java.util.function.Function;
diff --git a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/ClientException.java b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/ClientException.java
similarity index 92%
rename from x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/ClientException.java
rename to x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/ClientException.java
index 5eb18b86091c1..996bee3bed405 100644
--- a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/ClientException.java
+++ b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/ClientException.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.client.shared;
+package org.elasticsearch.xpack.sql.client;
/**
* A general-purpose exception to be used on the client-side code. Does not support var-args formatting.
diff --git a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/ConnectionConfiguration.java b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/ConnectionConfiguration.java
similarity index 99%
rename from x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/ConnectionConfiguration.java
rename to x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/ConnectionConfiguration.java
index aca262e172647..0de71d27471e7 100644
--- a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/ConnectionConfiguration.java
+++ b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/ConnectionConfiguration.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.client.shared;
+package org.elasticsearch.xpack.sql.client;
import java.net.URI;
import java.net.URISyntaxException;
diff --git a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/HttpClient.java b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/HttpClient.java
similarity index 95%
rename from x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/HttpClient.java
rename to x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/HttpClient.java
index 27e1870904f54..c84bc7b577a04 100644
--- a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/HttpClient.java
+++ b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/HttpClient.java
@@ -14,11 +14,7 @@
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.core.internal.io.Streams;
-import org.elasticsearch.xpack.sql.client.shared.CheckedFunction;
-import org.elasticsearch.xpack.sql.client.shared.ClientException;
-import org.elasticsearch.xpack.sql.client.shared.ConnectionConfiguration;
-import org.elasticsearch.xpack.sql.client.shared.JreHttpUrlConnection;
-import org.elasticsearch.xpack.sql.client.shared.JreHttpUrlConnection.ResponseOrException;
+import org.elasticsearch.xpack.sql.client.JreHttpUrlConnection.ResponseOrException;
import org.elasticsearch.xpack.sql.proto.AbstractSqlRequest;
import org.elasticsearch.xpack.sql.proto.MainResponse;
import org.elasticsearch.xpack.sql.proto.Mode;
diff --git a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/JreHttpUrlConnection.java b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/JreHttpUrlConnection.java
similarity index 99%
rename from x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/JreHttpUrlConnection.java
rename to x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/JreHttpUrlConnection.java
index 2f6289ee39507..0dca4a88f0592 100644
--- a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/JreHttpUrlConnection.java
+++ b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/JreHttpUrlConnection.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.client.shared;
+package org.elasticsearch.xpack.sql.client;
import java.io.BufferedInputStream;
import java.io.Closeable;
diff --git a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/ObjectUtils.java b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/ObjectUtils.java
similarity index 94%
rename from x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/ObjectUtils.java
rename to x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/ObjectUtils.java
index df924cdb37513..3c4fa7fcaad9b 100644
--- a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/ObjectUtils.java
+++ b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/ObjectUtils.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.client.shared;
+package org.elasticsearch.xpack.sql.client;
import java.util.Arrays;
import java.util.Map;
diff --git a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/ProxyConfig.java b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/ProxyConfig.java
similarity index 97%
rename from x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/ProxyConfig.java
rename to x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/ProxyConfig.java
index ca311e5292d26..4ec33f4fbe83d 100644
--- a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/ProxyConfig.java
+++ b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/ProxyConfig.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.client.shared;
+package org.elasticsearch.xpack.sql.client;
import java.net.InetSocketAddress;
import java.net.Proxy;
diff --git a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/RemoteFailure.java b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/RemoteFailure.java
similarity index 99%
rename from x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/RemoteFailure.java
rename to x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/RemoteFailure.java
index f9eccb4f157ef..61e62c390ec11 100644
--- a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/RemoteFailure.java
+++ b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/RemoteFailure.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.client.shared;
+package org.elasticsearch.xpack.sql.client;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonGenerator;
diff --git a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/SslConfig.java b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/SslConfig.java
similarity index 99%
rename from x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/SslConfig.java
rename to x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/SslConfig.java
index 35a1ebe3b96c6..fecfb44492c28 100644
--- a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/SslConfig.java
+++ b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/SslConfig.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.client.shared;
+package org.elasticsearch.xpack.sql.client;
import java.io.IOException;
import java.io.InputStream;
diff --git a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/StringUtils.java b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/StringUtils.java
similarity index 99%
rename from x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/StringUtils.java
rename to x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/StringUtils.java
index 192c217be513c..e4e5bf4d98517 100644
--- a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/StringUtils.java
+++ b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/StringUtils.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.client.shared;
+package org.elasticsearch.xpack.sql.client;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@@ -305,4 +305,4 @@ public static String asHexString(byte[] content, int offset, int length) {
return buf.toString();
}
-}
\ No newline at end of file
+}
diff --git a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/SuppressForbidden.java b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/SuppressForbidden.java
similarity index 93%
rename from x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/SuppressForbidden.java
rename to x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/SuppressForbidden.java
index 52b864edff4bc..fbbf13782a97d 100644
--- a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/SuppressForbidden.java
+++ b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/SuppressForbidden.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.client.shared;
+package org.elasticsearch.xpack.sql.client;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
diff --git a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/UriUtils.java b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/UriUtils.java
similarity index 98%
rename from x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/UriUtils.java
rename to x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/UriUtils.java
index f8c2e73e6a0c0..26113010c61da 100644
--- a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/UriUtils.java
+++ b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/UriUtils.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.client.shared;
+package org.elasticsearch.xpack.sql.client;
import java.net.URI;
import java.net.URISyntaxException;
diff --git a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/Version.java b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/Version.java
similarity index 98%
rename from x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/Version.java
rename to x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/Version.java
index bfa9e0a3cb492..d7327af6c4e48 100644
--- a/x-pack/plugin/sql/sql-shared-client/src/main/java/org/elasticsearch/xpack/sql/client/shared/Version.java
+++ b/x-pack/plugin/sql/sql-client/src/main/java/org/elasticsearch/xpack/sql/client/Version.java
@@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.client.shared;
+package org.elasticsearch.xpack.sql.client;
import java.io.IOException;
import java.net.URL;
diff --git a/x-pack/plugin/sql/sql-shared-client/src/test/java/org/elasticsearch/xpack/sql/client/shared/RemoteFailureTests.java b/x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/RemoteFailureTests.java
similarity index 99%
rename from x-pack/plugin/sql/sql-shared-client/src/test/java/org/elasticsearch/xpack/sql/client/shared/RemoteFailureTests.java
rename to x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/RemoteFailureTests.java
index ab0bc40f3ba72..ee3a859b548da 100644
--- a/x-pack/plugin/sql/sql-shared-client/src/test/java/org/elasticsearch/xpack/sql/client/shared/RemoteFailureTests.java
+++ b/x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/RemoteFailureTests.java
@@ -3,10 +3,11 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.client.shared;
+package org.elasticsearch.xpack.sql.client;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.test.ESTestCase;
+import org.elasticsearch.xpack.sql.client.RemoteFailure;
import java.io.IOException;
import java.io.InputStream;
diff --git a/x-pack/plugin/sql/sql-shared-client/src/test/java/org/elasticsearch/xpack/sql/client/shared/StringUtilsTests.java b/x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/StringUtilsTests.java
similarity index 81%
rename from x-pack/plugin/sql/sql-shared-client/src/test/java/org/elasticsearch/xpack/sql/client/shared/StringUtilsTests.java
rename to x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/StringUtilsTests.java
index b758d361ab978..34f1f20056a05 100644
--- a/x-pack/plugin/sql/sql-shared-client/src/test/java/org/elasticsearch/xpack/sql/client/shared/StringUtilsTests.java
+++ b/x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/StringUtilsTests.java
@@ -3,11 +3,11 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.client.shared;
+package org.elasticsearch.xpack.sql.client;
import org.elasticsearch.test.ESTestCase;
-import static org.elasticsearch.xpack.sql.client.shared.StringUtils.nullAsEmpty;
+import static org.elasticsearch.xpack.sql.client.StringUtils.nullAsEmpty;
public class StringUtilsTests extends ESTestCase {
public void testNullAsEmpty() {
diff --git a/x-pack/plugin/sql/sql-shared-client/src/test/java/org/elasticsearch/xpack/sql/client/shared/UriUtilsTests.java b/x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/UriUtilsTests.java
similarity index 94%
rename from x-pack/plugin/sql/sql-shared-client/src/test/java/org/elasticsearch/xpack/sql/client/shared/UriUtilsTests.java
rename to x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/UriUtilsTests.java
index f75b20d0f0d3f..0b7f6c47b0df0 100644
--- a/x-pack/plugin/sql/sql-shared-client/src/test/java/org/elasticsearch/xpack/sql/client/shared/UriUtilsTests.java
+++ b/x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/UriUtilsTests.java
@@ -3,14 +3,14 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.client.shared;
+package org.elasticsearch.xpack.sql.client;
import org.elasticsearch.test.ESTestCase;
import java.net.URI;
-import static org.elasticsearch.xpack.sql.client.shared.UriUtils.parseURI;
-import static org.elasticsearch.xpack.sql.client.shared.UriUtils.removeQuery;
+import static org.elasticsearch.xpack.sql.client.UriUtils.parseURI;
+import static org.elasticsearch.xpack.sql.client.UriUtils.removeQuery;
public class UriUtilsTests extends ESTestCase {
diff --git a/x-pack/plugin/sql/sql-shared-client/src/test/java/org/elasticsearch/xpack/sql/client/shared/VersionTests.java b/x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/VersionTests.java
similarity index 94%
rename from x-pack/plugin/sql/sql-shared-client/src/test/java/org/elasticsearch/xpack/sql/client/shared/VersionTests.java
rename to x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/VersionTests.java
index 9eabed07931a0..7ed772e352531 100644
--- a/x-pack/plugin/sql/sql-shared-client/src/test/java/org/elasticsearch/xpack/sql/client/shared/VersionTests.java
+++ b/x-pack/plugin/sql/sql-client/src/test/java/org/elasticsearch/xpack/sql/client/VersionTests.java
@@ -3,9 +3,10 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.client.shared;
+package org.elasticsearch.xpack.sql.client;
import org.elasticsearch.test.ESTestCase;
+import org.elasticsearch.xpack.sql.client.Version;
public class VersionTests extends ESTestCase {
public void test70Version() {
diff --git a/x-pack/plugin/sql/sql-shared-client/src/test/resources/remote_failure/basic.json b/x-pack/plugin/sql/sql-client/src/test/resources/remote_failure/basic.json
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-client/src/test/resources/remote_failure/basic.json
rename to x-pack/plugin/sql/sql-client/src/test/resources/remote_failure/basic.json
diff --git a/x-pack/plugin/sql/sql-shared-client/src/test/resources/remote_failure/bogus_error.json b/x-pack/plugin/sql/sql-client/src/test/resources/remote_failure/bogus_error.json
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-client/src/test/resources/remote_failure/bogus_error.json
rename to x-pack/plugin/sql/sql-client/src/test/resources/remote_failure/bogus_error.json
diff --git a/x-pack/plugin/sql/sql-shared-client/src/test/resources/remote_failure/invalid_json.txt b/x-pack/plugin/sql/sql-client/src/test/resources/remote_failure/invalid_json.txt
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-client/src/test/resources/remote_failure/invalid_json.txt
rename to x-pack/plugin/sql/sql-client/src/test/resources/remote_failure/invalid_json.txt
diff --git a/x-pack/plugin/sql/sql-shared-client/src/test/resources/remote_failure/missing_auth.json b/x-pack/plugin/sql/sql-client/src/test/resources/remote_failure/missing_auth.json
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-client/src/test/resources/remote_failure/missing_auth.json
rename to x-pack/plugin/sql/sql-client/src/test/resources/remote_failure/missing_auth.json
diff --git a/x-pack/plugin/sql/sql-shared-client/src/test/resources/remote_failure/nested.json b/x-pack/plugin/sql/sql-client/src/test/resources/remote_failure/nested.json
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-client/src/test/resources/remote_failure/nested.json
rename to x-pack/plugin/sql/sql-client/src/test/resources/remote_failure/nested.json
diff --git a/x-pack/plugin/sql/sql-shared-client/src/test/resources/remote_failure/no_error.json b/x-pack/plugin/sql/sql-client/src/test/resources/remote_failure/no_error.json
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-client/src/test/resources/remote_failure/no_error.json
rename to x-pack/plugin/sql/sql-client/src/test/resources/remote_failure/no_error.json
diff --git a/x-pack/plugin/sql/sql-shared-client/src/test/resources/remote_failure/no_stack.json b/x-pack/plugin/sql/sql-client/src/test/resources/remote_failure/no_stack.json
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-client/src/test/resources/remote_failure/no_stack.json
rename to x-pack/plugin/sql/sql-client/src/test/resources/remote_failure/no_stack.json
diff --git a/x-pack/plugin/sql/sql-shared-client/src/test/resources/remote_failure/no_type.json b/x-pack/plugin/sql/sql-client/src/test/resources/remote_failure/no_type.json
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-client/src/test/resources/remote_failure/no_type.json
rename to x-pack/plugin/sql/sql-client/src/test/resources/remote_failure/no_type.json
diff --git a/x-pack/plugin/sql/sql-shared-client/src/test/resources/ssl/client.keystore b/x-pack/plugin/sql/sql-client/src/test/resources/ssl/client.keystore
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-client/src/test/resources/ssl/client.keystore
rename to x-pack/plugin/sql/sql-client/src/test/resources/ssl/client.keystore
diff --git a/x-pack/plugin/sql/sql-shared-client/src/test/resources/ssl/readme.txt b/x-pack/plugin/sql/sql-client/src/test/resources/ssl/readme.txt
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-client/src/test/resources/ssl/readme.txt
rename to x-pack/plugin/sql/sql-client/src/test/resources/ssl/readme.txt
diff --git a/x-pack/plugin/sql/sql-shared-client/src/test/resources/ssl/server.keystore b/x-pack/plugin/sql/sql-client/src/test/resources/ssl/server.keystore
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-client/src/test/resources/ssl/server.keystore
rename to x-pack/plugin/sql/sql-client/src/test/resources/ssl/server.keystore
diff --git a/x-pack/plugin/sql/sql-proto/build.gradle b/x-pack/plugin/sql/sql-proto/build.gradle
index b1d8497f9b8df..5a1439f4360bc 100644
--- a/x-pack/plugin/sql/sql-proto/build.gradle
+++ b/x-pack/plugin/sql/sql-proto/build.gradle
@@ -1,8 +1,6 @@
/*
- * This project is named sql-proto because it is in the
- * "org.elasticsearch.plugin" group and it'd be super confusing for it to just
- * be called "proto" there.
+ * This project contains XContent protocol classes shared between server and http client
*/
import org.elasticsearch.gradle.precommit.PrecommitTasks
@@ -13,23 +11,14 @@ description = 'Request and response objects shared by the cli, jdbc ' +
'and the Elasticsearch plugin'
dependencies {
- /* We'd like to just depend on xcontent but there are some bits of
- * :server that we rely on.... */
- compile (project(':server')) {
- transitive = false
- }
compile (project(':libs:core')) {
transitive = false
}
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}"
- runtime "org.apache.logging.log4j:log4j-api:${versions.log4j}"
- runtime "org.apache.logging.log4j:log4j-core:${versions.log4j}"
testCompile "org.elasticsearch.test:framework:${version}"
}
@@ -42,113 +31,5 @@ forbiddenApisMain {
dependencyLicenses {
mapping from: /elasticsearch-core.*/, to: 'elasticsearch'
mapping from: /jackson-.*/, to: 'jackson'
- mapping from: /lucene-.*/, to: 'lucene'
- ignoreSha 'elasticsearch'
ignoreSha 'elasticsearch-core'
}
-
-thirdPartyAudit.excludes = [
- 'com.fasterxml.jackson.dataformat.yaml.YAMLFactory',
- 'com.fasterxml.jackson.dataformat.yaml.YAMLMapper',
-
- // from com.fasterxml.jackson.dataformat.yaml.YAMLMapper (jackson-dataformat-yaml)
- 'com.fasterxml.jackson.databind.ObjectMapper',
- 'org.fusesource.jansi.Ansi',
- 'org.fusesource.jansi.AnsiRenderer$Code',
-
- // from log4j
- 'com.conversantmedia.util.concurrent.DisruptorBlockingQueue',
- 'com.conversantmedia.util.concurrent.SpinPolicy',
- 'com.fasterxml.jackson.annotation.JsonInclude$Include',
- 'com.fasterxml.jackson.databind.DeserializationContext',
- 'com.fasterxml.jackson.databind.DeserializationFeature',
- 'com.fasterxml.jackson.databind.JsonMappingException',
- 'com.fasterxml.jackson.databind.JsonNode',
- 'com.fasterxml.jackson.databind.Module$SetupContext',
- 'com.fasterxml.jackson.databind.ObjectReader',
- 'com.fasterxml.jackson.databind.ObjectWriter',
- 'com.fasterxml.jackson.databind.SerializerProvider',
- 'com.fasterxml.jackson.databind.deser.std.StdDeserializer',
- 'com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer',
- 'com.fasterxml.jackson.databind.module.SimpleModule',
- 'com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter',
- 'com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider',
- 'com.fasterxml.jackson.databind.ser.std.StdScalarSerializer',
- 'com.fasterxml.jackson.databind.ser.std.StdSerializer',
- 'com.fasterxml.jackson.dataformat.xml.JacksonXmlModule',
- 'com.fasterxml.jackson.dataformat.xml.XmlMapper',
- 'com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter',
- 'com.fasterxml.jackson.databind.node.JsonNodeFactory',
- 'com.fasterxml.jackson.databind.node.ObjectNode',
- 'com.lmax.disruptor.BlockingWaitStrategy',
- 'com.lmax.disruptor.BusySpinWaitStrategy',
- 'com.lmax.disruptor.EventFactory',
- 'com.lmax.disruptor.EventTranslator',
- 'com.lmax.disruptor.EventTranslatorTwoArg',
- 'com.lmax.disruptor.EventTranslatorVararg',
- 'com.lmax.disruptor.ExceptionHandler',
- 'com.lmax.disruptor.LifecycleAware',
- 'com.lmax.disruptor.RingBuffer',
- 'com.lmax.disruptor.Sequence',
- 'com.lmax.disruptor.SequenceReportingEventHandler',
- 'com.lmax.disruptor.SleepingWaitStrategy',
- 'com.lmax.disruptor.TimeoutBlockingWaitStrategy',
- 'com.lmax.disruptor.WaitStrategy',
- 'com.lmax.disruptor.YieldingWaitStrategy',
- 'com.lmax.disruptor.dsl.Disruptor',
- 'com.lmax.disruptor.dsl.ProducerType',
- 'javax.jms.Connection',
- 'javax.jms.ConnectionFactory',
- 'javax.jms.Destination',
- 'javax.jms.JMSException',
- 'javax.jms.MapMessage',
- 'javax.jms.Message',
- 'javax.jms.MessageConsumer',
- 'javax.jms.MessageProducer',
- 'javax.jms.Session',
- 'javax.mail.Authenticator',
- 'javax.mail.Message$RecipientType',
- 'javax.mail.PasswordAuthentication',
- 'javax.mail.Session',
- 'javax.mail.Transport',
- 'javax.mail.internet.InternetAddress',
- 'javax.mail.internet.InternetHeaders',
- 'javax.mail.internet.MimeBodyPart',
- 'javax.mail.internet.MimeMessage',
- 'javax.mail.internet.MimeMultipart',
- 'javax.mail.internet.MimeUtility',
- 'javax.mail.util.ByteArrayDataSource',
- 'javax.persistence.AttributeConverter',
- 'javax.persistence.EntityManager',
- 'javax.persistence.EntityManagerFactory',
- 'javax.persistence.EntityTransaction',
- 'javax.persistence.Persistence',
- 'javax.persistence.PersistenceException',
- 'org.apache.commons.compress.compressors.CompressorStreamFactory',
- 'org.apache.commons.compress.utils.IOUtils',
- 'org.apache.commons.csv.CSVFormat',
- 'org.apache.commons.csv.QuoteMode',
- 'org.apache.kafka.clients.producer.Callback',
- 'org.apache.kafka.clients.producer.KafkaProducer',
- 'org.apache.kafka.clients.producer.Producer',
- 'org.apache.kafka.clients.producer.ProducerRecord',
- 'org.apache.kafka.clients.producer.RecordMetadata',
- 'org.codehaus.stax2.XMLStreamWriter2',
- 'org.jctools.queues.MessagePassingQueue$Consumer',
- 'org.jctools.queues.MpscArrayQueue',
- 'org.osgi.framework.AdaptPermission',
- 'org.osgi.framework.AdminPermission',
- 'org.osgi.framework.Bundle',
- 'org.osgi.framework.BundleActivator',
- 'org.osgi.framework.BundleContext',
- 'org.osgi.framework.BundleEvent',
- 'org.osgi.framework.BundleReference',
- 'org.osgi.framework.FrameworkUtil',
- 'org.osgi.framework.ServiceRegistration',
- 'org.osgi.framework.SynchronousBundleListener',
- 'org.osgi.framework.wiring.BundleWire',
- 'org.osgi.framework.wiring.BundleWiring',
- 'org.zeromq.ZMQ$Context',
- 'org.zeromq.ZMQ$Socket',
- 'org.zeromq.ZMQ'
-]
diff --git a/x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/proto/AbstractSqlRequest.java b/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/AbstractSqlRequest.java
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/proto/AbstractSqlRequest.java
rename to x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/AbstractSqlRequest.java
diff --git a/x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/proto/ColumnInfo.java b/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/ColumnInfo.java
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/proto/ColumnInfo.java
rename to x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/ColumnInfo.java
diff --git a/x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/proto/MainResponse.java b/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/MainResponse.java
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/proto/MainResponse.java
rename to x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/MainResponse.java
diff --git a/x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/proto/Mode.java b/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/Mode.java
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/proto/Mode.java
rename to x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/Mode.java
diff --git a/x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/proto/ProtoUtils.java b/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/ProtoUtils.java
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/proto/ProtoUtils.java
rename to x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/ProtoUtils.java
diff --git a/x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/proto/Protocol.java b/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/Protocol.java
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/proto/Protocol.java
rename to x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/Protocol.java
diff --git a/x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/proto/SqlClearCursorRequest.java b/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/SqlClearCursorRequest.java
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/proto/SqlClearCursorRequest.java
rename to x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/SqlClearCursorRequest.java
diff --git a/x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/proto/SqlClearCursorResponse.java b/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/SqlClearCursorResponse.java
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/proto/SqlClearCursorResponse.java
rename to x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/SqlClearCursorResponse.java
diff --git a/x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/proto/SqlQueryRequest.java b/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/SqlQueryRequest.java
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/proto/SqlQueryRequest.java
rename to x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/SqlQueryRequest.java
diff --git a/x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/proto/SqlQueryResponse.java b/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/SqlQueryResponse.java
similarity index 97%
rename from x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/proto/SqlQueryResponse.java
rename to x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/SqlQueryResponse.java
index f048bcb170a52..4cb500fe8025b 100644
--- a/x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/proto/SqlQueryResponse.java
+++ b/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/SqlQueryResponse.java
@@ -18,7 +18,6 @@
import static org.elasticsearch.common.xcontent.ConstructingObjectParser.constructorArg;
import static org.elasticsearch.common.xcontent.ConstructingObjectParser.optionalConstructorArg;
-import static org.elasticsearch.xpack.sql.proto.ProtoUtils.parseFieldsValue;
/**
* Response to perform an sql query for JDBC/CLI client
@@ -94,7 +93,7 @@ public static List parseRow(XContentParser parser) throws IOException {
List list = new ArrayList<>();
while (parser.nextToken() != XContentParser.Token.END_ARRAY) {
if (parser.currentToken().isValue()) {
- list.add(parseFieldsValue(parser));
+ list.add(ProtoUtils.parseFieldsValue(parser));
} else if (parser.currentToken() == XContentParser.Token.VALUE_NULL) {
list.add(null);
} else {
diff --git a/x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/proto/SqlTypedParamValue.java b/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/SqlTypedParamValue.java
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/proto/SqlTypedParamValue.java
rename to x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/SqlTypedParamValue.java
diff --git a/x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/type/DataType.java b/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/type/DataType.java
similarity index 93%
rename from x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/type/DataType.java
rename to x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/type/DataType.java
index c024af48187d3..3f77bc2fc2ed7 100644
--- a/x-pack/plugin/sql/sql-shared-proto/src/main/java/org/elasticsearch/xpack/sql/type/DataType.java
+++ b/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/type/DataType.java
@@ -61,11 +61,6 @@ public enum DataType {
*/
public final JDBCType jdbcType;
- /**
- * Name of corresponding java class
- */
- public final String javaName;
-
/**
* Size of the type in bytes
*
@@ -105,10 +100,12 @@ public enum DataType {
*/
public final boolean defaultDocValues;
+ private final Class> javaClass;
+
DataType(JDBCType jdbcType, Class> javaClass, int size, int defaultPrecision, int displaySize, boolean isInteger, boolean isRational,
boolean defaultDocValues) {
this.esType = name().toLowerCase(Locale.ROOT);
- this.javaName = javaClass == null ? null : javaClass.getName();
+ this.javaClass = javaClass;
this.jdbcType = jdbcType;
this.size = size;
this.defaultPrecision = defaultPrecision;
@@ -125,6 +122,10 @@ public enum DataType {
public String sqlName() {
return jdbcType.getName();
}
+
+ public Class> javaClass() {
+ return javaClass;
+ }
public boolean isNumeric() {
return isInteger || isRational;
@@ -152,6 +153,13 @@ public static DataType fromJdbcType(JDBCType jdbcType) {
}
return jdbcToEs.get(jdbcType);
}
+
+ public static Class> fromJdbcTypeToJava(JDBCType jdbcType) {
+ if (jdbcToEs.containsKey(jdbcType) == false) {
+ throw new IllegalArgumentException("Unsupported JDBC type [" + jdbcType + "]");
+ }
+ return jdbcToEs.get(jdbcType).javaClass();
+ }
/**
* Creates returns DataType enum coresponding to the specified es type
diff --git a/x-pack/plugin/sql/sql-shared-proto/src/test/java/org/elasticsearch/xpack/sql/proto/ProtoUtilsTests.java b/x-pack/plugin/sql/sql-proto/src/test/java/org/elasticsearch/xpack/sql/proto/ProtoUtilsTests.java
similarity index 100%
rename from x-pack/plugin/sql/sql-shared-proto/src/test/java/org/elasticsearch/xpack/sql/proto/ProtoUtilsTests.java
rename to x-pack/plugin/sql/sql-proto/src/test/java/org/elasticsearch/xpack/sql/proto/ProtoUtilsTests.java
diff --git a/x-pack/plugin/sql/sql-shared-proto/build.gradle b/x-pack/plugin/sql/sql-shared-proto/build.gradle
deleted file mode 100644
index 5a1439f4360bc..0000000000000
--- a/x-pack/plugin/sql/sql-shared-proto/build.gradle
+++ /dev/null
@@ -1,35 +0,0 @@
-
-/*
- * This project contains XContent protocol classes shared between server and http client
- */
-
-import org.elasticsearch.gradle.precommit.PrecommitTasks
-
-apply plugin: 'elasticsearch.build'
-
-description = 'Request and response objects shared by the cli, jdbc ' +
- 'and the Elasticsearch plugin'
-
-dependencies {
- compile (project(':libs:core')) {
- transitive = false
- }
- compile (project(':libs:x-content')) {
- transitive = false
- }
- compile 'joda-time:joda-time:2.9.9'
- runtime "com.fasterxml.jackson.core:jackson-core:${versions.jackson}"
-
- testCompile "org.elasticsearch.test:framework:${version}"
-}
-
-forbiddenApisMain {
- //sql does not depend on server, so only jdk signatures should be checked
- signaturesURLs = [PrecommitTasks.getResource('/forbidden/jdk-signatures.txt')]
-}
-
-dependencyLicenses {
- mapping from: /elasticsearch-core.*/, to: 'elasticsearch'
- mapping from: /jackson-.*/, to: 'jackson'
- ignoreSha 'elasticsearch-core'
-}
diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/Range.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/Range.java
index 54d541ab406b7..c17e9634492a1 100644
--- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/Range.java
+++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/expression/predicate/Range.java
@@ -87,7 +87,7 @@ public Object fold() {
}
/**
- * Check whether the boundaries are invalid ( upper < lower) or not.
+ * Check whether the boundaries are invalid ( upper < lower) or not.
* If they do, the value does not have to be evaluate.
*/
private boolean areBoundariesInvalid() {
@@ -139,4 +139,4 @@ public String toString() {
sb.append(upper);
return sb.toString();
}
-}
\ No newline at end of file
+}
diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/CliFormatterCursor.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/CliFormatterCursor.java
index 94422dd2888bf..b226e899e4d09 100644
--- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/CliFormatterCursor.java
+++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/CliFormatterCursor.java
@@ -10,6 +10,7 @@
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
+import org.elasticsearch.xpack.sql.action.CliFormatter;
import org.elasticsearch.xpack.sql.session.Configuration;
import org.elasticsearch.xpack.sql.session.Cursor;
import org.elasticsearch.xpack.sql.session.RowSet;
diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java
index 175b78d4f6655..e606eace9759d 100644
--- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java
+++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java
@@ -12,6 +12,8 @@
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.RestToXContentListener;
+import org.elasticsearch.xpack.sql.action.SqlClearCursorAction;
+import org.elasticsearch.xpack.sql.action.SqlClearCursorRequest;
import org.elasticsearch.xpack.sql.proto.Mode;
import org.elasticsearch.xpack.sql.proto.Protocol;
diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java
index a8daa1136d390..387b7d8727ec2 100644
--- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java
+++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java
@@ -18,6 +18,9 @@
import org.elasticsearch.rest.RestResponse;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.rest.action.RestResponseListener;
+import org.elasticsearch.xpack.sql.action.SqlQueryAction;
+import org.elasticsearch.xpack.sql.action.SqlQueryRequest;
+import org.elasticsearch.xpack.sql.action.SqlQueryResponse;
import org.elasticsearch.xpack.sql.proto.Mode;
import org.elasticsearch.xpack.sql.proto.Protocol;
import org.elasticsearch.xpack.sql.session.Cursor;
diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java
index 74d94e4800606..731046f923fef 100644
--- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java
+++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java
@@ -12,6 +12,8 @@
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.RestToXContentListener;
+import org.elasticsearch.xpack.sql.action.SqlTranslateAction;
+import org.elasticsearch.xpack.sql.action.SqlTranslateRequest;
import org.elasticsearch.xpack.sql.proto.Mode;
import java.io.IOException;
diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlPlugin.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlPlugin.java
index 24bf8f15aa7de..6c026b2607161 100644
--- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlPlugin.java
+++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/SqlPlugin.java
@@ -31,6 +31,9 @@
import org.elasticsearch.xpack.core.XPackField;
import org.elasticsearch.xpack.core.XPackPlugin;
import org.elasticsearch.xpack.core.XPackSettings;
+import org.elasticsearch.xpack.sql.action.SqlClearCursorAction;
+import org.elasticsearch.xpack.sql.action.SqlQueryAction;
+import org.elasticsearch.xpack.sql.action.SqlTranslateAction;
import org.elasticsearch.xpack.sql.analysis.index.IndexResolver;
import org.elasticsearch.xpack.sql.execution.PlanExecutor;
diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/TextFormat.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/TextFormat.java
index 9d0cd60c23e32..de8798ecf544b 100644
--- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/TextFormat.java
+++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/TextFormat.java
@@ -7,6 +7,8 @@
import org.elasticsearch.common.Strings;
import org.elasticsearch.rest.RestRequest;
+import org.elasticsearch.xpack.sql.action.SqlQueryResponse;
+import org.elasticsearch.xpack.sql.action.CliFormatter;
import org.elasticsearch.xpack.sql.proto.ColumnInfo;
import org.elasticsearch.xpack.sql.session.Cursor;
import org.elasticsearch.xpack.sql.session.Cursors;
diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/TransportSqlClearCursorAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/TransportSqlClearCursorAction.java
index 7a216f3a2bf9f..be0aae2001c5a 100644
--- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/TransportSqlClearCursorAction.java
+++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/TransportSqlClearCursorAction.java
@@ -13,12 +13,14 @@
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.tasks.Task;
import org.elasticsearch.transport.TransportService;
+import org.elasticsearch.xpack.sql.action.SqlClearCursorRequest;
+import org.elasticsearch.xpack.sql.action.SqlClearCursorResponse;
import org.elasticsearch.xpack.sql.execution.PlanExecutor;
import org.elasticsearch.xpack.sql.session.Configuration;
import org.elasticsearch.xpack.sql.session.Cursor;
import org.elasticsearch.xpack.sql.session.Cursors;
-import static org.elasticsearch.xpack.sql.plugin.SqlClearCursorAction.NAME;
+import static org.elasticsearch.xpack.sql.action.SqlClearCursorAction.NAME;
public class TransportSqlClearCursorAction extends HandledTransportAction {
private final PlanExecutor planExecutor;
diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/TransportSqlQueryAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/TransportSqlQueryAction.java
index 7993f00d71aee..e491f76749bdc 100644
--- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/TransportSqlQueryAction.java
+++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/TransportSqlQueryAction.java
@@ -15,6 +15,9 @@
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.tasks.Task;
import org.elasticsearch.transport.TransportService;
+import org.elasticsearch.xpack.sql.action.SqlQueryAction;
+import org.elasticsearch.xpack.sql.action.SqlQueryRequest;
+import org.elasticsearch.xpack.sql.action.SqlQueryResponse;
import org.elasticsearch.xpack.sql.execution.PlanExecutor;
import org.elasticsearch.xpack.sql.proto.ColumnInfo;
import org.elasticsearch.xpack.sql.session.Configuration;
diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/TransportSqlTranslateAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/TransportSqlTranslateAction.java
index 4ef7c14ab01f3..95a10497fdc54 100644
--- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/TransportSqlTranslateAction.java
+++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/TransportSqlTranslateAction.java
@@ -13,6 +13,9 @@
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.tasks.Task;
import org.elasticsearch.transport.TransportService;
+import org.elasticsearch.xpack.sql.action.SqlTranslateAction;
+import org.elasticsearch.xpack.sql.action.SqlTranslateRequest;
+import org.elasticsearch.xpack.sql.action.SqlTranslateResponse;
import org.elasticsearch.xpack.sql.execution.PlanExecutor;
import org.elasticsearch.xpack.sql.session.Configuration;
diff --git a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/plugin/CliFormatterTests.java b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/CliFormatterTests.java
similarity index 95%
rename from x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/plugin/CliFormatterTests.java
rename to x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/CliFormatterTests.java
index d87dba3306889..400a90712d6cf 100644
--- a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/plugin/CliFormatterTests.java
+++ b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/CliFormatterTests.java
@@ -3,9 +3,11 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
-package org.elasticsearch.xpack.sql.plugin;
+package org.elasticsearch.xpack.sql.action;
import org.elasticsearch.test.ESTestCase;
+import org.elasticsearch.xpack.sql.action.CliFormatter;
+import org.elasticsearch.xpack.sql.action.SqlQueryResponse;
import org.elasticsearch.xpack.sql.proto.ColumnInfo;
import java.sql.JDBCType;
diff --git a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlActionIT.java b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlActionIT.java
index ef90e8ccd470e..cbdf0e1ac9811 100644
--- a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlActionIT.java
+++ b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlActionIT.java
@@ -7,10 +7,7 @@
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.support.WriteRequest;
-import org.elasticsearch.xpack.sql.plugin.SqlQueryRequestBuilder;
import org.elasticsearch.xpack.sql.proto.ColumnInfo;
-import org.elasticsearch.xpack.sql.plugin.SqlQueryAction;
-import org.elasticsearch.xpack.sql.plugin.SqlQueryResponse;
import org.elasticsearch.xpack.sql.proto.Mode;
import java.sql.JDBCType;
diff --git a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlClearCursorActionIT.java b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlClearCursorActionIT.java
index 643372a21fe0a..de55d486555ad 100644
--- a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlClearCursorActionIT.java
+++ b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlClearCursorActionIT.java
@@ -8,12 +8,6 @@
import org.elasticsearch.action.bulk.BulkRequestBuilder;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.support.WriteRequest;
-import org.elasticsearch.xpack.sql.plugin.SqlClearCursorAction;
-import org.elasticsearch.xpack.sql.plugin.SqlClearCursorRequestBuilder;
-import org.elasticsearch.xpack.sql.plugin.SqlClearCursorResponse;
-import org.elasticsearch.xpack.sql.plugin.SqlQueryAction;
-import org.elasticsearch.xpack.sql.plugin.SqlQueryRequestBuilder;
-import org.elasticsearch.xpack.sql.plugin.SqlQueryResponse;
import org.elasticsearch.xpack.sql.session.Cursor;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
diff --git a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlDisabledIT.java b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlDisabledIT.java
index 395a2b673f946..c50f1095164df 100644
--- a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlDisabledIT.java
+++ b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlDisabledIT.java
@@ -7,8 +7,6 @@
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.xpack.core.XPackSettings;
-import org.elasticsearch.xpack.sql.plugin.SqlQueryAction;
-import org.elasticsearch.xpack.sql.plugin.SqlQueryRequestBuilder;
import static org.hamcrest.CoreMatchers.either;
import static org.hamcrest.CoreMatchers.startsWith;
diff --git a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlLicenseIT.java b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlLicenseIT.java
index a755d2b4f59c1..df0875690a2c2 100644
--- a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlLicenseIT.java
+++ b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlLicenseIT.java
@@ -21,12 +21,6 @@
import org.elasticsearch.test.hamcrest.ElasticsearchAssertions;
import org.elasticsearch.transport.Netty4Plugin;
import org.elasticsearch.transport.nio.NioTransportPlugin;
-import org.elasticsearch.xpack.sql.plugin.SqlQueryAction;
-import org.elasticsearch.xpack.sql.plugin.SqlQueryRequestBuilder;
-import org.elasticsearch.xpack.sql.plugin.SqlQueryResponse;
-import org.elasticsearch.xpack.sql.plugin.SqlTranslateAction;
-import org.elasticsearch.xpack.sql.plugin.SqlTranslateRequestBuilder;
-import org.elasticsearch.xpack.sql.plugin.SqlTranslateResponse;
import org.hamcrest.Matchers;
import org.junit.Before;
diff --git a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlTranslateActionIT.java b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlTranslateActionIT.java
index 2ef7c084d110d..e413a590dfaf1 100644
--- a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlTranslateActionIT.java
+++ b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlTranslateActionIT.java
@@ -11,9 +11,6 @@
import org.elasticsearch.search.fetch.subphase.DocValueFieldsContext;
import org.elasticsearch.search.fetch.subphase.FetchSourceContext;
import org.elasticsearch.search.sort.SortBuilders;
-import org.elasticsearch.xpack.sql.plugin.SqlTranslateAction;
-import org.elasticsearch.xpack.sql.plugin.SqlTranslateRequestBuilder;
-import org.elasticsearch.xpack.sql.plugin.SqlTranslateResponse;
import static java.util.Collections.singletonList;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
diff --git a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/execution/search/CursorTests.java b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/execution/search/CursorTests.java
index bac221df2e92d..7eb4e5402cd36 100644
--- a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/execution/search/CursorTests.java
+++ b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/execution/search/CursorTests.java
@@ -12,10 +12,10 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.sql.SqlException;
-import org.elasticsearch.xpack.sql.plugin.CliFormatter;
+import org.elasticsearch.xpack.sql.action.CliFormatter;
import org.elasticsearch.xpack.sql.plugin.CliFormatterCursor;
import org.elasticsearch.xpack.sql.proto.ColumnInfo;
-import org.elasticsearch.xpack.sql.plugin.SqlQueryResponse;
+import org.elasticsearch.xpack.sql.action.SqlQueryResponse;
import org.elasticsearch.xpack.sql.session.Configuration;
import org.elasticsearch.xpack.sql.session.Cursor;
import org.elasticsearch.xpack.sql.session.Cursors;
diff --git a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/plugin/TextFormatTests.java b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/plugin/TextFormatTests.java
index bf6ccbb225a54..7a0f6dbca9d13 100644
--- a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/plugin/TextFormatTests.java
+++ b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/plugin/TextFormatTests.java
@@ -10,6 +10,7 @@
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.rest.FakeRestRequest;
+import org.elasticsearch.xpack.sql.action.SqlQueryResponse;
import org.elasticsearch.xpack.sql.proto.ColumnInfo;
import java.util.ArrayList;
diff --git a/x-pack/plugin/upgrade/build.gradle b/x-pack/plugin/upgrade/build.gradle
index 5cead96ac7aa5..8e65f87da3070 100644
--- a/x-pack/plugin/upgrade/build.gradle
+++ b/x-pack/plugin/upgrade/build.gradle
@@ -35,7 +35,7 @@ task internalClusterTest(type: RandomizedTestingTask,
dependsOn: test.dependsOn) {
configure(BuildPlugin.commonTestConfig(project))
classpath = project.test.classpath
- testClassesDir = project.test.testClassesDir
+ testClassesDirs = project.test.testClassesDirs
include '**/*IT.class'
systemProperty 'es.set.netty.runtime.available.processors', 'false'
}
diff --git a/x-pack/qa/full-cluster-restart/build.gradle b/x-pack/qa/full-cluster-restart/build.gradle
index b2bb7a63f6fb4..78ac1436fd8bc 100644
--- a/x-pack/qa/full-cluster-restart/build.gradle
+++ b/x-pack/qa/full-cluster-restart/build.gradle
@@ -184,6 +184,7 @@ subprojects {
systemProperty 'tests.old_cluster_version', version.toString().minus("-SNAPSHOT")
systemProperty 'tests.path.repo', new File(buildDir, "cluster/shared/repo")
exclude 'org/elasticsearch/upgrades/FullClusterRestartIT.class'
+ exclude 'org/elasticsearch/upgrades/QueryBuilderBWCIT.class'
}
Task upgradedClusterTest = tasks.create(name: "${baseName}#upgradedClusterTest", type: RestIntegTestTask)
@@ -222,6 +223,7 @@ subprojects {
systemProperty 'tests.old_cluster_version', version.toString().minus("-SNAPSHOT")
systemProperty 'tests.path.repo', new File(buildDir, "cluster/shared/repo")
exclude 'org/elasticsearch/upgrades/FullClusterRestartIT.class'
+ exclude 'org/elasticsearch/upgrades/QueryBuilderBWCIT.class'
}
Task versionBwcTest = tasks.create(name: "${baseName}#bwcTest") {
diff --git a/x-pack/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/QueryBuilderBWCIT.java b/x-pack/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/QueryBuilderBWCIT.java
new file mode 100644
index 0000000000000..1c4cba6aa8caa
--- /dev/null
+++ b/x-pack/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/QueryBuilderBWCIT.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License;
+ * you may not use this file except in compliance with the Elastic License.
+ */
+package org.elasticsearch.xpack.restart;
+
+import org.elasticsearch.common.settings.Settings;
+import org.elasticsearch.common.util.concurrent.ThreadContext;
+
+import java.nio.charset.StandardCharsets;
+import java.util.Base64;
+
+public class QueryBuilderBWCIT extends org.elasticsearch.upgrades.QueryBuilderBWCIT {
+
+ @Override
+ protected Settings restClientSettings() {
+ String token = "Basic " + Base64.getEncoder().encodeToString("test_user:x-pack-test-password".getBytes(StandardCharsets.UTF_8));
+ return Settings.builder()
+ .put(ThreadContext.PREFIX + ".Authorization", token)
+ .build();
+ }
+}
diff --git a/x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/IndexAuditUpgradeIT.java b/x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/IndexAuditUpgradeIT.java
index 7c81a7141a991..92a8c3d2f830f 100644
--- a/x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/IndexAuditUpgradeIT.java
+++ b/x-pack/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/IndexAuditUpgradeIT.java
@@ -87,7 +87,6 @@ private void assertNumUniqueNodeNameBuckets(int numBuckets) throws Exception {
/**
* Has the master been upgraded to the new version?
- * @throws IOException
*/
private boolean masterIsNewVersion() throws IOException {
Map, ?> map = entityAsMap(client().performRequest("GET", "/_nodes/_master"));
diff --git a/x-pack/qa/sql/build.gradle b/x-pack/qa/sql/build.gradle
index 0bea3a9364b71..4d061fffa9110 100644
--- a/x-pack/qa/sql/build.gradle
+++ b/x-pack/qa/sql/build.gradle
@@ -89,7 +89,7 @@ subprojects {
testRuntime "net.sourceforge.csvjdbc:csvjdbc:1.0.34"
testRuntime "com.h2database:h2:1.4.197"
testRuntime project(path: xpackModule('sql:jdbc'), configuration: 'nodeps')
- testRuntime xpackProject('plugin:sql:sql-shared-client')
+ testRuntime xpackProject('plugin:sql:sql-client')
// TODO check if needed
@@ -99,7 +99,7 @@ subprojects {
// CLI testing dependencies
testRuntime project(path: xpackModule('sql:sql-cli'), configuration: 'nodeps')
- testRuntime (xpackProject('plugin:sql:sql-proto')) {
+ testRuntime (xpackProject('plugin:sql:sql-action')) {
transitive = false
}
testRuntime "org.jline:jline:3.6.0"