< prev index next >

test/jdk/com/sun/jdi/lib/jdb/JdbTest.java

Print this page




 221     // sets breakpoints in the class {@code launchOptions.debuggeeClass}
 222     // to the lines parsed by {@code parseBreakpoints}
 223     // from the file from test source directory specified by {@code launchOptions.sourceFilename}.
 224     // returns number of the breakpoints set.
 225     protected int setBreakpoints(int id) {
 226         verifySourceFilename();
 227         return setBreakpointsFromTestSource(launchOptions.sourceFilename, id);
 228     }
 229 
 230     // transforms class with the specified id (see {@code ClassTransformer})
 231     // and executes "redefine" jdb command for {@code launchOptions.debuggeeClass}.
 232     // returns reply for the command.
 233     protected List<String> redefineClass(int id, String... compilerOptions) {
 234         verifySourceFilename();
 235         String transformedClassFile = ClassTransformer.fromTestSource(launchOptions.sourceFilename)
 236                 .transform(id, launchOptions.debuggeeClass, compilerOptions);
 237         return jdb.command(JdbCommand.redefine(launchOptions.debuggeeClass, transformedClassFile));
 238     }
 239 
 240     // gets full test source path for the given test filename
 241     protected static String getTestSourcePath(String fileName) {
 242         return Paths.get(System.getProperty("test.src")).resolve(fileName).toString();
 243     }
 244 
 245     // verifies that sourceFilename is specified in ctor
 246     private void verifySourceFilename() {
 247         if (launchOptions.sourceFilename == null) {
 248             throw new RuntimeException("launchOptions.sourceFilename must be specified.");
 249         }
 250     }
 251 
 252     protected OutputAnalyzer execCommand(JdbCommand cmd) {
 253         List<String> reply = jdb.command(cmd);
 254         return new OutputAnalyzer(reply.stream().collect(Collectors.joining(lineSeparator)));
 255     }
 256 
 257     // helpers for "eval" jdb command.
 258     // executes "eval <expr>" and verifies output contains the specified text
 259     protected void evalShouldContain(String expr, String expectedString) {
 260         execCommand(JdbCommand.eval(expr))
 261                 .shouldContain(expectedString);


 221     // sets breakpoints in the class {@code launchOptions.debuggeeClass}
 222     // to the lines parsed by {@code parseBreakpoints}
 223     // from the file from test source directory specified by {@code launchOptions.sourceFilename}.
 224     // returns number of the breakpoints set.
 225     protected int setBreakpoints(int id) {
 226         verifySourceFilename();
 227         return setBreakpointsFromTestSource(launchOptions.sourceFilename, id);
 228     }
 229 
 230     // transforms class with the specified id (see {@code ClassTransformer})
 231     // and executes "redefine" jdb command for {@code launchOptions.debuggeeClass}.
 232     // returns reply for the command.
 233     protected List<String> redefineClass(int id, String... compilerOptions) {
 234         verifySourceFilename();
 235         String transformedClassFile = ClassTransformer.fromTestSource(launchOptions.sourceFilename)
 236                 .transform(id, launchOptions.debuggeeClass, compilerOptions);
 237         return jdb.command(JdbCommand.redefine(launchOptions.debuggeeClass, transformedClassFile));
 238     }
 239 
 240     // gets full test source path for the given test filename
 241     public static String getTestSourcePath(String fileName) {
 242         return Paths.get(System.getProperty("test.src")).resolve(fileName).toString();
 243     }
 244 
 245     // verifies that sourceFilename is specified in ctor
 246     private void verifySourceFilename() {
 247         if (launchOptions.sourceFilename == null) {
 248             throw new RuntimeException("launchOptions.sourceFilename must be specified.");
 249         }
 250     }
 251 
 252     protected OutputAnalyzer execCommand(JdbCommand cmd) {
 253         List<String> reply = jdb.command(cmd);
 254         return new OutputAnalyzer(reply.stream().collect(Collectors.joining(lineSeparator)));
 255     }
 256 
 257     // helpers for "eval" jdb command.
 258     // executes "eval <expr>" and verifies output contains the specified text
 259     protected void evalShouldContain(String expr, String expectedString) {
 260         execCommand(JdbCommand.eval(expr))
 261                 .shouldContain(expectedString);
< prev index next >