File tree Expand file tree Collapse file tree 5 files changed +13
-4
lines changed
main/java/org/elasticsearch/xpack/ccr/action
test/java/org/elasticsearch/xpack/ccr/action
core/src/test/java/org/elasticsearch/xpack/core/security/authz/privilege Expand file tree Collapse file tree 5 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ archivesBaseName = 'x-pack-ccr'
1616
1717integTest. 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
2123task internalClusterTest (type : RandomizedTestingTask ,
Original file line number Diff line number Diff 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 () {
Original file line number Diff line number Diff 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 ;
Original file line number Diff line number Diff line change 99import org .elasticsearch .common .xcontent .XContentParser ;
1010import org .elasticsearch .index .shard .ShardId ;
1111import org .elasticsearch .test .AbstractSerializingTestCase ;
12- import org .elasticsearch .test .RandomObjects ;
1312
1413import java .io .IOException ;
1514import java .util .Collections ;
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments