adapt randomFrom to not use null as a first param, in preparation for https://github.com/elastic/elasticsearch/pull/19172
Original commit: elastic/x-pack-elasticsearch@50296d6cfc
This commit is contained in:
parent
8c54887ab8
commit
7c1bc0c8de
|
@ -109,16 +109,16 @@ public class IndicesAccessControlTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testMergeNotGrantedAndGranted() {
|
||||
final Set<String> notGrantedFields = randomFrom(null, Collections.<String>emptySet(), Collections.singleton("baz"));
|
||||
final Set<BytesReference> notGrantedQueries = randomFrom(null, Collections.<BytesReference>emptySet(),
|
||||
final Set<String> notGrantedFields = randomFrom(Collections.<String>emptySet(), Collections.singleton("baz"), null);
|
||||
final Set<BytesReference> notGrantedQueries = randomFrom(Collections.<BytesReference>emptySet(), null,
|
||||
Collections.<BytesReference>singleton(new BytesArray(new byte[] { randomByte() })));
|
||||
final IndexAccessControl indexAccessControl = new IndexAccessControl(false, notGrantedFields, notGrantedQueries);
|
||||
|
||||
final BytesReference query1 = new BytesArray(new byte[] { 0x1 });
|
||||
final Set<String> fields =
|
||||
randomFrom(null, Collections.singleton("foo"), Sets.newHashSet("foo", "bar"), Collections.<String>emptySet());
|
||||
randomFrom(Collections.singleton("foo"), Sets.newHashSet("foo", "bar"), Collections.<String>emptySet(), null);
|
||||
final Set<BytesReference> queries =
|
||||
randomFrom(null, Collections.singleton(query1), Collections.<BytesReference>emptySet());
|
||||
randomFrom(Collections.singleton(query1), Collections.<BytesReference>emptySet(), null);
|
||||
final IndexAccessControl other = new IndexAccessControl(true, fields, queries);
|
||||
|
||||
IndexAccessControl merged = indexAccessControl.merge(other);
|
||||
|
@ -133,16 +133,16 @@ public class IndicesAccessControlTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testMergeNotGranted() {
|
||||
final Set<String> notGrantedFields = randomFrom(null, Collections.<String>emptySet(), Collections.singleton("baz"));
|
||||
final Set<BytesReference> notGrantedQueries = randomFrom(null, Collections.<BytesReference>emptySet(),
|
||||
final Set<String> notGrantedFields = randomFrom(Collections.<String>emptySet(), Collections.singleton("baz"), null);
|
||||
final Set<BytesReference> notGrantedQueries = randomFrom(Collections.<BytesReference>emptySet(), null,
|
||||
Collections.<BytesReference>singleton(new BytesArray(new byte[] { randomByte() })));
|
||||
final IndexAccessControl indexAccessControl = new IndexAccessControl(false, notGrantedFields, notGrantedQueries);
|
||||
|
||||
final BytesReference query1 = new BytesArray(new byte[] { 0x1 });
|
||||
final Set<String> fields =
|
||||
randomFrom(null, Collections.singleton("foo"), Sets.newHashSet("foo", "bar"), Collections.<String>emptySet());
|
||||
randomFrom(Collections.singleton("foo"), Sets.newHashSet("foo", "bar"), Collections.<String>emptySet(), null);
|
||||
final Set<BytesReference> queries =
|
||||
randomFrom(null, Collections.singleton(query1), Collections.<BytesReference>emptySet());
|
||||
randomFrom(Collections.singleton(query1), Collections.<BytesReference>emptySet(), null);
|
||||
final IndexAccessControl other = new IndexAccessControl(false, fields, queries);
|
||||
|
||||
IndexAccessControl merged = indexAccessControl.merge(other);
|
||||
|
|
|
@ -65,7 +65,7 @@ public class IndexActionTests extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testIndexActionExecuteSingleDoc() throws Exception {
|
||||
String timestampField = randomFrom(null, "@timestamp");
|
||||
String timestampField = randomFrom("@timestamp", null);
|
||||
boolean customTimestampField = timestampField != null;
|
||||
|
||||
IndexAction action = new IndexAction("test-index", "test-type", timestampField, null, null);
|
||||
|
@ -117,7 +117,7 @@ public class IndexActionTests extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testIndexActionExecuteMultiDoc() throws Exception {
|
||||
String timestampField = randomFrom(null, "@timestamp");
|
||||
String timestampField = randomFrom("@timestamp", null);
|
||||
boolean customTimestampField = "@timestamp".equals(timestampField);
|
||||
|
||||
assertAcked(prepareCreate("test-index")
|
||||
|
|
Loading…
Reference in New Issue