summaryrefslogtreecommitdiff
path: root/core/src/test/java/org/elasticsearch
diff options
context:
space:
mode:
authorBoaz Leskes <b.leskes@gmail.com>2017-06-22 23:37:08 +0200
committerBoaz Leskes <b.leskes@gmail.com>2017-06-22 23:37:08 +0200
commitd20cd6afcbad3244d899af33e501baad1cb946d6 (patch)
treeadfffde686a3fe17d212edd91a2531b0417379c1 /core/src/test/java/org/elasticsearch
parentfb8c767737dc50e3bdd151975d3aa38a854c31ee (diff)
ESIndexLevelReplicationTestCase.ReplicationAction#execute should send exceptions to it's listener rather than bubble them up
This is how TRA works as well.
Diffstat (limited to 'core/src/test/java/org/elasticsearch')
-rw-r--r--core/src/test/java/org/elasticsearch/index/replication/ESIndexLevelReplicationTestCase.java52
1 files changed, 28 insertions, 24 deletions
diff --git a/core/src/test/java/org/elasticsearch/index/replication/ESIndexLevelReplicationTestCase.java b/core/src/test/java/org/elasticsearch/index/replication/ESIndexLevelReplicationTestCase.java
index 87bfdc1c9d..e7518bd594 100644
--- a/core/src/test/java/org/elasticsearch/index/replication/ESIndexLevelReplicationTestCase.java
+++ b/core/src/test/java/org/elasticsearch/index/replication/ESIndexLevelReplicationTestCase.java
@@ -421,36 +421,40 @@ public abstract class ESIndexLevelReplicationTestCase extends IndexShardTestCase
this.opType = opType;
}
- public void execute() throws Exception {
- new ReplicationOperation<Request, ReplicaRequest, PrimaryResult>(request, new PrimaryRef(),
- new ActionListener<PrimaryResult>() {
+ public void execute() {
+ try {
+ new ReplicationOperation<Request, ReplicaRequest, PrimaryResult>(request, new PrimaryRef(),
+ new ActionListener<PrimaryResult>() {
+ @Override
+ public void onResponse(PrimaryResult result) {
+ result.respond(listener);
+ }
+
+ @Override
+ public void onFailure(Exception e) {
+ listener.onFailure(e);
+ }
+ }, new ReplicasRef(), () -> null, logger, opType) {
+
@Override
- public void onResponse(PrimaryResult result) {
- result.respond(listener);
+ protected List<ShardRouting> getShards(ShardId shardId, ClusterState state) {
+ return replicationGroup.shardRoutings();
}
@Override
- public void onFailure(Exception e) {
- listener.onFailure(e);
+ protected String checkActiveShardCount() {
+ return null;
}
- }, new ReplicasRef(), () -> null, logger, opType) {
- @Override
- protected List<ShardRouting> getShards(ShardId shardId, ClusterState state) {
- return replicationGroup.shardRoutings();
- }
-
- @Override
- protected String checkActiveShardCount() {
- return null;
- }
-
- @Override
- protected Set<String> getInSyncAllocationIds(ShardId shardId, ClusterState clusterState) {
- return replicationGroup.shardRoutings().stream().filter(ShardRouting::active).map(r -> r.allocationId().getId())
- .collect(Collectors.toSet());
- }
- }.execute();
+ @Override
+ protected Set<String> getInSyncAllocationIds(ShardId shardId, ClusterState clusterState) {
+ return replicationGroup.shardRoutings().stream().filter(ShardRouting::active).map(r -> r.allocationId().getId())
+ .collect(Collectors.toSet());
+ }
+ }.execute();
+ } catch (Exception e) {
+ listener.onFailure(e);
+ }
}
protected abstract PrimaryResult performOnPrimary(IndexShard primary, Request request) throws Exception;