private String[] randomIndicesOrAliases() { int count = randomIntBetween(1, indices.size() * 2); // every index has an alias String[] indices = new String[count]; for (int i = 0; i < count; i++) { indices[i] = randomIndexOrAlias(); } return indices; }
private static void assertIndicesSubset(List<String> indices, String... actions) { // indices returned by each bulk shard request need to be a subset of the original indices for (String action : actions) { List<TransportRequest> requests = consumeTransportRequests(action); assertThat( "no internal requests intercepted for action [" + action + "]", requests.size(), greaterThan(0)); for (TransportRequest internalRequest : requests) { assertThat(internalRequest, instanceOf(IndicesRequest.class)); for (String index : ((IndicesRequest) internalRequest).indices()) { assertThat(indices, hasItem(index)); } } } }
private static void assertSameIndices( IndicesRequest originalRequest, boolean optional, String... actions) { for (String action : actions) { List<TransportRequest> requests = consumeTransportRequests(action); if (!optional) { assertThat( "no internal requests intercepted for action [" + action + "]", requests.size(), greaterThan(0)); } for (TransportRequest internalRequest : requests) { assertThat(internalRequest, instanceOf(IndicesRequest.class)); assertThat( internalRequest.getClass().getName(), ((IndicesRequest) internalRequest).indices(), equalTo(originalRequest.indices())); assertThat( ((IndicesRequest) internalRequest).indicesOptions(), equalTo(originalRequest.indicesOptions())); } } }