use of javax.management.NotCompliantMBeanException in project jdk8u_jdk by JetBrains.
the class MBeanTest method testNonCompliant.
private static void testNonCompliant(Class<?> iface, Object bean) throws Exception {
try {
System.out.println("Registering a non-compliant MBean " + iface.getName() + " ...");
MBeanServer mbs = MBeanServerFactory.newMBeanServer();
ObjectName on = new ObjectName("test:type=NonCompliant");
mbs.registerMBean(bean, on);
fail("Registered a non-compliant MBean - " + iface.getName());
} catch (Exception e) {
Throwable t = e;
while (t != null && !(t instanceof NotCompliantMBeanException)) {
t = t.getCause();
}
if (t != null) {
success("MBean not registered");
} else {
throw e;
}
}
}
use of javax.management.NotCompliantMBeanException in project jdk8u_jdk by JetBrains.
the class JMXProxyFallbackTest method testPrivate.
private static void testPrivate(Class<?> iface) throws Exception {
try {
System.out.println("Creating a proxy for private M(X)Bean " + iface.getName() + " ...");
MBeanServer mbs = MBeanServerFactory.newMBeanServer();
ObjectName on = new ObjectName("test:type=Proxy");
JMX.newMBeanProxy(mbs, on, iface);
success("Created a proxy for private M(X)Bean - " + iface.getName());
} catch (Exception e) {
Throwable t = e;
while (t != null && !(t instanceof NotCompliantMBeanException)) {
t = t.getCause();
}
if (t != null) {
fail("Proxy not created");
} else {
throw e;
}
}
}
use of javax.management.NotCompliantMBeanException in project jdk8u_jdk by JetBrains.
the class JMXProxyTest method testCompliant.
private static void testCompliant(Class<?> iface, boolean isMx) throws Exception {
try {
System.out.println("Creating a proxy for compliant " + (isMx ? "MXBean" : "MBean") + " " + iface.getName() + " ...");
MBeanServer mbs = MBeanServerFactory.newMBeanServer();
ObjectName on = new ObjectName("test:type=Proxy");
if (isMx) {
JMX.newMXBeanProxy(mbs, on, iface);
} else {
JMX.newMBeanProxy(mbs, on, iface);
}
success("Created a proxy for compliant " + (isMx ? "MXBean" : "MBean") + " - " + iface.getName());
} catch (Exception e) {
Throwable t = e;
while (t != null && !(t instanceof NotCompliantMBeanException)) {
t = t.getCause();
}
if (t != null) {
fail("Proxy not created");
} else {
throw e;
}
}
}
use of javax.management.NotCompliantMBeanException in project jdk8u_jdk by JetBrains.
the class JMXProxyTest method testNonCompliant.
private static void testNonCompliant(Class<?> iface, boolean isMx) throws Exception {
try {
System.out.println("Creating a proxy for non-compliant " + (isMx ? "MXBean" : "MBean") + " " + iface.getName() + " ...");
MBeanServer mbs = MBeanServerFactory.newMBeanServer();
ObjectName on = new ObjectName("test:type=Proxy");
if (isMx) {
JMX.newMXBeanProxy(mbs, on, iface);
} else {
JMX.newMBeanProxy(mbs, on, iface);
}
fail("Created a proxy for non-compliant " + (isMx ? "MXBean" : "MBean") + " - " + iface.getName());
} catch (Exception e) {
Throwable t = e;
while (t != null && !(t instanceof NotCompliantMBeanException)) {
t = t.getCause();
}
if (t != null) {
success("Proxy not created");
} else {
throw e;
}
}
}
use of javax.management.NotCompliantMBeanException in project jdk8u_jdk by JetBrains.
the class MXBeanTest method testNonCompliantMXBean.
private static void testNonCompliantMXBean(String type, Object bean) throws Exception {
System.out.println(type + " MXBean test...");
MBeanServer mbs = MBeanServerFactory.newMBeanServer();
ObjectName on = new ObjectName("test:type=" + type);
try {
mbs.registerMBean(bean, on);
failure(bean.getClass().getInterfaces()[0].getName() + " is not a compliant " + "MXBean interface");
} catch (NotCompliantMBeanException e) {
success("Non-compliant MXBean not registered");
}
}
Aggregations