jdk/test/javax/management/MBeanInfo/TooManyFooTest.java
author ykantser
Thu, 07 May 2015 09:11:49 +0200
changeset 30376 2ccf2cf7ea48
parent 5506 202f599c92aa
child 44423 306c020eb154
permissions -rw-r--r--
8078896: Add @modules as needed to the jdk_svc tests Reviewed-by: alanb, mchung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
30376
2ccf2cf7ea48 8078896: Add @modules as needed to the jdk_svc tests
ykantser
parents: 5506
diff changeset
     2
 * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
 * @test
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
 * @bug 6398884
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 * @summary Test that a method inherited from two different interfaces
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 *          appears only once in MBeanInfo.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * @author dfuchs
30376
2ccf2cf7ea48 8078896: Add @modules as needed to the jdk_svc tests
ykantser
parents: 5506
diff changeset
    30
 * @modules java.management
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * @run clean TooManyFooTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * @run build TooManyFooTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * @run main TooManyFooTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.lang.management.ManagementFactory;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import java.lang.reflect.Method;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import java.util.Arrays;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import java.util.HashMap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import java.util.HashSet;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import java.util.Map;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import java.util.Set;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
import java.util.logging.Logger;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
import javax.management.Descriptor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
import javax.management.MBeanInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
import javax.management.MBeanOperationInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
import javax.management.MBeanServer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
import javax.management.ObjectName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
import javax.management.StandardMBean;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
import javax.management.openmbean.OpenMBeanOperationInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * Class TooManyFooTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * @author Sun Microsystems, 2005 - All rights reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
public class TooManyFooTest {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * A logger for this class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     **/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    private static final Logger LOG =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
            Logger.getLogger(TooManyFooTest.class.getName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    public static class NumberHolder {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        public Integer getNumber() { return 0;}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
        public void setNumber(Integer n) {};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    public static class MyNumberHolder extends NumberHolder {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    public interface Parent1 {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        public int foo(); // Both in Parent1 and Parent2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        public Integer barfoo(); // Subtype in Parent1, Super type in Parent2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        public Long    foobar(); // Subtype in Parent1 & MBean, Super type in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
                                 // Parent2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        public Number  toofoo(); // Subtype in Parent1, Super type in Parent2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
                                 // Concrete type in MBean
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        public Object toofoofoo(); // Super type in Parent1, Subtype in Parent2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        public NumberHolder toobarbar(); // toofoofoo reversed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    public interface Parent2 {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        public int foo(); // Both in Parent1 and Parent2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        public Number barfoo();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        public Number foobar();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        public Object toofoo();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        public NumberHolder  toofoofoo();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        public Object toobarbar();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    public interface ChildMBean extends Parent1, Parent2 {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        public Long foobar();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        public Long toofoo();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    public interface ChildMXBean extends Parent1, Parent2 {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        public Long foobar();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        public Long toofoo();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    public interface ChildMixMXBean extends ChildMBean, ChildMXBean {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    public static class Child implements ChildMBean {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        public int foo() {return 0;}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        public Long foobar() {return 0L;}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        public Long toofoo() {return 0L;}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        public Integer barfoo() {return 0;}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        public MyNumberHolder toofoofoo() { return null;}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        public MyNumberHolder toobarbar() { return null;}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    public static class ChildMix implements ChildMXBean {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        public int foo() {return 0;}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        public Long foobar() {return 0L;}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        public Long toofoo() {return 0L;}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        public Integer barfoo() {return 0;}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        public MyNumberHolder toofoofoo() { return null;}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        public MyNumberHolder toobarbar() { return null;}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    public static class ChildMixMix extends Child implements ChildMixMXBean {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    /** Creates a new instance of TooManyFooTest */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    public TooManyFooTest() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    private static final int OPCOUNT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    private static final Map<String,String> EXPECTED_TYPES;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    private static final String[][] type_array = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        { "foo", int.class.getName() },
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        { "foobar", Long.class.getName()},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        { "toofoo", Long.class.getName()},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        { "barfoo", Integer.class.getName()},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        { "toofoofoo", NumberHolder.class.getName()},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        { "toobarbar", NumberHolder.class.getName()},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
            final Set<String> declared = new HashSet<String>();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
            for (Method m:Child.class.getDeclaredMethods()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
                declared.add(m.getName()+Arrays.asList(m.getParameterTypes()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
            final Set<String> exposed = new HashSet<String>();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            for (Method m:ChildMBean.class.getMethods()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
                exposed.add(m.getName()+Arrays.asList(m.getParameterTypes()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
            declared.retainAll(exposed);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
            OPCOUNT = declared.size();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            EXPECTED_TYPES = new HashMap<String,String>();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            for (String[] st:type_array) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
                EXPECTED_TYPES.put(st[0],st[1]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        } catch (Exception x) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
            throw new ExceptionInInitializerError(x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    private static void test(Object child, String name, boolean mxbean)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        final ObjectName childName =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                new ObjectName("test:type=Child,name="+name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        final MBeanServer server =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
                ManagementFactory.getPlatformMBeanServer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        server.registerMBean(child,childName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
            final MBeanInfo info = server.getMBeanInfo(childName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
            System.out.println(name+": " + info.getDescriptor());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
            final int len = info.getOperations().length;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
            if (len == OPCOUNT) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
                System.out.println(name+": OK, only "+OPCOUNT+
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
                        " operations here...");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
                final String qual = (len>OPCOUNT)?"many":"few";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                System.err.println(name+": Too "+qual+" foos! Found "+
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                        len+", expected "+OPCOUNT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                for (MBeanOperationInfo op : info.getOperations()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
                    System.err.println("public "+op.getReturnType()+" "+
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                            op.getName()+"();");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
                throw new RuntimeException("Too " + qual +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
                        " foos for "+name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
            final Descriptor d = info.getDescriptor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
            final String mxstr = String.valueOf(d.getFieldValue("mxbean"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
            final boolean mxb =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
                    (mxstr==null)?false:Boolean.valueOf(mxstr).booleanValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
            System.out.println(name+": mxbean="+mxb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
            if (mxbean && !mxb)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
                throw new AssertionError("MXBean is not OpenMBean?");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
            for (MBeanOperationInfo mboi : info.getOperations()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
                // Sanity check
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
                if (mxbean && !mboi.getName().equals("foo")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
                    // The spec doesn't guarantee that the MBeanOperationInfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
                    // of an MXBean will be an OpenMBeanOperationInfo, and in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
                    // some circumstances in our implementation it will not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
                    // However, in thsi tests, for all methods but foo(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
                    // it should.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
                    //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                    if (!(mboi instanceof OpenMBeanOperationInfo))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
                        throw new AssertionError("Operation "+mboi.getName()+
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
                                "() is not Open?");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
                final String exp = EXPECTED_TYPES.get(mboi.getName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
                // For MXBeans, we need to compare 'exp' with the original
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
                // type - because mboi.getReturnType() returns the OpenType
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
                //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
                String type = (String)mboi.getDescriptor().
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
                            getFieldValue("originalType");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                if (type == null) type = mboi.getReturnType();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
                if (type.equals(exp)) continue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
                System.err.println("Bad return type for "+
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
                        mboi.getName()+"! Found "+type+
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
                        ", expected "+exp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
                throw new RuntimeException("Bad return type for "+
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
                        mboi.getName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        } finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
            server.unregisterMBean(childName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    public static void main(String[] args) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        final Child child = new Child();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        test(child,"Child[MBean]",false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        final ChildMix childx = new ChildMix();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        test(childx,"ChildMix[MXBean]",true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        final ChildMixMix childmx = new ChildMixMix();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        test(childmx,"ChildMixMix[MXBean]",false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        final StandardMBean schild = new StandardMBean(child,ChildMBean.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        test(schild,"Child[StandarMBean(Child)]",false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        final StandardMBean schildx =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
                new StandardMBean(childx,ChildMXBean.class,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
        test(schildx,"ChildMix[StandarMXBean(ChildMix)]",true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
        final StandardMBean schildmx =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
                new StandardMBean(childmx,ChildMixMXBean.class,true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        test(schildmx,"ChildMixMix[StandarMXBean(ChildMixMix)]",true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
}