01: /*
02: * Copyright (C) The MX4J Contributors.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the MX4J License version 1.0.
06: * See the terms of the MX4J License in the documentation provided with this software.
07: */
08:
09: 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: /**
18: * @version $Revision: 1.4 $
19: * @see
20: */
21:
22: public class ModelMBeanNotificationInfoTest extends TestCase {
23:
24: public ModelMBeanNotificationInfoTest(String s) {
25: super (s);
26: }
27:
28: public void setUp() throws Exception {
29: super .setUp();
30: }
31:
32: public void tearDown() throws Exception {
33: super .tearDown();
34: }
35:
36: public void testSeverityField() throws Exception {
37: // testcase for bug #775742, #744423 and #775739
38: // this should work ok
39: Descriptor descriptor = new DescriptorSupport(new String[] {
40: "name", "descriptortype", "severity" }, new String[] {
41: "aNotification", "notification", "6" });
42: ModelMBeanNotificationInfo notification = new ModelMBeanNotificationInfo(
43: new String[] { "type1" }, "aNotification",
44: "A description", descriptor);
45: assertSame(descriptor.getFieldValue("notification"),
46: notification.getDescriptor().getFieldValue(
47: "notification"));
48:
49: descriptor = new DescriptorSupport(new String[] { "name",
50: "descriptortype", "severity" }, new String[] {
51: "aNotification", "notification", "0" });
52: notification = new ModelMBeanNotificationInfo(
53: new String[] { "type1" }, "aNotification",
54: "A description", descriptor);
55: assertSame(descriptor.getFieldValue("notification"),
56: notification.getDescriptor().getFieldValue(
57: "notification"));
58: }
59:
60: public void testCaseInsensitiveDescriptorType() {
61: DescriptorSupport ds = new DescriptorSupport(new String[] {
62: "name=badthing", "descriptorType=NOTification",
63: "severity=1" });
64: ModelMBeanNotificationInfo info = new ModelMBeanNotificationInfo(
65: new String[] { "bad.thing" }, "badthing",
66: "The bad thing happened", ds);
67: }
68: }
|