Search in sources :

Example 6 with Notification

use of javax.management.Notification in project jdk8u_jdk by JetBrains.

the class MXBeanExceptionHandlingTest method run.

public void run(Map<String, Object> args) {
    System.out.println("MXBeanExceptionHandlingTest::run: Start");
    int errorCount = 0;
    try {
        parseArgs(args);
        notifList = new ArrayBlockingQueue<Notification>(numOfNotifications);
        // JMX MbeanServer used inside single VM as if remote.
        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
        JMXServiceURL url = new JMXServiceURL("rmi", null, 0);
        JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs);
        cs.start();
        JMXServiceURL addr = cs.getAddress();
        JMXConnector cc = JMXConnectorFactory.connect(addr);
        MBeanServerConnection mbsc = cc.getMBeanServerConnection();
        // ----
        System.out.println("Add me as notification listener");
        mbsc.addNotificationListener(MBeanServerDelegate.DELEGATE_NAME, this, null, null);
        System.out.println("---- OK\n");
        // ----
        System.out.println("Create and register the MBean");
        ObjectName objName = new ObjectName("sqe:type=Basic,protocol=rmi");
        mbsc.createMBean(BASIC_MXBEAN_CLASS_NAME, objName);
        System.out.println("---- OK\n");
        // ----
        System.out.println("Call method throwException on our MXBean");
        try {
            mbsc.invoke(objName, "throwException", null, null);
            errorCount++;
            System.out.println("(ERROR) Did not get awaited MBeanException");
        } catch (MBeanException mbe) {
            System.out.println("(OK) Got awaited MBeanException");
            Throwable cause = mbe.getCause();
            if (cause instanceof java.lang.Exception) {
                System.out.println("(OK) Cause is of the right class");
                String mess = cause.getMessage();
                if (mess.equals(Basic.EXCEPTION_MESSAGE)) {
                    System.out.println("(OK) Cause message is fine");
                } else {
                    errorCount++;
                    System.out.println("(ERROR) Cause has message " + cause.getMessage() + " as we expect " + Basic.EXCEPTION_MESSAGE);
                }
            } else {
                errorCount++;
                System.out.println("(ERROR) Cause is of  class " + cause.getClass().getName() + " as we expect java.lang.Exception");
            }
        } catch (Exception e) {
            errorCount++;
            System.out.println("(ERROR) Did not get awaited MBeanException but " + e);
            Utils.printThrowable(e, true);
        }
        System.out.println("---- DONE\n");
        // ----
        System.out.println("Call method throwError on our MXBean");
        try {
            mbsc.invoke(objName, "throwError", null, null);
            errorCount++;
            System.out.println("(ERROR) Did not get awaited RuntimeErrorException");
        } catch (RuntimeErrorException ree) {
            System.out.println("(OK) Got awaited RuntimeErrorException");
            Throwable cause = ree.getCause();
            if (cause instanceof java.lang.InternalError) {
                System.out.println("(OK) Cause is of the right class");
                String mess = cause.getMessage();
                if (mess.equals(Basic.EXCEPTION_MESSAGE)) {
                    System.out.println("(OK) Cause message is fine");
                } else {
                    errorCount++;
                    System.out.println("(ERROR) Cause has message " + cause.getMessage() + " as we expect " + Basic.EXCEPTION_MESSAGE);
                }
            } else {
                errorCount++;
                System.out.println("(ERROR) Cause is of  class " + cause.getClass().getName() + " as we expect java.lang.InternalError");
            }
        } catch (Exception e) {
            errorCount++;
            System.out.println("(ERROR) Did not get awaited RuntimeErrorException but " + e);
            Utils.printThrowable(e, true);
        }
        System.out.println("---- DONE\n");
        // ----
        System.out.println("Unregister the MBean");
        mbsc.unregisterMBean(objName);
        System.out.println("---- OK\n");
        Thread.sleep(timeForNotificationInSeconds * 1000);
        int numOfReceivedNotif = notifList.size();
        if (numOfReceivedNotif == numOfNotifications) {
            System.out.println("(OK) We received " + numOfNotifications + " Notifications");
        } else {
            errorCount++;
            System.out.println("(ERROR) We received " + numOfReceivedNotif + " Notifications in place of " + numOfNotifications);
        }
    } catch (Exception e) {
        Utils.printThrowable(e, true);
        throw new RuntimeException(e);
    }
    if (errorCount == 0) {
        System.out.println("MXBeanExceptionHandlingTest::run: Done without any error");
    } else {
        System.out.println("MXBeanExceptionHandlingTest::run: Done with " + errorCount + " error(s)");
        throw new RuntimeException("errorCount = " + errorCount);
    }
}
Also used : JMXServiceURL(javax.management.remote.JMXServiceURL) RuntimeErrorException(javax.management.RuntimeErrorException) Notification(javax.management.Notification) RuntimeErrorException(javax.management.RuntimeErrorException) MBeanException(javax.management.MBeanException) JMXConnectorServer(javax.management.remote.JMXConnectorServer) ObjectName(javax.management.ObjectName) JMXConnector(javax.management.remote.JMXConnector) MBeanException(javax.management.MBeanException) MBeanServerConnection(javax.management.MBeanServerConnection) MBeanServer(javax.management.MBeanServer)

