|
1 /* |
|
2 * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. |
|
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 * |
|
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
20 * CA 95054 USA or visit www.sun.com if you need additional information or |
|
21 * have any questions. |
|
22 */ |
|
23 |
|
24 /* |
|
25 * |
|
26 * @test EventWithNamespaceControlTest.java |
|
27 * @summary Check -Djmx.remote.use.event.service=true and |
|
28 * -Djmx.remote.delegate.event.service |
|
29 * @author Daniel Fuchs |
|
30 * @run clean EventWithNamespaceTest EventWithNamespaceControlTest |
|
31 * Wombat WombatMBean JMXRemoteTargetNamespace |
|
32 * NamespaceController NamespaceControllerMBean |
|
33 * @compile -XDignore.symbol.file=true EventWithNamespaceTest.java |
|
34 EventWithNamespaceControlTest.java |
|
35 * Wombat.java WombatMBean.java JMXRemoteTargetNamespace.java |
|
36 * NamespaceController.java NamespaceControllerMBean.java |
|
37 * @run main/othervm -Djmx.remote.use.event.service=true EventWithNamespaceControlTest |
|
38 * @run main/othervm EventWithNamespaceControlTest |
|
39 * @run main/othervm -Djmx.remote.delegate.event.service=false EventWithNamespaceControlTest java.lang.UnsupportedOperationException |
|
40 */ |
|
41 |
|
42 import java.util.Collections; |
|
43 import java.util.Map; |
|
44 import java.util.logging.Logger; |
|
45 import javax.management.RuntimeOperationsException; |
|
46 |
|
47 /** |
|
48 * |
|
49 * @author Sun Microsystems, Inc. |
|
50 */ |
|
51 public class EventWithNamespaceControlTest extends EventWithNamespaceTest { |
|
52 |
|
53 /** |
|
54 * A logger for this class. |
|
55 **/ |
|
56 private static final Logger LOG = |
|
57 Logger.getLogger(EventWithNamespaceControlTest.class.getName()); |
|
58 |
|
59 /** Creates a new instance of EventWithNamespaceTest */ |
|
60 public EventWithNamespaceControlTest() { |
|
61 } |
|
62 |
|
63 |
|
64 |
|
65 public static void main(String[] args) { |
|
66 final EventWithNamespaceControlTest test = |
|
67 new EventWithNamespaceControlTest(); |
|
68 if (args.length == 0) { |
|
69 test.run(args); |
|
70 System.out.println("Test successfully passed"); |
|
71 } else { |
|
72 try { |
|
73 test.run(args); |
|
74 throw new RuntimeException("Test should have failed."); |
|
75 } catch (RuntimeOperationsException x) { |
|
76 if (! args[0].equals(x.getCause().getClass().getName())) { |
|
77 System.err.println("Unexpected wrapped exception: "+ |
|
78 x.getCause()); |
|
79 throw x; |
|
80 } else { |
|
81 System.out.println("Got expected exception: "+x.getCause()); |
|
82 } |
|
83 } |
|
84 } |
|
85 } |
|
86 |
|
87 public Map<String, ?> getServerMap() { |
|
88 Map<String, ?> retValue = Collections.emptyMap(); |
|
89 return retValue; |
|
90 } |
|
91 |
|
92 } |