PreRegisterNameTest.java revision 2362
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6448042
* @summary Test that MXBeans can define their own names in preRegister
* @author Eamonn McManus
*/
/*
* Test that an MXBean can decide its name by returning a value from
* the preRegister method. Also test the same thing for Standard MBeans
* for good measure.
*/
public class PreRegisterNameTest {
public static interface SpumeMXBean {}
private ObjectName realName;
}
public void preDeregister() throws Exception {
}
public void postDeregister() {
}
}
return realName;
}
}
public static interface ThingMBean {
public boolean getNoddy();
}
private ObjectName realName;
}
return realName;
}
public void preDeregister() {}
public void postDeregister() {}
public boolean getNoddy() {
return true;
}
}
private ObjectName realName;
super(ThingMBean.class, false);
}
return realName;
}
public boolean getNoddy() {
return false;
}
}
private ObjectName realName;
super(SpumeMXBean.class, true);
}
throws Exception {
return realName;
}
}
}) {
"...");
"<" + n + ">: ";
try {
} catch (Exception e) {
e.printStackTrace();
continue;
}
}
}
}
if (failures == 0)
else
}
failures++;
}
private static int failures;
}