Example 7 with Notification

use of javax.management.Notification in project jdk8u_jdk by JetBrains.

the class ConnectionListenerNullTest method test.

public static int test(String... urls) {
    int errCount = 0;
    for (int i = 0; i < urls.length; i++) {
        try {
            final JMXServiceURL url = new JMXServiceURL(urls[i]);
            final JMXConnector c = JMXConnectorFactory.newJMXConnector(url, (Map<String, String>) null);
            final NotificationListener nl = null;
            final NotificationFilter nf = null;
            final Object h = null;
            System.out.println("Testing " + c.getClass().getName());
            try {
                System.out.println("addConnectionNotificationListener(null,null,null)");
                c.addConnectionNotificationListener(nl, nf, h);
                throw new AssertionError("No exception raised");
            } catch (NullPointerException npe) {
            // OK.
            }
            final NotificationListener listener = new NotificationListener() {

                public void handleNotification(Notification notification, Object handback) {
                }
            };
            c.addConnectionNotificationListener(listener, nf, h);
            try {
                System.out.println("removeConnectionNotificationListener(null)");
                c.removeConnectionNotificationListener(nl);
                throw new AssertionError("No exception raised");
            } catch (NullPointerException npe) {
            // OK.
            }
            try {
                System.out.println("removeConnectionNotificationListener(null,null,null)");
                c.removeConnectionNotificationListener(nl, nf, h);
                throw new AssertionError("No exception raised");
            } catch (NullPointerException npe) {
            // OK.
            }
            c.removeConnectionNotificationListener(listener);
            System.out.println(c.getClass().getName() + " successfully tested.");
        } catch (Exception x) {
            System.err.println("Unexpected exception for " + urls[i] + ": " + x);
            x.printStackTrace();
            errCount++;
        } catch (AssertionError e) {
            System.err.println("Unexpected assertion error for " + urls[i] + ": " + e);
            e.printStackTrace();
            errCount++;
        }
    }
    return errCount;
}
Also used : JMXServiceURL(javax.management.remote.JMXServiceURL) JMXConnector(javax.management.remote.JMXConnector) NotificationFilter(javax.management.NotificationFilter) Notification(javax.management.Notification) NotificationListener(javax.management.NotificationListener)

Example 8 with Notification

use of javax.management.Notification in project jdk8u_jdk by JetBrains.

the class RMIExitTest method test.

private static void test() {
    try {
        JMXServiceURL u = new JMXServiceURL("rmi", null, 0);
        JMXConnectorServer server;
        JMXServiceURL addr;
        JMXConnector client;
        MBeanServerConnection mserver;
        final ObjectName delegateName = new ObjectName("JMImplementation:type=MBeanServerDelegate");
        final NotificationListener dummyListener = new NotificationListener() {

            public void handleNotification(Notification n, Object o) {
                // do nothing
                return;
            }
        };
        server = JMXConnectorServerFactory.newJMXConnectorServer(u, null, mbs);
        server.start();
        addr = server.getAddress();
        client = JMXConnectorFactory.newJMXConnector(addr, null);
        client.connect(null);
        mserver = client.getMBeanServerConnection();
        String s1 = "1";
        String s2 = "2";
        String s3 = "3";
        mserver.addNotificationListener(delegateName, dummyListener, null, s1);
        mserver.addNotificationListener(delegateName, dummyListener, null, s2);
        mserver.addNotificationListener(delegateName, dummyListener, null, s3);
        mserver.removeNotificationListener(delegateName, dummyListener, null, s3);
        mserver.removeNotificationListener(delegateName, dummyListener, null, s2);
        mserver.removeNotificationListener(delegateName, dummyListener, null, s1);
        client.close();
        server.stop();
    } catch (Exception e) {
        System.out.println(e);
        e.printStackTrace();
        System.exit(1);
    }
}
Also used : JMXServiceURL(javax.management.remote.JMXServiceURL) JMXConnector(javax.management.remote.JMXConnector) MBeanServerConnection(javax.management.MBeanServerConnection) Notification(javax.management.Notification) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) JMXConnectorServer(javax.management.remote.JMXConnectorServer) ObjectName(javax.management.ObjectName) NotificationListener(javax.management.NotificationListener)

