package org.jboss.test.ha.jmx.test;
import javax.management.Notification;
import junit.framework.TestCase;
import org.jboss.test.ha.jmx.HAServiceMBeanSupportTester;
public class HAServiceMBeanSupportUnitTestCase extends TestCase
{
private HAServiceMBeanSupportTester haServiceMBeanSupportTester_ = null;
public HAServiceMBeanSupportUnitTestCase(String name)
{
super(name);
}
public void setUp()
{
haServiceMBeanSupportTester_ = new HAServiceMBeanSupportTester();
}
public void tearDown()
{
haServiceMBeanSupportTester_ = null;
}
public void testSendNotificationBroadcastsToClusterAndLocally()
{
Notification notification = new Notification("test.notification", "some:name=tester", 1);
haServiceMBeanSupportTester_.sendNotification( notification );
assertEquals("sendNotificationToLocalListeners() was not handed the original notification",
haServiceMBeanSupportTester_.__invokationStack__.pop(), notification );
assertEquals("method not invoked as expected",
haServiceMBeanSupportTester_.__invokationStack__.pop(), "sendNotificationToLocalListeners");
assertEquals("sendNotificationRemote() was not handed the original notification",
haServiceMBeanSupportTester_.__invokationStack__.pop(), notification );
assertEquals("method not invoked as expected",
haServiceMBeanSupportTester_.__invokationStack__.pop(), "sendNotificationRemote");
}
public void testSendNotificationAfterClusterFailureContinueWithLocal()
{
haServiceMBeanSupportTester_.__shouldSendNotificationRemoteFail__ = true;
Notification notification = new Notification("test.notification", "some:name=tester", 1);
haServiceMBeanSupportTester_.sendNotification( notification );
assertEquals("sendNotificationToLocalListeners() was not handed the original notification",
haServiceMBeanSupportTester_.__invokationStack__.pop(), notification );
assertEquals("method not invoked as expected",
haServiceMBeanSupportTester_.__invokationStack__.pop(), "sendNotificationToLocalListeners");
}
}