1 8 9 package test.javax.management.modelmbean; 10 11 import javax.management.Descriptor ; 12 import javax.management.modelmbean.DescriptorSupport ; 13 import javax.management.modelmbean.ModelMBeanNotificationInfo ; 14 15 import junit.framework.TestCase; 16 17 21 22 public class ModelMBeanNotificationInfoTest extends TestCase 23 { 24 25 public ModelMBeanNotificationInfoTest(String s) 26 { 27 super(s); 28 } 29 30 public void setUp() throws Exception 31 { 32 super.setUp(); 33 } 34 35 public void tearDown() throws Exception 36 { 37 super.tearDown(); 38 } 39 40 public void testSeverityField() throws Exception 41 { 42 Descriptor descriptor = new DescriptorSupport (new String []{"name", "descriptortype", "severity"}, 45 new String []{"aNotification", "notification", "6"}); 46 ModelMBeanNotificationInfo notification 47 = new ModelMBeanNotificationInfo (new String []{"type1"}, "aNotification", "A description", descriptor); 48 assertSame(descriptor.getFieldValue("notification"), notification.getDescriptor().getFieldValue("notification")); 49 50 descriptor = new DescriptorSupport (new String []{"name", "descriptortype", "severity"}, 51 new String []{"aNotification", "notification", "0"}); 52 notification 53 = new ModelMBeanNotificationInfo (new String []{"type1"}, "aNotification", "A description", descriptor); 54 assertSame(descriptor.getFieldValue("notification"), notification.getDescriptor().getFieldValue("notification")); 55 } 56 57 public void testCaseInsensitiveDescriptorType() 58 { 59 DescriptorSupport ds = new DescriptorSupport (new String []{ 60 "name=badthing", 61 "descriptorType=NOTification", 62 "severity=1" 63 }); 64 ModelMBeanNotificationInfo info = 65 new ModelMBeanNotificationInfo (new String []{"bad.thing"}, 66 "badthing", 67 "The bad thing happened", 68 ds); 69 } 70 } 71 | Popular Tags |