Skip to content

Commit cf203de

Browse files
committed
refactoring getter/setters for package action.admin.cluster.reroute #2657
1 parent 78f0589 commit cf203de

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

src/main/java/org/elasticsearch/action/admin/cluster/reroute/ClusterRerouteResponse.java

-4
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ public class ClusterRerouteResponse extends ActionResponse {
4040
this.state = state;
4141
}
4242

43-
public ClusterState state() {
44-
return this.state;
45-
}
46-
4743
public ClusterState getState() {
4844
return this.state;
4945
}

src/main/java/org/elasticsearch/rest/action/admin/cluster/reroute/RestClusterRerouteAction.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public void onResponse(ClusterRerouteResponse response) {
7777
if (request.param("filter_metadata") == null) {
7878
request.params().put("filter_metadata", "true");
7979
}
80-
response.state().settingsFilter(settingsFilter).toXContent(builder, request);
80+
response.getState().settingsFilter(settingsFilter).toXContent(builder, request);
8181
builder.endObject();
8282

8383
builder.endObject();

src/test/java/org/elasticsearch/test/integration/cluster/allocation/ClusterRerouteTests.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public void rerouteWithCommands() throws Exception {
7979
state = client("node1").admin().cluster().prepareReroute()
8080
.add(new AllocateAllocationCommand(new ShardId("test", 0), "node1", true))
8181
.setDryRun(true)
82-
.execute().actionGet().state();
82+
.execute().actionGet().getState();
8383
assertThat(state.routingNodes().unassigned().size(), equalTo(1));
8484
assertThat(state.routingNodes().node(state.nodes().resolveNode("node1").id()).shards().get(0).state(), equalTo(ShardRoutingState.INITIALIZING));
8585

@@ -90,7 +90,7 @@ public void rerouteWithCommands() throws Exception {
9090
logger.info("--> explicitly allocate shard 1, actually allocating, no dry run");
9191
state = client("node1").admin().cluster().prepareReroute()
9292
.add(new AllocateAllocationCommand(new ShardId("test", 0), "node1", true))
93-
.execute().actionGet().state();
93+
.execute().actionGet().getState();
9494
assertThat(state.routingNodes().unassigned().size(), equalTo(1));
9595
assertThat(state.routingNodes().node(state.nodes().resolveNode("node1").id()).shards().get(0).state(), equalTo(ShardRoutingState.INITIALIZING));
9696

@@ -105,7 +105,7 @@ public void rerouteWithCommands() throws Exception {
105105
logger.info("--> move shard 1 primary from node1 to node2");
106106
state = client("node1").admin().cluster().prepareReroute()
107107
.add(new MoveAllocationCommand(new ShardId("test", 0), "node1", "node2"))
108-
.execute().actionGet().state();
108+
.execute().actionGet().getState();
109109

110110
assertThat(state.routingNodes().node(state.nodes().resolveNode("node1").id()).shards().get(0).state(), equalTo(ShardRoutingState.RELOCATING));
111111
assertThat(state.routingNodes().node(state.nodes().resolveNode("node2").id()).shards().get(0).state(), equalTo(ShardRoutingState.INITIALIZING));
@@ -149,7 +149,7 @@ public void rerouteWithAllocateLocalGateway() throws Exception {
149149
logger.info("--> explicitly allocate shard 1, actually allocating, no dry run");
150150
state = client("node1").admin().cluster().prepareReroute()
151151
.add(new AllocateAllocationCommand(new ShardId("test", 0), "node1", true))
152-
.execute().actionGet().state();
152+
.execute().actionGet().getState();
153153
assertThat(state.routingNodes().unassigned().size(), equalTo(1));
154154
assertThat(state.routingNodes().node(state.nodes().resolveNode("node1").id()).shards().get(0).state(), equalTo(ShardRoutingState.INITIALIZING));
155155

0 commit comments

Comments
 (0)