Skip to content

Commit 9f42dd1

Browse files
committed
iter
1 parent bf8876c commit 9f42dd1

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

x-pack/plugin/ccr/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ archivesBaseName = 'x-pack-ccr'
1616

1717
integTest.enabled = false
1818

19+
compileJava.options.compilerArgs << "-Xlint:-try"
20+
1921
// Instead we create a separate task to run the
2022
// tests based on ESIntegTestCase
2123
task internalClusterTest(type: RandomizedTestingTask,

x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/ShardFollowTask.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public class ShardFollowTask implements PersistentTaskParams {
7979
this.maxChunkSize = maxChunkSize;
8080
this.numConcurrentChunks = numConcurrentChunks;
8181
this.processorMaxTranslogBytes = processorMaxTranslogBytes;
82-
this.headers = headers != null ? headers : Collections.emptyMap();
82+
this.headers = headers != null ? Collections.unmodifiableMap(headers) : Collections.emptyMap();
8383
}
8484

8585
public ShardFollowTask(StreamInput in) throws IOException {
@@ -89,7 +89,7 @@ public ShardFollowTask(StreamInput in) throws IOException {
8989
this.maxChunkSize = in.readVLong();
9090
this.numConcurrentChunks = in.readVInt();
9191
this.processorMaxTranslogBytes = in.readVLong();
92-
this.headers = in.readMap(StreamInput::readString, StreamInput::readString);
92+
this.headers = Collections.unmodifiableMap(in.readMap(StreamInput::readString, StreamInput::readString));
9393
}
9494

9595
public String getLeaderClusterAlias() {

x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/ShardFollowTasksExecutor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,6 @@ boolean shouldRetry(Exception e) {
374374

375375
}
376376

377-
@SuppressWarnings("try")
378377
static Client wrapClient(Client client, ShardFollowTask shardFollowTask) {
379378
if (shardFollowTask.getHeaders().isEmpty()) {
380379
return client;

x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/ShardFollowTaskTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import org.elasticsearch.common.xcontent.XContentParser;
1010
import org.elasticsearch.index.shard.ShardId;
1111
import org.elasticsearch.test.AbstractSerializingTestCase;
12-
import org.elasticsearch.test.RandomObjects;
1312

1413
import java.io.IOException;
1514
import java.util.Collections;

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/privilege/PrivilegeTests.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,13 @@ public void testSystem() throws Exception {
127127
assertThat(predicate.test("indices:admin/seq_no/global_checkpoint_sync[p]"), is(true));
128128
assertThat(predicate.test("indices:admin/seq_no/global_checkpoint_sync[r]"), is(true));
129129
}
130+
131+
public void testManageCcrPrivilege() {
132+
Predicate<String> predicate = ClusterPrivilege.MANAGE_CCR.predicate();
133+
assertThat(predicate.test("cluster:admin/xpack/ccr/follow_index"), is(true));
134+
assertThat(predicate.test("cluster:admin/xpack/ccr/unfollow_index"), is(true));
135+
assertThat(predicate.test("cluster:admin/xpack/ccr/brand_new_api"), is(true));
136+
assertThat(predicate.test("cluster:admin/xpack/whatever"), is(false));
137+
}
138+
130139
}

0 commit comments

Comments
 (0)