You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2010/06/22 11:17:28 UTC
svn commit: r956831 -
/camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxNotificationEventNotifierTest.java
Author: ningjiang
Date: Tue Jun 22 09:17:28 2010
New Revision: 956831
URL: http://svn.apache.org/viewvc?rev=956831&view=rev
Log:
CAMEL-2753 added the wiki tags
Modified:
camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxNotificationEventNotifierTest.java
Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxNotificationEventNotifierTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxNotificationEventNotifierTest.java?rev=956831&r1=956830&r2=956831&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxNotificationEventNotifierTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxNotificationEventNotifierTest.java Tue Jun 22 09:17:28 2010
@@ -40,6 +40,8 @@ public class JmxNotificationEventNotifie
@Override
protected CamelContext createCamelContext() throws Exception {
+ // START SNIPPET: e1
+ // Set up the JmxNotificationEventNotifier
notifier = new JmxNotificationEventNotifier();
notifier.setSource("MyCamel");
notifier.setIgnoreCamelContextEvents(true);
@@ -49,24 +51,28 @@ public class JmxNotificationEventNotifie
CamelContext context = new DefaultCamelContext(createRegistry());
context.getManagementStrategy().addEventNotifier(notifier);
+ // Set up the ManagementNamingStrategy
DefaultManagementNamingStrategy naming = (DefaultManagementNamingStrategy) context.getManagementStrategy().getManagementNamingStrategy();
naming.setHostName("localhost");
naming.setDomainName("org.apache.camel");
-
+ // END SNIPPET: e2
return context;
}
public void testExchangeDone() throws Exception {
+ // START SNIPPET: e2
+ // register the NotificationListener
ObjectName on = ObjectName.getInstance("org.apache.camel:context=localhost/camel-1,type=eventnotifiers,name=JmxEventNotifier");
MyNotificationListener listener = new MyNotificationListener();
context.getManagementStrategy().getManagementAgent().getMBeanServer().addNotificationListener(on,
listener,
new NotificationFilter() {
public boolean isNotificationEnabled(Notification notification) {
- return true;
+ return notification.getSource().equals("MyCamel");
}
}, null);
+ // END SNIPPET: e2
getMockEndpoint("mock:result").expectedMessageCount(1);
template.sendBody("direct:start", "Hello World");