Example 9 with Notification

use of javax.management.Notification in project jdk8u_jdk by JetBrains.

the class NotificationBufferTest method test.

private static boolean test() throws Exception {
    MBeanServer mbs = MBeanServerFactory.createMBeanServer();
    Integer queuesize = new Integer(10);
    HashMap env = new HashMap();
    env.put(com.sun.jmx.remote.util.EnvHelp.BUFFER_SIZE_PROPERTY, queuesize);
    final NotificationBuffer nb = ArrayNotificationBuffer.getNotificationBuffer(mbs, env);
    final ObjectName senderName = new ObjectName("dom:type=sender");
    final ObjectName wildcardName = new ObjectName("*:*");
    final String notifType = MBeanServerNotification.REGISTRATION_NOTIFICATION;
    Integer allListenerId = new Integer(99);
    NotificationBufferFilter allListenerFilter = makeFilter(allListenerId, wildcardName, null);
    NotificationFilterSupport regFilter = new NotificationFilterSupport();
    regFilter.enableType(notifType);
    // Get initial sequence number
    NotificationResult nr = nb.fetchNotifications(allListenerFilter, 0, 0L, 0);
    int nnotifs = nr.getTargetedNotifications().length;
    if (nnotifs > 0) {
        System.out.println("Expected 0 notifs for initial fetch, " + "got " + nnotifs);
        return false;
    }
    System.out.println("Got 0 notifs for initial fetch, OK");
    long earliest = nr.getEarliestSequenceNumber();
    long next = nr.getNextSequenceNumber();
    if (earliest != next) {
        System.out.println("Expected earliest==next in initial fetch, " + "earliest=" + earliest + "; next=" + next);
        return false;
    }
    System.out.println("Got earliest==next in initial fetch, OK");
    mbs.createMBean(MLet.class.getName(), null);
    mbs.createMBean(NotificationSender.class.getName(), senderName);
    NotificationSenderMBean sender = (NotificationSenderMBean) MBeanServerInvocationHandler.newProxyInstance(mbs, senderName, NotificationSenderMBean.class, false);
    /* We test here that MBeans already present when the
           NotificationBuffer was created get a listener for the
           buffer, as do MBeans created later.  The
           MBeanServerDelegate was already present, while the
           NotificationSender was created later.  */
    // Check that the NotificationSender does indeed have a listener
    /* Note we are dependent on the specifics of our JMX
           implementation here.  There is no guarantee that the MBean
           creation listeners will have run to completion when
           creation of the MBean returns.  */
    int nlisteners = sender.getListenerCount();
    if (nlisteners != 1) {
        System.out.println("Notification sender should have 1 listener, " + "has " + nlisteners);
        return false;
    }
    System.out.println("Notification sender has 1 listener, OK");
    // Now we should see two creation notifications
    nr = nb.fetchNotifications(allListenerFilter, next, 0L, Integer.MAX_VALUE);
    TargetedNotification[] tns = nr.getTargetedNotifications();
    if (tns.length != 2) {
        System.out.println("Expected 2 notifs, got: " + Arrays.asList(tns));
        return false;
    }
    if (!(tns[0].getNotification() instanceof MBeanServerNotification) || !(tns[1].getNotification() instanceof MBeanServerNotification)) {
        System.out.println("Expected 2 MBeanServerNotifications, got: " + Arrays.asList(tns));
        return false;
    }
    if (!tns[0].getListenerID().equals(tns[1].getListenerID()) || !tns[0].getListenerID().equals(allListenerId)) {
        System.out.println("Bad listener IDs: " + Arrays.asList(tns));
        return false;
    }
    System.out.println("Got 2 different MBeanServerNotifications, OK");
    // If we ask for max 1 notifs, we should only get one
    nr = nb.fetchNotifications(allListenerFilter, next, 0L, 1);
    tns = nr.getTargetedNotifications();
    if (tns.length != 1) {
        System.out.println("Expected 1 notif, got: " + Arrays.asList(tns));
        return false;
    }
    TargetedNotification tn1 = tns[0];
    System.out.println("Got 1 notif when asked for 1, OK");
    // Now we should get the other one
    nr = nb.fetchNotifications(allListenerFilter, nr.getNextSequenceNumber(), 0L, 1);
    tns = nr.getTargetedNotifications();
    if (tns.length != 1) {
        System.out.println("Expected 1 notif, got: " + Arrays.asList(tns));
        return false;
    }
    TargetedNotification tn2 = tns[0];
    System.out.println("Got 1 notif when asked for 1 again, OK");
    if (tn1.getNotification() == tn2.getNotification()) {
        System.out.println("Returned same notif twice: " + tn1);
        return false;
    }
    System.out.println("2 creation notifs are different, OK");
    // Now we should get none (timeout is 0)
    long oldNext = nr.getNextSequenceNumber();
    nr = nb.fetchNotifications(allListenerFilter, oldNext, 0L, Integer.MAX_VALUE);
    tns = nr.getTargetedNotifications();
    if (tns.length != 0) {
        System.out.println("Expected 0 notifs, got: " + Arrays.asList(tns));
        return false;
    }
    System.out.println("Got 0 notifs with 0 timeout, OK");
    if (nr.getNextSequenceNumber() != oldNext) {
        System.out.println("Sequence number changed: " + oldNext + " -> " + nr.getNextSequenceNumber());
        return false;
    }
    System.out.println("Next seqno unchanged with 0 timeout, OK");
    // Check that timeouts work
    long startTime = System.currentTimeMillis();
    nr = nb.fetchNotifications(allListenerFilter, oldNext, 250L, Integer.MAX_VALUE);
    tns = nr.getTargetedNotifications();
    if (tns.length != 0) {
        System.out.println("Expected 0 notifs, got: " + Arrays.asList(tns));
        return false;
    }
    long endTime = System.currentTimeMillis();
    long elapsed = endTime - startTime;
    if (elapsed < 250L) {
        System.out.println("Elapsed time shorter than timeout: " + elapsed);
        return false;
    }
    System.out.println("Timeout worked, OK");
    // Check that notification filtering works
    NotificationFilter senderFilter = new NotificationFilter() {

        public boolean isNotificationEnabled(Notification n) {
            if (!(n instanceof MBeanServerNotification))
                return false;
            MBeanServerNotification mbsn = (MBeanServerNotification) n;
            return (mbsn.getMBeanName().equals(senderName));
        }
    };
    Integer senderListenerId = new Integer(88);
    NotificationBufferFilter senderListenerFilter = makeFilter(senderListenerId, wildcardName, senderFilter);
    nr = nb.fetchNotifications(senderListenerFilter, 0, 1000L, Integer.MAX_VALUE);
    tns = nr.getTargetedNotifications();
    if (tns.length != 1) {
        System.out.println("Expected 1 notif, got: " + Arrays.asList(tns));
        return false;
    }
    MBeanServerNotification mbsn = (MBeanServerNotification) tns[0].getNotification();
    if (!mbsn.getMBeanName().equals(senderName)) {
        System.out.println("Expected notif with senderName, got: " + mbsn + " (" + mbsn.getMBeanName() + ")");
        return false;
    }
    System.out.println("Successfully applied NotificationFilter, OK");
    // Now send 8 notifs to fill up our 10-element buffer
    sender.sendNotifs("tiddly.pom", 8);
    nr = nb.fetchNotifications(allListenerFilter, 0, 1000L, Integer.MAX_VALUE);
    tns = nr.getTargetedNotifications();
    if (tns.length != 10) {
        System.out.println("Expected 10 notifs, got: " + Arrays.asList(tns));
        return false;
    }
    System.out.println("Got full buffer of 10 notifications, OK");
    // Check that the 10 notifs are the ones we expected
    for (int i = 0; i < 10; i++) {
        String expected = (i < 2) ? notifType : "tiddly.pom";
        String found = tns[i].getNotification().getType();
        if (!found.equals(expected)) {
            System.out.println("Notif " + i + " bad type: expected <" + expected + ">, found <" + found + ">");
            return false;
        }
    }
    System.out.println("Notifs have right types, OK");
    // Check that ObjectName filtering works
    NotificationBufferFilter senderNameFilter = makeFilter(new Integer(66), senderName, null);
    nr = nb.fetchNotifications(senderNameFilter, 0, 0L, Integer.MAX_VALUE);
    tns = nr.getTargetedNotifications();
    if (tns.length != 8) {
        System.out.println("Bad result from ObjectName filtering: " + Arrays.asList(tns));
        return false;
    }
    System.out.println("ObjectName filtering works, OK");
    // Send one more notif, which should cause the oldest one to drop
    sender.sendNotifs("foo.bar", 1);
    nr = nb.fetchNotifications(allListenerFilter, 0, 1000L, Integer.MAX_VALUE);
    if (nr.getEarliestSequenceNumber() <= earliest) {
        System.out.println("Expected earliest to increase: " + nr.getEarliestSequenceNumber() + " should be > " + earliest);
        return false;
    }
    System.out.println("Earliest notif dropped, OK");
    // Check that the 10 notifs are the ones we expected
    tns = nr.getTargetedNotifications();
    for (int i = 0; i < 10; i++) {
        String expected = (i < 1) ? notifType : (i < 9) ? "tiddly.pom" : "foo.bar";
        String found = tns[i].getNotification().getType();
        if (!found.equals(expected)) {
            System.out.println("Notif " + i + " bad type: expected <" + expected + ">, found <" + found + ">");
            return false;
        }
    }
    System.out.println("Notifs have right types, OK");
    // Apply a filter that only selects the first notif, with max notifs 1,
    // then check that it skipped past the others even though it already
    // had its 1 notif
    NotificationBufferFilter firstFilter = makeFilter(new Integer(55), wildcardName, regFilter);
    nr = nb.fetchNotifications(firstFilter, 0, 1000L, 1);
    tns = nr.getTargetedNotifications();
    if (tns.length != 1 || !tns[0].getNotification().getType().equals(notifType)) {
        System.out.println("Unexpected return from filtered call: " + Arrays.asList(tns));
        return false;
    }
    nr = nb.fetchNotifications(allListenerFilter, nr.getNextSequenceNumber(), 0L, 1000);
    tns = nr.getTargetedNotifications();
    if (tns.length != 0) {
        System.out.println("Expected 0 notifs, got: " + Arrays.asList(tns));
        return false;
    }
    // Create a second, larger buffer, which should share the same notifs
    nr = nb.fetchNotifications(allListenerFilter, 0, 1000L, Integer.MAX_VALUE);
    queuesize = new Integer(20);
    env.put(com.sun.jmx.remote.util.EnvHelp.BUFFER_SIZE_PROPERTY, queuesize);
    NotificationBuffer nb2 = ArrayNotificationBuffer.getNotificationBuffer(mbs, env);
    NotificationResult nr2 = nb2.fetchNotifications(allListenerFilter, 0, 1000L, Integer.MAX_VALUE);
    if (nr.getEarliestSequenceNumber() != nr2.getEarliestSequenceNumber() || nr.getNextSequenceNumber() != nr2.getNextSequenceNumber() || !sameTargetedNotifs(nr.getTargetedNotifications(), nr2.getTargetedNotifications()))
        return false;
    System.out.println("Adding second buffer preserved notif list, OK");
    // Check that the capacity is now 20
    sender.sendNotifs("propter.hoc", 10);
    nr2 = nb2.fetchNotifications(allListenerFilter, 0, 1000L, Integer.MAX_VALUE);
    if (nr.getEarliestSequenceNumber() != nr2.getEarliestSequenceNumber()) {
        System.out.println("Earliest seq number changed after notifs " + "that should have fit");
        return false;
    }
    TargetedNotification[] tns2 = new TargetedNotification[10];
    Arrays.asList(nr2.getTargetedNotifications()).subList(0, 10).toArray(tns2);
    if (!sameTargetedNotifs(nr.getTargetedNotifications(), tns2)) {
        System.out.println("Early notifs changed after notifs " + "that should have fit");
        return false;
    }
    System.out.println("New notifications fit in now-larger buffer, OK");
    // Drop the second buffer and check that the capacity shrinks
    nb2.dispose();
    NotificationResult nr3 = nb.fetchNotifications(allListenerFilter, 0, 1000L, Integer.MAX_VALUE);
    if (nr3.getEarliestSequenceNumber() != nr.getNextSequenceNumber()) {
        System.out.println("After shrink, notifs not dropped as expected");
        return false;
    }
    if (nr3.getNextSequenceNumber() != nr2.getNextSequenceNumber()) {
        System.out.println("After shrink, next seq no does not match");
        return false;
    }
    tns2 = new TargetedNotification[10];
    Arrays.asList(nr2.getTargetedNotifications()).subList(10, 20).toArray(tns2);
    if (!sameTargetedNotifs(nr3.getTargetedNotifications(), tns2)) {
        System.out.println("Later notifs not preserved after shrink");
        return false;
    }
    System.out.println("Dropping second buffer shrank capacity, OK");
    // Final test: check that destroying the final shared buffer
    // removes its listeners
    nb.dispose();
    nlisteners = sender.getListenerCount();
    if (nlisteners != 0) {
        System.out.println("Disposing buffer should leave 0 listeners, " + "but notification sender has " + nlisteners);
        return false;
    }
    System.out.println("Dropping first buffer drops listeners, OK");
    return true;
}
Also used : HashMap(java.util.HashMap) MBeanServerNotification(javax.management.MBeanServerNotification) MLet(javax.management.loading.MLet) NotificationBufferFilter(com.sun.jmx.remote.internal.NotificationBufferFilter) NotificationResult(javax.management.remote.NotificationResult) TargetedNotification(javax.management.remote.TargetedNotification) Notification(javax.management.Notification) MBeanServerNotification(javax.management.MBeanServerNotification) ObjectName(javax.management.ObjectName) NotificationFilterSupport(javax.management.NotificationFilterSupport) NotificationBuffer(com.sun.jmx.remote.internal.NotificationBuffer) ArrayNotificationBuffer(com.sun.jmx.remote.internal.ArrayNotificationBuffer) TargetedNotification(javax.management.remote.TargetedNotification) NotificationFilter(javax.management.NotificationFilter) MBeanServer(javax.management.MBeanServer)

