1 8 9 package test.javax.management; 10 11 import java.util.Map ; 12 import javax.management.MBeanAttributeInfo ; 13 import javax.management.MBeanConstructorInfo ; 14 import javax.management.MBeanNotificationInfo ; 15 import javax.management.MBeanOperationInfo ; 16 import javax.management.MBeanParameterInfo ; 17 18 import junit.framework.TestCase; 19 20 23 public class MBeanStarInfoTest extends TestCase 24 { 25 public MBeanStarInfoTest(String s) 26 { 27 super(s); 28 } 29 30 public void testValidMBeanStarInfoNullName() throws Exception 31 { 32 new MBeanAttributeInfo (null, "java.lang.String", "description", true, false, false); 33 new MBeanConstructorInfo (null, "description", null); 34 new MBeanOperationInfo (null, "description", null, "java.lang.String", MBeanOperationInfo.UNKNOWN); 35 new MBeanParameterInfo (null, "java.lang.String", "description"); 36 } 37 38 public void testValidMBeanStarInfoEmptyName() throws Exception 39 { 40 new MBeanAttributeInfo ("", "java.lang.String", "description", true, false, false); 41 new MBeanConstructorInfo ("", "description", null); 42 new MBeanOperationInfo ("", "description", null, "java.lang.String", MBeanOperationInfo.UNKNOWN); 43 new MBeanParameterInfo ("", "java.lang.String", "description"); 44 } 45 46 public void testValidMBeanStarInfoInvalidName1() throws Exception 47 { 48 new MBeanAttributeInfo ("123", "java.lang.String", "description", true, false, false); 49 new MBeanConstructorInfo ("123", "description", null); 50 new MBeanOperationInfo ("123", "description", null, "java.lang.String", MBeanOperationInfo.UNKNOWN); 51 new MBeanParameterInfo ("123", "java.lang.String", "description"); 52 } 53 54 public void testValidMBeanStarInfoInvalidName2() throws Exception 55 { 56 new MBeanAttributeInfo (".123", "java.lang.String", "description", true, false, false); 57 new MBeanConstructorInfo (".123", "description", null); 58 new MBeanOperationInfo (".123", "description", null, "java.lang.String", MBeanOperationInfo.UNKNOWN); 59 new MBeanParameterInfo (".123", "java.lang.String", "description"); 60 } 61 62 public void testValidMBeanStarInfoInvalidName3() throws Exception 63 { 64 new MBeanAttributeInfo (" identifier", "java.lang.String", "description", true, false, false); 65 new MBeanConstructorInfo (" identifier", "description", null); 66 new MBeanOperationInfo (" identifier", "description", null, "java.lang.String", MBeanOperationInfo.UNKNOWN); 67 new MBeanParameterInfo (" identifier", "java.lang.String", "description"); 68 } 69 70 public void testValidMBeanStarInfoNullType() throws Exception 71 { 72 new MBeanAttributeInfo ("identifier", null, "description", true, false, false); 73 new MBeanNotificationInfo (new String [0], null, "description"); 74 new MBeanOperationInfo ("identifier", "description", null, null, MBeanOperationInfo.UNKNOWN); 75 new MBeanParameterInfo ("identifier", null, "description"); 76 } 77 78 public void testValidMBeanStarInfoEmptyType() throws Exception 79 { 80 new MBeanAttributeInfo ("identifier", "", "description", true, false, false); 81 new MBeanNotificationInfo (new String [0], "", "description"); 82 new MBeanOperationInfo ("identifier", "description", null, "", MBeanOperationInfo.UNKNOWN); 83 new MBeanParameterInfo ("identifier", "", "description"); 84 } 85 86 public void testValidMBeanStarInfoInvalidType1() throws Exception 87 { 88 new MBeanAttributeInfo ("identifier", "123", "description", true, false, false); 89 new MBeanNotificationInfo (new String [0], "123", "description"); 90 new MBeanOperationInfo ("identifier", "description", null, "123", MBeanOperationInfo.UNKNOWN); 91 new MBeanParameterInfo ("identifier", "123", "description"); 92 } 93 94 public void testValidMBeanStarInfoInvalidType2() throws Exception 95 { 96 new MBeanAttributeInfo ("identifier", ".type", "description", true, false, false); 97 new MBeanNotificationInfo (new String [0], ".type", "description"); 98 new MBeanOperationInfo ("identifier", "description", null, ".type", MBeanOperationInfo.UNKNOWN); 99 new MBeanParameterInfo ("identifier", ".type", "description"); 100 } 101 102 public void testValidMBeanStarInfoInvalidType3() throws Exception 103 { 104 new MBeanAttributeInfo ("identifier", " type", "description", true, false, false); 105 new MBeanNotificationInfo (new String [0], " type", "description"); 106 new MBeanOperationInfo ("identifier", "description", null, " type", MBeanOperationInfo.UNKNOWN); 107 new MBeanParameterInfo ("identifier", " type", "description"); 108 } 109 110 public void testValidMBeanStarInfo1() throws Exception 111 { 112 new MBeanAttributeInfo ("name", "type", "description", true, false, false); 113 new MBeanConstructorInfo ("name", "description", null); 114 new MBeanNotificationInfo (new String [0], "type", "description"); 115 new MBeanOperationInfo ("name", "description", null, "type", MBeanOperationInfo.UNKNOWN); 116 new MBeanParameterInfo ("name", "type", "description"); 117 } 118 119 public void testValidMBeanStarInfo2() throws Exception 120 { 121 new MBeanAttributeInfo ("_", int.class.getName(), "description", true, false, false); 122 new MBeanConstructorInfo ("_", "description", null); 123 new MBeanNotificationInfo (new String [0], "java.lang.String", "description"); 124 new MBeanOperationInfo ("_", "description", null, int[].class.getName(), MBeanOperationInfo.UNKNOWN); 125 new MBeanParameterInfo ("_", int[][].class.getName(), "description"); 126 } 127 128 public void testValidMBeanStarInfo3() throws Exception 129 { 130 new MBeanAttributeInfo ("a", String .class.getName(), "description", true, false, false); 131 new MBeanConstructorInfo ("a", "description", null); 132 new MBeanNotificationInfo (new String [0], "java.lang.String", "description"); 133 new MBeanOperationInfo ("a", "description", null, String [].class.getName(), MBeanOperationInfo.UNKNOWN); 134 new MBeanParameterInfo ("a", String [][].class.getName(), "description"); 135 } 136 137 public void testValidMBeanStarInfo4() throws Exception 138 { 139 new MBeanAttributeInfo ("a", Map.Entry .class.getName(), "description", true, false, false); 140 new MBeanConstructorInfo ("a", "description", null); 141 new MBeanNotificationInfo (new String [0], "java.lang.String", "description"); 142 new MBeanOperationInfo ("a", "description", null, Map.Entry [].class.getName(), MBeanOperationInfo.UNKNOWN); 143 new MBeanParameterInfo ("a", Map.Entry [][].class.getName(), "description"); 144 } 145 146 } 148 | Popular Tags |