author | iignatyev |
Wed, 15 Mar 2017 22:48:59 -0700 | |
changeset 44423 | 306c020eb154 |
parent 30376 | 2ccf2cf7ea48 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
30376
2ccf2cf7ea48
8078896: Add @modules as needed to the jdk_svc tests
ykantser
parents:
24973
diff
changeset
|
2 |
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5506 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
2 | 22 |
*/ |
23 |
||
24 |
/** |
|
44423 | 25 |
* @test |
26 |
* @bug 4331872 |
|
27 |
* @summary erm.deleteEventRequests(erm.breakpointRequests()) throws exception |
|
28 |
* @author Robert Field |
|
2 | 29 |
* |
44423 | 30 |
* @run build TestScaffold VMConnection TargetListener TargetAdapter |
31 |
* @run compile -g DeleteEventRequestsTest.java |
|
32 |
* @run driver DeleteEventRequestsTest |
|
2 | 33 |
*/ |
34 |
import com.sun.jdi.*; |
|
35 |
import com.sun.jdi.event.*; |
|
36 |
import com.sun.jdi.request.*; |
|
37 |
||
38 |
import java.util.*; |
|
39 |
||
40 |
/********** target program **********/ |
|
41 |
||
42 |
class DeleteEventRequestsTarg { |
|
43 |
public static void main(String[] args){ |
|
44 |
System.out.println("Howdy!"); |
|
45 |
System.out.println("Goodbye from DeleteEventRequestsTarg!"); |
|
46 |
} |
|
47 |
} |
|
48 |
||
49 |
/********** test program **********/ |
|
50 |
||
51 |
public class DeleteEventRequestsTest extends TestScaffold { |
|
52 |
ReferenceType targetClass; |
|
53 |
ThreadReference mainThread; |
|
54 |
||
55 |
DeleteEventRequestsTest (String args[]) { |
|
56 |
super(args); |
|
57 |
} |
|
58 |
||
59 |
public static void main(String[] args) throws Exception { |
|
60 |
new DeleteEventRequestsTest(args).startTests(); |
|
61 |
} |
|
62 |
||
63 |
/********** event handlers **********/ |
|
64 |
||
65 |
public void stepCompleted(StepEvent event) { |
|
66 |
failure("Got StepEvent which was deleted"); |
|
67 |
} |
|
68 |
||
69 |
/********** test core **********/ |
|
70 |
||
71 |
protected void runTests() throws Exception { |
|
72 |
/* |
|
73 |
* Get to the top of main() |
|
74 |
* to determine targetClass and mainThread |
|
75 |
*/ |
|
76 |
BreakpointEvent bpe = startToMain("DeleteEventRequestsTarg"); |
|
77 |
targetClass = bpe.location().declaringType(); |
|
78 |
mainThread = bpe.thread(); |
|
79 |
EventRequestManager erm = vm().eventRequestManager(); |
|
80 |
||
81 |
/* |
|
82 |
* Set event requests |
|
83 |
*/ |
|
84 |
StepRequest request = erm.createStepRequest(mainThread, |
|
85 |
StepRequest.STEP_LINE, |
|
86 |
StepRequest.STEP_OVER); |
|
87 |
request.enable(); |
|
88 |
||
89 |
/* |
|
90 |
* This should not die with ConcurrentModificationException |
|
91 |
*/ |
|
92 |
erm.deleteEventRequests(erm.stepRequests()); |
|
93 |
||
94 |
/* |
|
95 |
* resume the target listening for events |
|
96 |
*/ |
|
97 |
listenUntilVMDisconnect(); |
|
98 |
||
99 |
/* |
|
100 |
* deal with results of test |
|
101 |
* if anything has called failure("foo") testFailed will be true |
|
102 |
*/ |
|
103 |
if (!testFailed) { |
|
104 |
println("DeleteEventRequestsTest: passed"); |
|
105 |
} else { |
|
106 |
throw new Exception("DeleteEventRequestsTest: failed"); |
|
107 |
} |
|
108 |
} |
|
109 |
} |