mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 09:28:55 -04:00
Upgrade spotless plugin to 6.17.0 (#94994)
Fixes #82794. Upgrade the spotless plugin, which addresses the issue around formatting `instanceof` expressions. Formatting of statements including lambdas seems to have improved too.
This commit is contained in:
parent
696e63570f
commit
fe1083f6c5
349 changed files with 2104 additions and 2716 deletions
|
@ -60,7 +60,9 @@ public class MapperServiceFactory {
|
||||||
.withDeprecationHandler(LoggingDeprecationHandler.INSTANCE),
|
.withDeprecationHandler(LoggingDeprecationHandler.INSTANCE),
|
||||||
similarityService,
|
similarityService,
|
||||||
mapperRegistry,
|
mapperRegistry,
|
||||||
() -> { throw new UnsupportedOperationException(); },
|
() -> {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
},
|
||||||
new ProvidedIdFieldMapper(() -> true),
|
new ProvidedIdFieldMapper(() -> true),
|
||||||
new ScriptCompiler() {
|
new ScriptCompiler() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -175,7 +175,9 @@ public class QueryParserHelperBenchmark {
|
||||||
.withDeprecationHandler(LoggingDeprecationHandler.INSTANCE),
|
.withDeprecationHandler(LoggingDeprecationHandler.INSTANCE),
|
||||||
similarityService,
|
similarityService,
|
||||||
mapperRegistry,
|
mapperRegistry,
|
||||||
() -> { throw new UnsupportedOperationException(); },
|
() -> {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
},
|
||||||
new ProvidedIdFieldMapper(() -> true),
|
new ProvidedIdFieldMapper(() -> true),
|
||||||
new ScriptCompiler() {
|
new ScriptCompiler() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -54,12 +54,9 @@ public class InternalDistributionBwcSetupPlugin implements Plugin<Project> {
|
||||||
@Override
|
@Override
|
||||||
public void apply(Project project) {
|
public void apply(Project project) {
|
||||||
project.getRootProject().getPluginManager().apply(GlobalBuildInfoPlugin.class);
|
project.getRootProject().getPluginManager().apply(GlobalBuildInfoPlugin.class);
|
||||||
BuildParams.getBwcVersions()
|
BuildParams.getBwcVersions().forPreviousUnreleased((BwcVersions.UnreleasedVersionInfo unreleasedVersion) -> {
|
||||||
.forPreviousUnreleased(
|
|
||||||
(BwcVersions.UnreleasedVersionInfo unreleasedVersion) -> {
|
|
||||||
configureBwcProject(project.project(unreleasedVersion.gradleProjectPath()), unreleasedVersion);
|
configureBwcProject(project.project(unreleasedVersion.gradleProjectPath()), unreleasedVersion);
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void configureBwcProject(Project project, BwcVersions.UnreleasedVersionInfo versionInfo) {
|
private void configureBwcProject(Project project, BwcVersions.UnreleasedVersionInfo versionInfo) {
|
||||||
|
|
|
@ -32,13 +32,9 @@ public class DockerSupportPlugin implements Plugin<Project> {
|
||||||
|
|
||||||
Provider<DockerSupportService> dockerSupportServiceProvider = project.getGradle()
|
Provider<DockerSupportService> dockerSupportServiceProvider = project.getGradle()
|
||||||
.getSharedServices()
|
.getSharedServices()
|
||||||
.registerIfAbsent(
|
.registerIfAbsent(DOCKER_SUPPORT_SERVICE_NAME, DockerSupportService.class, spec -> spec.parameters(params -> {
|
||||||
DOCKER_SUPPORT_SERVICE_NAME,
|
params.setExclusionsFile(new File(project.getRootDir(), DOCKER_ON_LINUX_EXCLUSIONS_FILE));
|
||||||
DockerSupportService.class,
|
}));
|
||||||
spec -> spec.parameters(
|
|
||||||
params -> { params.setExclusionsFile(new File(project.getRootDir(), DOCKER_ON_LINUX_EXCLUSIONS_FILE)); }
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Ensure that if we are trying to run any DockerBuildTask tasks, we assert an available Docker installation exists
|
// Ensure that if we are trying to run any DockerBuildTask tasks, we assert an available Docker installation exists
|
||||||
project.getGradle().getTaskGraph().whenReady(graph -> {
|
project.getGradle().getTaskGraph().whenReady(graph -> {
|
||||||
|
|
|
@ -199,13 +199,9 @@ public class DistroTestPlugin implements Plugin<Project> {
|
||||||
|
|
||||||
// windows boxes get windows distributions, and linux boxes get linux distributions
|
// windows boxes get windows distributions, and linux boxes get linux distributions
|
||||||
if (isWindows(vmProject)) {
|
if (isWindows(vmProject)) {
|
||||||
configureVMWrapperTasks(
|
configureVMWrapperTasks(vmProject, windowsTestTasks, depsTasks, wrapperTask -> {
|
||||||
vmProject,
|
vmLifecyleTasks.get(ARCHIVE).configure(t -> t.dependsOn(wrapperTask));
|
||||||
windowsTestTasks,
|
}, vmDependencies);
|
||||||
depsTasks,
|
|
||||||
wrapperTask -> { vmLifecyleTasks.get(ARCHIVE).configure(t -> t.dependsOn(wrapperTask)); },
|
|
||||||
vmDependencies
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
for (var entry : linuxTestTasks.entrySet()) {
|
for (var entry : linuxTestTasks.entrySet()) {
|
||||||
ElasticsearchDistributionType type = entry.getKey();
|
ElasticsearchDistributionType type = entry.getKey();
|
||||||
|
|
|
@ -130,8 +130,9 @@ public class RestTestTransformer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
currentNode.elements()
|
currentNode.elements().forEachRemaining(node -> {
|
||||||
.forEachRemaining(node -> { traverseTest(testContext, node, parentKeyName, objectKeyFinders, arrayByObjectKeyFinders); });
|
traverseTest(testContext, node, parentKeyName, objectKeyFinders, arrayByObjectKeyFinders);
|
||||||
|
});
|
||||||
} else if (currentNode.isObject()) {
|
} else if (currentNode.isObject()) {
|
||||||
currentNode.fields().forEachRemaining(entry -> {
|
currentNode.fields().forEachRemaining(entry -> {
|
||||||
List<RestTestTransformByParentObject> transforms = objectKeyFinders.get(entry.getKey());
|
List<RestTestTransformByParentObject> transforms = objectKeyFinders.get(entry.getKey());
|
||||||
|
|
|
@ -19,7 +19,9 @@ public class MainResponse {
|
||||||
private static final ConstructingObjectParser<MainResponse, Void> PARSER = new ConstructingObjectParser<>(
|
private static final ConstructingObjectParser<MainResponse, Void> PARSER = new ConstructingObjectParser<>(
|
||||||
MainResponse.class.getName(),
|
MainResponse.class.getName(),
|
||||||
true,
|
true,
|
||||||
args -> { return new MainResponse((String) args[0], (Version) args[1], (String) args[2], (String) args[3], (String) args[4]); }
|
args -> {
|
||||||
|
return new MainResponse((String) args[0], (Version) args[1], (String) args[2], (String) args[3], (String) args[4]);
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -39,6 +39,6 @@ shadow-plugin = "gradle.plugin.com.github.johnrengelman:shadow:7.1.2"
|
||||||
spock-core = { group = "org.spockframework", name="spock-core", version.ref="spock" }
|
spock-core = { group = "org.spockframework", name="spock-core", version.ref="spock" }
|
||||||
spock-junit4 = { group = "org.spockframework", name="spock-junit4", version.ref="spock" }
|
spock-junit4 = { group = "org.spockframework", name="spock-junit4", version.ref="spock" }
|
||||||
spock-platform = { group = "org.spockframework", name="spock-bom", version.ref="spock" }
|
spock-platform = { group = "org.spockframework", name="spock-bom", version.ref="spock" }
|
||||||
spotless-plugin = "com.diffplug.spotless:spotless-plugin-gradle:6.11.0"
|
spotless-plugin = "com.diffplug.spotless:spotless-plugin-gradle:6.17.0"
|
||||||
wiremock = "com.github.tomakehurst:wiremock-jre8-standalone:2.23.2"
|
wiremock = "com.github.tomakehurst:wiremock-jre8-standalone:2.23.2"
|
||||||
xmlunit-core = "org.xmlunit:xmlunit-core:2.8.2"
|
xmlunit-core = "org.xmlunit:xmlunit-core:2.8.2"
|
||||||
|
|
|
@ -179,6 +179,11 @@
|
||||||
<sha256 value="095fd1dc77888c073f0be39a018156ee526722798b09de9e285ef2135e16eac4" origin="Generated by Gradle"/>
|
<sha256 value="095fd1dc77888c073f0be39a018156ee526722798b09de9e285ef2135e16eac4" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="com.diffplug.durian" name="durian-swt.os" version="4.1.1">
|
||||||
|
<artifact name="durian-swt.os-4.1.1.jar">
|
||||||
|
<sha256 value="9ff15ac4f14c4ef9e241108392c43347916a433658c5ad971e999df1191b3230" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="com.diffplug.spotless" name="spotless-eclipse-base" version="3.5.2">
|
<component group="com.diffplug.spotless" name="spotless-eclipse-base" version="3.5.2">
|
||||||
<artifact name="spotless-eclipse-base-3.5.2.jar">
|
<artifact name="spotless-eclipse-base-3.5.2.jar">
|
||||||
<sha256 value="e381d6996a3d7f41c02d79bd0b1dff077aaec40b55fa15971c1bb45ab16f5a20" origin="Generated by Gradle"/>
|
<sha256 value="e381d6996a3d7f41c02d79bd0b1dff077aaec40b55fa15971c1bb45ab16f5a20" origin="Generated by Gradle"/>
|
||||||
|
@ -194,16 +199,31 @@
|
||||||
<sha256 value="21f4d7fc032bfada42f29e629ce7d894e1a9bcf7dd5aa9b243fedd0c7d24f0a1" origin="Generated by Gradle"/>
|
<sha256 value="21f4d7fc032bfada42f29e629ce7d894e1a9bcf7dd5aa9b243fedd0c7d24f0a1" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="com.diffplug.spotless" name="spotless-lib" version="2.37.0">
|
||||||
|
<artifact name="spotless-lib-2.37.0.jar">
|
||||||
|
<sha256 value="71ffe1c3c3511ab44454ead09c20b9203cc3a14493453a18d1d8df862659c9fb" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="com.diffplug.spotless" name="spotless-lib-extra" version="2.30.0">
|
<component group="com.diffplug.spotless" name="spotless-lib-extra" version="2.30.0">
|
||||||
<artifact name="spotless-lib-extra-2.30.0.jar">
|
<artifact name="spotless-lib-extra-2.30.0.jar">
|
||||||
<sha256 value="9b4ce98aa4f5dbc75850fe6d9a79e878d318be718f997e5ea4052c885621baab" origin="Generated by Gradle"/>
|
<sha256 value="9b4ce98aa4f5dbc75850fe6d9a79e878d318be718f997e5ea4052c885621baab" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="com.diffplug.spotless" name="spotless-lib-extra" version="2.37.0">
|
||||||
|
<artifact name="spotless-lib-extra-2.37.0.jar">
|
||||||
|
<sha256 value="9bc857d39085731c1fa2db883c69ad8bdaa104482816f4a56798a124fe60c1f8" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="com.diffplug.spotless" name="spotless-plugin-gradle" version="6.11.0">
|
<component group="com.diffplug.spotless" name="spotless-plugin-gradle" version="6.11.0">
|
||||||
<artifact name="spotless-plugin-gradle-6.11.0.jar">
|
<artifact name="spotless-plugin-gradle-6.11.0.jar">
|
||||||
<sha256 value="54293b86170b821115772090bb90aeb466cda6bf9e08b06bacbd3bb94a714e1f" origin="Generated by Gradle"/>
|
<sha256 value="54293b86170b821115772090bb90aeb466cda6bf9e08b06bacbd3bb94a714e1f" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="com.diffplug.spotless" name="spotless-plugin-gradle" version="6.17.0">
|
||||||
|
<artifact name="spotless-plugin-gradle-6.17.0.jar">
|
||||||
|
<sha256 value="8f27c05d31a4389259ba54938c476427ae8a88cc1540d421623fdc6c9fc86f7b" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="com.ethlo.time" name="itu" version="1.7.0">
|
<component group="com.ethlo.time" name="itu" version="1.7.0">
|
||||||
<artifact name="itu-1.7.0.jar">
|
<artifact name="itu-1.7.0.jar">
|
||||||
<sha256 value="55ceb418c9e8138c4fcf62e213c4c814d89e8a84c827d395407cbecba5d791e7" origin="Generated by Gradle"/>
|
<sha256 value="55ceb418c9e8138c4fcf62e213c4c814d89e8a84c827d395407cbecba5d791e7" origin="Generated by Gradle"/>
|
||||||
|
@ -789,6 +809,11 @@
|
||||||
<sha256 value="88ac9fd1bb51f82bcc664cc1eb9c225c90dc4389d660231b4cc737bebfe7d0aa" origin="Generated by Gradle"/>
|
<sha256 value="88ac9fd1bb51f82bcc664cc1eb9c225c90dc4389d660231b4cc737bebfe7d0aa" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="com.squareup.okhttp3" name="okhttp" version="4.10.0">
|
||||||
|
<artifact name="okhttp-4.10.0.jar">
|
||||||
|
<sha256 value="7580f14fa1691206e37081ad3f92063b1603b328da0bb316f2fef02e0562e7ec" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="com.squareup.okio" name="okio" version="1.4.0">
|
<component group="com.squareup.okio" name="okio" version="1.4.0">
|
||||||
<artifact name="okio-1.4.0.jar">
|
<artifact name="okio-1.4.0.jar">
|
||||||
<sha256 value="b53c1760864e1c39b5275d9023e2a6fbe8f3189e6e67b4c87877b8ec8f92e05a" origin="Generated by Gradle"/>
|
<sha256 value="b53c1760864e1c39b5275d9023e2a6fbe8f3189e6e67b4c87877b8ec8f92e05a" origin="Generated by Gradle"/>
|
||||||
|
@ -799,6 +824,11 @@
|
||||||
<sha256 value="114bdc1f47338a68bcbc95abf2f5cdc72beeec91812f2fcd7b521c1937876266" origin="Generated by Gradle"/>
|
<sha256 value="114bdc1f47338a68bcbc95abf2f5cdc72beeec91812f2fcd7b521c1937876266" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="com.squareup.okio" name="okio-jvm" version="3.0.0">
|
||||||
|
<artifact name="okio-jvm-3.0.0.jar">
|
||||||
|
<sha256 value="be64a0cc1f28ea9cd5c970dd7e7557af72c808d738c495b397bf897c9921e907" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="com.sun.activation" name="jakarta.activation" version="1.2.1">
|
<component group="com.sun.activation" name="jakarta.activation" version="1.2.1">
|
||||||
<artifact name="jakarta.activation-1.2.1.jar">
|
<artifact name="jakarta.activation-1.2.1.jar">
|
||||||
<sha256 value="d84d4ba8b55cdb7fdcbb885e6939386367433f56f5ab8cfdc302a7c3587fa92b" origin="Generated by Gradle"/>
|
<sha256 value="d84d4ba8b55cdb7fdcbb885e6939386367433f56f5ab8cfdc302a7c3587fa92b" origin="Generated by Gradle"/>
|
||||||
|
@ -1054,6 +1084,11 @@
|
||||||
<sha256 value="c02730010ecc60ed49fb23e5ec25f678789a2c1a2582835806bc0ae6100ee109" origin="Generated by Gradle"/>
|
<sha256 value="c02730010ecc60ed49fb23e5ec25f678789a2c1a2582835806bc0ae6100ee109" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="dev.equo.ide" name="solstice" version="1.0.0">
|
||||||
|
<artifact name="solstice-1.0.0.jar">
|
||||||
|
<sha256 value="0ce1317572fb65b6045ffde5c4ccf104dd42552dda0fd1621120b92c1c4df16d" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="dnsjava" name="dnsjava" version="2.1.7">
|
<component group="dnsjava" name="dnsjava" version="2.1.7">
|
||||||
<artifact name="dnsjava-2.1.7.jar">
|
<artifact name="dnsjava-2.1.7.jar">
|
||||||
<sha256 value="2c52a6fabd5af9331d73fc7787dafc32a56bd8019c49f89749c2eeef244e303c" origin="Generated by Gradle"/>
|
<sha256 value="2c52a6fabd5af9331d73fc7787dafc32a56bd8019c49f89749c2eeef244e303c" origin="Generated by Gradle"/>
|
||||||
|
@ -1883,6 +1918,11 @@
|
||||||
<sha256 value="f2354b8207926be80debb9edd3108cd0b86eff8e4fe22a9244f214723f96d28e" origin="Generated by Gradle"/>
|
<sha256 value="f2354b8207926be80debb9edd3108cd0b86eff8e4fe22a9244f214723f96d28e" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="org.apache.felix" name="org.apache.felix.scr" version="2.2.4">
|
||||||
|
<artifact name="org.apache.felix.scr-2.2.4.jar">
|
||||||
|
<sha256 value="f4a14dc142faee676c81757104469895caf0b858c9326416b8246da6abaadd89" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="org.apache.geronimo.specs" name="geronimo-jcache_1.0_spec" version="1.0-alpha-1">
|
<component group="org.apache.geronimo.specs" name="geronimo-jcache_1.0_spec" version="1.0-alpha-1">
|
||||||
<artifact name="geronimo-jcache_1.0_spec-1.0-alpha-1.jar">
|
<artifact name="geronimo-jcache_1.0_spec-1.0-alpha-1.jar">
|
||||||
<sha256 value="0070a12e58f491b95719391325299a6294530ee6c3ce25e50bdc98b0b700966c" origin="Generated by Gradle"/>
|
<sha256 value="0070a12e58f491b95719391325299a6294530ee6c3ce25e50bdc98b0b700966c" origin="Generated by Gradle"/>
|
||||||
|
@ -3204,6 +3244,11 @@
|
||||||
<sha256 value="c84bba71adf3a11db1d2a93dbe2e056eba2e5418f04a437540a7946c24db20c8" origin="Generated by Gradle"/>
|
<sha256 value="c84bba71adf3a11db1d2a93dbe2e056eba2e5418f04a437540a7946c24db20c8" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="org.eclipse.jdt" name="org.eclipse.jdt.core" version="3.32.0">
|
||||||
|
<artifact name="org.eclipse.jdt.core-3.32.0.jar">
|
||||||
|
<sha256 value="cd396e4368b025f8f898ea7b7693fe5b9b1f6981c365c3857420d178132ef945" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="org.eclipse.jetty" name="jetty-annotations" version="9.4.40.v20210413">
|
<component group="org.eclipse.jetty" name="jetty-annotations" version="9.4.40.v20210413">
|
||||||
<artifact name="jetty-annotations-9.4.40.v20210413.jar">
|
<artifact name="jetty-annotations-9.4.40.v20210413.jar">
|
||||||
<sha256 value="faccdc2113daf5ace9157cacd98751a41280fec94f584fd571b7fc26ff84742d" origin="Generated by Gradle"/>
|
<sha256 value="faccdc2113daf5ace9157cacd98751a41280fec94f584fd571b7fc26ff84742d" origin="Generated by Gradle"/>
|
||||||
|
@ -3309,46 +3354,106 @@
|
||||||
<sha256 value="d679365a6c8e55c1496701099f5e5765433f68dcb659759416ba5b222eb5055c" origin="Generated by Gradle"/>
|
<sha256 value="d679365a6c8e55c1496701099f5e5765433f68dcb659759416ba5b222eb5055c" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="org.eclipse.jgit" name="org.eclipse.jgit" version="6.5.0.202303070854-r">
|
||||||
|
<artifact name="org.eclipse.jgit-6.5.0.202303070854-r.jar">
|
||||||
|
<sha256 value="9b4da8cde1651fa7a9f4d242585fe94343d40165e4c06ad5a722044a2cbe6251" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="org.eclipse.platform" name="org.eclipse.core.commands" version="3.10.100">
|
<component group="org.eclipse.platform" name="org.eclipse.core.commands" version="3.10.100">
|
||||||
<artifact name="org.eclipse.core.commands-3.10.100.jar">
|
<artifact name="org.eclipse.core.commands-3.10.100.jar">
|
||||||
<sha256 value="177c605efd78681e28765b869a2ff5284a79b02d133007a6169a64317cee8633" origin="Generated by Gradle"/>
|
<sha256 value="177c605efd78681e28765b869a2ff5284a79b02d133007a6169a64317cee8633" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="org.eclipse.platform" name="org.eclipse.core.commands" version="3.10.300">
|
||||||
|
<artifact name="org.eclipse.core.commands-3.10.300.jar">
|
||||||
|
<sha256 value="e589b4036723278bcd25e7aa190d1632a58569437a202d5c2b97c7ac9847b874" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="org.eclipse.platform" name="org.eclipse.core.contenttype" version="3.8.0">
|
<component group="org.eclipse.platform" name="org.eclipse.core.contenttype" version="3.8.0">
|
||||||
<artifact name="org.eclipse.core.contenttype-3.8.0.jar">
|
<artifact name="org.eclipse.core.contenttype-3.8.0.jar">
|
||||||
<sha256 value="f90fa8dd89b9da7d5e817281f963b46ad1414d33376354e541464434f0b23c90" origin="Generated by Gradle"/>
|
<sha256 value="f90fa8dd89b9da7d5e817281f963b46ad1414d33376354e541464434f0b23c90" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="org.eclipse.platform" name="org.eclipse.core.contenttype" version="3.8.200">
|
||||||
|
<artifact name="org.eclipse.core.contenttype-3.8.200.jar">
|
||||||
|
<sha256 value="d32716bfb03e7f3244a5df0f8816a8f0b6644a8c782f54062af8a3b00e1b4e45" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
|
<component group="org.eclipse.platform" name="org.eclipse.core.expressions" version="3.8.200">
|
||||||
|
<artifact name="org.eclipse.core.expressions-3.8.200.jar">
|
||||||
|
<sha256 value="13dbbe3256f1199c69a79c3ba4c6ee79e6c1a0e73f67d49f5f3365b7ad387818" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="org.eclipse.platform" name="org.eclipse.core.filesystem" version="1.9.100">
|
<component group="org.eclipse.platform" name="org.eclipse.core.filesystem" version="1.9.100">
|
||||||
<artifact name="org.eclipse.core.filesystem-1.9.100.jar">
|
<artifact name="org.eclipse.core.filesystem-1.9.100.jar">
|
||||||
<sha256 value="36e802c4d9a2c864e7d6b22b8d06f59927d113475ea04b3fd9bf6312d5a97ff6" origin="Generated by Gradle"/>
|
<sha256 value="36e802c4d9a2c864e7d6b22b8d06f59927d113475ea04b3fd9bf6312d5a97ff6" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="org.eclipse.platform" name="org.eclipse.core.filesystem" version="1.9.500">
|
||||||
|
<artifact name="org.eclipse.core.filesystem-1.9.500.jar">
|
||||||
|
<sha256 value="0c4810a1fa6e871c0bb23b29090a72c83b760af8171495c1325b4711b919072b" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="org.eclipse.platform" name="org.eclipse.core.jobs" version="3.12.0">
|
<component group="org.eclipse.platform" name="org.eclipse.core.jobs" version="3.12.0">
|
||||||
<artifact name="org.eclipse.core.jobs-3.12.0.jar">
|
<artifact name="org.eclipse.core.jobs-3.12.0.jar">
|
||||||
<sha256 value="98cc919c93c5a1c45e15afc82c64fc2b91a6b4c243bed6925ccdd4e3db3a96e9" origin="Generated by Gradle"/>
|
<sha256 value="98cc919c93c5a1c45e15afc82c64fc2b91a6b4c243bed6925ccdd4e3db3a96e9" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="org.eclipse.platform" name="org.eclipse.core.jobs" version="3.13.200">
|
||||||
|
<artifact name="org.eclipse.core.jobs-3.13.200.jar">
|
||||||
|
<sha256 value="f6303d411f5013aac5e3491860392b7fddc09b518d0eb63722b0926679cd9dbf" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="org.eclipse.platform" name="org.eclipse.core.resources" version="3.15.100">
|
<component group="org.eclipse.platform" name="org.eclipse.core.resources" version="3.15.100">
|
||||||
<artifact name="org.eclipse.core.resources-3.15.100.jar">
|
<artifact name="org.eclipse.core.resources-3.15.100.jar">
|
||||||
<sha256 value="428cc4ac13e6d4992f9806d67ee2a80e35005ae3ccd08f1788ed1693a05d35fa" origin="Generated by Gradle"/>
|
<sha256 value="428cc4ac13e6d4992f9806d67ee2a80e35005ae3ccd08f1788ed1693a05d35fa" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="org.eclipse.platform" name="org.eclipse.core.resources" version="3.18.100">
|
||||||
|
<artifact name="org.eclipse.core.resources-3.18.100.jar">
|
||||||
|
<sha256 value="4607aa2affc287783e498dc01a93d0338a549ffefb00df4b18aef8824622100a" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="org.eclipse.platform" name="org.eclipse.core.runtime" version="3.23.0">
|
<component group="org.eclipse.platform" name="org.eclipse.core.runtime" version="3.23.0">
|
||||||
<artifact name="org.eclipse.core.runtime-3.23.0.jar">
|
<artifact name="org.eclipse.core.runtime-3.23.0.jar">
|
||||||
<sha256 value="c81c0fd5c3cb632c93586c80f31461749f43104e3499f53e0cf33525bd606ce3" origin="Generated by Gradle"/>
|
<sha256 value="c81c0fd5c3cb632c93586c80f31461749f43104e3499f53e0cf33525bd606ce3" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="org.eclipse.platform" name="org.eclipse.core.runtime" version="3.26.100">
|
||||||
|
<artifact name="org.eclipse.core.runtime-3.26.100.jar">
|
||||||
|
<sha256 value="f90ebd2f052d602281840b2b8cd1f5a7b6d1cf2d5a85b7b0415c70456855d173" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="org.eclipse.platform" name="org.eclipse.equinox.app" version="1.6.0">
|
<component group="org.eclipse.platform" name="org.eclipse.equinox.app" version="1.6.0">
|
||||||
<artifact name="org.eclipse.equinox.app-1.6.0.jar">
|
<artifact name="org.eclipse.equinox.app-1.6.0.jar">
|
||||||
<sha256 value="745332dac397b823a7e3e3348447339f8fdb1973ceea4851612978ccf80bcc8c" origin="Generated by Gradle"/>
|
<sha256 value="745332dac397b823a7e3e3348447339f8fdb1973ceea4851612978ccf80bcc8c" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="org.eclipse.platform" name="org.eclipse.equinox.app" version="1.6.200">
|
||||||
|
<artifact name="org.eclipse.equinox.app-1.6.200.jar">
|
||||||
|
<sha256 value="52840b5fe48ed8f50a26d792d21b2db73b622a0a10d64c18883da6fb85dcbc24" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="org.eclipse.platform" name="org.eclipse.equinox.common" version="3.15.0">
|
<component group="org.eclipse.platform" name="org.eclipse.equinox.common" version="3.15.0">
|
||||||
<artifact name="org.eclipse.equinox.common-3.15.0.jar">
|
<artifact name="org.eclipse.equinox.common-3.15.0.jar">
|
||||||
<sha256 value="044a3d106f514072b1d0dd48638c1f8ffe93300a05d6943766992449ed9e0b3a" origin="Generated by Gradle"/>
|
<sha256 value="044a3d106f514072b1d0dd48638c1f8ffe93300a05d6943766992449ed9e0b3a" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="org.eclipse.platform" name="org.eclipse.equinox.common" version="3.17.0">
|
||||||
|
<artifact name="org.eclipse.equinox.common-3.17.0.jar">
|
||||||
|
<sha256 value="e85fee16eba255a451cbed66c03dc024267542036bdc590f7b7a6b3092959ada" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
|
<component group="org.eclipse.platform" name="org.eclipse.equinox.event" version="1.6.100">
|
||||||
|
<artifact name="org.eclipse.equinox.event-1.6.100.jar">
|
||||||
|
<sha256 value="72e27d45e88f47717a1d172cbd1236a7454ba74749b96bb204a3357956621229" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
|
<component group="org.eclipse.platform" name="org.eclipse.equinox.preferences" version="3.10.100">
|
||||||
|
<artifact name="org.eclipse.equinox.preferences-3.10.100.jar">
|
||||||
|
<sha256 value="ee791bfa46e35e3551209b89b2152544a6f860a12c4aab4a2f6c9c0cc3dd1dda" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="org.eclipse.platform" name="org.eclipse.equinox.preferences" version="3.9.0">
|
<component group="org.eclipse.platform" name="org.eclipse.equinox.preferences" version="3.9.0">
|
||||||
<artifact name="org.eclipse.equinox.preferences-3.9.0.jar">
|
<artifact name="org.eclipse.equinox.preferences-3.9.0.jar">
|
||||||
<sha256 value="02da6934a2e02d23b9016ec4eb5234733eeafd1f938acc23368b0d30c3567ae9" origin="Generated by Gradle"/>
|
<sha256 value="02da6934a2e02d23b9016ec4eb5234733eeafd1f938acc23368b0d30c3567ae9" origin="Generated by Gradle"/>
|
||||||
|
@ -3359,16 +3464,36 @@
|
||||||
<sha256 value="20a89fd326063e7ebe29308fa347a23b377924280038bc4233436d9117a8ba7b" origin="Generated by Gradle"/>
|
<sha256 value="20a89fd326063e7ebe29308fa347a23b377924280038bc4233436d9117a8ba7b" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="org.eclipse.platform" name="org.eclipse.equinox.registry" version="3.11.200">
|
||||||
|
<artifact name="org.eclipse.equinox.registry-3.11.200.jar">
|
||||||
|
<sha256 value="7a3668ca406930213e3edb8024ac72c51fbc3f289de63a33254c8070aa8d0a3f" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
|
<component group="org.eclipse.platform" name="org.eclipse.equinox.supplement" version="1.10.600">
|
||||||
|
<artifact name="org.eclipse.equinox.supplement-1.10.600.jar">
|
||||||
|
<sha256 value="d36dd1d1b0db36a3dad7a7b7f2f93ca48140fc3e663b47b0d56aed5c5e6fd655" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="org.eclipse.platform" name="org.eclipse.osgi" version="3.17.0">
|
<component group="org.eclipse.platform" name="org.eclipse.osgi" version="3.17.0">
|
||||||
<artifact name="org.eclipse.osgi-3.17.0.jar">
|
<artifact name="org.eclipse.osgi-3.17.0.jar">
|
||||||
<sha256 value="b9b5cf6bb057b94be55f3510bdd831cdbaef16f2d1cab6b3770b72452811e538" origin="Generated by Gradle"/>
|
<sha256 value="b9b5cf6bb057b94be55f3510bdd831cdbaef16f2d1cab6b3770b72452811e538" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="org.eclipse.platform" name="org.eclipse.osgi" version="3.18.200">
|
||||||
|
<artifact name="org.eclipse.osgi-3.18.200.jar">
|
||||||
|
<sha256 value="efa0779f1c0cdabb7fcbced2adbbf8632e1e8e239cb03ed9f37dd40c63a975d2" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="org.eclipse.platform" name="org.eclipse.text" version="3.12.0">
|
<component group="org.eclipse.platform" name="org.eclipse.text" version="3.12.0">
|
||||||
<artifact name="org.eclipse.text-3.12.0.jar">
|
<artifact name="org.eclipse.text-3.12.0.jar">
|
||||||
<sha256 value="457c1f8af07e870acce65130a2d9aa1e0fd95c92a7667bbd2db5bf7f9f19dd31" origin="Generated by Gradle"/>
|
<sha256 value="457c1f8af07e870acce65130a2d9aa1e0fd95c92a7667bbd2db5bf7f9f19dd31" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="org.eclipse.platform" name="org.eclipse.text" version="3.12.300">
|
||||||
|
<artifact name="org.eclipse.text-3.12.300.jar">
|
||||||
|
<sha256 value="6c4f4f01397ae566cb7007ca885ffc5d1813c913d6602d78a8f81801a39060e8" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="org.ehcache" name="ehcache" version="3.3.1">
|
<component group="org.ehcache" name="ehcache" version="3.3.1">
|
||||||
<artifact name="ehcache-3.3.1.jar">
|
<artifact name="ehcache-3.3.1.jar">
|
||||||
<sha256 value="bb3bad2519b4fde456ca3c7f06a44235da347699fcf4cb29bc9f6a0cb09604f6" origin="Generated by Gradle"/>
|
<sha256 value="bb3bad2519b4fde456ca3c7f06a44235da347699fcf4cb29bc9f6a0cb09604f6" origin="Generated by Gradle"/>
|
||||||
|
@ -3444,21 +3569,41 @@
|
||||||
<sha256 value="f78c5d8c09db985912ab83a1de3c3b53ddf208d7b151f06a72358ea3e137d01b" origin="Generated by Gradle"/>
|
<sha256 value="f78c5d8c09db985912ab83a1de3c3b53ddf208d7b151f06a72358ea3e137d01b" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="org.jetbrains.kotlin" name="kotlin-stdlib" version="1.6.20">
|
||||||
|
<artifact name="kotlin-stdlib-1.6.20.jar">
|
||||||
|
<sha256 value="eeb51c2b67b26233fd81d0bc4f8044ec849718890905763ceffd84a31e2cb799" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="org.jetbrains.kotlin" name="kotlin-stdlib-common" version="1.4.21">
|
<component group="org.jetbrains.kotlin" name="kotlin-stdlib-common" version="1.4.21">
|
||||||
<artifact name="kotlin-stdlib-common-1.4.21.jar">
|
<artifact name="kotlin-stdlib-common-1.4.21.jar">
|
||||||
<sha256 value="812cf197d9c4c67e1f47f95e2d72a9b600f0d1124560617bfe9850773eccbcff" origin="Generated by Gradle"/>
|
<sha256 value="812cf197d9c4c67e1f47f95e2d72a9b600f0d1124560617bfe9850773eccbcff" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="org.jetbrains.kotlin" name="kotlin-stdlib-common" version="1.6.20">
|
||||||
|
<artifact name="kotlin-stdlib-common-1.6.20.jar">
|
||||||
|
<sha256 value="8da40a2520d30dcb1012176fe93d24e82d08a3e346c37e0343b0fb6f64f6be01" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="org.jetbrains.kotlin" name="kotlin-stdlib-jdk7" version="1.4.21">
|
<component group="org.jetbrains.kotlin" name="kotlin-stdlib-jdk7" version="1.4.21">
|
||||||
<artifact name="kotlin-stdlib-jdk7-1.4.21.jar">
|
<artifact name="kotlin-stdlib-jdk7-1.4.21.jar">
|
||||||
<sha256 value="50de5f7dad6235064ac6c0ff577f095a91b3306c2547d8bc372291587495024a" origin="Generated by Gradle"/>
|
<sha256 value="50de5f7dad6235064ac6c0ff577f095a91b3306c2547d8bc372291587495024a" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="org.jetbrains.kotlin" name="kotlin-stdlib-jdk7" version="1.5.31">
|
||||||
|
<artifact name="kotlin-stdlib-jdk7-1.5.31.jar">
|
||||||
|
<sha256 value="a25bf47353ce899d843cbddee516d621a73473e7fba97f8d0301e7b4aed7c15f" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="org.jetbrains.kotlin" name="kotlin-stdlib-jdk8" version="1.4.21">
|
<component group="org.jetbrains.kotlin" name="kotlin-stdlib-jdk8" version="1.4.21">
|
||||||
<artifact name="kotlin-stdlib-jdk8-1.4.21.jar">
|
<artifact name="kotlin-stdlib-jdk8-1.4.21.jar">
|
||||||
<sha256 value="8ec3db1516948b2d3524e3afbe75cb5ac59e02d98cb6ef586ef57ba63ca8d11f" origin="Generated by Gradle"/>
|
<sha256 value="8ec3db1516948b2d3524e3afbe75cb5ac59e02d98cb6ef586ef57ba63ca8d11f" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="org.jetbrains.kotlin" name="kotlin-stdlib-jdk8" version="1.5.31">
|
||||||
|
<artifact name="kotlin-stdlib-jdk8-1.5.31.jar">
|
||||||
|
<sha256 value="b548f7767aacf029d2417e47440742bd6d3ebede19b60386e23554ce5c4c5fdc" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="org.jline" name="jline" version="3.9.0">
|
<component group="org.jline" name="jline" version="3.9.0">
|
||||||
<artifact name="jline-3.9.0.jar">
|
<artifact name="jline-3.9.0.jar">
|
||||||
<sha256 value="d2b986fd15d05e0b900faba776c1de9b4dc4a4fcdfeaa12a8ab8fb2b290ed527" origin="Generated by Gradle"/>
|
<sha256 value="d2b986fd15d05e0b900faba776c1de9b4dc4a4fcdfeaa12a8ab8fb2b290ed527" origin="Generated by Gradle"/>
|
||||||
|
@ -3734,6 +3879,41 @@
|
||||||
<sha256 value="0b9a7c048ee2f607b00cb0749f554cc0b13c2a0c3d51180297b2d28ad03ee8e6" origin="Generated by Gradle"/>
|
<sha256 value="0b9a7c048ee2f607b00cb0749f554cc0b13c2a0c3d51180297b2d28ad03ee8e6" origin="Generated by Gradle"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
|
<component group="org.osgi" name="org.osgi.service.cm" version="1.6.1">
|
||||||
|
<artifact name="org.osgi.service.cm-1.6.1.jar">
|
||||||
|
<sha256 value="529da7b6806af4d788acc0aef0079c9c920f6cb1d2679c8f392ca552fb2e1d35" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
|
<component group="org.osgi" name="org.osgi.service.component" version="1.5.0">
|
||||||
|
<artifact name="org.osgi.service.component-1.5.0.jar">
|
||||||
|
<sha256 value="120a22db8758c0c2c27cb4a7686ca094150ca47067dc8a32d488d79e8beb3609" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
|
<component group="org.osgi" name="org.osgi.service.event" version="1.4.1">
|
||||||
|
<artifact name="org.osgi.service.event-1.4.1.jar">
|
||||||
|
<sha256 value="9f11c68980dbd931850f3f27fc7c35e1d710ecc728fe872bd6d786cd7e4b7b5e" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
|
<component group="org.osgi" name="org.osgi.service.metatype" version="1.4.1">
|
||||||
|
<artifact name="org.osgi.service.metatype-1.4.1.jar">
|
||||||
|
<sha256 value="83d9cc2b62500d2e438be91c157659c2d693a262cfd14eb9b916286ca627ed00" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
|
<component group="org.osgi" name="org.osgi.service.prefs" version="1.1.2">
|
||||||
|
<artifact name="org.osgi.service.prefs-1.1.2.jar">
|
||||||
|
<sha256 value="43c7c870710e363405d422da653cce0d798a4537f76e4930f79bceadd3a55345" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
|
<component group="org.osgi" name="org.osgi.util.function" version="1.2.0">
|
||||||
|
<artifact name="org.osgi.util.function-1.2.0.jar">
|
||||||
|
<sha256 value="208819c7c71690c15a6bb8b187474e7f9d0147946b680182a62b9f222ae014ec" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
|
<component group="org.osgi" name="org.osgi.util.promise" version="1.2.0">
|
||||||
|
<artifact name="org.osgi.util.promise-1.2.0.jar">
|
||||||
|
<sha256 value="fef86e64f584d012a16a0306160764f6179663b90988a226c4641b920f3a4b36" origin="Generated by Gradle"/>
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="org.ow2.asm" name="asm" version="5.0.4">
|
<component group="org.ow2.asm" name="asm" version="5.0.4">
|
||||||
<artifact name="asm-5.0.4.jar">
|
<artifact name="asm-5.0.4.jar">
|
||||||
<sha256 value="896618ed8ae62702521a78bc7be42b7c491a08e6920a15f89a3ecdec31e9a220" origin="Generated by Gradle"/>
|
<sha256 value="896618ed8ae62702521a78bc7be42b7c491a08e6920a15f89a3ecdec31e9a220" origin="Generated by Gradle"/>
|
||||||
|
|
|
@ -246,10 +246,9 @@ public class SynonymsAnalysisTests extends ESTestCase {
|
||||||
.build();
|
.build();
|
||||||
IndexSettings idxSettings = IndexSettingsModule.newIndexSettings("index", settings);
|
IndexSettings idxSettings = IndexSettingsModule.newIndexSettings("index", settings);
|
||||||
|
|
||||||
expectThrows(
|
expectThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
indexAnalyzers = createTestAnalysis(idxSettings, settings, new CommonAnalysisPlugin()).indexAnalyzers;
|
||||||
() -> { indexAnalyzers = createTestAnalysis(idxSettings, settings, new CommonAnalysisPlugin()).indexAnalyzers; }
|
});
|
||||||
);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,7 +300,9 @@ public class SynonymsAnalysisTests extends ESTestCase {
|
||||||
IllegalArgumentException e = expectThrows(
|
IllegalArgumentException e = expectThrows(
|
||||||
IllegalArgumentException.class,
|
IllegalArgumentException.class,
|
||||||
"Expected exception for factory " + tf.getName(),
|
"Expected exception for factory " + tf.getName(),
|
||||||
() -> { tf.get(idxSettings, null, tf.getName(), settings).getSynonymFilter(); }
|
() -> {
|
||||||
|
tf.get(idxSettings, null, tf.getName(), settings).getSynonymFilter();
|
||||||
|
}
|
||||||
);
|
);
|
||||||
assertEquals(tf.getName(), "Token filter [" + tf.getName() + "] cannot be used to parse synonyms", e.getMessage());
|
assertEquals(tf.getName(), "Token filter [" + tf.getName() + "] cannot be used to parse synonyms", e.getMessage());
|
||||||
disallowedFiltersTested.add(tf.getName());
|
disallowedFiltersTested.add(tf.getName());
|
||||||
|
|
|
@ -41,11 +41,7 @@ class APMAgentSettings {
|
||||||
* Sensible defaults that Elasticsearch configures. This cannot be done via the APM agent
|
* Sensible defaults that Elasticsearch configures. This cannot be done via the APM agent
|
||||||
* config file, as then their values could not be overridden dynamically via system properties.
|
* config file, as then their values could not be overridden dynamically via system properties.
|
||||||
*/
|
*/
|
||||||
// tag::noformat
|
static Map<String, String> APM_AGENT_DEFAULT_SETTINGS = Map.of("transaction_sample_rate", "0.2");
|
||||||
static Map<String, String> APM_AGENT_DEFAULT_SETTINGS = Map.of(
|
|
||||||
"transaction_sample_rate", "0.2"
|
|
||||||
);
|
|
||||||
// end::noformat
|
|
||||||
|
|
||||||
void addClusterSettingsListeners(ClusterService clusterService, APMTracer apmTracer) {
|
void addClusterSettingsListeners(ClusterService clusterService, APMTracer apmTracer) {
|
||||||
final ClusterSettings clusterSettings = clusterService.getClusterSettings();
|
final ClusterSettings clusterSettings = clusterService.getClusterSettings();
|
||||||
|
|
|
@ -132,14 +132,9 @@ public class DataStreamsStatsTests extends ESSingleNodeTestCase {
|
||||||
client().admin().indices().close(new CloseIndexRequest(".ds-" + dataStreamName + "-*-000001")).actionGet().isAcknowledged()
|
client().admin().indices().close(new CloseIndexRequest(".ds-" + dataStreamName + "-*-000001")).actionGet().isAcknowledged()
|
||||||
);
|
);
|
||||||
|
|
||||||
assertBusy(
|
assertBusy(() -> {
|
||||||
() -> {
|
assertNotEquals(ClusterHealthStatus.RED, client().admin().cluster().health(new ClusterHealthRequest()).actionGet().getStatus());
|
||||||
assertNotEquals(
|
});
|
||||||
ClusterHealthStatus.RED,
|
|
||||||
client().admin().cluster().health(new ClusterHealthRequest()).actionGet().getStatus()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
DataStreamsStatsAction.Response stats = getDataStreamsStats();
|
DataStreamsStatsAction.Response stats = getDataStreamsStats();
|
||||||
assertEquals(2, stats.getSuccessfulShards());
|
assertEquals(2, stats.getSuccessfulShards());
|
||||||
|
|
|
@ -51,11 +51,9 @@ public class GeoIpCacheTests extends ESTestCase {
|
||||||
GeoIpCache cache = new GeoIpCache(1);
|
GeoIpCache cache = new GeoIpCache(1);
|
||||||
IllegalArgumentException ex = expectThrows(
|
IllegalArgumentException ex = expectThrows(
|
||||||
IllegalArgumentException.class,
|
IllegalArgumentException.class,
|
||||||
() -> cache.putIfAbsent(
|
() -> cache.putIfAbsent(InetAddresses.forString("127.0.0.1"), "path/to/db", ip -> {
|
||||||
InetAddresses.forString("127.0.0.1"),
|
throw new IllegalArgumentException("bad");
|
||||||
"path/to/db",
|
})
|
||||||
ip -> { throw new IllegalArgumentException("bad"); }
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
assertEquals("bad", ex.getMessage());
|
assertEquals("bad", ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,23 +25,15 @@ public class WhitelistLoaderTests extends ESTestCase {
|
||||||
public void testUnknownAnnotations() {
|
public void testUnknownAnnotations() {
|
||||||
Map<String, WhitelistAnnotationParser> parsers = new HashMap<>(WhitelistAnnotationParser.BASE_ANNOTATION_PARSERS);
|
Map<String, WhitelistAnnotationParser> parsers = new HashMap<>(WhitelistAnnotationParser.BASE_ANNOTATION_PARSERS);
|
||||||
|
|
||||||
RuntimeException expected = expectThrows(
|
RuntimeException expected = expectThrows(RuntimeException.class, () -> {
|
||||||
RuntimeException.class,
|
WhitelistLoader.loadFromResourceFiles(Whitelist.class, parsers, "org.elasticsearch.painless.annotation.unknown");
|
||||||
() -> { WhitelistLoader.loadFromResourceFiles(Whitelist.class, parsers, "org.elasticsearch.painless.annotation.unknown"); }
|
});
|
||||||
);
|
|
||||||
assertEquals("invalid annotation: parser not found for [unknownAnnotation] [@unknownAnnotation]", expected.getCause().getMessage());
|
assertEquals("invalid annotation: parser not found for [unknownAnnotation] [@unknownAnnotation]", expected.getCause().getMessage());
|
||||||
assertEquals(IllegalArgumentException.class, expected.getCause().getClass());
|
assertEquals(IllegalArgumentException.class, expected.getCause().getClass());
|
||||||
|
|
||||||
expected = expectThrows(
|
expected = expectThrows(RuntimeException.class, () -> {
|
||||||
RuntimeException.class,
|
WhitelistLoader.loadFromResourceFiles(Whitelist.class, parsers, "org.elasticsearch.painless.annotation.unknown_with_options");
|
||||||
() -> {
|
});
|
||||||
WhitelistLoader.loadFromResourceFiles(
|
|
||||||
Whitelist.class,
|
|
||||||
parsers,
|
|
||||||
"org.elasticsearch.painless.annotation.unknown_with_options"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"invalid annotation: parser not found for [unknownAnnotationWithMessage] [@unknownAnnotationWithMessage[arg=\"arg value\"]]",
|
"invalid annotation: parser not found for [unknownAnnotationWithMessage] [@unknownAnnotationWithMessage[arg=\"arg value\"]]",
|
||||||
expected.getCause().getMessage()
|
expected.getCause().getMessage()
|
||||||
|
|
|
@ -132,21 +132,13 @@ public class DefBootstrapTests extends ESTestCase {
|
||||||
map.put("a", "b");
|
map.put("a", "b");
|
||||||
assertEquals(2, (int) handle.invokeExact((Object) map));
|
assertEquals(2, (int) handle.invokeExact((Object) map));
|
||||||
|
|
||||||
final IllegalArgumentException iae = expectThrows(
|
final IllegalArgumentException iae = expectThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
Integer.toString((int) handle.invokeExact(new Object()));
|
||||||
() -> { Integer.toString((int) handle.invokeExact(new Object())); }
|
});
|
||||||
);
|
|
||||||
assertEquals("dynamic method [java.lang.Object, size/0] not found", iae.getMessage());
|
assertEquals("dynamic method [java.lang.Object, size/0] not found", iae.getMessage());
|
||||||
assertTrue(
|
assertTrue("Does not fail inside ClassValue.computeValue()", Arrays.stream(iae.getStackTrace()).anyMatch(e -> {
|
||||||
"Does not fail inside ClassValue.computeValue()",
|
return e.getMethodName().equals("computeValue") && e.getClassName().startsWith("org.elasticsearch.painless.DefBootstrap$PIC$");
|
||||||
Arrays.stream(iae.getStackTrace())
|
}));
|
||||||
.anyMatch(
|
|
||||||
e -> {
|
|
||||||
return e.getMethodName().equals("computeValue")
|
|
||||||
&& e.getClassName().startsWith("org.elasticsearch.painless.DefBootstrap$PIC$");
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// test operators with null guards
|
// test operators with null guards
|
||||||
|
|
|
@ -244,18 +244,16 @@ public class FunctionRefTests extends ScriptTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMethodMissing() {
|
public void testMethodMissing() {
|
||||||
Exception e = expectScriptThrows(
|
Exception e = expectScriptThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
exec("List l = [2, 1]; l.sort(Integer::bogus); return l.get(0);");
|
||||||
() -> { exec("List l = [2, 1]; l.sort(Integer::bogus); return l.get(0);"); }
|
});
|
||||||
);
|
|
||||||
assertThat(e.getMessage(), containsString("function reference [Integer::bogus/2] matching [java.util.Comparator"));
|
assertThat(e.getMessage(), containsString("function reference [Integer::bogus/2] matching [java.util.Comparator"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testQualifiedMethodMissing() {
|
public void testQualifiedMethodMissing() {
|
||||||
Exception e = expectScriptThrows(
|
Exception e = expectScriptThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
exec("List l = [2, 1]; l.sort(java.time.Instant::bogus); return l.get(0);", false);
|
||||||
() -> { exec("List l = [2, 1]; l.sort(java.time.Instant::bogus); return l.get(0);", false); }
|
});
|
||||||
);
|
|
||||||
assertThat(
|
assertThat(
|
||||||
e.getMessage(),
|
e.getMessage(),
|
||||||
containsString("function reference [java.time.Instant::bogus/2] matching [java.util.Comparator, compare/2")
|
containsString("function reference [java.time.Instant::bogus/2] matching [java.util.Comparator, compare/2")
|
||||||
|
@ -263,26 +261,23 @@ public class FunctionRefTests extends ScriptTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testClassMissing() {
|
public void testClassMissing() {
|
||||||
Exception e = expectScriptThrows(
|
Exception e = expectScriptThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
exec("List l = [2, 1]; l.sort(Bogus::bogus); return l.get(0);", false);
|
||||||
() -> { exec("List l = [2, 1]; l.sort(Bogus::bogus); return l.get(0);", false); }
|
});
|
||||||
);
|
|
||||||
assertThat(e.getMessage(), endsWith("variable [Bogus] is not defined"));
|
assertThat(e.getMessage(), endsWith("variable [Bogus] is not defined"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testQualifiedClassMissing() {
|
public void testQualifiedClassMissing() {
|
||||||
Exception e = expectScriptThrows(
|
Exception e = expectScriptThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
exec("List l = [2, 1]; l.sort(org.package.BogusClass::bogus); return l.get(0);", false);
|
||||||
() -> { exec("List l = [2, 1]; l.sort(org.package.BogusClass::bogus); return l.get(0);", false); }
|
});
|
||||||
);
|
|
||||||
assertEquals("variable [org.package.BogusClass] is not defined", e.getMessage());
|
assertEquals("variable [org.package.BogusClass] is not defined", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNotFunctionalInterface() {
|
public void testNotFunctionalInterface() {
|
||||||
IllegalArgumentException expected = expectScriptThrows(
|
IllegalArgumentException expected = expectScriptThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
exec("List l = new ArrayList(); l.add(2); l.add(1); l.add(Integer::bogus); return l.get(0);");
|
||||||
() -> { exec("List l = new ArrayList(); l.add(2); l.add(1); l.add(Integer::bogus); return l.get(0);"); }
|
});
|
||||||
);
|
|
||||||
assertThat(
|
assertThat(
|
||||||
expected.getMessage(),
|
expected.getMessage(),
|
||||||
containsString("cannot convert function reference [Integer::bogus] to a non-functional interface [def]")
|
containsString("cannot convert function reference [Integer::bogus] to a non-functional interface [def]")
|
||||||
|
@ -290,17 +285,15 @@ public class FunctionRefTests extends ScriptTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIncompatible() {
|
public void testIncompatible() {
|
||||||
expectScriptThrows(
|
expectScriptThrows(ClassCastException.class, () -> {
|
||||||
ClassCastException.class,
|
exec("List l = new ArrayList(); l.add(2); l.add(1); l.sort(String::startsWith); return l.get(0);");
|
||||||
() -> { exec("List l = new ArrayList(); l.add(2); l.add(1); l.sort(String::startsWith); return l.get(0);"); }
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testWrongArity() {
|
public void testWrongArity() {
|
||||||
IllegalArgumentException expected = expectScriptThrows(
|
IllegalArgumentException expected = expectScriptThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
exec("Optional.empty().orElseGet(String::startsWith);");
|
||||||
() -> { exec("Optional.empty().orElseGet(String::startsWith);"); }
|
});
|
||||||
);
|
|
||||||
assertThat(
|
assertThat(
|
||||||
expected.getMessage(),
|
expected.getMessage(),
|
||||||
containsString("function reference [String::startsWith/0] matching [java.util.function.Supplier")
|
containsString("function reference [String::startsWith/0] matching [java.util.function.Supplier")
|
||||||
|
@ -308,18 +301,16 @@ public class FunctionRefTests extends ScriptTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testWrongArityNotEnough() {
|
public void testWrongArityNotEnough() {
|
||||||
IllegalArgumentException expected = expectScriptThrows(
|
IllegalArgumentException expected = expectScriptThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
exec("List l = new ArrayList(); l.add(2); l.add(1); l.sort(String::isEmpty);");
|
||||||
() -> { exec("List l = new ArrayList(); l.add(2); l.add(1); l.sort(String::isEmpty);"); }
|
});
|
||||||
);
|
|
||||||
assertThat(expected.getMessage(), containsString("function reference [String::isEmpty/2] matching [java.util.Comparator"));
|
assertThat(expected.getMessage(), containsString("function reference [String::isEmpty/2] matching [java.util.Comparator"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testWrongArityDef() {
|
public void testWrongArityDef() {
|
||||||
IllegalArgumentException expected = expectScriptThrows(
|
IllegalArgumentException expected = expectScriptThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
exec("def y = Optional.empty(); return y.orElseGet(String::startsWith);");
|
||||||
() -> { exec("def y = Optional.empty(); return y.orElseGet(String::startsWith);"); }
|
});
|
||||||
);
|
|
||||||
assertThat(
|
assertThat(
|
||||||
expected.getMessage(),
|
expected.getMessage(),
|
||||||
containsString("function reference [String::startsWith/0] matching [java.util.function.Supplier")
|
containsString("function reference [String::startsWith/0] matching [java.util.function.Supplier")
|
||||||
|
@ -327,38 +318,33 @@ public class FunctionRefTests extends ScriptTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testWrongArityNotEnoughDef() {
|
public void testWrongArityNotEnoughDef() {
|
||||||
IllegalArgumentException expected = expectScriptThrows(
|
IllegalArgumentException expected = expectScriptThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
exec("def l = new ArrayList(); l.add(2); l.add(1); l.sort(String::isEmpty);");
|
||||||
() -> { exec("def l = new ArrayList(); l.add(2); l.add(1); l.sort(String::isEmpty);"); }
|
});
|
||||||
);
|
|
||||||
assertThat(expected.getMessage(), containsString("function reference [String::isEmpty/2] matching [java.util.Comparator"));
|
assertThat(expected.getMessage(), containsString("function reference [String::isEmpty/2] matching [java.util.Comparator"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testReturnVoid() {
|
public void testReturnVoid() {
|
||||||
Throwable expected = expectScriptThrows(
|
Throwable expected = expectScriptThrows(ClassCastException.class, () -> {
|
||||||
ClassCastException.class,
|
exec("StringBuilder b = new StringBuilder(); List l = [1, 2]; l.stream().mapToLong(b::setLength).sum();");
|
||||||
() -> { exec("StringBuilder b = new StringBuilder(); List l = [1, 2]; l.stream().mapToLong(b::setLength).sum();"); }
|
});
|
||||||
);
|
|
||||||
assertThat(expected.getMessage(), containsString("Cannot cast from [void] to [long]."));
|
assertThat(expected.getMessage(), containsString("Cannot cast from [void] to [long]."));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testReturnVoidDef() {
|
public void testReturnVoidDef() {
|
||||||
Exception expected = expectScriptThrows(
|
Exception expected = expectScriptThrows(LambdaConversionException.class, () -> {
|
||||||
LambdaConversionException.class,
|
exec("StringBuilder b = new StringBuilder(); def l = [1, 2]; l.stream().mapToLong(b::setLength);");
|
||||||
() -> { exec("StringBuilder b = new StringBuilder(); def l = [1, 2]; l.stream().mapToLong(b::setLength);"); }
|
});
|
||||||
);
|
|
||||||
assertThat(expected.getMessage(), containsString("lambda expects return type [long], but found return type [void]"));
|
assertThat(expected.getMessage(), containsString("lambda expects return type [long], but found return type [void]"));
|
||||||
|
|
||||||
expected = expectScriptThrows(
|
expected = expectScriptThrows(LambdaConversionException.class, () -> {
|
||||||
LambdaConversionException.class,
|
exec("def b = new StringBuilder(); def l = [1, 2]; l.stream().mapToLong(b::setLength);");
|
||||||
() -> { exec("def b = new StringBuilder(); def l = [1, 2]; l.stream().mapToLong(b::setLength);"); }
|
});
|
||||||
);
|
|
||||||
assertThat(expected.getMessage(), containsString("lambda expects return type [long], but found return type [void]"));
|
assertThat(expected.getMessage(), containsString("lambda expects return type [long], but found return type [void]"));
|
||||||
|
|
||||||
expected = expectScriptThrows(
|
expected = expectScriptThrows(LambdaConversionException.class, () -> {
|
||||||
LambdaConversionException.class,
|
exec("def b = new StringBuilder(); List l = [1, 2]; l.stream().mapToLong(b::setLength);");
|
||||||
() -> { exec("def b = new StringBuilder(); List l = [1, 2]; l.stream().mapToLong(b::setLength);"); }
|
});
|
||||||
);
|
|
||||||
assertThat(expected.getMessage(), containsString("lambda expects return type [long], but found return type [void]"));
|
assertThat(expected.getMessage(), containsString("lambda expects return type [long], but found return type [void]"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,10 +58,9 @@ public class FunctionTests extends ScriptTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDuplicates() {
|
public void testDuplicates() {
|
||||||
Exception expected = expectScriptThrows(
|
Exception expected = expectScriptThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
exec("void test(int x) {x = 2;} void test(def y) {y = 3;} test()");
|
||||||
() -> { exec("void test(int x) {x = 2;} void test(def y) {y = 3;} test()"); }
|
});
|
||||||
);
|
|
||||||
assertThat(expected.getMessage(), containsString("found duplicate function"));
|
assertThat(expected.getMessage(), containsString("found duplicate function"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,23 +83,20 @@ public class FunctionTests extends ScriptTestCase {
|
||||||
|
|
||||||
public void testReturnVoid() {
|
public void testReturnVoid() {
|
||||||
assertEquals(null, exec("void test(StringBuilder b, int i) {b.setLength(i)} test(new StringBuilder(), 1)"));
|
assertEquals(null, exec("void test(StringBuilder b, int i) {b.setLength(i)} test(new StringBuilder(), 1)"));
|
||||||
Exception expected = expectScriptThrows(
|
Exception expected = expectScriptThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
exec("int test(StringBuilder b, int i) {b.setLength(i)} test(new StringBuilder(), 1)");
|
||||||
() -> { exec("int test(StringBuilder b, int i) {b.setLength(i)} test(new StringBuilder(), 1)"); }
|
});
|
||||||
);
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"invalid function definition: " + "not all paths provide a return value for function [test] with [2] parameters",
|
"invalid function definition: " + "not all paths provide a return value for function [test] with [2] parameters",
|
||||||
expected.getMessage()
|
expected.getMessage()
|
||||||
);
|
);
|
||||||
expected = expectScriptThrows(
|
expected = expectScriptThrows(ClassCastException.class, () -> {
|
||||||
ClassCastException.class,
|
exec("int test(StringBuilder b, int i) {return b.setLength(i)} test(new StringBuilder(), 1)");
|
||||||
() -> { exec("int test(StringBuilder b, int i) {return b.setLength(i)} test(new StringBuilder(), 1)"); }
|
});
|
||||||
);
|
|
||||||
assertEquals("Cannot cast from [void] to [int].", expected.getMessage());
|
assertEquals("Cannot cast from [void] to [int].", expected.getMessage());
|
||||||
expected = expectScriptThrows(
|
expected = expectScriptThrows(ClassCastException.class, () -> {
|
||||||
ClassCastException.class,
|
exec("def test(StringBuilder b, int i) {return b.setLength(i)} test(new StringBuilder(), 1)");
|
||||||
() -> { exec("def test(StringBuilder b, int i) {return b.setLength(i)} test(new StringBuilder(), 1)"); }
|
});
|
||||||
);
|
|
||||||
assertEquals("Cannot cast from [void] to [def].", expected.getMessage());
|
assertEquals("Cannot cast from [void] to [def].", expected.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,14 +269,12 @@ public class GeneralCastTests extends ScriptTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIllegalVoidCasts() {
|
public void testIllegalVoidCasts() {
|
||||||
expectScriptThrows(
|
expectScriptThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
exec("def map = ['a': 1,'b': 2,'c': 3]; map.c = Collections.sort(new ArrayList(map.keySet()));");
|
||||||
() -> { exec("def map = ['a': 1,'b': 2,'c': 3]; map.c = Collections.sort(new ArrayList(map.keySet()));"); }
|
});
|
||||||
);
|
expectScriptThrows(IllegalArgumentException.class, () -> {
|
||||||
expectScriptThrows(
|
exec("Map map = ['a': 1,'b': 2,'c': 3]; def x = new HashMap(); x.put(1, map.clear());");
|
||||||
IllegalArgumentException.class,
|
});
|
||||||
() -> { exec("Map map = ['a': 1,'b': 2,'c': 3]; def x = new HashMap(); x.put(1, map.clear());"); }
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBoxedDefCalls() {
|
public void testBoxedDefCalls() {
|
||||||
|
|
|
@ -149,28 +149,19 @@ public class LambdaTests extends ScriptTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCapturesAreReadOnly() {
|
public void testCapturesAreReadOnly() {
|
||||||
IllegalArgumentException expected = expectScriptThrows(
|
IllegalArgumentException expected = expectScriptThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
exec("List l = new ArrayList(); l.add(1); l.add(1); " + "return l.stream().mapToInt(x -> { l = null; return x + 1 }).sum();");
|
||||||
() -> {
|
});
|
||||||
exec(
|
|
||||||
"List l = new ArrayList(); l.add(1); l.add(1); " + "return l.stream().mapToInt(x -> { l = null; return x + 1 }).sum();"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
assertTrue(expected.getMessage().contains("is read-only"));
|
assertTrue(expected.getMessage().contains("is read-only"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Lambda parameters shouldn't be able to mask a variable already in scope */
|
/** Lambda parameters shouldn't be able to mask a variable already in scope */
|
||||||
public void testNoParamMasking() {
|
public void testNoParamMasking() {
|
||||||
IllegalArgumentException expected = expectScriptThrows(
|
IllegalArgumentException expected = expectScriptThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
|
||||||
() -> {
|
|
||||||
exec(
|
exec(
|
||||||
"int x = 0; List l = new ArrayList(); l.add(1); l.add(1); "
|
"int x = 0; List l = new ArrayList(); l.add(1); l.add(1); " + "return l.stream().mapToInt(x -> { x += 1; return x }).sum();"
|
||||||
+ "return l.stream().mapToInt(x -> { x += 1; return x }).sum();"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
});
|
||||||
assertTrue(expected.getMessage().contains("already defined"));
|
assertTrue(expected.getMessage().contains("already defined"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,36 +181,30 @@ public class LambdaTests extends ScriptTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testWrongArity() {
|
public void testWrongArity() {
|
||||||
IllegalArgumentException expected = expectScriptThrows(
|
IllegalArgumentException expected = expectScriptThrows(IllegalArgumentException.class, false, () -> {
|
||||||
IllegalArgumentException.class,
|
exec("Optional.empty().orElseGet(x -> x);");
|
||||||
false,
|
});
|
||||||
() -> { exec("Optional.empty().orElseGet(x -> x);"); }
|
|
||||||
);
|
|
||||||
assertTrue(expected.getMessage().contains("Incorrect number of parameters"));
|
assertTrue(expected.getMessage().contains("Incorrect number of parameters"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testWrongArityDef() {
|
public void testWrongArityDef() {
|
||||||
IllegalArgumentException expected = expectScriptThrows(
|
IllegalArgumentException expected = expectScriptThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
exec("def y = Optional.empty(); return y.orElseGet(x -> x);");
|
||||||
() -> { exec("def y = Optional.empty(); return y.orElseGet(x -> x);"); }
|
});
|
||||||
);
|
|
||||||
assertTrue(expected.getMessage(), expected.getMessage().contains("due to an incorrect number of arguments"));
|
assertTrue(expected.getMessage(), expected.getMessage().contains("due to an incorrect number of arguments"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testWrongArityNotEnough() {
|
public void testWrongArityNotEnough() {
|
||||||
IllegalArgumentException expected = expectScriptThrows(
|
IllegalArgumentException expected = expectScriptThrows(IllegalArgumentException.class, false, () -> {
|
||||||
IllegalArgumentException.class,
|
exec("List l = new ArrayList(); l.add(1); l.add(1); " + "return l.stream().mapToInt(() -> 5).sum();");
|
||||||
false,
|
});
|
||||||
() -> { exec("List l = new ArrayList(); l.add(1); l.add(1); " + "return l.stream().mapToInt(() -> 5).sum();"); }
|
|
||||||
);
|
|
||||||
assertTrue(expected.getMessage().contains("Incorrect number of parameters"));
|
assertTrue(expected.getMessage().contains("Incorrect number of parameters"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testWrongArityNotEnoughDef() {
|
public void testWrongArityNotEnoughDef() {
|
||||||
IllegalArgumentException expected = expectScriptThrows(
|
IllegalArgumentException expected = expectScriptThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
exec("def l = new ArrayList(); l.add(1); l.add(1); " + "return l.stream().mapToInt(() -> 5).sum();");
|
||||||
() -> { exec("def l = new ArrayList(); l.add(1); l.add(1); " + "return l.stream().mapToInt(() -> 5).sum();"); }
|
});
|
||||||
);
|
|
||||||
assertTrue(expected.getMessage(), expected.getMessage().contains("due to an incorrect number of arguments"));
|
assertTrue(expected.getMessage(), expected.getMessage().contains("due to an incorrect number of arguments"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,19 +269,17 @@ public class LambdaTests extends ScriptTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testReturnVoid() {
|
public void testReturnVoid() {
|
||||||
Throwable expected = expectScriptThrows(
|
Throwable expected = expectScriptThrows(ClassCastException.class, () -> {
|
||||||
ClassCastException.class,
|
exec("StringBuilder b = new StringBuilder(); List l = [1, 2]; l.stream().mapToLong(i -> b.setLength(i))");
|
||||||
() -> { exec("StringBuilder b = new StringBuilder(); List l = [1, 2]; l.stream().mapToLong(i -> b.setLength(i))"); }
|
});
|
||||||
);
|
|
||||||
assertThat(expected.getMessage(), containsString("Cannot cast from [void] to [long]."));
|
assertThat(expected.getMessage(), containsString("Cannot cast from [void] to [long]."));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testReturnVoidDef() {
|
public void testReturnVoidDef() {
|
||||||
// If we can catch the error at compile time we do
|
// If we can catch the error at compile time we do
|
||||||
Exception expected = expectScriptThrows(
|
Exception expected = expectScriptThrows(ClassCastException.class, () -> {
|
||||||
ClassCastException.class,
|
exec("StringBuilder b = new StringBuilder(); def l = [1, 2]; l.stream().mapToLong(i -> b.setLength(i))");
|
||||||
() -> { exec("StringBuilder b = new StringBuilder(); def l = [1, 2]; l.stream().mapToLong(i -> b.setLength(i))"); }
|
});
|
||||||
);
|
|
||||||
assertThat(expected.getMessage(), containsString("Cannot cast from [void] to [def]."));
|
assertThat(expected.getMessage(), containsString("Cannot cast from [void] to [def]."));
|
||||||
|
|
||||||
// Otherwise we convert the void into a null
|
// Otherwise we convert the void into a null
|
||||||
|
|
|
@ -14,20 +14,18 @@ public class OverloadTests extends ScriptTestCase {
|
||||||
public void testMethod() {
|
public void testMethod() {
|
||||||
// assertEquals(2, exec("return 'abc123abc'.indexOf('c');"));
|
// assertEquals(2, exec("return 'abc123abc'.indexOf('c');"));
|
||||||
// assertEquals(8, exec("return 'abc123abc'.indexOf('c', 3);"));
|
// assertEquals(8, exec("return 'abc123abc'.indexOf('c', 3);"));
|
||||||
IllegalArgumentException expected = expectScriptThrows(
|
IllegalArgumentException expected = expectScriptThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
exec("return 'abc123abc'.indexOf('c', 3, 'bogus');");
|
||||||
() -> { exec("return 'abc123abc'.indexOf('c', 3, 'bogus');"); }
|
});
|
||||||
);
|
|
||||||
assertTrue(expected.getMessage().contains("[java.lang.String, indexOf/3]"));
|
assertTrue(expected.getMessage().contains("[java.lang.String, indexOf/3]"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMethodDynamic() {
|
public void testMethodDynamic() {
|
||||||
assertEquals(2, exec("def x = 'abc123abc'; return x.indexOf('c');"));
|
assertEquals(2, exec("def x = 'abc123abc'; return x.indexOf('c');"));
|
||||||
assertEquals(8, exec("def x = 'abc123abc'; return x.indexOf('c', 3);"));
|
assertEquals(8, exec("def x = 'abc123abc'; return x.indexOf('c', 3);"));
|
||||||
IllegalArgumentException expected = expectScriptThrows(
|
IllegalArgumentException expected = expectScriptThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
exec("def x = 'abc123abc'; return x.indexOf('c', 3, 'bogus');");
|
||||||
() -> { exec("def x = 'abc123abc'; return x.indexOf('c', 3, 'bogus');"); }
|
});
|
||||||
);
|
|
||||||
assertTrue(expected.getMessage().contains("dynamic method [java.lang.String, indexOf/3] not found"));
|
assertTrue(expected.getMessage().contains("dynamic method [java.lang.String, indexOf/3] not found"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -157,11 +157,9 @@ public class StringTests extends ScriptTestCase {
|
||||||
assertEquals('c', exec("String s = \"c\"; (char)s"));
|
assertEquals('c', exec("String s = \"c\"; (char)s"));
|
||||||
assertEquals('c', exec("String s = 'c'; (char)s"));
|
assertEquals('c', exec("String s = 'c'; (char)s"));
|
||||||
|
|
||||||
ClassCastException expected = expectScriptThrows(
|
ClassCastException expected = expectScriptThrows(ClassCastException.class, false, () -> {
|
||||||
ClassCastException.class,
|
assertEquals("cc", exec("return (String)(char)\"cc\""));
|
||||||
false,
|
});
|
||||||
() -> { assertEquals("cc", exec("return (String)(char)\"cc\"")); }
|
|
||||||
);
|
|
||||||
assertTrue(expected.getMessage().contains("cannot cast java.lang.String with length not equal to one to char"));
|
assertTrue(expected.getMessage().contains("cannot cast java.lang.String with length not equal to one to char"));
|
||||||
|
|
||||||
expected = expectScriptThrows(ClassCastException.class, false, () -> { assertEquals("cc", exec("return (String)(char)'cc'")); });
|
expected = expectScriptThrows(ClassCastException.class, false, () -> { assertEquals("cc", exec("return (String)(char)'cc'")); });
|
||||||
|
|
|
@ -37,10 +37,9 @@ public class WhenThingsGoWrongTests extends ScriptTestCase {
|
||||||
assertEquals(npe.getMessage(), "cannot access method/field [intValue] from a null def reference");
|
assertEquals(npe.getMessage(), "cannot access method/field [intValue] from a null def reference");
|
||||||
npe = expectScriptThrows(NullPointerException.class, () -> { exec("def x = [1, null]; for (y in x) y.intValue(); return null;"); });
|
npe = expectScriptThrows(NullPointerException.class, () -> { exec("def x = [1, null]; for (y in x) y.intValue(); return null;"); });
|
||||||
assertEquals(npe.getMessage(), "cannot access method/field [intValue] from a null def reference");
|
assertEquals(npe.getMessage(), "cannot access method/field [intValue] from a null def reference");
|
||||||
npe = expectScriptThrows(
|
npe = expectScriptThrows(NullPointerException.class, () -> {
|
||||||
NullPointerException.class,
|
exec("def x = [1, 2L, 3.0, 'test', (byte)1, (short)1, (char)1, null]; for (y in x) y.toString(); return null;");
|
||||||
() -> { exec("def x = [1, 2L, 3.0, 'test', (byte)1, (short)1, (char)1, null]; for (y in x) y.toString(); return null;"); }
|
});
|
||||||
);
|
|
||||||
assertEquals(npe.getMessage(), "cannot access method/field [toString] from a null def reference");
|
assertEquals(npe.getMessage(), "cannot access method/field [toString] from a null def reference");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,10 +50,9 @@ public class WhenThingsGoWrongTests extends ScriptTestCase {
|
||||||
public void testScriptStack() {
|
public void testScriptStack() {
|
||||||
for (String type : new String[] { "String", "def " }) {
|
for (String type : new String[] { "String", "def " }) {
|
||||||
// trigger NPE at line 1 of the script
|
// trigger NPE at line 1 of the script
|
||||||
ScriptException exception = expectThrows(
|
ScriptException exception = expectThrows(ScriptException.class, () -> {
|
||||||
ScriptException.class,
|
exec(type + " x = null; boolean y = x.isEmpty();\n" + "return y;");
|
||||||
() -> { exec(type + " x = null; boolean y = x.isEmpty();\n" + "return y;"); }
|
});
|
||||||
);
|
|
||||||
// null deref at x.isEmpty(), the '.' is offset 30
|
// null deref at x.isEmpty(), the '.' is offset 30
|
||||||
assertScriptElementColumn(30, exception);
|
assertScriptElementColumn(30, exception);
|
||||||
assertScriptStack(exception, "y = x.isEmpty();\n", " ^---- HERE");
|
assertScriptStack(exception, "y = x.isEmpty();\n", " ^---- HERE");
|
||||||
|
@ -78,12 +76,9 @@ public class WhenThingsGoWrongTests extends ScriptTestCase {
|
||||||
assertThat(exception.getCause(), instanceOf(NullPointerException.class));
|
assertThat(exception.getCause(), instanceOf(NullPointerException.class));
|
||||||
|
|
||||||
// trigger NPE at line 4 in script (inside conditional)
|
// trigger NPE at line 4 in script (inside conditional)
|
||||||
exception = expectThrows(
|
exception = expectThrows(ScriptException.class, () -> {
|
||||||
ScriptException.class,
|
|
||||||
() -> {
|
|
||||||
exec(type + " x = null;\n" + "boolean y = false;\n" + "if (!y) {\n" + " y = x.isEmpty();\n" + "}\n" + "return y;");
|
exec(type + " x = null;\n" + "boolean y = false;\n" + "if (!y) {\n" + " y = x.isEmpty();\n" + "}\n" + "return y;");
|
||||||
}
|
});
|
||||||
);
|
|
||||||
// null deref at x.isEmpty(), the '.' is offset 53
|
// null deref at x.isEmpty(), the '.' is offset 53
|
||||||
assertScriptElementColumn(53, exception);
|
assertScriptElementColumn(53, exception);
|
||||||
assertScriptStack(exception, "y = x.isEmpty();\n}\n", " ^---- HERE");
|
assertScriptStack(exception, "y = x.isEmpty();\n}\n", " ^---- HERE");
|
||||||
|
@ -115,10 +110,9 @@ public class WhenThingsGoWrongTests extends ScriptTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBogusParameter() {
|
public void testBogusParameter() {
|
||||||
IllegalArgumentException expected = expectThrows(
|
IllegalArgumentException expected = expectThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
exec("return 5;", null, Collections.singletonMap("bogusParameterKey", "bogusParameterValue"), true);
|
||||||
() -> { exec("return 5;", null, Collections.singletonMap("bogusParameterKey", "bogusParameterValue"), true); }
|
});
|
||||||
);
|
|
||||||
assertTrue(expected.getMessage().contains("Unrecognized compile-time parameter"));
|
assertTrue(expected.getMessage().contains("Unrecognized compile-time parameter"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,10 +166,9 @@ public class WhenThingsGoWrongTests extends ScriptTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIllegalDynamicMethod() {
|
public void testIllegalDynamicMethod() {
|
||||||
IllegalArgumentException expected = expectScriptThrows(
|
IllegalArgumentException expected = expectScriptThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
exec("def x = 'test'; return x.getClass().toString()");
|
||||||
() -> { exec("def x = 'test'; return x.getClass().toString()"); }
|
});
|
||||||
);
|
|
||||||
assertTrue(expected.getMessage().contains("dynamic method [java.lang.String, getClass/0] not found"));
|
assertTrue(expected.getMessage().contains("dynamic method [java.lang.String, getClass/0] not found"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,10 +205,9 @@ public class WhenThingsGoWrongTests extends ScriptTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSecurityException() {
|
public void testSecurityException() {
|
||||||
expectThrows(
|
expectThrows(SecurityException.class, () -> {
|
||||||
SecurityException.class,
|
exec("params.v.get();", Map.of("v", (Supplier<String>) () -> { throw new SecurityException(); }), true);
|
||||||
() -> { exec("params.v.get();", Map.of("v", (Supplier<String>) () -> { throw new SecurityException(); }), true); }
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testOutOfMemoryError() {
|
public void testOutOfMemoryError() {
|
||||||
|
|
|
@ -315,7 +315,9 @@ public class ScaledFloatFieldMapper extends FieldMapper {
|
||||||
name(),
|
name(),
|
||||||
IndexNumericFieldData.NumericType.LONG,
|
IndexNumericFieldData.NumericType.LONG,
|
||||||
valuesSourceType,
|
valuesSourceType,
|
||||||
(dv, n) -> { throw new UnsupportedOperationException(); }
|
(dv, n) -> {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
).build(cache, breakerService);
|
).build(cache, breakerService);
|
||||||
return new ScaledFloatIndexFieldData(scaledValues, scalingFactor, ScaledFloatDocValuesField::new);
|
return new ScaledFloatIndexFieldData(scaledValues, scalingFactor, ScaledFloatDocValuesField::new);
|
||||||
};
|
};
|
||||||
|
|
|
@ -409,10 +409,9 @@ public class PercolatorQuerySearchIT extends ESIntegTestCase {
|
||||||
client().admin().indices().prepareRefresh().get();
|
client().admin().indices().prepareRefresh().get();
|
||||||
|
|
||||||
logger.info("percolating empty doc with source disabled");
|
logger.info("percolating empty doc with source disabled");
|
||||||
IllegalArgumentException e = expectThrows(
|
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
client().prepareSearch().setQuery(new PercolateQueryBuilder("query", "test", "1", null, null, null)).get();
|
||||||
() -> { client().prepareSearch().setQuery(new PercolateQueryBuilder("query", "test", "1", null, null, null)).get(); }
|
});
|
||||||
);
|
|
||||||
assertThat(e.getMessage(), containsString("source disabled"));
|
assertThat(e.getMessage(), containsString("source disabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -228,10 +228,9 @@ public class PercolateQueryBuilderTests extends AbstractQueryTestCase<PercolateQ
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRequiredParameters() {
|
public void testRequiredParameters() {
|
||||||
IllegalArgumentException e = expectThrows(
|
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
new PercolateQueryBuilder(null, new BytesArray("{}"), XContentType.JSON);
|
||||||
() -> { new PercolateQueryBuilder(null, new BytesArray("{}"), XContentType.JSON); }
|
});
|
||||||
);
|
|
||||||
assertThat(e.getMessage(), equalTo("[field] is a required argument"));
|
assertThat(e.getMessage(), equalTo("[field] is a required argument"));
|
||||||
|
|
||||||
e = expectThrows(
|
e = expectThrows(
|
||||||
|
|
|
@ -563,14 +563,9 @@ public class PercolatorFieldMapperTests extends ESSingleNodeTestCase {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
BytesRef qbSource = doc.rootDoc().getFields(fieldType.queryBuilderField.name()).get(0).binaryValue();
|
BytesRef qbSource = doc.rootDoc().getFields(fieldType.queryBuilderField.name()).get(0).binaryValue();
|
||||||
SearchExecutionContext searchExecutionContext = indexService.newSearchExecutionContext(
|
SearchExecutionContext searchExecutionContext = indexService.newSearchExecutionContext(randomInt(20), 0, null, () -> {
|
||||||
randomInt(20),
|
throw new UnsupportedOperationException();
|
||||||
0,
|
}, null, emptyMap());
|
||||||
null,
|
|
||||||
() -> { throw new UnsupportedOperationException(); },
|
|
||||||
null,
|
|
||||||
emptyMap()
|
|
||||||
);
|
|
||||||
PlainActionFuture<QueryBuilder> future = new PlainActionFuture<>();
|
PlainActionFuture<QueryBuilder> future = new PlainActionFuture<>();
|
||||||
Rewriteable.rewriteAndFetch(queryBuilder, searchExecutionContext, future);
|
Rewriteable.rewriteAndFetch(queryBuilder, searchExecutionContext, future);
|
||||||
assertQueryBuilder(qbSource, future.get());
|
assertQueryBuilder(qbSource, future.get());
|
||||||
|
|
|
@ -258,11 +258,9 @@ public class DiscountedCumulativeGain implements EvaluationMetric {
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final ConstructingObjectParser<Detail, Void> PARSER = new ConstructingObjectParser<>(
|
private static final ConstructingObjectParser<Detail, Void> PARSER = new ConstructingObjectParser<>(NAME, true, args -> {
|
||||||
NAME,
|
return new Detail((Double) args[0], (Double) args[1] != null ? (Double) args[1] : 0.0d, (Integer) args[2]);
|
||||||
true,
|
});
|
||||||
args -> { return new Detail((Double) args[0], (Double) args[1] != null ? (Double) args[1] : 0.0d, (Integer) args[2]); }
|
|
||||||
);
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
PARSER.declareDouble(constructorArg(), DCG_FIELD);
|
PARSER.declareDouble(constructorArg(), DCG_FIELD);
|
||||||
|
|
|
@ -238,11 +238,9 @@ public class ExpectedReciprocalRank implements EvaluationMetric {
|
||||||
return builder.field(UNRATED_FIELD.getPreferredName(), this.unratedDocs);
|
return builder.field(UNRATED_FIELD.getPreferredName(), this.unratedDocs);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final ConstructingObjectParser<Detail, Void> PARSER = new ConstructingObjectParser<>(
|
private static final ConstructingObjectParser<Detail, Void> PARSER = new ConstructingObjectParser<>(NAME, true, args -> {
|
||||||
NAME,
|
return new Detail((Integer) args[0]);
|
||||||
true,
|
});
|
||||||
args -> { return new Detail((Integer) args[0]); }
|
|
||||||
);
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
PARSER.declareInt(constructorArg(), UNRATED_FIELD);
|
PARSER.declareInt(constructorArg(), UNRATED_FIELD);
|
||||||
|
|
|
@ -195,11 +195,9 @@ public class MeanReciprocalRank implements EvaluationMetric {
|
||||||
return builder.field(FIRST_RELEVANT_RANK_FIELD.getPreferredName(), firstRelevantRank);
|
return builder.field(FIRST_RELEVANT_RANK_FIELD.getPreferredName(), firstRelevantRank);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final ConstructingObjectParser<Detail, Void> PARSER = new ConstructingObjectParser<>(
|
private static final ConstructingObjectParser<Detail, Void> PARSER = new ConstructingObjectParser<>(NAME, true, args -> {
|
||||||
NAME,
|
return new Detail((Integer) args[0]);
|
||||||
true,
|
});
|
||||||
args -> { return new Detail((Integer) args[0]); }
|
|
||||||
);
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
PARSER.declareInt(constructorArg(), FIRST_RELEVANT_RANK_FIELD);
|
PARSER.declareInt(constructorArg(), FIRST_RELEVANT_RANK_FIELD);
|
||||||
|
|
|
@ -311,11 +311,9 @@ public class DiscountedCumulativeGainTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEqualsAndHash() throws IOException {
|
public void testEqualsAndHash() throws IOException {
|
||||||
checkEqualsAndHashCode(
|
checkEqualsAndHashCode(createTestItem(), original -> {
|
||||||
createTestItem(),
|
return new DiscountedCumulativeGain(original.getNormalize(), original.getUnknownDocRating(), original.getK());
|
||||||
original -> { return new DiscountedCumulativeGain(original.getNormalize(), original.getUnknownDocRating(), original.getK()); },
|
}, DiscountedCumulativeGainTests::mutateTestItem);
|
||||||
DiscountedCumulativeGainTests::mutateTestItem
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static DiscountedCumulativeGain mutateTestItem(DiscountedCumulativeGain original) {
|
private static DiscountedCumulativeGain mutateTestItem(DiscountedCumulativeGain original) {
|
||||||
|
|
|
@ -188,11 +188,9 @@ public class ExpectedReciprocalRankTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEqualsAndHash() throws IOException {
|
public void testEqualsAndHash() throws IOException {
|
||||||
checkEqualsAndHashCode(
|
checkEqualsAndHashCode(createTestItem(), original -> {
|
||||||
createTestItem(),
|
return new ExpectedReciprocalRank(original.getMaxRelevance(), original.getUnknownDocRating(), original.getK());
|
||||||
original -> { return new ExpectedReciprocalRank(original.getMaxRelevance(), original.getUnknownDocRating(), original.getK()); },
|
}, ExpectedReciprocalRankTests::mutateTestItem);
|
||||||
ExpectedReciprocalRankTests::mutateTestItem
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ExpectedReciprocalRank mutateTestItem(ExpectedReciprocalRank original) {
|
private static ExpectedReciprocalRank mutateTestItem(ExpectedReciprocalRank original) {
|
||||||
|
|
|
@ -67,11 +67,9 @@ public class RatedDocumentTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEqualsAndHash() throws IOException {
|
public void testEqualsAndHash() throws IOException {
|
||||||
checkEqualsAndHashCode(
|
checkEqualsAndHashCode(createRatedDocument(), original -> {
|
||||||
createRatedDocument(),
|
return new RatedDocument(original.getIndex(), original.getDocID(), original.getRating());
|
||||||
original -> { return new RatedDocument(original.getIndex(), original.getDocID(), original.getRating()); },
|
}, RatedDocumentTests::mutateTestItem);
|
||||||
RatedDocumentTests::mutateTestItem
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static RatedDocument mutateTestItem(RatedDocument original) {
|
private static RatedDocument mutateTestItem(RatedDocument original) {
|
||||||
|
|
|
@ -108,7 +108,9 @@ public class BulkByScrollUsesAllScrollDocumentsAfterConflictsIntegTests extends
|
||||||
scriptEnabled,
|
scriptEnabled,
|
||||||
updateByQuery(),
|
updateByQuery(),
|
||||||
true,
|
true,
|
||||||
(bulkByScrollResponse, updatedDocCount) -> { assertThat(bulkByScrollResponse.getUpdated(), is((long) updatedDocCount)); }
|
(bulkByScrollResponse, updatedDocCount) -> {
|
||||||
|
assertThat(bulkByScrollResponse.getUpdated(), is((long) updatedDocCount));
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +132,9 @@ public class BulkByScrollUsesAllScrollDocumentsAfterConflictsIntegTests extends
|
||||||
scriptEnabled,
|
scriptEnabled,
|
||||||
reindexRequestBuilder,
|
reindexRequestBuilder,
|
||||||
false,
|
false,
|
||||||
(bulkByScrollResponse, reindexDocCount) -> { assertThat(bulkByScrollResponse.getCreated(), is((long) reindexDocCount)); }
|
(bulkByScrollResponse, reindexDocCount) -> {
|
||||||
|
assertThat(bulkByScrollResponse.getCreated(), is((long) reindexDocCount));
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +146,9 @@ public class BulkByScrollUsesAllScrollDocumentsAfterConflictsIntegTests extends
|
||||||
false,
|
false,
|
||||||
deleteByQuery(),
|
deleteByQuery(),
|
||||||
true,
|
true,
|
||||||
(bulkByScrollResponse, deletedDocCount) -> { assertThat(bulkByScrollResponse.getDeleted(), is((long) deletedDocCount)); }
|
(bulkByScrollResponse, deletedDocCount) -> {
|
||||||
|
assertThat(bulkByScrollResponse.getDeleted(), is((long) deletedDocCount));
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,10 +92,9 @@ public class AzureClientProviderTests extends ESTestCase {
|
||||||
|
|
||||||
LocationMode locationMode = LocationMode.SECONDARY_ONLY;
|
LocationMode locationMode = LocationMode.SECONDARY_ONLY;
|
||||||
RequestRetryOptions requestRetryOptions = new RequestRetryOptions();
|
RequestRetryOptions requestRetryOptions = new RequestRetryOptions();
|
||||||
expectThrows(
|
expectThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
azureClientProvider.createClient(storageSettings, locationMode, requestRetryOptions, null, EMPTY_CONSUMER);
|
||||||
() -> { azureClientProvider.createClient(storageSettings, locationMode, requestRetryOptions, null, EMPTY_CONSUMER); }
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String encodeKey(final String value) {
|
private static String encodeKey(final String value) {
|
||||||
|
|
|
@ -245,9 +245,9 @@ public class URLHttpClientTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private URLHttpClient.HttpResponse executeRequest(String endpoint) throws Exception {
|
private URLHttpClient.HttpResponse executeRequest(String endpoint) throws Exception {
|
||||||
return AccessController.doPrivileged(
|
return AccessController.doPrivileged((PrivilegedExceptionAction<URLHttpClient.HttpResponse>) () -> {
|
||||||
(PrivilegedExceptionAction<URLHttpClient.HttpResponse>) () -> { return httpClient.get(getURIForEndpoint(endpoint), Map.of()); }
|
return httpClient.get(getURIForEndpoint(endpoint), Map.of());
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private URI getURIForEndpoint(String endpoint) throws Exception {
|
private URI getURIForEndpoint(String endpoint) throws Exception {
|
||||||
|
|
|
@ -105,12 +105,9 @@ public interface NamedGroupExtractor {
|
||||||
throw new IllegalArgumentException("emitted warnings: " + warnings);
|
throw new IllegalArgumentException("emitted warnings: " + warnings);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Grok(
|
return new Grok(GrokBuiltinPatterns.legacyPatterns(), pattern, watchdog, w -> {
|
||||||
GrokBuiltinPatterns.legacyPatterns(),
|
throw new IllegalArgumentException("grok [" + pattern + "] emitted a warning: " + w);
|
||||||
pattern,
|
});
|
||||||
watchdog,
|
|
||||||
w -> { throw new IllegalArgumentException("grok [" + pattern + "] emitted a warning: " + w); }
|
|
||||||
);
|
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
throw new IllegalArgumentException("error compiling grok pattern [" + pattern + "]: " + e.getMessage(), e);
|
throw new IllegalArgumentException("error compiling grok pattern [" + pattern + "]: " + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -593,16 +593,9 @@ public class Netty4HttpServerTransportTests extends AbstractHttpServerTransportT
|
||||||
public void dispatchRequest(final RestRequest request, final RestChannel channel, final ThreadContext threadContext) {
|
public void dispatchRequest(final RestRequest request, final RestChannel channel, final ThreadContext threadContext) {
|
||||||
try {
|
try {
|
||||||
channel.sendResponse(
|
channel.sendResponse(
|
||||||
new RestResponse(
|
new RestResponse(OK, ChunkedRestResponseBody.fromXContent(ignored -> Iterators.single((builder, params) -> {
|
||||||
OK,
|
throw new AssertionError("should not be called for HEAD REQUEST");
|
||||||
ChunkedRestResponseBody.fromXContent(
|
}), ToXContent.EMPTY_PARAMS, channel))
|
||||||
ignored -> Iterators.single(
|
|
||||||
(builder, params) -> { throw new AssertionError("should not be called for HEAD REQUEST"); }
|
|
||||||
),
|
|
||||||
ToXContent.EMPTY_PARAMS,
|
|
||||||
channel
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new AssertionError(e);
|
throw new AssertionError(e);
|
||||||
|
|
|
@ -52,9 +52,9 @@ public class HaHdfsFailoverTestSuiteIT extends ESRestTestCase {
|
||||||
String nn2Port = "10002";
|
String nn2Port = "10002";
|
||||||
if (ports.length() > 0) {
|
if (ports.length() > 0) {
|
||||||
final Path path = PathUtils.get(ports);
|
final Path path = PathUtils.get(ports);
|
||||||
final List<String> lines = AccessController.doPrivileged(
|
final List<String> lines = AccessController.doPrivileged((PrivilegedExceptionAction<List<String>>) () -> {
|
||||||
(PrivilegedExceptionAction<List<String>>) () -> { return Files.readAllLines(path); }
|
return Files.readAllLines(path);
|
||||||
);
|
});
|
||||||
nn1Port = lines.get(0);
|
nn1Port = lines.get(0);
|
||||||
nn2Port = lines.get(1);
|
nn2Port = lines.get(1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,10 +44,9 @@ public class NodeEnvironmentEvilTests extends ESTestCase {
|
||||||
.put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toAbsolutePath().toString())
|
.put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toAbsolutePath().toString())
|
||||||
.putList(Environment.PATH_DATA_SETTING.getKey(), tempPaths)
|
.putList(Environment.PATH_DATA_SETTING.getKey(), tempPaths)
|
||||||
.build();
|
.build();
|
||||||
IllegalStateException exception = expectThrows(
|
IllegalStateException exception = expectThrows(IllegalStateException.class, () -> {
|
||||||
IllegalStateException.class,
|
new NodeEnvironment(build, TestEnvironment.newEnvironment(build));
|
||||||
() -> { new NodeEnvironment(build, TestEnvironment.newEnvironment(build)); }
|
});
|
||||||
);
|
|
||||||
assertTrue(
|
assertTrue(
|
||||||
exception.getCause().getCause().getMessage(),
|
exception.getCause().getCause().getMessage(),
|
||||||
exception.getCause().getCause().getMessage().startsWith(path.toString())
|
exception.getCause().getCause().getMessage().startsWith(path.toString())
|
||||||
|
|
|
@ -231,11 +231,9 @@ public class ArchiveTests extends PackagingTestCase {
|
||||||
final Installation.Executables bin = installation.executables();
|
final Installation.Executables bin = installation.executables();
|
||||||
final String password = "some-keystore-password";
|
final String password = "some-keystore-password";
|
||||||
Platforms.onLinux(() -> bin.keystoreTool.run("passwd", password + "\n" + password + "\n"));
|
Platforms.onLinux(() -> bin.keystoreTool.run("passwd", password + "\n" + password + "\n"));
|
||||||
Platforms.onWindows(
|
Platforms.onWindows(() -> {
|
||||||
() -> {
|
|
||||||
sh.run("Invoke-Command -ScriptBlock {echo '" + password + "'; echo '" + password + "'} | " + bin.keystoreTool + " passwd");
|
sh.run("Invoke-Command -ScriptBlock {echo '" + password + "'; echo '" + password + "'} | " + bin.keystoreTool + " passwd");
|
||||||
}
|
});
|
||||||
);
|
|
||||||
Shell.Result result = runElasticsearchStartCommand("some-wrong-password-here", false, false);
|
Shell.Result result = runElasticsearchStartCommand("some-wrong-password-here", false, false);
|
||||||
assertElasticsearchFailure(result, "Provided keystore password was incorrect", null);
|
assertElasticsearchFailure(result, "Provided keystore password was incorrect", null);
|
||||||
verifySecurityNotAutoConfigured(installation);
|
verifySecurityNotAutoConfigured(installation);
|
||||||
|
|
|
@ -488,14 +488,12 @@ public class TasksIT extends ESIntegTestCase {
|
||||||
if (index != null) {
|
if (index != null) {
|
||||||
index.join();
|
index.join();
|
||||||
}
|
}
|
||||||
assertBusy(
|
assertBusy(() -> {
|
||||||
() -> {
|
|
||||||
assertEquals(
|
assertEquals(
|
||||||
emptyList(),
|
emptyList(),
|
||||||
client().admin().cluster().prepareListTasks().setActions("indices:data/write/index*").get().getTasks()
|
client().admin().cluster().prepareListTasks().setActions("indices:data/write/index*").get().getTasks()
|
||||||
);
|
);
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,18 +81,9 @@ public class BulkWithUpdatesIT extends ESIntegTestCase {
|
||||||
|
|
||||||
scripts.put("ctx._source.field2 = 'value2'", vars -> srcScript(vars, source -> source.replace("field2", "value2")));
|
scripts.put("ctx._source.field2 = 'value2'", vars -> srcScript(vars, source -> source.replace("field2", "value2")));
|
||||||
|
|
||||||
scripts.put(
|
scripts.put("throw script exception on unknown var", vars -> {
|
||||||
"throw script exception on unknown var",
|
throw new ScriptException("message", null, Collections.emptyList(), "exception on unknown var", CustomScriptPlugin.NAME);
|
||||||
vars -> {
|
});
|
||||||
throw new ScriptException(
|
|
||||||
"message",
|
|
||||||
null,
|
|
||||||
Collections.emptyList(),
|
|
||||||
"exception on unknown var",
|
|
||||||
CustomScriptPlugin.NAME
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
scripts.put("ctx.op = \"none\"", vars -> ((Map<String, Object>) vars.get("ctx")).put("op", "none"));
|
scripts.put("ctx.op = \"none\"", vars -> ((Map<String, Object>) vars.get("ctx")).put("op", "none"));
|
||||||
scripts.put("ctx.op = \"delete\"", vars -> ((Map<String, Object>) vars.get("ctx")).put("op", "delete"));
|
scripts.put("ctx.op = \"delete\"", vars -> ((Map<String, Object>) vars.get("ctx")).put("op", "delete"));
|
||||||
|
|
|
@ -196,7 +196,9 @@ public class PrevalidateNodeRemovalIT extends ESIntegTestCase {
|
||||||
MockTransportService node2TransportService = (MockTransportService) internalCluster().getInstance(TransportService.class, node2);
|
MockTransportService node2TransportService = (MockTransportService) internalCluster().getInstance(TransportService.class, node2);
|
||||||
node2TransportService.addRequestHandlingBehavior(
|
node2TransportService.addRequestHandlingBehavior(
|
||||||
TransportPrevalidateShardPathAction.ACTION_NAME + "[n]",
|
TransportPrevalidateShardPathAction.ACTION_NAME + "[n]",
|
||||||
(handler, request, channel, task) -> { logger.info("drop the check shards request"); }
|
(handler, request, channel, task) -> {
|
||||||
|
logger.info("drop the check shards request");
|
||||||
|
}
|
||||||
);
|
);
|
||||||
PrevalidateNodeRemovalRequest req = PrevalidateNodeRemovalRequest.builder()
|
PrevalidateNodeRemovalRequest req = PrevalidateNodeRemovalRequest.builder()
|
||||||
.setNames(node2)
|
.setNames(node2)
|
||||||
|
|
|
@ -79,11 +79,9 @@ public class TemplateUpgradeServiceIT extends ESIntegTestCase {
|
||||||
Tracer tracer,
|
Tracer tracer,
|
||||||
AllocationService allocationService
|
AllocationService allocationService
|
||||||
) {
|
) {
|
||||||
clusterService.getClusterSettings()
|
clusterService.getClusterSettings().addSettingsUpdateConsumer(UPDATE_TEMPLATE_DUMMY_SETTING, integer -> {
|
||||||
.addSettingsUpdateConsumer(
|
logger.debug("the template dummy setting was updated to {}", integer);
|
||||||
UPDATE_TEMPLATE_DUMMY_SETTING,
|
});
|
||||||
integer -> { logger.debug("the template dummy setting was updated to {}", integer); }
|
|
||||||
);
|
|
||||||
return super.createComponents(
|
return super.createComponents(
|
||||||
client,
|
client,
|
||||||
clusterService,
|
clusterService,
|
||||||
|
|
|
@ -141,11 +141,9 @@ public class IndexShardIT extends ESSingleNodeTestCase {
|
||||||
|
|
||||||
final LockObtainFailedException exception = expectThrows(
|
final LockObtainFailedException exception = expectThrows(
|
||||||
LockObtainFailedException.class,
|
LockObtainFailedException.class,
|
||||||
() -> env.deleteShardDirectoryUnderLock(
|
() -> env.deleteShardDirectoryUnderLock(sLock, indexSettings, indexPaths -> {
|
||||||
sLock,
|
assert false : "should not be called " + indexPaths;
|
||||||
indexSettings,
|
})
|
||||||
indexPaths -> { assert false : "should not be called " + indexPaths; }
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
assertThat(exception.getMessage(), exception.getMessage(), containsString("unable to acquire write.lock"));
|
assertThat(exception.getMessage(), exception.getMessage(), containsString("unable to acquire write.lock"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,10 +263,9 @@ public class IndexActionIT extends ESIntegTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDocumentWithBlankFieldName() {
|
public void testDocumentWithBlankFieldName() {
|
||||||
Exception e = expectThrows(
|
Exception e = expectThrows(DocumentParsingException.class, () -> {
|
||||||
DocumentParsingException.class,
|
client().prepareIndex("test").setId("1").setSource("", "value1_2").execute().actionGet();
|
||||||
() -> { client().prepareIndex("test").setId("1").setSource("", "value1_2").execute().actionGet(); }
|
});
|
||||||
);
|
|
||||||
assertThat(e.getMessage(), containsString("failed to parse"));
|
assertThat(e.getMessage(), containsString("failed to parse"));
|
||||||
assertThat(e.getCause().getMessage(), containsString("field name cannot be an empty string"));
|
assertThat(e.getCause().getMessage(), containsString("field name cannot be an empty string"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,11 +114,9 @@ public class UpdateSettingsIT extends ESIntegTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onIndexModule(IndexModule indexModule) {
|
public void onIndexModule(IndexModule indexModule) {
|
||||||
indexModule.addSettingsUpdateConsumer(
|
indexModule.addSettingsUpdateConsumer(DUMMY_SETTING, (s) -> {}, (s) -> {
|
||||||
DUMMY_SETTING,
|
if (s.equals("boom")) throw new IllegalArgumentException("this setting goes boom");
|
||||||
(s) -> {},
|
});
|
||||||
(s) -> { if (s.equals("boom")) throw new IllegalArgumentException("this setting goes boom"); }
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -94,14 +94,13 @@ public class TransportPostFeatureUpgradeAction extends TransportMasterNodeAction
|
||||||
SYSTEM_INDEX_UPGRADE_TASK_NAME,
|
SYSTEM_INDEX_UPGRADE_TASK_NAME,
|
||||||
SYSTEM_INDEX_UPGRADE_TASK_NAME,
|
SYSTEM_INDEX_UPGRADE_TASK_NAME,
|
||||||
new SystemIndexMigrationTaskParams(),
|
new SystemIndexMigrationTaskParams(),
|
||||||
ActionListener.wrap(
|
ActionListener.wrap(startedTask -> {
|
||||||
startedTask -> { listener.onResponse(new PostFeatureUpgradeResponse(true, featuresToMigrate, null, null)); },
|
listener.onResponse(new PostFeatureUpgradeResponse(true, featuresToMigrate, null, null));
|
||||||
ex -> {
|
}, ex -> {
|
||||||
logger.error("failed to start system index upgrade task", ex);
|
logger.error("failed to start system index upgrade task", ex);
|
||||||
|
|
||||||
listener.onResponse(new PostFeatureUpgradeResponse(false, null, null, new ElasticsearchException(ex)));
|
listener.onResponse(new PostFeatureUpgradeResponse(false, null, null, new ElasticsearchException(ex)));
|
||||||
}
|
})
|
||||||
)
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
listener.onResponse(new PostFeatureUpgradeResponse(false, null, "No system indices require migration", null));
|
listener.onResponse(new PostFeatureUpgradeResponse(false, null, "No system indices require migration", null));
|
||||||
|
|
|
@ -33,7 +33,9 @@ public class ClusterUpdateSettingsResponse extends AcknowledgedResponse {
|
||||||
private static final ConstructingObjectParser<ClusterUpdateSettingsResponse, Void> PARSER = new ConstructingObjectParser<>(
|
private static final ConstructingObjectParser<ClusterUpdateSettingsResponse, Void> PARSER = new ConstructingObjectParser<>(
|
||||||
"cluster_update_settings_response",
|
"cluster_update_settings_response",
|
||||||
true,
|
true,
|
||||||
args -> { return new ClusterUpdateSettingsResponse((boolean) args[0], (Settings) args[1], (Settings) args[2]); }
|
args -> {
|
||||||
|
return new ClusterUpdateSettingsResponse((boolean) args[0], (Settings) args[1], (Settings) args[2]);
|
||||||
|
}
|
||||||
);
|
);
|
||||||
static {
|
static {
|
||||||
declareAcknowledgedField(PARSER);
|
declareAcknowledgedField(PARSER);
|
||||||
|
|
|
@ -188,11 +188,9 @@ public class TransportAnalyzeAction extends TransportSingleShardAction<AnalyzeAc
|
||||||
MappedFieldType fieldType = indexService.mapperService().fieldType(request.field());
|
MappedFieldType fieldType = indexService.mapperService().fieldType(request.field());
|
||||||
if (fieldType != null) {
|
if (fieldType != null) {
|
||||||
if (fieldType instanceof StringFieldType) {
|
if (fieldType instanceof StringFieldType) {
|
||||||
return indexService.mapperService()
|
return indexService.mapperService().indexAnalyzer(fieldType.name(), f -> {
|
||||||
.indexAnalyzer(
|
throw new IllegalArgumentException("No analyzer configured for field " + fieldType.name());
|
||||||
fieldType.name(),
|
});
|
||||||
f -> { throw new IllegalArgumentException("No analyzer configured for field " + fieldType.name()); }
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Can't process field [" + request.field() + "], Analysis requests are only supported on tokenized fields"
|
"Can't process field [" + request.field() + "], Analysis requests are only supported on tokenized fields"
|
||||||
|
|
|
@ -61,7 +61,9 @@ public class FieldCapabilitiesFailure implements Writeable, ToXContentObject {
|
||||||
private static final ConstructingObjectParser<FieldCapabilitiesFailure, Void> PARSER = new ConstructingObjectParser<>(
|
private static final ConstructingObjectParser<FieldCapabilitiesFailure, Void> PARSER = new ConstructingObjectParser<>(
|
||||||
"field_capabilities_failure",
|
"field_capabilities_failure",
|
||||||
true,
|
true,
|
||||||
a -> { return new FieldCapabilitiesFailure(((List<String>) a[0]).toArray(String[]::new), (Exception) a[1]); }
|
a -> {
|
||||||
|
return new FieldCapabilitiesFailure(((List<String>) a[0]).toArray(String[]::new), (Exception) a[1]);
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
|
@ -48,10 +48,9 @@ class SimulateExecutionService {
|
||||||
pipeline.getMetadata(),
|
pipeline.getMetadata(),
|
||||||
verbosePipelineProcessor
|
verbosePipelineProcessor
|
||||||
);
|
);
|
||||||
ingestDocument.executePipeline(
|
ingestDocument.executePipeline(verbosePipeline, (result, e) -> {
|
||||||
verbosePipeline,
|
handler.accept(new SimulateDocumentVerboseResult(processorResultList), e);
|
||||||
(result, e) -> { handler.accept(new SimulateDocumentVerboseResult(processorResultList), e); }
|
});
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
ingestDocument.executePipeline(pipeline, (result, e) -> {
|
ingestDocument.executePipeline(pipeline, (result, e) -> {
|
||||||
if (e == null) {
|
if (e == null) {
|
||||||
|
|
|
@ -557,7 +557,9 @@ public class SearchTransportService {
|
||||||
QUERY_CAN_MATCH_NAME,
|
QUERY_CAN_MATCH_NAME,
|
||||||
ThreadPool.Names.SAME,
|
ThreadPool.Names.SAME,
|
||||||
ShardSearchRequest::new,
|
ShardSearchRequest::new,
|
||||||
(request, channel, task) -> { searchService.canMatch(request, new ChannelActionListener<>(channel)); }
|
(request, channel, task) -> {
|
||||||
|
searchService.canMatch(request, new ChannelActionListener<>(channel));
|
||||||
|
}
|
||||||
);
|
);
|
||||||
TransportActionProxy.registerProxyAction(transportService, QUERY_CAN_MATCH_NAME, true, CanMatchShardResponse::new);
|
TransportActionProxy.registerProxyAction(transportService, QUERY_CAN_MATCH_NAME, true, CanMatchShardResponse::new);
|
||||||
|
|
||||||
|
@ -565,7 +567,9 @@ public class SearchTransportService {
|
||||||
QUERY_CAN_MATCH_NODE_NAME,
|
QUERY_CAN_MATCH_NODE_NAME,
|
||||||
ThreadPool.Names.SEARCH_COORDINATION,
|
ThreadPool.Names.SEARCH_COORDINATION,
|
||||||
CanMatchNodeRequest::new,
|
CanMatchNodeRequest::new,
|
||||||
(request, channel, task) -> { searchService.canMatch(request, new ChannelActionListener<>(channel)); }
|
(request, channel, task) -> {
|
||||||
|
searchService.canMatch(request, new ChannelActionListener<>(channel));
|
||||||
|
}
|
||||||
);
|
);
|
||||||
TransportActionProxy.registerProxyAction(transportService, QUERY_CAN_MATCH_NODE_NAME, true, CanMatchNodeResponse::new);
|
TransportActionProxy.registerProxyAction(transportService, QUERY_CAN_MATCH_NODE_NAME, true, CanMatchNodeResponse::new);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,12 +54,9 @@ public class NodesShutdownMetadata implements Metadata.Custom {
|
||||||
});
|
});
|
||||||
|
|
||||||
static {
|
static {
|
||||||
PARSER.declareNamedObjects(
|
PARSER.declareNamedObjects(ConstructingObjectParser.constructorArg(), (p, c, n) -> SingleNodeShutdownMetadata.parse(p), v -> {
|
||||||
ConstructingObjectParser.constructorArg(),
|
throw new IllegalArgumentException("ordered " + NODES_FIELD.getPreferredName() + " are not supported");
|
||||||
(p, c, n) -> SingleNodeShutdownMetadata.parse(p),
|
}, NODES_FIELD);
|
||||||
v -> { throw new IllegalArgumentException("ordered " + NODES_FIELD.getPreferredName() + " are not supported"); },
|
|
||||||
NODES_FIELD
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static NodesShutdownMetadata fromXContent(XContentParser parser) {
|
public static NodesShutdownMetadata fromXContent(XContentParser parser) {
|
||||||
|
|
|
@ -217,15 +217,9 @@ public class Maps {
|
||||||
Function<T, ? extends K> keyMapper,
|
Function<T, ? extends K> keyMapper,
|
||||||
Function<T, ? extends V> valueMapper
|
Function<T, ? extends V> valueMapper
|
||||||
) {
|
) {
|
||||||
return Collectors.collectingAndThen(
|
return Collectors.collectingAndThen(Collectors.toMap(keyMapper, valueMapper, (v1, v2) -> {
|
||||||
Collectors.toMap(
|
throw new IllegalStateException("Duplicate key (attempted merging values " + v1 + " and " + v2 + ")");
|
||||||
keyMapper,
|
}, () -> new TreeMap<K, V>()), Collections::unmodifiableNavigableMap);
|
||||||
valueMapper,
|
|
||||||
(v1, v2) -> { throw new IllegalStateException("Duplicate key (attempted merging values " + v1 + " and " + v2 + ")"); },
|
|
||||||
() -> new TreeMap<K, V>()
|
|
||||||
),
|
|
||||||
Collections::unmodifiableNavigableMap
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -239,15 +233,9 @@ public class Maps {
|
||||||
Function<T, ? extends K> keyMapper,
|
Function<T, ? extends K> keyMapper,
|
||||||
Function<T, ? extends V> valueMapper
|
Function<T, ? extends V> valueMapper
|
||||||
) {
|
) {
|
||||||
return Collectors.collectingAndThen(
|
return Collectors.collectingAndThen(Collectors.toMap(keyMapper, valueMapper, (v1, v2) -> {
|
||||||
Collectors.toMap(
|
throw new IllegalStateException("Duplicate key (attempted merging values " + v1 + " and " + v2 + ")");
|
||||||
keyMapper,
|
}, (Supplier<LinkedHashMap<K, V>>) LinkedHashMap::new), Collections::unmodifiableMap);
|
||||||
valueMapper,
|
|
||||||
(v1, v2) -> { throw new IllegalStateException("Duplicate key (attempted merging values " + v1 + " and " + v2 + ")"); },
|
|
||||||
(Supplier<LinkedHashMap<K, V>>) LinkedHashMap::new
|
|
||||||
),
|
|
||||||
Collections::unmodifiableMap
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -650,7 +650,9 @@ public final class IndexModule {
|
||||||
parserConfiguration,
|
parserConfiguration,
|
||||||
new SimilarityService(indexSettings, scriptService, similarities),
|
new SimilarityService(indexSettings, scriptService, similarities),
|
||||||
mapperRegistry,
|
mapperRegistry,
|
||||||
() -> { throw new UnsupportedOperationException("no index query shard context available"); },
|
() -> {
|
||||||
|
throw new UnsupportedOperationException("no index query shard context available");
|
||||||
|
},
|
||||||
indexSettings.getMode().idFieldMapperWithoutFieldData(),
|
indexSettings.getMode().idFieldMapperWithoutFieldData(),
|
||||||
scriptService
|
scriptService
|
||||||
);
|
);
|
||||||
|
|
|
@ -742,10 +742,9 @@ public final class IndexSettings {
|
||||||
mode = scopedSettings.get(MODE);
|
mode = scopedSettings.get(MODE);
|
||||||
this.timestampBounds = mode.getTimestampBound(indexMetadata);
|
this.timestampBounds = mode.getTimestampBound(indexMetadata);
|
||||||
if (timestampBounds != null) {
|
if (timestampBounds != null) {
|
||||||
scopedSettings.addSettingsUpdateConsumer(
|
scopedSettings.addSettingsUpdateConsumer(IndexSettings.TIME_SERIES_END_TIME, endTime -> {
|
||||||
IndexSettings.TIME_SERIES_END_TIME,
|
this.timestampBounds = TimestampBounds.updateEndTime(this.timestampBounds, endTime);
|
||||||
endTime -> { this.timestampBounds = TimestampBounds.updateEndTime(this.timestampBounds, endTime); }
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
this.searchThrottled = INDEX_SEARCH_THROTTLED.get(settings);
|
this.searchThrottled = INDEX_SEARCH_THROTTLED.get(settings);
|
||||||
this.queryStringLenient = QUERY_STRING_LENIENT_SETTING.get(settings);
|
this.queryStringLenient = QUERY_STRING_LENIENT_SETTING.get(settings);
|
||||||
|
|
|
@ -247,10 +247,9 @@ public final class IndexSortConfig {
|
||||||
}
|
}
|
||||||
IndexFieldData<?> fieldData;
|
IndexFieldData<?> fieldData;
|
||||||
try {
|
try {
|
||||||
fieldData = fieldDataLookup.apply(
|
fieldData = fieldDataLookup.apply(ft, () -> {
|
||||||
ft,
|
throw new UnsupportedOperationException("index sorting not supported on runtime field [" + ft.name() + "]");
|
||||||
() -> { throw new UnsupportedOperationException("index sorting not supported on runtime field [" + ft.name() + "]"); }
|
});
|
||||||
);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new IllegalArgumentException("docvalues not found for index sort field:[" + sortSpec.field + "]", e);
|
throw new IllegalArgumentException("docvalues not found for index sort field:[" + sortSpec.field + "]", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -607,7 +607,9 @@ public final class AnalysisRegistry implements Closeable {
|
||||||
charFilterFactoryFactories,
|
charFilterFactoryFactories,
|
||||||
tokenizerFactoryFactories
|
tokenizerFactoryFactories
|
||||||
),
|
),
|
||||||
(k, v) -> { throw new IllegalStateException("already registered analyzer with name: " + entry.getKey()); }
|
(k, v) -> {
|
||||||
|
throw new IllegalStateException("already registered analyzer with name: " + entry.getKey());
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
for (Map.Entry<String, AnalyzerProvider<?>> entry : normalizerProviders.entrySet()) {
|
for (Map.Entry<String, AnalyzerProvider<?>> entry : normalizerProviders.entrySet()) {
|
||||||
|
|
|
@ -29,10 +29,9 @@ public class MapperBuilderContext {
|
||||||
* A context to use to build metadata fields.
|
* A context to use to build metadata fields.
|
||||||
*/
|
*/
|
||||||
public static MapperBuilderContext forMetadata() {
|
public static MapperBuilderContext forMetadata() {
|
||||||
return new MapperBuilderContext(
|
return new MapperBuilderContext(null, () -> {
|
||||||
null,
|
throw new UnsupportedOperationException("metadata fields can't check if _source is synthetic");
|
||||||
() -> { throw new UnsupportedOperationException("metadata fields can't check if _source is synthetic"); }
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final String path;
|
private final String path;
|
||||||
|
|
|
@ -214,14 +214,9 @@ public interface RuntimeField extends ToXContentFragment {
|
||||||
throw new IllegalStateException("Found sub-fields with name not belonging to the parent field they are part of " + names);
|
throw new IllegalStateException("Found sub-fields with name not belonging to the parent field they are part of " + names);
|
||||||
}
|
}
|
||||||
return runtimeField.asMappedFieldTypes();
|
return runtimeField.asMappedFieldTypes();
|
||||||
})
|
}).collect(Collectors.toUnmodifiableMap(MappedFieldType::name, mappedFieldType -> mappedFieldType, (t, t2) -> {
|
||||||
.collect(
|
throw new IllegalArgumentException("Found two runtime fields with same name [" + t.name() + "]");
|
||||||
Collectors.toUnmodifiableMap(
|
}));
|
||||||
MappedFieldType::name,
|
|
||||||
mappedFieldType -> mappedFieldType,
|
|
||||||
(t, t2) -> { throw new IllegalArgumentException("Found two runtime fields with same name [" + t.name() + "]"); }
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static <T> Function<FieldMapper, T> initializerNotSupported() {
|
static <T> Function<FieldMapper, T> initializerNotSupported() {
|
||||||
|
|
|
@ -492,9 +492,9 @@ public class SearchExecutionContext extends QueryRewriteContext {
|
||||||
*/
|
*/
|
||||||
public SearchLookup lookup() {
|
public SearchLookup lookup() {
|
||||||
if (this.lookup == null) {
|
if (this.lookup == null) {
|
||||||
SourceProvider sourceProvider = isSourceSynthetic()
|
SourceProvider sourceProvider = isSourceSynthetic() ? (ctx, doc) -> {
|
||||||
? (ctx, doc) -> { throw new IllegalArgumentException("Cannot access source from scripts in synthetic mode"); }
|
throw new IllegalArgumentException("Cannot access source from scripts in synthetic mode");
|
||||||
: SourceProvider.fromStoredFields();
|
} : SourceProvider.fromStoredFields();
|
||||||
setLookupProviders(sourceProvider, LeafFieldLookupProvider.fromStoredFields());
|
setLookupProviders(sourceProvider, LeafFieldLookupProvider.fromStoredFields());
|
||||||
}
|
}
|
||||||
return this.lookup;
|
return this.lookup;
|
||||||
|
|
|
@ -1949,11 +1949,15 @@ public class Translog extends AbstractIndexShardComponent implements IndexShardC
|
||||||
EMPTY_TRANSLOG_BUFFER_SIZE,
|
EMPTY_TRANSLOG_BUFFER_SIZE,
|
||||||
minTranslogGeneration,
|
minTranslogGeneration,
|
||||||
initialGlobalCheckpoint,
|
initialGlobalCheckpoint,
|
||||||
() -> { throw new UnsupportedOperationException(); },
|
() -> {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
},
|
||||||
() -> { throw new UnsupportedOperationException(); },
|
() -> { throw new UnsupportedOperationException(); },
|
||||||
primaryTerm,
|
primaryTerm,
|
||||||
new TragicExceptionHolder(),
|
new TragicExceptionHolder(),
|
||||||
seqNo -> { throw new UnsupportedOperationException(); },
|
seqNo -> {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
},
|
||||||
BigArrays.NON_RECYCLING_INSTANCE,
|
BigArrays.NON_RECYCLING_INSTANCE,
|
||||||
DiskIoBufferPool.INSTANCE,
|
DiskIoBufferPool.INSTANCE,
|
||||||
(d, s, l) -> {}
|
(d, s, l) -> {}
|
||||||
|
|
|
@ -47,13 +47,11 @@ public class IndexSnapshotsService {
|
||||||
ShardId shardId,
|
ShardId shardId,
|
||||||
ActionListener<Optional<ShardSnapshotInfo>> originalListener
|
ActionListener<Optional<ShardSnapshotInfo>> originalListener
|
||||||
) {
|
) {
|
||||||
final ActionListener<Optional<ShardSnapshotInfo>> listener = originalListener.delegateResponse(
|
final ActionListener<Optional<ShardSnapshotInfo>> listener = originalListener.delegateResponse((delegate, err) -> {
|
||||||
(delegate, err) -> {
|
|
||||||
delegate.onFailure(
|
delegate.onFailure(
|
||||||
new RepositoryException(repositoryName, "Unable to find the latest snapshot for shard [" + shardId + "]", err)
|
new RepositoryException(repositoryName, "Unable to find the latest snapshot for shard [" + shardId + "]", err)
|
||||||
);
|
);
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
final Repository repository = getRepository(repositoryName);
|
final Repository repository = getRepository(repositoryName);
|
||||||
if (repository == null) {
|
if (repository == null) {
|
||||||
|
|
|
@ -1115,23 +1115,13 @@ public class SearchModule {
|
||||||
);
|
);
|
||||||
registerQuery(new QuerySpec<>(GeoShapeQueryBuilder.NAME, GeoShapeQueryBuilder::new, GeoShapeQueryBuilder::fromXContent));
|
registerQuery(new QuerySpec<>(GeoShapeQueryBuilder.NAME, GeoShapeQueryBuilder::new, GeoShapeQueryBuilder::fromXContent));
|
||||||
|
|
||||||
registerQuery(
|
registerQuery(new QuerySpec<>(KnnVectorQueryBuilder.NAME, KnnVectorQueryBuilder::new, parser -> {
|
||||||
new QuerySpec<>(
|
|
||||||
KnnVectorQueryBuilder.NAME,
|
|
||||||
KnnVectorQueryBuilder::new,
|
|
||||||
parser -> {
|
|
||||||
throw new IllegalArgumentException("[knn] queries cannot be provided directly, use the [knn] body parameter instead");
|
throw new IllegalArgumentException("[knn] queries cannot be provided directly, use the [knn] body parameter instead");
|
||||||
}
|
}));
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
registerQuery(
|
registerQuery(new QuerySpec<>(KnnScoreDocQueryBuilder.NAME, KnnScoreDocQueryBuilder::new, parser -> {
|
||||||
new QuerySpec<>(
|
throw new IllegalArgumentException("[score_doc] queries cannot be provided directly");
|
||||||
KnnScoreDocQueryBuilder.NAME,
|
}));
|
||||||
KnnScoreDocQueryBuilder::new,
|
|
||||||
parser -> { throw new IllegalArgumentException("[score_doc] queries cannot be provided directly"); }
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
registerFromPlugin(plugins, SearchPlugin::getQueries, this::registerQuery);
|
registerFromPlugin(plugins, SearchPlugin::getQueries, this::registerQuery);
|
||||||
|
|
||||||
|
|
|
@ -136,11 +136,9 @@ class DoubleValuesSource extends SingleDimensionValuesSource<Double> {
|
||||||
} else if (value instanceof Number) {
|
} else if (value instanceof Number) {
|
||||||
afterValue = ((Number) value).doubleValue();
|
afterValue = ((Number) value).doubleValue();
|
||||||
} else {
|
} else {
|
||||||
afterValue = format.parseDouble(
|
afterValue = format.parseDouble(value.toString(), false, () -> {
|
||||||
value.toString(),
|
throw new IllegalArgumentException("now() is not supported in [after] key");
|
||||||
false,
|
});
|
||||||
() -> { throw new IllegalArgumentException("now() is not supported in [after] key"); }
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,11 +46,9 @@ class GeoTileValuesSource extends LongValuesSource {
|
||||||
} else if (value instanceof Number) {
|
} else if (value instanceof Number) {
|
||||||
afterValue = ((Number) value).longValue();
|
afterValue = ((Number) value).longValue();
|
||||||
} else {
|
} else {
|
||||||
afterValue = format.parseLong(
|
afterValue = format.parseLong(value.toString(), false, () -> {
|
||||||
value.toString(),
|
throw new IllegalArgumentException("now() is not supported in [after] key");
|
||||||
false,
|
});
|
||||||
() -> { throw new IllegalArgumentException("now() is not supported in [after] key"); }
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -528,11 +528,9 @@ public class InternalComposite extends InternalMultiBucketAggregation<InternalCo
|
||||||
} else {
|
} else {
|
||||||
formatted = format.format(value);
|
formatted = format.format(value);
|
||||||
}
|
}
|
||||||
parsed = format.parseLong(
|
parsed = format.parseLong(formatted.toString(), false, () -> {
|
||||||
formatted.toString(),
|
throw new UnsupportedOperationException("Using now() is not supported in after keys");
|
||||||
false,
|
});
|
||||||
() -> { throw new UnsupportedOperationException("Using now() is not supported in after keys"); }
|
|
||||||
);
|
|
||||||
if (parsed.equals(((Number) obj).longValue()) == false) {
|
if (parsed.equals(((Number) obj).longValue()) == false) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Format ["
|
"Format ["
|
||||||
|
@ -556,11 +554,9 @@ public class InternalComposite extends InternalMultiBucketAggregation<InternalCo
|
||||||
} else {
|
} else {
|
||||||
formatted = format.format(value);
|
formatted = format.format(value);
|
||||||
}
|
}
|
||||||
parsed = format.parseDouble(
|
parsed = format.parseDouble(formatted.toString(), false, () -> {
|
||||||
formatted.toString(),
|
throw new UnsupportedOperationException("Using now() is not supported in after keys");
|
||||||
false,
|
});
|
||||||
() -> { throw new UnsupportedOperationException("Using now() is not supported in after keys"); }
|
|
||||||
);
|
|
||||||
if (parsed.equals(((Number) obj).doubleValue()) == false) {
|
if (parsed.equals(((Number) obj).doubleValue()) == false) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Format ["
|
"Format ["
|
||||||
|
|
|
@ -153,11 +153,9 @@ class LongValuesSource extends SingleDimensionValuesSource<Long> {
|
||||||
afterValue = null;
|
afterValue = null;
|
||||||
} else {
|
} else {
|
||||||
// parse the value from a string in case it is a date or a formatted unsigned long.
|
// parse the value from a string in case it is a date or a formatted unsigned long.
|
||||||
afterValue = format.parseLong(
|
afterValue = format.parseLong(value.toString(), false, () -> {
|
||||||
value.toString(),
|
throw new IllegalArgumentException("now() is not supported in [after] key");
|
||||||
false,
|
});
|
||||||
() -> { throw new IllegalArgumentException("now() is not supported in [after] key"); }
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -310,13 +310,9 @@ class DateHistogramAggregator extends BucketsAggregator implements SizedBucketAg
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InternalAggregation[] buildAggregations(long[] owningBucketOrds) throws IOException {
|
public InternalAggregation[] buildAggregations(long[] owningBucketOrds) throws IOException {
|
||||||
return buildAggregationsForVariableBuckets(
|
return buildAggregationsForVariableBuckets(owningBucketOrds, bucketOrds, (bucketValue, docCount, subAggregationResults) -> {
|
||||||
owningBucketOrds,
|
|
||||||
bucketOrds,
|
|
||||||
(bucketValue, docCount, subAggregationResults) -> {
|
|
||||||
return new InternalDateHistogram.Bucket(bucketValue, docCount, keyed, formatter, subAggregationResults);
|
return new InternalDateHistogram.Bucket(bucketValue, docCount, keyed, formatter, subAggregationResults);
|
||||||
},
|
}, (owningBucketOrd, buckets) -> {
|
||||||
(owningBucketOrd, buckets) -> {
|
|
||||||
// the contract of the histogram aggregation is that shards must return buckets ordered by key in ascending order
|
// the contract of the histogram aggregation is that shards must return buckets ordered by key in ascending order
|
||||||
CollectionUtil.introSort(buckets, BucketOrder.key(true).comparator());
|
CollectionUtil.introSort(buckets, BucketOrder.key(true).comparator());
|
||||||
|
|
||||||
|
@ -334,8 +330,7 @@ class DateHistogramAggregator extends BucketsAggregator implements SizedBucketAg
|
||||||
keyed,
|
keyed,
|
||||||
metadata()
|
metadata()
|
||||||
);
|
);
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -737,22 +737,13 @@ public class FieldSortBuilder extends SortBuilder<FieldSortBuilder> {
|
||||||
PARSER.declareObject(FieldSortBuilder::setNestedSort, (p, c) -> NestedSortBuilder.fromXContent(p), NESTED_FIELD);
|
PARSER.declareObject(FieldSortBuilder::setNestedSort, (p, c) -> NestedSortBuilder.fromXContent(p), NESTED_FIELD);
|
||||||
PARSER.declareString(FieldSortBuilder::setNumericType, NUMERIC_TYPE);
|
PARSER.declareString(FieldSortBuilder::setNumericType, NUMERIC_TYPE);
|
||||||
PARSER.declareString(FieldSortBuilder::setFormat, FORMAT);
|
PARSER.declareString(FieldSortBuilder::setFormat, FORMAT);
|
||||||
PARSER.declareField(
|
PARSER.declareField((b, v) -> {}, (p, c) -> {
|
||||||
(b, v) -> {},
|
|
||||||
(p, c) -> {
|
|
||||||
throw new ParsingException(p.getTokenLocation(), "[nested_path] has been removed in favour of the [nested] parameter", c);
|
throw new ParsingException(p.getTokenLocation(), "[nested_path] has been removed in favour of the [nested] parameter", c);
|
||||||
},
|
}, NESTED_PATH_FIELD, ValueType.STRING);
|
||||||
NESTED_PATH_FIELD,
|
|
||||||
ValueType.STRING
|
|
||||||
);
|
|
||||||
|
|
||||||
PARSER.declareObject(
|
PARSER.declareObject((b, v) -> {}, (p, c) -> {
|
||||||
(b, v) -> {},
|
|
||||||
(p, c) -> {
|
|
||||||
throw new ParsingException(p.getTokenLocation(), "[nested_filter] has been removed in favour of the [nested] parameter", c);
|
throw new ParsingException(p.getTokenLocation(), "[nested_filter] has been removed in favour of the [nested] parameter", c);
|
||||||
},
|
}, NESTED_FILTER_FIELD);
|
||||||
NESTED_FILTER_FIELD
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -219,21 +219,13 @@ public class ScriptSortBuilder extends SortBuilder<ScriptSortBuilder> {
|
||||||
PARSER.declareString((b, v) -> b.sortMode(SortMode.fromString(v)), SORTMODE_FIELD);
|
PARSER.declareString((b, v) -> b.sortMode(SortMode.fromString(v)), SORTMODE_FIELD);
|
||||||
PARSER.declareObject(ScriptSortBuilder::setNestedSort, (p, c) -> NestedSortBuilder.fromXContent(p), NESTED_FIELD);
|
PARSER.declareObject(ScriptSortBuilder::setNestedSort, (p, c) -> NestedSortBuilder.fromXContent(p), NESTED_FIELD);
|
||||||
|
|
||||||
PARSER.declareObject(
|
PARSER.declareObject((b, v) -> {}, (p, c) -> {
|
||||||
(b, v) -> {},
|
|
||||||
(p, c) -> {
|
|
||||||
throw new ParsingException(p.getTokenLocation(), "[nested_path] has been removed in favour of the [nested] parameter", c);
|
throw new ParsingException(p.getTokenLocation(), "[nested_path] has been removed in favour of the [nested] parameter", c);
|
||||||
},
|
}, NESTED_PATH_FIELD);
|
||||||
NESTED_PATH_FIELD
|
|
||||||
);
|
|
||||||
|
|
||||||
PARSER.declareObject(
|
PARSER.declareObject((b, v) -> {}, (p, c) -> {
|
||||||
(b, v) -> {},
|
|
||||||
(p, c) -> {
|
|
||||||
throw new ParsingException(p.getTokenLocation(), "[nested_filter] has been removed in favour of the [nested] parameter", c);
|
throw new ParsingException(p.getTokenLocation(), "[nested_filter] has been removed in favour of the [nested] parameter", c);
|
||||||
},
|
}, NESTED_FILTER_FIELD);
|
||||||
NESTED_FILTER_FIELD
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -55,7 +55,9 @@ public class FeatureMigrationResults implements Metadata.Custom {
|
||||||
PARSER.declareNamedObjects(
|
PARSER.declareNamedObjects(
|
||||||
ConstructingObjectParser.constructorArg(),
|
ConstructingObjectParser.constructorArg(),
|
||||||
(p, c, n) -> new Tuple<>(n, SingleFeatureMigrationResult.fromXContent(p)),
|
(p, c, n) -> new Tuple<>(n, SingleFeatureMigrationResult.fromXContent(p)),
|
||||||
v -> { throw new IllegalArgumentException("ordered " + RESULTS_FIELD.getPreferredName() + " are not supported"); },
|
v -> {
|
||||||
|
throw new IllegalArgumentException("ordered " + RESULTS_FIELD.getPreferredName() + " are not supported");
|
||||||
|
},
|
||||||
RESULTS_FIELD
|
RESULTS_FIELD
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,7 +230,9 @@ class SystemIndexMigrationInfo implements Comparable<SystemIndexMigrationInfo> {
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.filter(setting -> setting.getProperties().contains(Setting.Property.NotCopyableOnResize) == false)
|
.filter(setting -> setting.getProperties().contains(Setting.Property.NotCopyableOnResize) == false)
|
||||||
.filter(setting -> setting.getProperties().contains(Setting.Property.PrivateIndex) == false)
|
.filter(setting -> setting.getProperties().contains(Setting.Property.PrivateIndex) == false)
|
||||||
.forEach(setting -> { newIndexSettings.put(setting.getKey(), currentIndexSettings.get(setting.getKey())); });
|
.forEach(setting -> {
|
||||||
|
newIndexSettings.put(setting.getKey(), currentIndexSettings.get(setting.getKey()));
|
||||||
|
});
|
||||||
return newIndexSettings.build();
|
return newIndexSettings.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -298,16 +298,13 @@ public class SystemIndexMigrator extends AllocatedPersistentTask {
|
||||||
MigrationResultsUpdateTask updateTask = MigrationResultsUpdateTask.upsert(
|
MigrationResultsUpdateTask updateTask = MigrationResultsUpdateTask.upsert(
|
||||||
lastMigrationInfo.getFeatureName(),
|
lastMigrationInfo.getFeatureName(),
|
||||||
SingleFeatureMigrationResult.success(),
|
SingleFeatureMigrationResult.success(),
|
||||||
ActionListener.wrap(
|
ActionListener.wrap(state -> {
|
||||||
state -> {
|
|
||||||
prepareNextIndex(
|
prepareNextIndex(
|
||||||
state,
|
state,
|
||||||
clusterState -> migrateSingleIndex(clusterState, this::finishIndexAndLoop),
|
clusterState -> migrateSingleIndex(clusterState, this::finishIndexAndLoop),
|
||||||
lastMigrationInfo.getFeatureName()
|
lastMigrationInfo.getFeatureName()
|
||||||
);
|
);
|
||||||
},
|
}, this::markAsFailed)
|
||||||
this::markAsFailed
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
updateTask.submit(clusterService);
|
updateTask.submit(clusterService);
|
||||||
}
|
}
|
||||||
|
|
|
@ -409,10 +409,9 @@ public class ActionListenerTests extends ESTestCase {
|
||||||
assertThat(assertionError.getCause(), instanceOf(IllegalArgumentException.class));
|
assertThat(assertionError.getCause(), instanceOf(IllegalArgumentException.class));
|
||||||
assertNull(exReference.get());
|
assertNull(exReference.get());
|
||||||
|
|
||||||
assertionError = expectThrows(
|
assertionError = expectThrows(AssertionError.class, () -> ActionListener.completeWith(listener, () -> {
|
||||||
AssertionError.class,
|
throw new IllegalArgumentException();
|
||||||
() -> ActionListener.completeWith(listener, () -> { throw new IllegalArgumentException(); })
|
}));
|
||||||
);
|
|
||||||
assertThat(assertionError.getCause(), instanceOf(AssertionError.class));
|
assertThat(assertionError.getCause(), instanceOf(AssertionError.class));
|
||||||
assertThat(assertionError.getCause().getCause(), instanceOf(IllegalArgumentException.class));
|
assertThat(assertionError.getCause().getCause(), instanceOf(IllegalArgumentException.class));
|
||||||
assertThat(exReference.get(), instanceOf(IllegalArgumentException.class));
|
assertThat(exReference.get(), instanceOf(IllegalArgumentException.class));
|
||||||
|
|
|
@ -82,10 +82,9 @@ public class ClusterRerouteTests extends ESAllocationTestCase {
|
||||||
ClusterState clusterState = createInitialClusterState(allocationService);
|
ClusterState clusterState = createInitialClusterState(allocationService);
|
||||||
|
|
||||||
var responseRef = new AtomicReference<ClusterRerouteResponse>();
|
var responseRef = new AtomicReference<ClusterRerouteResponse>();
|
||||||
var responseActionListener = ActionListener.<ClusterRerouteResponse>wrap(
|
var responseActionListener = ActionListener.<ClusterRerouteResponse>wrap(responseRef::set, exception -> {
|
||||||
responseRef::set,
|
throw new AssertionError("Should not fail in test", exception);
|
||||||
exception -> { throw new AssertionError("Should not fail in test", exception); }
|
});
|
||||||
);
|
|
||||||
|
|
||||||
var request = new ClusterRerouteRequest().dryRun(true);
|
var request = new ClusterRerouteRequest().dryRun(true);
|
||||||
var task = new TransportClusterRerouteAction.ClusterRerouteResponseAckedClusterStateUpdateTask(
|
var task = new TransportClusterRerouteAction.ClusterRerouteResponseAckedClusterStateUpdateTask(
|
||||||
|
|
|
@ -322,10 +322,9 @@ public class TransportAnalyzeActionTests extends ESTestCase {
|
||||||
|
|
||||||
public void testGetFieldAnalyzerWithoutIndexAnalyzers() {
|
public void testGetFieldAnalyzerWithoutIndexAnalyzers() {
|
||||||
AnalyzeAction.Request req = new AnalyzeAction.Request().field("field").text("text");
|
AnalyzeAction.Request req = new AnalyzeAction.Request().field("field").text("text");
|
||||||
IllegalArgumentException e = expectThrows(
|
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> {
|
||||||
IllegalArgumentException.class,
|
TransportAnalyzeAction.analyze(req, registry, null, maxTokenCount);
|
||||||
() -> { TransportAnalyzeAction.analyze(req, registry, null, maxTokenCount); }
|
});
|
||||||
);
|
|
||||||
assertEquals(e.getMessage(), "analysis based on a specific field requires an index");
|
assertEquals(e.getMessage(), "analysis based on a specific field requires an index");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,10 +50,9 @@ public class CreateIndexRequestBuilderTests extends ESTestCase {
|
||||||
public void testSetSource() throws IOException {
|
public void testSetSource() throws IOException {
|
||||||
CreateIndexRequestBuilder builder = new CreateIndexRequestBuilder(this.testClient, CreateIndexAction.INSTANCE);
|
CreateIndexRequestBuilder builder = new CreateIndexRequestBuilder(this.testClient, CreateIndexAction.INSTANCE);
|
||||||
|
|
||||||
ElasticsearchParseException e = expectThrows(
|
ElasticsearchParseException e = expectThrows(ElasticsearchParseException.class, () -> {
|
||||||
ElasticsearchParseException.class,
|
builder.setSource(Strings.format("{ \"%s\": \"%s\" }", KEY, VALUE), XContentType.JSON);
|
||||||
() -> { builder.setSource(Strings.format("{ \"%s\": \"%s\" }", KEY, VALUE), XContentType.JSON); }
|
});
|
||||||
);
|
|
||||||
assertEquals(Strings.format("unknown key [%s] for create index", KEY), e.getMessage());
|
assertEquals(Strings.format("unknown key [%s] for create index", KEY), e.getMessage());
|
||||||
|
|
||||||
builder.setSource(Strings.format("{ \"settings\": { \"%s\": \"%s\" }}", KEY, VALUE), XContentType.JSON);
|
builder.setSource(Strings.format("{ \"settings\": { \"%s\": \"%s\" }}", KEY, VALUE), XContentType.JSON);
|
||||||
|
|
|
@ -89,7 +89,9 @@ public class GetIndexActionTests extends ESSingleNodeTestCase {
|
||||||
"index.refresh_interval should be set as we are including defaults",
|
"index.refresh_interval should be set as we are including defaults",
|
||||||
defaultsResponse.getSetting(indexName, "index.refresh_interval")
|
defaultsResponse.getSetting(indexName, "index.refresh_interval")
|
||||||
),
|
),
|
||||||
exception -> { throw new AssertionError(exception); }
|
exception -> {
|
||||||
|
throw new AssertionError(exception);
|
||||||
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -105,7 +107,9 @@ public class GetIndexActionTests extends ESSingleNodeTestCase {
|
||||||
"index.refresh_interval should be null as it was never set",
|
"index.refresh_interval should be null as it was never set",
|
||||||
noDefaultsResponse.getSetting(indexName, "index.refresh_interval")
|
noDefaultsResponse.getSetting(indexName, "index.refresh_interval")
|
||||||
),
|
),
|
||||||
exception -> { throw new AssertionError(exception); }
|
exception -> {
|
||||||
|
throw new AssertionError(exception);
|
||||||
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,55 +38,25 @@ public class BulkRequestParserTests extends ESTestCase {
|
||||||
}, req -> fail(), req -> fail());
|
}, req -> fail(), req -> fail());
|
||||||
assertTrue(parsed.get());
|
assertTrue(parsed.get());
|
||||||
|
|
||||||
parser.parse(
|
parser.parse(request, "foo", null, null, null, true, false, XContentType.JSON, (indexRequest, type) -> {
|
||||||
request,
|
assertTrue(indexRequest.isRequireAlias());
|
||||||
"foo",
|
}, req -> fail(), req -> fail());
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
XContentType.JSON,
|
|
||||||
(indexRequest, type) -> { assertTrue(indexRequest.isRequireAlias()); },
|
|
||||||
req -> fail(),
|
|
||||||
req -> fail()
|
|
||||||
);
|
|
||||||
|
|
||||||
request = new BytesArray("""
|
request = new BytesArray("""
|
||||||
{ "index":{ "_id": "bar", "require_alias": true } }
|
{ "index":{ "_id": "bar", "require_alias": true } }
|
||||||
{}
|
{}
|
||||||
""");
|
""");
|
||||||
parser.parse(
|
parser.parse(request, "foo", null, null, null, null, false, XContentType.JSON, (indexRequest, type) -> {
|
||||||
request,
|
assertTrue(indexRequest.isRequireAlias());
|
||||||
"foo",
|
}, req -> fail(), req -> fail());
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
false,
|
|
||||||
XContentType.JSON,
|
|
||||||
(indexRequest, type) -> { assertTrue(indexRequest.isRequireAlias()); },
|
|
||||||
req -> fail(),
|
|
||||||
req -> fail()
|
|
||||||
);
|
|
||||||
|
|
||||||
request = new BytesArray("""
|
request = new BytesArray("""
|
||||||
{ "index":{ "_id": "bar", "require_alias": false } }
|
{ "index":{ "_id": "bar", "require_alias": false } }
|
||||||
{}
|
{}
|
||||||
""");
|
""");
|
||||||
parser.parse(
|
parser.parse(request, "foo", null, null, null, true, false, XContentType.JSON, (indexRequest, type) -> {
|
||||||
request,
|
assertFalse(indexRequest.isRequireAlias());
|
||||||
"foo",
|
}, req -> fail(), req -> fail());
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
XContentType.JSON,
|
|
||||||
(indexRequest, type) -> { assertFalse(indexRequest.isRequireAlias()); },
|
|
||||||
req -> fail(),
|
|
||||||
req -> fail()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDeleteRequest() throws IOException {
|
public void testDeleteRequest() throws IOException {
|
||||||
|
@ -132,55 +102,25 @@ public class BulkRequestParserTests extends ESTestCase {
|
||||||
}, req -> fail());
|
}, req -> fail());
|
||||||
assertTrue(parsed.get());
|
assertTrue(parsed.get());
|
||||||
|
|
||||||
parser.parse(
|
parser.parse(request, "foo", null, null, null, true, false, XContentType.JSON, (req, type) -> fail(), updateRequest -> {
|
||||||
request,
|
assertTrue(updateRequest.isRequireAlias());
|
||||||
"foo",
|
}, req -> fail());
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
XContentType.JSON,
|
|
||||||
(req, type) -> fail(),
|
|
||||||
updateRequest -> { assertTrue(updateRequest.isRequireAlias()); },
|
|
||||||
req -> fail()
|
|
||||||
);
|
|
||||||
|
|
||||||
request = new BytesArray("""
|
request = new BytesArray("""
|
||||||
{ "update":{ "_id": "bar", "require_alias": true } }
|
{ "update":{ "_id": "bar", "require_alias": true } }
|
||||||
{}
|
{}
|
||||||
""");
|
""");
|
||||||
parser.parse(
|
parser.parse(request, "foo", null, null, null, null, false, XContentType.JSON, (req, type) -> fail(), updateRequest -> {
|
||||||
request,
|
assertTrue(updateRequest.isRequireAlias());
|
||||||
"foo",
|
}, req -> fail());
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
false,
|
|
||||||
XContentType.JSON,
|
|
||||||
(req, type) -> fail(),
|
|
||||||
updateRequest -> { assertTrue(updateRequest.isRequireAlias()); },
|
|
||||||
req -> fail()
|
|
||||||
);
|
|
||||||
|
|
||||||
request = new BytesArray("""
|
request = new BytesArray("""
|
||||||
{ "update":{ "_id": "bar", "require_alias": false } }
|
{ "update":{ "_id": "bar", "require_alias": false } }
|
||||||
{}
|
{}
|
||||||
""");
|
""");
|
||||||
parser.parse(
|
parser.parse(request, "foo", null, null, null, true, false, XContentType.JSON, (req, type) -> fail(), updateRequest -> {
|
||||||
request,
|
assertFalse(updateRequest.isRequireAlias());
|
||||||
"foo",
|
}, req -> fail());
|
||||||
null,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
XContentType.JSON,
|
|
||||||
(req, type) -> fail(),
|
|
||||||
updateRequest -> { assertFalse(updateRequest.isRequireAlias()); },
|
|
||||||
req -> fail()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBarfOnLackOfTrailingNewline() {
|
public void testBarfOnLackOfTrailingNewline() {
|
||||||
|
|
|
@ -69,12 +69,9 @@ public class TransportBulkActionIndicesThatCannotBeCreatedTests extends ESTestCa
|
||||||
bulkRequest.add(new IndexRequest("can't"));
|
bulkRequest.add(new IndexRequest("can't"));
|
||||||
bulkRequest.add(new DeleteRequest("do").version(0).versionType(VersionType.EXTERNAL));
|
bulkRequest.add(new DeleteRequest("do").version(0).versionType(VersionType.EXTERNAL));
|
||||||
bulkRequest.add(new UpdateRequest("nothin", randomAlphaOfLength(5)));
|
bulkRequest.add(new UpdateRequest("nothin", randomAlphaOfLength(5)));
|
||||||
indicesThatCannotBeCreatedTestCase(
|
indicesThatCannotBeCreatedTestCase(Set.of("no", "can't", "do", "nothin"), bulkRequest, index -> true, index -> {
|
||||||
Set.of("no", "can't", "do", "nothin"),
|
throw new IndexNotFoundException("Can't make it because I say so");
|
||||||
bulkRequest,
|
});
|
||||||
index -> true,
|
|
||||||
index -> { throw new IndexNotFoundException("Can't make it because I say so"); }
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSomeFail() {
|
public void testSomeFail() {
|
||||||
|
|
|
@ -251,12 +251,9 @@ public class TransportBulkActionIngestTests extends ESTestCase {
|
||||||
public void testSingleItemBulkActionIngestSkipped() throws Exception {
|
public void testSingleItemBulkActionIngestSkipped() throws Exception {
|
||||||
IndexRequest indexRequest = new IndexRequest("index").id("id");
|
IndexRequest indexRequest = new IndexRequest("index").id("id");
|
||||||
indexRequest.source(Collections.emptyMap());
|
indexRequest.source(Collections.emptyMap());
|
||||||
ActionTestUtils.execute(
|
ActionTestUtils.execute(singleItemBulkWriteAction, null, indexRequest, ActionListener.wrap(response -> {}, exception -> {
|
||||||
singleItemBulkWriteAction,
|
throw new AssertionError(exception);
|
||||||
null,
|
}));
|
||||||
indexRequest,
|
|
||||||
ActionListener.wrap(response -> {}, exception -> { throw new AssertionError(exception); })
|
|
||||||
);
|
|
||||||
assertTrue(action.isExecuted);
|
assertTrue(action.isExecuted);
|
||||||
verifyNoMoreInteractions(ingestService);
|
verifyNoMoreInteractions(ingestService);
|
||||||
}
|
}
|
||||||
|
@ -738,12 +735,9 @@ public class TransportBulkActionIngestTests extends ESTestCase {
|
||||||
|
|
||||||
AtomicBoolean responseCalled = new AtomicBoolean(false);
|
AtomicBoolean responseCalled = new AtomicBoolean(false);
|
||||||
AtomicBoolean failureCalled = new AtomicBoolean(false);
|
AtomicBoolean failureCalled = new AtomicBoolean(false);
|
||||||
ActionTestUtils.execute(
|
ActionTestUtils.execute(action, null, bulkRequest, ActionListener.wrap(response -> { responseCalled.set(true); }, e -> {
|
||||||
action,
|
failureCalled.set(true);
|
||||||
null,
|
}));
|
||||||
bulkRequest,
|
|
||||||
ActionListener.wrap(response -> { responseCalled.set(true); }, e -> { failureCalled.set(true); })
|
|
||||||
);
|
|
||||||
|
|
||||||
// check failure works, and passes through to the listener
|
// check failure works, and passes through to the listener
|
||||||
assertFalse(action.isExecuted); // haven't executed yet
|
assertFalse(action.isExecuted); // haven't executed yet
|
||||||
|
|
|
@ -63,10 +63,9 @@ public class SearchAsyncActionTests extends ESTestCase {
|
||||||
int numShards = 10;
|
int numShards = 10;
|
||||||
|
|
||||||
AtomicReference<SearchResponse> searchResponse = new AtomicReference<>();
|
AtomicReference<SearchResponse> searchResponse = new AtomicReference<>();
|
||||||
ActionListener<SearchResponse> responseListener = ActionListener.wrap(
|
ActionListener<SearchResponse> responseListener = ActionListener.wrap(searchResponse::set, (e) -> {
|
||||||
searchResponse::set,
|
throw new AssertionError("unexpected", e);
|
||||||
(e) -> { throw new AssertionError("unexpected", e); }
|
});
|
||||||
);
|
|
||||||
DiscoveryNode primaryNode = new DiscoveryNode("node_1", buildNewFakeTransportAddress(), Version.CURRENT);
|
DiscoveryNode primaryNode = new DiscoveryNode("node_1", buildNewFakeTransportAddress(), Version.CURRENT);
|
||||||
DiscoveryNode replicaNode = new DiscoveryNode("node_2", buildNewFakeTransportAddress(), Version.CURRENT);
|
DiscoveryNode replicaNode = new DiscoveryNode("node_2", buildNewFakeTransportAddress(), Version.CURRENT);
|
||||||
|
|
||||||
|
@ -284,7 +283,9 @@ public class SearchAsyncActionTests extends ESTestCase {
|
||||||
AtomicReference<TestSearchResponse> response = new AtomicReference<>();
|
AtomicReference<TestSearchResponse> response = new AtomicReference<>();
|
||||||
ActionListener<SearchResponse> responseListener = ActionListener.wrap(
|
ActionListener<SearchResponse> responseListener = ActionListener.wrap(
|
||||||
searchResponse -> response.set((TestSearchResponse) searchResponse),
|
searchResponse -> response.set((TestSearchResponse) searchResponse),
|
||||||
(e) -> { throw new AssertionError("unexpected", e); }
|
(e) -> {
|
||||||
|
throw new AssertionError("unexpected", e);
|
||||||
|
}
|
||||||
);
|
);
|
||||||
DiscoveryNode primaryNode = new DiscoveryNode("node_1", buildNewFakeTransportAddress(), Version.CURRENT);
|
DiscoveryNode primaryNode = new DiscoveryNode("node_1", buildNewFakeTransportAddress(), Version.CURRENT);
|
||||||
DiscoveryNode replicaNode = new DiscoveryNode("node_2", buildNewFakeTransportAddress(), Version.CURRENT);
|
DiscoveryNode replicaNode = new DiscoveryNode("node_2", buildNewFakeTransportAddress(), Version.CURRENT);
|
||||||
|
@ -615,10 +616,9 @@ public class SearchAsyncActionTests extends ESTestCase {
|
||||||
request.allowPartialSearchResults(true);
|
request.allowPartialSearchResults(true);
|
||||||
|
|
||||||
AtomicReference<SearchResponse> searchResponse = new AtomicReference<>();
|
AtomicReference<SearchResponse> searchResponse = new AtomicReference<>();
|
||||||
ActionListener<SearchResponse> responseListener = ActionListener.wrap(
|
ActionListener<SearchResponse> responseListener = ActionListener.wrap(searchResponse::set, (e) -> {
|
||||||
searchResponse::set,
|
throw new AssertionError("unexpected", e);
|
||||||
(e) -> { throw new AssertionError("unexpected", e); }
|
});
|
||||||
);
|
|
||||||
DiscoveryNode primaryNode = new DiscoveryNode("node_1", buildNewFakeTransportAddress(), Version.CURRENT);
|
DiscoveryNode primaryNode = new DiscoveryNode("node_1", buildNewFakeTransportAddress(), Version.CURRENT);
|
||||||
|
|
||||||
final int numUnavailableSkippedShards = randomIntBetween(1, 10);
|
final int numUnavailableSkippedShards = randomIntBetween(1, 10);
|
||||||
|
|
|
@ -53,9 +53,8 @@ public class OriginSettingClientTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> ActionListener<T> listenerThatAssertsOriginNotSet(ThreadContext threadContext) {
|
private <T> ActionListener<T> listenerThatAssertsOriginNotSet(ThreadContext threadContext) {
|
||||||
return ActionListener.wrap(
|
return ActionListener.wrap(r -> { assertNull(threadContext.getTransient(ThreadContext.ACTION_ORIGIN_TRANSIENT_NAME)); }, e -> {
|
||||||
r -> { assertNull(threadContext.getTransient(ThreadContext.ACTION_ORIGIN_TRANSIENT_NAME)); },
|
fail("didn't expect to fail but: " + e);
|
||||||
e -> { fail("didn't expect to fail but: " + e); }
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,12 +62,9 @@ public class InternalClusterInfoServiceSchedulingTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
final MasterService masterService = new FakeThreadPoolMasterService(
|
final MasterService masterService = new FakeThreadPoolMasterService("test", "masterService", threadPool, r -> {
|
||||||
"test",
|
fail("master service should not run any tasks");
|
||||||
"masterService",
|
});
|
||||||
threadPool,
|
|
||||||
r -> { fail("master service should not run any tasks"); }
|
|
||||||
);
|
|
||||||
|
|
||||||
final ClusterService clusterService = new ClusterService(settings, clusterSettings, masterService, clusterApplierService);
|
final ClusterService clusterService = new ClusterService(settings, clusterSettings, masterService, clusterApplierService);
|
||||||
|
|
||||||
|
|
|
@ -109,9 +109,9 @@ public class ClusterBootstrapServiceTests extends ESTestCase {
|
||||||
settings.put(UNCONFIGURED_BOOTSTRAP_TIMEOUT_SETTING.getKey(), timeout + "ms");
|
settings.put(UNCONFIGURED_BOOTSTRAP_TIMEOUT_SETTING.getKey(), timeout + "ms");
|
||||||
}
|
}
|
||||||
|
|
||||||
final AtomicReference<Supplier<Iterable<DiscoveryNode>>> discoveredNodesSupplier = new AtomicReference<>(
|
final AtomicReference<Supplier<Iterable<DiscoveryNode>>> discoveredNodesSupplier = new AtomicReference<>(() -> {
|
||||||
() -> { throw new AssertionError("should not be called yet"); }
|
throw new AssertionError("should not be called yet");
|
||||||
);
|
});
|
||||||
|
|
||||||
final AtomicBoolean bootstrapped = new AtomicBoolean();
|
final AtomicBoolean bootstrapped = new AtomicBoolean();
|
||||||
ClusterBootstrapService clusterBootstrapService = new ClusterBootstrapService(
|
ClusterBootstrapService clusterBootstrapService = new ClusterBootstrapService(
|
||||||
|
@ -165,13 +165,9 @@ public class ClusterBootstrapServiceTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testDoesNothingWithSettings(Settings.Builder builder) {
|
private void testDoesNothingWithSettings(Settings.Builder builder) {
|
||||||
ClusterBootstrapService clusterBootstrapService = new ClusterBootstrapService(
|
ClusterBootstrapService clusterBootstrapService = new ClusterBootstrapService(builder.build(), transportService, () -> {
|
||||||
builder.build(),
|
throw new AssertionError("should not be called");
|
||||||
transportService,
|
}, () -> false, vc -> { throw new AssertionError("should not be called"); });
|
||||||
() -> { throw new AssertionError("should not be called"); },
|
|
||||||
() -> false,
|
|
||||||
vc -> { throw new AssertionError("should not be called"); }
|
|
||||||
);
|
|
||||||
transportService.start();
|
transportService.start();
|
||||||
clusterBootstrapService.scheduleUnconfiguredBootstrap();
|
clusterBootstrapService.scheduleUnconfiguredBootstrap();
|
||||||
deterministicTaskQueue.runAllTasks();
|
deterministicTaskQueue.runAllTasks();
|
||||||
|
@ -185,7 +181,9 @@ public class ClusterBootstrapServiceTests extends ESTestCase {
|
||||||
transportService,
|
transportService,
|
||||||
Collections::emptyList,
|
Collections::emptyList,
|
||||||
() -> false,
|
() -> false,
|
||||||
vc -> { throw new AssertionError("should not be called"); }
|
vc -> {
|
||||||
|
throw new AssertionError("should not be called");
|
||||||
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -309,7 +307,9 @@ public class ClusterBootstrapServiceTests extends ESTestCase {
|
||||||
transportService,
|
transportService,
|
||||||
Collections::emptyList,
|
Collections::emptyList,
|
||||||
() -> true,
|
() -> true,
|
||||||
vc -> { throw new AssertionError("should not be called"); }
|
vc -> {
|
||||||
|
throw new AssertionError("should not be called");
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
transportService.start();
|
transportService.start();
|
||||||
|
@ -332,7 +332,9 @@ public class ClusterBootstrapServiceTests extends ESTestCase {
|
||||||
transportService,
|
transportService,
|
||||||
() -> Stream.of(otherNode1).toList(),
|
() -> Stream.of(otherNode1).toList(),
|
||||||
() -> false,
|
() -> false,
|
||||||
vc -> { throw new AssertionError("should not be called"); }
|
vc -> {
|
||||||
|
throw new AssertionError("should not be called");
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
transportService.start();
|
transportService.start();
|
||||||
|
@ -356,7 +358,9 @@ public class ClusterBootstrapServiceTests extends ESTestCase {
|
||||||
transportService,
|
transportService,
|
||||||
() -> Stream.of(otherNode1, otherNode2).toList(),
|
() -> Stream.of(otherNode1, otherNode2).toList(),
|
||||||
() -> false,
|
() -> false,
|
||||||
vc -> { throw new AssertionError("should not be called"); }
|
vc -> {
|
||||||
|
throw new AssertionError("should not be called");
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
transportService.start();
|
transportService.start();
|
||||||
|
@ -372,7 +376,9 @@ public class ClusterBootstrapServiceTests extends ESTestCase {
|
||||||
transportService,
|
transportService,
|
||||||
() -> Stream.of(otherNode1, otherNode2).toList(),
|
() -> Stream.of(otherNode1, otherNode2).toList(),
|
||||||
() -> true,
|
() -> true,
|
||||||
vc -> { throw new AssertionError("should not be called"); }
|
vc -> {
|
||||||
|
throw new AssertionError("should not be called");
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
transportService.start();
|
transportService.start();
|
||||||
|
@ -396,7 +402,9 @@ public class ClusterBootstrapServiceTests extends ESTestCase {
|
||||||
transportService,
|
transportService,
|
||||||
() -> Stream.of(localNode, otherNode1, otherNode2).toList(),
|
() -> Stream.of(localNode, otherNode1, otherNode2).toList(),
|
||||||
() -> false,
|
() -> false,
|
||||||
vc -> { throw new AssertionError("should not be called"); }
|
vc -> {
|
||||||
|
throw new AssertionError("should not be called");
|
||||||
|
}
|
||||||
);
|
);
|
||||||
transportService.start();
|
transportService.start();
|
||||||
clusterBootstrapService.onFoundPeersUpdated();
|
clusterBootstrapService.onFoundPeersUpdated();
|
||||||
|
@ -409,7 +417,9 @@ public class ClusterBootstrapServiceTests extends ESTestCase {
|
||||||
transportService,
|
transportService,
|
||||||
() -> Stream.of(localNode, otherNode1, otherNode2).toList(),
|
() -> Stream.of(localNode, otherNode1, otherNode2).toList(),
|
||||||
() -> false,
|
() -> false,
|
||||||
vc -> { throw new AssertionError("should not be called"); }
|
vc -> {
|
||||||
|
throw new AssertionError("should not be called");
|
||||||
|
}
|
||||||
);
|
);
|
||||||
transportService.start();
|
transportService.start();
|
||||||
clusterBootstrapService.onFoundPeersUpdated();
|
clusterBootstrapService.onFoundPeersUpdated();
|
||||||
|
@ -422,7 +432,9 @@ public class ClusterBootstrapServiceTests extends ESTestCase {
|
||||||
transportService,
|
transportService,
|
||||||
() -> Stream.of(localNode, otherNode1, otherNode2).toList(),
|
() -> Stream.of(localNode, otherNode1, otherNode2).toList(),
|
||||||
() -> false,
|
() -> false,
|
||||||
vc -> { throw new AssertionError("should not be called"); }
|
vc -> {
|
||||||
|
throw new AssertionError("should not be called");
|
||||||
|
}
|
||||||
);
|
);
|
||||||
transportService.start();
|
transportService.start();
|
||||||
clusterBootstrapService.scheduleUnconfiguredBootstrap();
|
clusterBootstrapService.scheduleUnconfiguredBootstrap();
|
||||||
|
@ -461,7 +473,9 @@ public class ClusterBootstrapServiceTests extends ESTestCase {
|
||||||
transportService,
|
transportService,
|
||||||
discoveredNodes::get,
|
discoveredNodes::get,
|
||||||
() -> false,
|
() -> false,
|
||||||
vc -> { throw new AssertionError("should not be called"); }
|
vc -> {
|
||||||
|
throw new AssertionError("should not be called");
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
transportService.start();
|
transportService.start();
|
||||||
|
@ -482,7 +496,9 @@ public class ClusterBootstrapServiceTests extends ESTestCase {
|
||||||
transportService,
|
transportService,
|
||||||
discoveredNodes::get,
|
discoveredNodes::get,
|
||||||
() -> false,
|
() -> false,
|
||||||
vc -> { throw new AssertionError("should not be called"); }
|
vc -> {
|
||||||
|
throw new AssertionError("should not be called");
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
transportService.start();
|
transportService.start();
|
||||||
|
@ -568,7 +584,9 @@ public class ClusterBootstrapServiceTests extends ESTestCase {
|
||||||
transportService,
|
transportService,
|
||||||
Collections::emptyList,
|
Collections::emptyList,
|
||||||
() -> false,
|
() -> false,
|
||||||
vc -> { throw new AssertionError("should not be called"); }
|
vc -> {
|
||||||
|
throw new AssertionError("should not be called");
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
transportService.start();
|
transportService.start();
|
||||||
|
@ -681,7 +699,9 @@ public class ClusterBootstrapServiceTests extends ESTestCase {
|
||||||
transportService,
|
transportService,
|
||||||
Collections::emptyList,
|
Collections::emptyList,
|
||||||
() -> false,
|
() -> false,
|
||||||
vc -> { throw new AssertionError("should not be called"); }
|
vc -> {
|
||||||
|
throw new AssertionError("should not be called");
|
||||||
|
}
|
||||||
).logBootstrapState(metadataBuilder.build());
|
).logBootstrapState(metadataBuilder.build());
|
||||||
|
|
||||||
mockAppender.assertAllExpectationsMatched();
|
mockAppender.assertAllExpectationsMatched();
|
||||||
|
@ -695,13 +715,9 @@ public class ClusterBootstrapServiceTests extends ESTestCase {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
new ClusterBootstrapService(
|
new ClusterBootstrapService(Settings.EMPTY, transportService, Collections::emptyList, () -> false, vc -> {
|
||||||
Settings.EMPTY,
|
throw new AssertionError("should not be called");
|
||||||
transportService,
|
}).logBootstrapState(Metadata.builder().clusterUUID("test-uuid").clusterUUIDCommitted(true).build());
|
||||||
Collections::emptyList,
|
|
||||||
() -> false,
|
|
||||||
vc -> { throw new AssertionError("should not be called"); }
|
|
||||||
).logBootstrapState(Metadata.builder().clusterUUID("test-uuid").clusterUUIDCommitted(true).build());
|
|
||||||
|
|
||||||
mockAppender.assertAllExpectationsMatched();
|
mockAppender.assertAllExpectationsMatched();
|
||||||
|
|
||||||
|
@ -725,7 +741,9 @@ public class ClusterBootstrapServiceTests extends ESTestCase {
|
||||||
transportService,
|
transportService,
|
||||||
Collections::emptyList,
|
Collections::emptyList,
|
||||||
() -> false,
|
() -> false,
|
||||||
vc -> { throw new AssertionError("should not be called"); }
|
vc -> {
|
||||||
|
throw new AssertionError("should not be called");
|
||||||
|
}
|
||||||
).logBootstrapState(Metadata.builder().clusterUUID("test-uuid").clusterUUIDCommitted(true).build());
|
).logBootstrapState(Metadata.builder().clusterUUID("test-uuid").clusterUUIDCommitted(true).build());
|
||||||
|
|
||||||
mockAppender.assertAllExpectationsMatched();
|
mockAppender.assertAllExpectationsMatched();
|
||||||
|
|
|
@ -1603,11 +1603,9 @@ public class CoordinatorTests extends AbstractCoordinatorTestCase {
|
||||||
nodes.stream().map(ClusterNode::getLocalNode).map(DiscoveryNode::getId).collect(Collectors.toSet())
|
nodes.stream().map(ClusterNode::getLocalNode).map(DiscoveryNode::getId).collect(Collectors.toSet())
|
||||||
) == false,
|
) == false,
|
||||||
() -> randomSubsetOf(cluster.clusterNodes)
|
() -> randomSubsetOf(cluster.clusterNodes)
|
||||||
).forEach(
|
).forEach(cn -> cn.extraJoinValidators.add((discoveryNode, clusterState) -> {
|
||||||
cn -> cn.extraJoinValidators.add(
|
throw new IllegalArgumentException("join validation failed");
|
||||||
(discoveryNode, clusterState) -> { throw new IllegalArgumentException("join validation failed"); }
|
}));
|
||||||
)
|
|
||||||
);
|
|
||||||
cluster.bootstrapIfNecessary();
|
cluster.bootstrapIfNecessary();
|
||||||
cluster.runFor(10000, "failing join validation");
|
cluster.runFor(10000, "failing join validation");
|
||||||
assertTrue(cluster.clusterNodes.stream().allMatch(cn -> cn.getLastAppliedClusterState().version() == 0));
|
assertTrue(cluster.clusterNodes.stream().allMatch(cn -> cn.getLastAppliedClusterState().version() == 0));
|
||||||
|
|
|
@ -111,7 +111,9 @@ public class FollowersCheckerTests extends ESTestCase {
|
||||||
settings,
|
settings,
|
||||||
transportService,
|
transportService,
|
||||||
fcr -> { assert false : fcr; },
|
fcr -> { assert false : fcr; },
|
||||||
(node, reason) -> { assert false : node; },
|
(node, reason) -> {
|
||||||
|
assert false : node;
|
||||||
|
},
|
||||||
() -> new StatusInfo(StatusInfo.Status.HEALTHY, "healthy-info")
|
() -> new StatusInfo(StatusInfo.Status.HEALTHY, "healthy-info")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -762,7 +764,9 @@ public class FollowersCheckerTests extends ESTestCase {
|
||||||
Settings.EMPTY,
|
Settings.EMPTY,
|
||||||
transportService,
|
transportService,
|
||||||
fcr -> { assert false : fcr; },
|
fcr -> { assert false : fcr; },
|
||||||
(node, reason) -> { assert false : node; },
|
(node, reason) -> {
|
||||||
|
assert false : node;
|
||||||
|
},
|
||||||
() -> new StatusInfo(HEALTHY, "healthy-info")
|
() -> new StatusInfo(HEALTHY, "healthy-info")
|
||||||
);
|
);
|
||||||
followersChecker.setCurrentNodes(discoveryNodes);
|
followersChecker.setCurrentNodes(discoveryNodes);
|
||||||
|
|
|
@ -75,7 +75,9 @@ public class JoinHelperTests extends ESTestCase {
|
||||||
new NoOpClusterApplier(),
|
new NoOpClusterApplier(),
|
||||||
transportService,
|
transportService,
|
||||||
() -> 0L,
|
() -> 0L,
|
||||||
(joinRequest, joinCallback) -> { throw new AssertionError(); },
|
(joinRequest, joinCallback) -> {
|
||||||
|
throw new AssertionError();
|
||||||
|
},
|
||||||
startJoinRequest -> { throw new AssertionError(); },
|
startJoinRequest -> { throw new AssertionError(); },
|
||||||
(s, p, r) -> {},
|
(s, p, r) -> {},
|
||||||
() -> new StatusInfo(HEALTHY, "info"),
|
() -> new StatusInfo(HEALTHY, "info"),
|
||||||
|
@ -239,7 +241,9 @@ public class JoinHelperTests extends ESTestCase {
|
||||||
new NoOpClusterApplier(),
|
new NoOpClusterApplier(),
|
||||||
transportService,
|
transportService,
|
||||||
() -> 0L,
|
() -> 0L,
|
||||||
(joinRequest, joinCallback) -> { throw new AssertionError(); },
|
(joinRequest, joinCallback) -> {
|
||||||
|
throw new AssertionError();
|
||||||
|
},
|
||||||
startJoinRequest -> { throw new AssertionError(); },
|
startJoinRequest -> { throw new AssertionError(); },
|
||||||
(s, p, r) -> {},
|
(s, p, r) -> {},
|
||||||
nodeHealthServiceStatus::get,
|
nodeHealthServiceStatus::get,
|
||||||
|
|
|
@ -68,9 +68,9 @@ import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
public class NodeJoinExecutorTests extends ESTestCase {
|
public class NodeJoinExecutorTests extends ESTestCase {
|
||||||
|
|
||||||
private static final ActionListener<Void> NOT_COMPLETED_LISTENER = ActionListener.running(
|
private static final ActionListener<Void> NOT_COMPLETED_LISTENER = ActionListener.running(() -> {
|
||||||
() -> { throw new AssertionError("should not complete publication"); }
|
throw new AssertionError("should not complete publication");
|
||||||
);
|
});
|
||||||
|
|
||||||
public void testPreventJoinClusterWithNewerIndices() {
|
public void testPreventJoinClusterWithNewerIndices() {
|
||||||
Settings.builder().build();
|
Settings.builder().build();
|
||||||
|
|
|
@ -549,14 +549,9 @@ public class NodeJoinTests extends ESTestCase {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
assertTrue(
|
assertTrue(MasterServiceTests.discoveryState(masterService).getVotingConfigExclusions().stream().anyMatch(exclusion -> {
|
||||||
MasterServiceTests.discoveryState(masterService)
|
return "knownNodeName".equals(exclusion.getNodeName()) && "newNodeId".equals(exclusion.getNodeId());
|
||||||
.getVotingConfigExclusions()
|
}));
|
||||||
.stream()
|
|
||||||
.anyMatch(
|
|
||||||
exclusion -> { return "knownNodeName".equals(exclusion.getNodeName()) && "newNodeId".equals(exclusion.getNodeId()); }
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ClusterState buildStateWithVotingConfigExclusion(
|
private ClusterState buildStateWithVotingConfigExclusion(
|
||||||
|
|
|
@ -699,9 +699,9 @@ public class MetadataCreateIndexServiceTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAggregateSettingsAppliesSettingsFromTemplatesAndRequest() {
|
public void testAggregateSettingsAppliesSettingsFromTemplatesAndRequest() {
|
||||||
IndexTemplateMetadata templateMetadata = addMatchingTemplate(
|
IndexTemplateMetadata templateMetadata = addMatchingTemplate(builder -> {
|
||||||
builder -> { builder.settings(Settings.builder().put("template_setting", "value1")); }
|
builder.settings(Settings.builder().put("template_setting", "value1"));
|
||||||
);
|
});
|
||||||
Metadata metadata = new Metadata.Builder().templates(Map.of("template_1", templateMetadata)).build();
|
Metadata metadata = new Metadata.Builder().templates(Map.of("template_1", templateMetadata)).build();
|
||||||
ClusterState clusterState = ClusterState.builder(
|
ClusterState clusterState = ClusterState.builder(
|
||||||
org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING.getDefault(Settings.EMPTY)
|
org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING.getDefault(Settings.EMPTY)
|
||||||
|
|
|
@ -113,12 +113,9 @@ public class MetadataMappingServiceTests extends ESSingleNodeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<MetadataMappingService.PutMappingClusterStateUpdateTask> singleTask(PutMappingClusterStateUpdateRequest request) {
|
private static List<MetadataMappingService.PutMappingClusterStateUpdateTask> singleTask(PutMappingClusterStateUpdateRequest request) {
|
||||||
return Collections.singletonList(
|
return Collections.singletonList(new MetadataMappingService.PutMappingClusterStateUpdateTask(request, ActionListener.running(() -> {
|
||||||
new MetadataMappingService.PutMappingClusterStateUpdateTask(
|
throw new AssertionError("task should not complete publication");
|
||||||
request,
|
})));
|
||||||
ActionListener.running(() -> { throw new AssertionError("task should not complete publication"); })
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,9 @@ public class ShardRoutingTests extends AbstractWireSerializingTestCase<ShardRout
|
||||||
switch (newState) {
|
switch (newState) {
|
||||||
case UNASSIGNED -> null;
|
case UNASSIGNED -> null;
|
||||||
case INITIALIZING, STARTED -> requireNonNullElseGet(instance.allocationId(), AllocationId::newInitializing);
|
case INITIALIZING, STARTED -> requireNonNullElseGet(instance.allocationId(), AllocationId::newInitializing);
|
||||||
case RELOCATING -> AllocationId.newRelocation(requireNonNullElseGet(instance.allocationId(), AllocationId::newInitializing));
|
case RELOCATING -> AllocationId.newRelocation(
|
||||||
|
requireNonNullElseGet(instance.allocationId(), AllocationId::newInitializing)
|
||||||
|
);
|
||||||
},
|
},
|
||||||
instance.getExpectedShardSize(),
|
instance.getExpectedShardSize(),
|
||||||
instance.role()
|
instance.role()
|
||||||
|
|
|
@ -162,8 +162,9 @@ public class FailedNodeRoutingTests extends ESAllocationTestCase {
|
||||||
// Pick a random subset of primaries to fail
|
// Pick a random subset of primaries to fail
|
||||||
List<FailedShard> shardsToFail = new ArrayList<>();
|
List<FailedShard> shardsToFail = new ArrayList<>();
|
||||||
List<ShardRouting> failedPrimaries = randomSubsetOf(primaries);
|
List<ShardRouting> failedPrimaries = randomSubsetOf(primaries);
|
||||||
failedPrimaries.stream()
|
failedPrimaries.stream().forEach(sr -> {
|
||||||
.forEach(sr -> { shardsToFail.add(new FailedShard(randomFrom(sr), "failed primary", new Exception(), randomBoolean())); });
|
shardsToFail.add(new FailedShard(randomFrom(sr), "failed primary", new Exception(), randomBoolean()));
|
||||||
|
});
|
||||||
|
|
||||||
logger.info("--> state before failing shards: {}", state);
|
logger.info("--> state before failing shards: {}", state);
|
||||||
state = cluster.applyFailedShards(state, shardsToFail);
|
state = cluster.applyFailedShards(state, shardsToFail);
|
||||||
|
|
|
@ -25,10 +25,9 @@ public class AllocationActionListenerTests extends ESTestCase {
|
||||||
|
|
||||||
public void testShouldDelegateWhenBothComplete() {
|
public void testShouldDelegateWhenBothComplete() {
|
||||||
var completed = new AtomicBoolean(false);
|
var completed = new AtomicBoolean(false);
|
||||||
var listener = new AllocationActionListener<AcknowledgedResponse>(
|
var listener = new AllocationActionListener<AcknowledgedResponse>(ActionListener.wrap(ignore -> completed.set(true), exception -> {
|
||||||
ActionListener.wrap(ignore -> completed.set(true), exception -> { throw new AssertionError("Should not fail in test"); }),
|
throw new AssertionError("Should not fail in test");
|
||||||
createEmptyThreadContext()
|
}), createEmptyThreadContext());
|
||||||
);
|
|
||||||
|
|
||||||
listener.clusterStateUpdate().onResponse(AcknowledgedResponse.TRUE);
|
listener.clusterStateUpdate().onResponse(AcknowledgedResponse.TRUE);
|
||||||
listener.reroute().onResponse(null);
|
listener.reroute().onResponse(null);
|
||||||
|
@ -38,10 +37,9 @@ public class AllocationActionListenerTests extends ESTestCase {
|
||||||
|
|
||||||
public void testShouldNotDelegateWhenOnlyOneComplete() {
|
public void testShouldNotDelegateWhenOnlyOneComplete() {
|
||||||
var completed = new AtomicBoolean(false);
|
var completed = new AtomicBoolean(false);
|
||||||
var listener = new AllocationActionListener<AcknowledgedResponse>(
|
var listener = new AllocationActionListener<AcknowledgedResponse>(ActionListener.wrap(ignore -> completed.set(true), exception -> {
|
||||||
ActionListener.wrap(ignore -> completed.set(true), exception -> { throw new AssertionError("Should not fail in test"); }),
|
throw new AssertionError("Should not fail in test");
|
||||||
createEmptyThreadContext()
|
}), createEmptyThreadContext());
|
||||||
);
|
|
||||||
|
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
listener.clusterStateUpdate().onResponse(AcknowledgedResponse.TRUE);
|
listener.clusterStateUpdate().onResponse(AcknowledgedResponse.TRUE);
|
||||||
|
@ -54,10 +52,9 @@ public class AllocationActionListenerTests extends ESTestCase {
|
||||||
|
|
||||||
public void testShouldDelegateFailureImmediately() {
|
public void testShouldDelegateFailureImmediately() {
|
||||||
var completed = new AtomicBoolean(false);
|
var completed = new AtomicBoolean(false);
|
||||||
var listener = new AllocationActionListener<AcknowledgedResponse>(
|
var listener = new AllocationActionListener<AcknowledgedResponse>(ActionListener.wrap(ignore -> {
|
||||||
ActionListener.wrap(ignore -> { throw new AssertionError("Should not complete in test"); }, exception -> completed.set(true)),
|
throw new AssertionError("Should not complete in test");
|
||||||
createEmptyThreadContext()
|
}, exception -> completed.set(true)), createEmptyThreadContext());
|
||||||
);
|
|
||||||
|
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
listener.clusterStateUpdate().onFailure(new RuntimeException());
|
listener.clusterStateUpdate().onFailure(new RuntimeException());
|
||||||
|
|
|
@ -51,9 +51,9 @@ public class AllocationActionMultiListenerTests extends ESTestCase {
|
||||||
var listener = new AllocationActionMultiListener<AcknowledgedResponse>(createEmptyThreadContext());
|
var listener = new AllocationActionMultiListener<AcknowledgedResponse>(createEmptyThreadContext());
|
||||||
|
|
||||||
var completed = new AtomicBoolean(false);
|
var completed = new AtomicBoolean(false);
|
||||||
var delegate = listener.delay(
|
var delegate = listener.delay(ActionListener.wrap(ignore -> completed.set(true), exception -> {
|
||||||
ActionListener.wrap(ignore -> completed.set(true), exception -> { throw new AssertionError("Should not fail in test"); })
|
throw new AssertionError("Should not fail in test");
|
||||||
);
|
}));
|
||||||
|
|
||||||
switch (randomInt(2)) {
|
switch (randomInt(2)) {
|
||||||
case 0 -> delegate.onResponse(AcknowledgedResponse.TRUE);
|
case 0 -> delegate.onResponse(AcknowledgedResponse.TRUE);
|
||||||
|
|
|
@ -240,7 +240,9 @@ public class ClusterAllocationSimulationTests extends ESAllocationTestCase {
|
||||||
1,
|
1,
|
||||||
1,
|
1,
|
||||||
TimeUnit.SECONDS,
|
TimeUnit.SECONDS,
|
||||||
r -> { throw new AssertionError("should not create new threads"); },
|
r -> {
|
||||||
|
throw new AssertionError("should not create new threads");
|
||||||
|
},
|
||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -164,14 +164,9 @@ public class DesiredBalanceShardsAllocatorTests extends ESTestCase {
|
||||||
.addAsNew(indexMetadata)
|
.addAsNew(indexMetadata)
|
||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
return allocationService.reroute(
|
return allocationService.reroute(newState, "test", ActionListener.wrap(response -> listenerCalled.set(true), exception -> {
|
||||||
newState,
|
throw new AssertionError("should not happen in test", exception);
|
||||||
"test",
|
}));
|
||||||
ActionListener.wrap(
|
|
||||||
response -> listenerCalled.set(true),
|
|
||||||
exception -> { throw new AssertionError("should not happen in test", exception); }
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -362,14 +357,9 @@ public class DesiredBalanceShardsAllocatorTests extends ESTestCase {
|
||||||
.addAsNew(indexMetadata)
|
.addAsNew(indexMetadata)
|
||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
return allocationService.reroute(
|
return allocationService.reroute(newState, "test", ActionListener.wrap(response -> {
|
||||||
newState,
|
throw new AssertionError("Should not happen in test");
|
||||||
"test",
|
}, exception -> listenersCalled.countDown()));
|
||||||
ActionListener.wrap(
|
|
||||||
response -> { throw new AssertionError("Should not happen in test"); },
|
|
||||||
exception -> listenersCalled.countDown()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue