2017-06-19 15:19:54 -04:00
|
|
|
import org.elasticsearch.gradle.Version
|
2017-06-27 17:54:07 -04:00
|
|
|
import org.elasticsearch.gradle.test.RunTask
|
2017-06-19 15:19:54 -04:00
|
|
|
|
|
|
|
apply plugin: 'elasticsearch.build'
|
|
|
|
|
2017-06-21 12:12:19 -04:00
|
|
|
description = 'JDBC driver for Elasticsearch'
|
|
|
|
|
2017-06-19 15:19:54 -04:00
|
|
|
def generatedResources = "$buildDir/generated-resources/main"
|
|
|
|
|
|
|
|
sourceSets {
|
|
|
|
main {
|
|
|
|
output.dir(generatedResources, builtBy: "generateGitHash")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-29 14:31:23 -04:00
|
|
|
forbiddenApisMain {
|
|
|
|
// does not depend on core, so only jdk and http signatures should be checked
|
|
|
|
signaturesURLs = [this.class.getResource('/forbidden/jdk-signatures.txt')]
|
|
|
|
}
|
|
|
|
|
2017-06-19 15:19:54 -04:00
|
|
|
task generateGitHash {
|
|
|
|
// TODO use the manifest file automatically built by elasticsearch.build
|
|
|
|
doLast {
|
|
|
|
Version current = Version.fromString(versions.elasticsearch)
|
|
|
|
String revHash = '123123123123123'
|
|
|
|
Properties props = new Properties()
|
|
|
|
props.put("version", versions.elasticsearch)
|
|
|
|
props.put("hash", revHash)
|
|
|
|
props.put("version.major", current.major as String)
|
|
|
|
props.put("version.minor", current.minor as String)
|
|
|
|
File output = new File(generatedResources, "jdbc-build.properties")
|
|
|
|
new File(generatedResources).mkdirs()
|
|
|
|
output.createNewFile()
|
|
|
|
def writer = output.newWriter("UTF-8")
|
|
|
|
try {
|
|
|
|
props.store(writer, null)
|
|
|
|
} finally {
|
|
|
|
writer.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2017-06-29 14:31:23 -04:00
|
|
|
compile project(':x-pack-elasticsearch:sql:net-client')
|
|
|
|
compile project(':x-pack-elasticsearch:sql:jdbc-proto')
|
2017-06-19 15:19:54 -04:00
|
|
|
|
Get jdbc tests passing
`gradle check -xforbiddenPatterns` now passes in jdbc.
This makes running the embedded HTTP server slightly more difficult,
you now have to add the following to your jvm arguments.
```
-ea -Dtests.rest.cluster=localhost:9200 -Dtests.embed.sql=true -Dtests.security.manager=false
```
Depending on your environment the embedded jdbc connection may give
spurious failures that look like:
```
org.elasticsearch.xpack.sql.jdbc.jdbc.JdbcException: RemoteTransportException[[node-0][127.0.0.1:9300][indices:data/read/search]]; nested: SearchPhaseExecutionException[]; nested: GeneralScriptException[Failed to compile inline script [( params.a0 > params.v0 ) && ( params.a1 > params.v1 )] using lang [painless]]; nested: CircuitBreakingException[[script] Too many dynamic script compilations within one minute, max: [15/min]; please use on-disk, indexed, or scripts with parameters instead; this limit can be changed by the [script.max_compilations_per_minute] setting];
...
Caused by: Failed to execute phase [fetch],
..
Caused by: GeneralScriptException[Failed to compile inline script [( params.a0 > params.v0 ) && ( params.a1 > params.v1 )] using lang [painless]]; nested: CircuitBreakingException[[script] Too many dynamic script compilations within one minute, max: [15/min]; please use on-disk, indexed, or scripts with parameters instead; this limit can be changed by the [script.max_compilations_per_minute] setting];
...
Caused by: CircuitBreakingException[[script] Too many dynamic script compilations within one minute, max: [15/min]; please use on-disk, indexed, or scripts with parameters instead; this limit can be changed by the [script.max_compilations_per_minute] setting]
```
`gradle check` works around this by setting `script.max_compilations_per_minute`
to `1000`.
Another change is that we no longer support loading the test data by
uncommenting some code. Instead we load the test data into Elaticsearch
before the first test and we deleted it after the last test. This is
so that tests that required different test data can interoperate with
eachother. The spec tests all use the same test data but the metadata
tests do not.
Original commit: elastic/x-pack-elasticsearch@8b8f684ac19d4dc2d2b7bdce05caa0f1693bd937
2017-07-05 13:38:17 -04:00
|
|
|
testCompile project(path: ':client:transport', configuration: 'runtime')
|
2017-06-20 15:08:50 -04:00
|
|
|
testCompile project(path: ':x-pack-elasticsearch:plugin', configuration: 'testArtifacts')
|
2017-06-29 14:31:23 -04:00
|
|
|
testCompile project(':x-pack-elasticsearch:sql:test-utils')
|
Get jdbc tests passing
`gradle check -xforbiddenPatterns` now passes in jdbc.
This makes running the embedded HTTP server slightly more difficult,
you now have to add the following to your jvm arguments.
```
-ea -Dtests.rest.cluster=localhost:9200 -Dtests.embed.sql=true -Dtests.security.manager=false
```
Depending on your environment the embedded jdbc connection may give
spurious failures that look like:
```
org.elasticsearch.xpack.sql.jdbc.jdbc.JdbcException: RemoteTransportException[[node-0][127.0.0.1:9300][indices:data/read/search]]; nested: SearchPhaseExecutionException[]; nested: GeneralScriptException[Failed to compile inline script [( params.a0 > params.v0 ) && ( params.a1 > params.v1 )] using lang [painless]]; nested: CircuitBreakingException[[script] Too many dynamic script compilations within one minute, max: [15/min]; please use on-disk, indexed, or scripts with parameters instead; this limit can be changed by the [script.max_compilations_per_minute] setting];
...
Caused by: Failed to execute phase [fetch],
..
Caused by: GeneralScriptException[Failed to compile inline script [( params.a0 > params.v0 ) && ( params.a1 > params.v1 )] using lang [painless]]; nested: CircuitBreakingException[[script] Too many dynamic script compilations within one minute, max: [15/min]; please use on-disk, indexed, or scripts with parameters instead; this limit can be changed by the [script.max_compilations_per_minute] setting];
...
Caused by: CircuitBreakingException[[script] Too many dynamic script compilations within one minute, max: [15/min]; please use on-disk, indexed, or scripts with parameters instead; this limit can be changed by the [script.max_compilations_per_minute] setting]
```
`gradle check` works around this by setting `script.max_compilations_per_minute`
to `1000`.
Another change is that we no longer support loading the test data by
uncommenting some code. Instead we load the test data into Elaticsearch
before the first test and we deleted it after the last test. This is
so that tests that required different test data can interoperate with
eachother. The spec tests all use the same test data but the metadata
tests do not.
Original commit: elastic/x-pack-elasticsearch@8b8f684ac19d4dc2d2b7bdce05caa0f1693bd937
2017-07-05 13:38:17 -04:00
|
|
|
testCompile "net.sourceforge.csvjdbc:csvjdbc:1.0.31"
|
2017-06-29 12:07:39 -04:00
|
|
|
|
2017-07-03 14:01:29 -04:00
|
|
|
testRuntime "com.h2database:h2:1.4.194"
|
2017-06-19 15:19:54 -04:00
|
|
|
}
|
|
|
|
|
2017-06-20 15:53:39 -04:00
|
|
|
dependencyLicenses {
|
|
|
|
mapping from: /jdbc-proto.*/, to: 'elasticsearch'
|
|
|
|
mapping from: /net-client.*/, to: 'elasticsearch'
|
|
|
|
ignoreSha 'jdbc-proto'
|
|
|
|
ignoreSha 'net-client'
|
|
|
|
}
|
|
|
|
|
2017-06-19 15:19:54 -04:00
|
|
|
// TODO seems like we should use the jars....
|
|
|
|
jar {
|
2017-06-29 14:31:23 -04:00
|
|
|
from(zipTree(project(':x-pack-elasticsearch:sql:net-client').jar.archivePath))
|
|
|
|
from(zipTree(project(':x-pack-elasticsearch:sql:jdbc-proto').jar.archivePath))
|
2017-06-19 15:19:54 -04:00
|
|
|
}
|
2017-06-27 17:54:07 -04:00
|
|
|
|
|
|
|
apply plugin: 'elasticsearch.rest-test'
|
2017-06-29 08:53:38 -04:00
|
|
|
integTest.mustRunAfter test
|
2017-06-27 17:54:07 -04:00
|
|
|
|
|
|
|
integTestCluster {
|
|
|
|
distribution = 'zip' // NOCOMMIT make double sure we want all the modules
|
|
|
|
plugin project(':x-pack-elasticsearch:plugin').path
|
|
|
|
/* Get a "clean" test without the other x-pack features here and check them
|
|
|
|
* all together later on. */
|
|
|
|
setting 'xpack.security.enabled', 'false'
|
|
|
|
setting 'xpack.monitoring.enabled', 'false'
|
|
|
|
setting 'xpack.ml.enabled', 'false'
|
|
|
|
setting 'xpack.watcher.enabled', 'false'
|
Get jdbc tests passing
`gradle check -xforbiddenPatterns` now passes in jdbc.
This makes running the embedded HTTP server slightly more difficult,
you now have to add the following to your jvm arguments.
```
-ea -Dtests.rest.cluster=localhost:9200 -Dtests.embed.sql=true -Dtests.security.manager=false
```
Depending on your environment the embedded jdbc connection may give
spurious failures that look like:
```
org.elasticsearch.xpack.sql.jdbc.jdbc.JdbcException: RemoteTransportException[[node-0][127.0.0.1:9300][indices:data/read/search]]; nested: SearchPhaseExecutionException[]; nested: GeneralScriptException[Failed to compile inline script [( params.a0 > params.v0 ) && ( params.a1 > params.v1 )] using lang [painless]]; nested: CircuitBreakingException[[script] Too many dynamic script compilations within one minute, max: [15/min]; please use on-disk, indexed, or scripts with parameters instead; this limit can be changed by the [script.max_compilations_per_minute] setting];
...
Caused by: Failed to execute phase [fetch],
..
Caused by: GeneralScriptException[Failed to compile inline script [( params.a0 > params.v0 ) && ( params.a1 > params.v1 )] using lang [painless]]; nested: CircuitBreakingException[[script] Too many dynamic script compilations within one minute, max: [15/min]; please use on-disk, indexed, or scripts with parameters instead; this limit can be changed by the [script.max_compilations_per_minute] setting];
...
Caused by: CircuitBreakingException[[script] Too many dynamic script compilations within one minute, max: [15/min]; please use on-disk, indexed, or scripts with parameters instead; this limit can be changed by the [script.max_compilations_per_minute] setting]
```
`gradle check` works around this by setting `script.max_compilations_per_minute`
to `1000`.
Another change is that we no longer support loading the test data by
uncommenting some code. Instead we load the test data into Elaticsearch
before the first test and we deleted it after the last test. This is
so that tests that required different test data can interoperate with
eachother. The spec tests all use the same test data but the metadata
tests do not.
Original commit: elastic/x-pack-elasticsearch@8b8f684ac19d4dc2d2b7bdce05caa0f1693bd937
2017-07-05 13:38:17 -04:00
|
|
|
setting 'script.max_compilations_per_minute', '1000'
|
2017-06-27 17:54:07 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
task run(type: RunTask) {
|
|
|
|
distribution = 'zip' // NOCOMMIT make double sure we want all the modules
|
|
|
|
plugin project(':x-pack-elasticsearch:plugin').path
|
|
|
|
/* Get a "clean" test without the other x-pack features here and check them
|
|
|
|
* all together later on. */
|
|
|
|
setting 'xpack.security.enabled', 'false'
|
|
|
|
setting 'xpack.monitoring.enabled', 'false'
|
|
|
|
setting 'xpack.ml.enabled', 'false'
|
|
|
|
setting 'xpack.watcher.enabled', 'false'
|
Get jdbc tests passing
`gradle check -xforbiddenPatterns` now passes in jdbc.
This makes running the embedded HTTP server slightly more difficult,
you now have to add the following to your jvm arguments.
```
-ea -Dtests.rest.cluster=localhost:9200 -Dtests.embed.sql=true -Dtests.security.manager=false
```
Depending on your environment the embedded jdbc connection may give
spurious failures that look like:
```
org.elasticsearch.xpack.sql.jdbc.jdbc.JdbcException: RemoteTransportException[[node-0][127.0.0.1:9300][indices:data/read/search]]; nested: SearchPhaseExecutionException[]; nested: GeneralScriptException[Failed to compile inline script [( params.a0 > params.v0 ) && ( params.a1 > params.v1 )] using lang [painless]]; nested: CircuitBreakingException[[script] Too many dynamic script compilations within one minute, max: [15/min]; please use on-disk, indexed, or scripts with parameters instead; this limit can be changed by the [script.max_compilations_per_minute] setting];
...
Caused by: Failed to execute phase [fetch],
..
Caused by: GeneralScriptException[Failed to compile inline script [( params.a0 > params.v0 ) && ( params.a1 > params.v1 )] using lang [painless]]; nested: CircuitBreakingException[[script] Too many dynamic script compilations within one minute, max: [15/min]; please use on-disk, indexed, or scripts with parameters instead; this limit can be changed by the [script.max_compilations_per_minute] setting];
...
Caused by: CircuitBreakingException[[script] Too many dynamic script compilations within one minute, max: [15/min]; please use on-disk, indexed, or scripts with parameters instead; this limit can be changed by the [script.max_compilations_per_minute] setting]
```
`gradle check` works around this by setting `script.max_compilations_per_minute`
to `1000`.
Another change is that we no longer support loading the test data by
uncommenting some code. Instead we load the test data into Elaticsearch
before the first test and we deleted it after the last test. This is
so that tests that required different test data can interoperate with
eachother. The spec tests all use the same test data but the metadata
tests do not.
Original commit: elastic/x-pack-elasticsearch@8b8f684ac19d4dc2d2b7bdce05caa0f1693bd937
2017-07-05 13:38:17 -04:00
|
|
|
setting 'script.max_compilations_per_minute', '1000'
|
|
|
|
}
|
|
|
|
|
|
|
|
// Allow for com.sun.net.httpserver.* usage for testing
|
|
|
|
eclipse {
|
|
|
|
classpath.file {
|
|
|
|
whenMerged { cp ->
|
|
|
|
def con = entries.find { e ->
|
|
|
|
e.kind == "con" && e.toString().contains("org.eclipse.jdt.launching.JRE_CONTAINER")
|
|
|
|
}
|
|
|
|
con.accessRules.add(new org.gradle.plugins.ide.eclipse.model.AccessRule(
|
|
|
|
"accessible", "com/sun/net/httpserver/*"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
forbiddenApisTest {
|
|
|
|
bundledSignatures -= 'jdk-non-portable'
|
|
|
|
bundledSignatures += 'jdk-internal'
|
2017-06-27 17:54:07 -04:00
|
|
|
}
|