Example 10 with Notification

use of javax.management.Notification in project jdk8u_jdk by JetBrains.

the class ConcurrentModificationTest method main.

public static void main(String[] args) throws Exception {
    System.out.println(">>> test on Concurrent Modification.");
    Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {

        @Override
        public void uncaughtException(Thread t, Throwable e) {
            e.printStackTrace();
            if (e instanceof ConcurrentModificationException) {
                uncaughtException = e;
            }
        }
    });
    delegateName = new ObjectName("JMImplementation:type=MBeanServerDelegate");
    for (int i = 0; i < number; i++) {
        timerNames[i] = new ObjectName("MBean:name=Timer" + i);
        listeners[i] = new NotificationListener() {

            @Override
            public void handleNotification(Notification notification, Object handback) {
            // nothing
            }
        };
    }
    String errors = "";
    for (int i = 0; i < protocols.length; i++) {
        uncaughtException = null;
        System.out.println(">>> Test for protocol " + protocols[i]);
        test(protocols[i]);
        if (uncaughtException != null) {
            if ("".equals(errors)) {
                errors = "Failed to " + protocols[i] + ": " + uncaughtException;
            } else {
                errors = errors + ", failed to " + protocols[i] + ": " + uncaughtException;
            }
            System.out.println(">>> FAILED for protocol " + protocols[i]);
        } else {
            System.out.println(">>> PASSED for protocol " + protocols[i]);
        }
    }
    if ("".equals(errors)) {
        System.out.println("All Passed!");
    } else {
        System.out.println("!!!!!! Failed.");
        throw new RuntimeException(errors);
    }
}
Also used : ConcurrentModificationException(java.util.ConcurrentModificationException) Notification(javax.management.Notification) ObjectName(javax.management.ObjectName) NotificationListener(javax.management.NotificationListener)

Aggregations

Notification (javax.management.Notification)204 ObjectName (javax.management.ObjectName)68 NotificationListener (javax.management.NotificationListener)35 AttributeChangeNotification (javax.management.AttributeChangeNotification)29 CompositeData (javax.management.openmbean.CompositeData)25 IOException (java.io.IOException)23 Test (org.junit.Test)20 HashMap (java.util.HashMap)19 MalformedObjectNameException (javax.management.MalformedObjectNameException)19 Test (org.testng.annotations.Test)18 ListenerNotFoundException (javax.management.ListenerNotFoundException)17 ArrayList (java.util.ArrayList)16 MBeanServer (javax.management.MBeanServer)16 NotificationFilter (javax.management.NotificationFilter)15 NotificationEmitter (javax.management.NotificationEmitter)14 JMXConnector (javax.management.remote.JMXConnector)14 JMXServiceURL (javax.management.remote.JMXServiceURL)14 MBeanServerConnection (javax.management.MBeanServerConnection)12 MalformedURLException (java.net.MalformedURLException)11 JMXConnectorServer (javax.management.remote.JMXConnectorServer)11