Skip to content

Commit 0cd25d7

Browse files
committed
Merge branch 'master' into ccr
* master: Improve message when JAVA_HOME not set (#32022) [TEST] improve REST high-level client naming conventions check (#32244)
2 parents b6b596e + 0a511cc commit 0cd25d7

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,11 @@ class BuildPlugin implements Plugin<Project> {
222222
// IntelliJ does not set JAVA_HOME, so we use the JDK that Gradle was run with
223223
return Jvm.current().javaHome
224224
} else {
225-
throw new GradleException("JAVA_HOME must be set to build Elasticsearch")
225+
throw new GradleException(
226+
"JAVA_HOME must be set to build Elasticsearch. " +
227+
"Note that if the variable was just set you might have to run `./gradlew --stop` for " +
228+
"it to be picked up. See https://github.com/elastic/elasticsearch/issues/31399 details."
229+
)
226230
}
227231
}
228232
return javaHome

client/rest-high-level/src/test/java/org/elasticsearch/client/RestHighLevelClientTests.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -724,8 +724,8 @@ public void testApiNamingConventions() throws Exception {
724724
assertEquals(0, method.getExceptionTypes().length);
725725
assertEquals(3, method.getParameterTypes().length);
726726
assertThat(method.getParameterTypes()[0].getSimpleName(), endsWith("Request"));
727-
assertThat(method.getParameterTypes()[1].getName(), equalTo(RequestOptions.class.getName()));
728-
assertThat(method.getParameterTypes()[2].getName(), equalTo(ActionListener.class.getName()));
727+
assertThat(method.getParameterTypes()[1], equalTo(RequestOptions.class));
728+
assertThat(method.getParameterTypes()[2], equalTo(ActionListener.class));
729729
} else {
730730
//A few methods return a boolean rather than a response object
731731
if (apiName.equals("ping") || apiName.contains("exist")) {
@@ -738,18 +738,23 @@ public void testApiNamingConventions() throws Exception {
738738
//a few methods don't accept a request object as argument
739739
if (apiName.equals("ping") || apiName.equals("info")) {
740740
assertEquals(1, method.getParameterTypes().length);
741-
assertThat(method.getParameterTypes()[0].getName(), equalTo(RequestOptions.class.getName()));
741+
assertThat(method.getParameterTypes()[0], equalTo(RequestOptions.class));
742742
} else {
743743
assertEquals(apiName, 2, method.getParameterTypes().length);
744744
assertThat(method.getParameterTypes()[0].getSimpleName(), endsWith("Request"));
745-
assertThat(method.getParameterTypes()[1].getName(), equalTo(RequestOptions.class.getName()));
745+
assertThat(method.getParameterTypes()[1], equalTo(RequestOptions.class));
746746
}
747747

748748
boolean remove = apiSpec.remove(apiName);
749-
if (remove == false && deprecatedMethods.contains(apiName) == false) {
750-
//TODO xpack api are currently ignored, we need to load xpack yaml spec too
751-
if (apiName.startsWith("xpack.") == false) {
752-
apiNotFound.add(apiName);
749+
if (remove == false) {
750+
if (deprecatedMethods.contains(apiName)) {
751+
assertTrue("method [" + method.getName() + "], api [" + apiName + "] should be deprecated",
752+
method.isAnnotationPresent(Deprecated.class));
753+
} else {
754+
//TODO xpack api are currently ignored, we need to load xpack yaml spec too
755+
if (apiName.startsWith("xpack.") == false) {
756+
apiNotFound.add(apiName);
757+
}
753758
}
754759
}
755760
}

0 commit comments

Comments
 (0)