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