Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[TEST] improve REST high-level client naming conventions check #32244

Merged
merged 1 commit into from
Jul 21, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -724,8 +724,8 @@ public void testApiNamingConventions() throws Exception {
assertEquals(0, method.getExceptionTypes().length);
assertEquals(3, method.getParameterTypes().length);
assertThat(method.getParameterTypes()[0].getSimpleName(), endsWith("Request"));
assertThat(method.getParameterTypes()[1].getName(), equalTo(RequestOptions.class.getName()));
assertThat(method.getParameterTypes()[2].getName(), equalTo(ActionListener.class.getName()));
assertThat(method.getParameterTypes()[1], equalTo(RequestOptions.class));
assertThat(method.getParameterTypes()[2], equalTo(ActionListener.class));
Copy link
Member

Choose a reason for hiding this comment

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

👍

} else {
//A few methods return a boolean rather than a response object
if (apiName.equals("ping") || apiName.contains("exist")) {
Expand All @@ -738,18 +738,23 @@ public void testApiNamingConventions() throws Exception {
//a few methods don't accept a request object as argument
if (apiName.equals("ping") || apiName.equals("info")) {
assertEquals(1, method.getParameterTypes().length);
assertThat(method.getParameterTypes()[0].getName(), equalTo(RequestOptions.class.getName()));
assertThat(method.getParameterTypes()[0], equalTo(RequestOptions.class));
} else {
assertEquals(apiName, 2, method.getParameterTypes().length);
assertThat(method.getParameterTypes()[0].getSimpleName(), endsWith("Request"));
assertThat(method.getParameterTypes()[1].getName(), equalTo(RequestOptions.class.getName()));
assertThat(method.getParameterTypes()[1], equalTo(RequestOptions.class));
}

boolean remove = apiSpec.remove(apiName);
if (remove == false && deprecatedMethods.contains(apiName) == false) {
//TODO xpack api are currently ignored, we need to load xpack yaml spec too
if (apiName.startsWith("xpack.") == false) {
apiNotFound.add(apiName);
if (remove == false) {
if (deprecatedMethods.contains(apiName)) {
assertTrue("method [" + method.getName() + "], api [" + apiName + "] should be deprecated",
method.isAnnotationPresent(Deprecated.class));
} else {
//TODO xpack api are currently ignored, we need to load xpack yaml spec too
if (apiName.startsWith("xpack.") == false) {
apiNotFound.add(apiName);
}
}
}
}
Expand Down