2222import java .nio .file .attribute .UserPrincipal ;
2323import java .util .Scanner ;
2424
25+ import static org .elasticsearch .entitlement .qa .test .EntitlementTest .ExpectedAccess .PLUGINS ;
26+
2527@ SuppressForbidden (reason = "Explicitly checking APIs that are forbidden" )
2628class FileCheckActions {
2729
@@ -43,38 +45,47 @@ private static Path readWriteFile() {
4345 return testRootDir .resolve ("read_write_file" );
4446 }
4547
48+ @ EntitlementTest (expectedAccess = PLUGINS )
4649 static void createScannerFile () throws FileNotFoundException {
4750 new Scanner (readFile ().toFile ());
4851 }
4952
53+ @ EntitlementTest (expectedAccess = PLUGINS )
5054 static void createScannerFileWithCharset () throws IOException {
5155 new Scanner (readFile ().toFile (), StandardCharsets .UTF_8 );
5256 }
5357
58+ @ EntitlementTest (expectedAccess = PLUGINS )
5459 static void createScannerFileWithCharsetName () throws FileNotFoundException {
5560 new Scanner (readFile ().toFile (), "UTF-8" );
5661 }
5762
63+ @ EntitlementTest (expectedAccess = PLUGINS )
5864 static void createFileOutputStreamString () throws IOException {
5965 new FileOutputStream (readWriteFile ().toString ()).close ();
6066 }
6167
68+ @ EntitlementTest (expectedAccess = PLUGINS )
6269 static void createFileOutputStreamStringWithAppend () throws IOException {
6370 new FileOutputStream (readWriteFile ().toString (), false ).close ();
6471 }
6572
73+ @ EntitlementTest (expectedAccess = PLUGINS )
6674 static void createFileOutputStreamFile () throws IOException {
6775 new FileOutputStream (readWriteFile ().toFile ()).close ();
6876 }
6977
78+ @ EntitlementTest (expectedAccess = PLUGINS )
7079 static void createFileOutputStreamFileWithAppend () throws IOException {
7180 new FileOutputStream (readWriteFile ().toFile (), false ).close ();
7281 }
7382
83+ @ EntitlementTest (expectedAccess = PLUGINS )
7484 static void filesProbeContentType () throws IOException {
7585 Files .probeContentType (readFile ());
7686 }
7787
88+ @ EntitlementTest (expectedAccess = PLUGINS )
7889 static void filesSetOwner () throws IOException {
7990 UserPrincipal owner = EntitledActions .getFileOwner (readWriteFile ());
8091 Files .setOwner (readWriteFile (), owner ); // set to existing owner, just trying to execute the method
0 commit comments