< prev index next >

test/jdk/sun/management/jmxremote/bootstrap/AbstractFilePermissionTest.java

Print this page
rev 59104 : imported patch serviceability


  78             } catch (Exception ex) {
  79                 System.out.println("WARNING: " + path.toFile().getAbsolutePath() + " already exists - unable to remove old copy");
  80                 ex.printStackTrace();
  81             }
  82         }
  83 
  84         try (BufferedWriter bw = Files.newBufferedWriter(path, Charset.defaultCharset())) {
  85             for (String str : content) {
  86                 bw.write(str, 0, str.length());
  87                 bw.newLine();
  88             }
  89         }
  90     }
  91 
  92     public boolean skipTest() {
  93         if ((TEST_CLASSES == null) || ("".equals(TEST_CLASSES))) {
  94             System.out.println("Test is designed to be run from jtreg only");
  95             return true;
  96         }
  97 
  98         if (!Platform.isLinux() && !Platform.isSolaris()) {
  99             System.out.println("Test not designed to run on this operating system, skipping...");
 100             return true;
 101         }
 102         return false;
 103     }
 104 
 105     protected abstract void testSetup() throws IOException;
 106 
 107     public void runTest(String[] args) throws Exception {
 108 
 109         if (skipTest()) {
 110             return;
 111         }
 112 
 113         Files.deleteIfExists(mgmt);
 114         Files.deleteIfExists(file2PermissionTest);
 115         libDir.toFile().mkdir();
 116 
 117         testSetup();
 118 




  78             } catch (Exception ex) {
  79                 System.out.println("WARNING: " + path.toFile().getAbsolutePath() + " already exists - unable to remove old copy");
  80                 ex.printStackTrace();
  81             }
  82         }
  83 
  84         try (BufferedWriter bw = Files.newBufferedWriter(path, Charset.defaultCharset())) {
  85             for (String str : content) {
  86                 bw.write(str, 0, str.length());
  87                 bw.newLine();
  88             }
  89         }
  90     }
  91 
  92     public boolean skipTest() {
  93         if ((TEST_CLASSES == null) || ("".equals(TEST_CLASSES))) {
  94             System.out.println("Test is designed to be run from jtreg only");
  95             return true;
  96         }
  97 
  98         if (!Platform.isLinux()) {
  99             System.out.println("Test not designed to run on this operating system, skipping...");
 100             return true;
 101         }
 102         return false;
 103     }
 104 
 105     protected abstract void testSetup() throws IOException;
 106 
 107     public void runTest(String[] args) throws Exception {
 108 
 109         if (skipTest()) {
 110             return;
 111         }
 112 
 113         Files.deleteIfExists(mgmt);
 114         Files.deleteIfExists(file2PermissionTest);
 115         libDir.toFile().mkdir();
 116 
 117         testSetup();
 118 


< prev index next >