Returns empty set of filters in MonitoringIndexNameResolver and fix tests

Original commit: elastic/x-pack-elasticsearch@e901347de9
This commit is contained in:
Tanguy Leroux 2016-08-30 10:10:08 +02:00
parent 203ad03d26
commit d3dff6659b
2 changed files with 4 additions and 3 deletions

View File

@ -23,6 +23,7 @@ import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter; import org.joda.time.format.DateTimeFormatter;
import java.io.IOException; import java.io.IOException;
import java.util.Collections;
import java.util.Locale; import java.util.Locale;
import java.util.Set; import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
@ -108,11 +109,11 @@ public abstract class MonitoringIndexNameResolver<T extends MonitoringDoc> {
/** /**
* @return the filters used when rendering the document. * @return the filters used when rendering the document.
* If null or empty, no filtering is applied. * If empty, no filtering is applied.
*/ */
public Set<String> filters() { public Set<String> filters() {
// No filtering by default // No filtering by default
return null; return Collections.emptySet();
} }
protected abstract void buildXContent(T document, XContentBuilder builder, ToXContent.Params params) throws IOException; protected abstract void buildXContent(T document, XContentBuilder builder, ToXContent.Params params) throws IOException;

View File

@ -161,7 +161,7 @@ public abstract class MonitoringIndexNameResolverTestCase<M extends MonitoringDo
}; };
assertThat("source must contains default fields", sourceFields.keySet(), hasItems(commons)); assertThat("source must contains default fields", sourceFields.keySet(), hasItems(commons));
if (fields != null) { if (fields != null && fields.isEmpty() == false) {
for (String field : fields) { for (String field : fields) {
assertSourceField(field, sourceFields); assertSourceField(field, sourceFields);
} }