Search in sources :

Example 1 with ShardShuffler

use of org.elasticsearch.cluster.routing.ShardShuffler in project elasticsearch by elastic.

the class RoutingIteratorTests method testEmptyIterator.

public void testEmptyIterator() {
    ShardShuffler shuffler = new RotationShardShuffler(0);
    ShardIterator shardIterator = new PlainShardIterator(new ShardId("test1", "_na_", 0), shuffler.shuffle(Collections.<ShardRouting>emptyList()));
    assertThat(shardIterator.remaining(), equalTo(0));
    assertThat(shardIterator.nextOrNull(), nullValue());
    assertThat(shardIterator.remaining(), equalTo(0));
    assertThat(shardIterator.nextOrNull(), nullValue());
    assertThat(shardIterator.remaining(), equalTo(0));
    shardIterator = new PlainShardIterator(new ShardId("test1", "_na_", 0), shuffler.shuffle(Collections.<ShardRouting>emptyList()));
    assertThat(shardIterator.remaining(), equalTo(0));
    assertThat(shardIterator.nextOrNull(), nullValue());
    assertThat(shardIterator.remaining(), equalTo(0));
    assertThat(shardIterator.nextOrNull(), nullValue());
    assertThat(shardIterator.remaining(), equalTo(0));
    shardIterator = new PlainShardIterator(new ShardId("test1", "_na_", 0), shuffler.shuffle(Collections.<ShardRouting>emptyList()));
    assertThat(shardIterator.remaining(), equalTo(0));
    assertThat(shardIterator.nextOrNull(), nullValue());
    assertThat(shardIterator.remaining(), equalTo(0));
    assertThat(shardIterator.nextOrNull(), nullValue());
    assertThat(shardIterator.remaining(), equalTo(0));
    shardIterator = new PlainShardIterator(new ShardId("test1", "_na_", 0), shuffler.shuffle(Collections.<ShardRouting>emptyList()));
    assertThat(shardIterator.remaining(), equalTo(0));
    assertThat(shardIterator.nextOrNull(), nullValue());
    assertThat(shardIterator.remaining(), equalTo(0));
    assertThat(shardIterator.nextOrNull(), nullValue());
    assertThat(shardIterator.remaining(), equalTo(0));
}
Also used : ShardId(org.elasticsearch.index.shard.ShardId) RotationShardShuffler(org.elasticsearch.cluster.routing.RotationShardShuffler) PlainShardIterator(org.elasticsearch.cluster.routing.PlainShardIterator) ShardIterator(org.elasticsearch.cluster.routing.ShardIterator) PlainShardIterator(org.elasticsearch.cluster.routing.PlainShardIterator) RotationShardShuffler(org.elasticsearch.cluster.routing.RotationShardShuffler) ShardShuffler(org.elasticsearch.cluster.routing.ShardShuffler) ShardRouting(org.elasticsearch.cluster.routing.ShardRouting)

Aggregations

PlainShardIterator (org.elasticsearch.cluster.routing.PlainShardIterator)1 RotationShardShuffler (org.elasticsearch.cluster.routing.RotationShardShuffler)1 ShardIterator (org.elasticsearch.cluster.routing.ShardIterator)1 ShardRouting (org.elasticsearch.cluster.routing.ShardRouting)1 ShardShuffler (org.elasticsearch.cluster.routing.ShardShuffler)1 ShardId (org.elasticsearch.index.shard.ShardId)1