< prev index next >

test/jdk/jdk/jfr/api/recording/destination/TestDestLongPath.java

Print this page
rev 51054 : imported patch 9000013-aixDisableJFR-requires.patch


  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.jfr.api.recording.destination;
  27 
  28 import java.nio.file.Files;
  29 import java.nio.file.Path;
  30 import java.nio.file.Paths;
  31 import java.util.List;
  32 
  33 import jdk.jfr.Recording;
  34 import jdk.jfr.consumer.RecordedEvent;
  35 import jdk.jfr.consumer.RecordingFile;
  36 import jdk.test.lib.Asserts;
  37 import jdk.test.lib.jfr.EventNames;
  38 import jdk.test.lib.jfr.FileHelper;
  39 
  40 /*
  41  * @test
  42  * @summary Set destination to a long path
  43  * @key jfr

  44  * @library /test/lib
  45  * @run main/othervm jdk.jfr.api.recording.destination.TestDestLongPath
  46  */
  47 public class TestDestLongPath {
  48 
  49     public static void main(String[] args) throws Throwable {
  50         Path dir = FileHelper.createLongDir(Paths.get("."));
  51         Path dest = Paths.get(dir.toString(), "my.jfr");
  52         Recording r = new Recording();
  53         r.enable(EventNames.OSInformation);
  54         r.setToDisk(true);
  55         r.setDestination(dest);
  56         r.start();
  57         r.stop();
  58         r.close();
  59         Asserts.assertTrue(Files.exists(dest), "No recording file: " + dest);
  60         List<RecordedEvent> events = RecordingFile.readAllEvents(dest);
  61         Asserts.assertFalse(events.isEmpty(), "No event found");
  62         System.out.printf("Found event %s%n", events.get(0).getEventType().getName());
  63     }


  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package jdk.jfr.api.recording.destination;
  27 
  28 import java.nio.file.Files;
  29 import java.nio.file.Path;
  30 import java.nio.file.Paths;
  31 import java.util.List;
  32 
  33 import jdk.jfr.Recording;
  34 import jdk.jfr.consumer.RecordedEvent;
  35 import jdk.jfr.consumer.RecordingFile;
  36 import jdk.test.lib.Asserts;
  37 import jdk.test.lib.jfr.EventNames;
  38 import jdk.test.lib.jfr.FileHelper;
  39 
  40 /**
  41  * @test
  42  * @summary Set destination to a long path
  43  * @key jfr
  44  * @requires vm.hasJFR
  45  * @library /test/lib
  46  * @run main/othervm jdk.jfr.api.recording.destination.TestDestLongPath
  47  */
  48 public class TestDestLongPath {
  49 
  50     public static void main(String[] args) throws Throwable {
  51         Path dir = FileHelper.createLongDir(Paths.get("."));
  52         Path dest = Paths.get(dir.toString(), "my.jfr");
  53         Recording r = new Recording();
  54         r.enable(EventNames.OSInformation);
  55         r.setToDisk(true);
  56         r.setDestination(dest);
  57         r.start();
  58         r.stop();
  59         r.close();
  60         Asserts.assertTrue(Files.exists(dest), "No recording file: " + dest);
  61         List<RecordedEvent> events = RecordingFile.readAllEvents(dest);
  62         Asserts.assertFalse(events.isEmpty(), "No event found");
  63         System.out.printf("Found event %s%n", events.get(0).getEventType().getName());
  64     }
< prev index next >