0N/A/*
1472N/A * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
0N/A/**
0N/A * @test * @bug 0000000
0N/A * @summary This is just an exercise of various JDI elements for use in
0N/A * testing the SA/JDI client
0N/A *
0N/A * @author jjh
0N/A *
0N/A * @run build TestScaffold VMConnection TargetListener TargetAdapter sagdoit
0N/A * @run compile -g -source 1.5 sagtarg.java
0N/A * @run main sagtest
0N/A */
0N/Aimport com.sun.jdi.*;
0N/Aimport com.sun.jdi.event.*;
0N/Aimport com.sun.jdi.request.*;
0N/A
0N/Aimport java.util.*;
0N/A
0N/A /********** target program **********/
0N/A
0N/A// The target program is sagtarg.java
0N/A
0N/A /********** test program **********/
0N/A
0N/Apublic class sagtest extends TestScaffold {
0N/A ReferenceType targetClass;
0N/A ThreadReference mainThread;
0N/A
0N/A sagtest (String args[]) {
0N/A super(args);
0N/A }
0N/A
0N/A public static void main(String[] args) throws Exception {
0N/A new sagtest(args).startTests();
0N/A }
0N/A
0N/A /********** event handlers **********/
0N/A
0N/A
0N/A /********** test core **********/
0N/A
0N/A protected void runTests() throws Exception {
0N/A /*
0N/A * Get to the top of main()
0N/A * to determine targetClass and mainThread
0N/A */
0N/A BreakpointEvent bpe = startToMain("sagtarg");
0N/A targetClass = bpe.location().declaringType();
0N/A mainThread = bpe.thread();
0N/A EventRequestManager erm = vm().eventRequestManager();
0N/A stepOverLine(mainThread); //stop on 18
0N/A stepOverLine(mainThread); //stop on 19
0N/A stepOverLine(mainThread); //stop on 20
0N/A stepOverLine(mainThread); //stop on 21
0N/A stepOverLine(mainThread); //stop on 22
0N/A
0N/A sagdoit mine = new sagdoit(vm());
0N/A mine.doAll();
0N/A
0N/A if (!testFailed) {
0N/A println("sagtest: passed");
0N/A } else {
0N/A throw new Exception("sagtest: failed");
0N/A }
0N/A }
0N/A}