001: /*
002: * Copyright (C) The MX4J Contributors.
003: * All rights reserved.
004: *
005: * This software is distributed under the terms of the MX4J License version 1.0.
006: * See the terms of the MX4J License in the documentation provided with this software.
007: */
008:
009: package test.javax.management;
010:
011: import java.util.Map;
012: import javax.management.MBeanAttributeInfo;
013: import javax.management.MBeanConstructorInfo;
014: import javax.management.MBeanNotificationInfo;
015: import javax.management.MBeanOperationInfo;
016: import javax.management.MBeanParameterInfo;
017:
018: import junit.framework.TestCase;
019:
020: /**
021: * @version $Revision: 1.4 $
022: */
023: public class MBeanStarInfoTest extends TestCase {
024: public MBeanStarInfoTest(String s) {
025: super (s);
026: }
027:
028: public void testValidMBeanStarInfoNullName() throws Exception {
029: new MBeanAttributeInfo(null, "java.lang.String", "description",
030: true, false, false);
031: new MBeanConstructorInfo(null, "description", null);
032: new MBeanOperationInfo(null, "description", null,
033: "java.lang.String", MBeanOperationInfo.UNKNOWN);
034: new MBeanParameterInfo(null, "java.lang.String", "description");
035: }
036:
037: public void testValidMBeanStarInfoEmptyName() throws Exception {
038: new MBeanAttributeInfo("", "java.lang.String", "description",
039: true, false, false);
040: new MBeanConstructorInfo("", "description", null);
041: new MBeanOperationInfo("", "description", null,
042: "java.lang.String", MBeanOperationInfo.UNKNOWN);
043: new MBeanParameterInfo("", "java.lang.String", "description");
044: }
045:
046: public void testValidMBeanStarInfoInvalidName1() throws Exception {
047: new MBeanAttributeInfo("123", "java.lang.String",
048: "description", true, false, false);
049: new MBeanConstructorInfo("123", "description", null);
050: new MBeanOperationInfo("123", "description", null,
051: "java.lang.String", MBeanOperationInfo.UNKNOWN);
052: new MBeanParameterInfo("123", "java.lang.String", "description");
053: }
054:
055: public void testValidMBeanStarInfoInvalidName2() throws Exception {
056: new MBeanAttributeInfo(".123", "java.lang.String",
057: "description", true, false, false);
058: new MBeanConstructorInfo(".123", "description", null);
059: new MBeanOperationInfo(".123", "description", null,
060: "java.lang.String", MBeanOperationInfo.UNKNOWN);
061: new MBeanParameterInfo(".123", "java.lang.String",
062: "description");
063: }
064:
065: public void testValidMBeanStarInfoInvalidName3() throws Exception {
066: new MBeanAttributeInfo(" identifier", "java.lang.String",
067: "description", true, false, false);
068: new MBeanConstructorInfo(" identifier", "description", null);
069: new MBeanOperationInfo(" identifier", "description", null,
070: "java.lang.String", MBeanOperationInfo.UNKNOWN);
071: new MBeanParameterInfo(" identifier", "java.lang.String",
072: "description");
073: }
074:
075: public void testValidMBeanStarInfoNullType() throws Exception {
076: new MBeanAttributeInfo("identifier", null, "description", true,
077: false, false);
078: new MBeanNotificationInfo(new String[0], null, "description");
079: new MBeanOperationInfo("identifier", "description", null, null,
080: MBeanOperationInfo.UNKNOWN);
081: new MBeanParameterInfo("identifier", null, "description");
082: }
083:
084: public void testValidMBeanStarInfoEmptyType() throws Exception {
085: new MBeanAttributeInfo("identifier", "", "description", true,
086: false, false);
087: new MBeanNotificationInfo(new String[0], "", "description");
088: new MBeanOperationInfo("identifier", "description", null, "",
089: MBeanOperationInfo.UNKNOWN);
090: new MBeanParameterInfo("identifier", "", "description");
091: }
092:
093: public void testValidMBeanStarInfoInvalidType1() throws Exception {
094: new MBeanAttributeInfo("identifier", "123", "description",
095: true, false, false);
096: new MBeanNotificationInfo(new String[0], "123", "description");
097: new MBeanOperationInfo("identifier", "description", null,
098: "123", MBeanOperationInfo.UNKNOWN);
099: new MBeanParameterInfo("identifier", "123", "description");
100: }
101:
102: public void testValidMBeanStarInfoInvalidType2() throws Exception {
103: new MBeanAttributeInfo("identifier", ".type", "description",
104: true, false, false);
105: new MBeanNotificationInfo(new String[0], ".type", "description");
106: new MBeanOperationInfo("identifier", "description", null,
107: ".type", MBeanOperationInfo.UNKNOWN);
108: new MBeanParameterInfo("identifier", ".type", "description");
109: }
110:
111: public void testValidMBeanStarInfoInvalidType3() throws Exception {
112: new MBeanAttributeInfo("identifier", " type", "description",
113: true, false, false);
114: new MBeanNotificationInfo(new String[0], " type", "description");
115: new MBeanOperationInfo("identifier", "description", null,
116: " type", MBeanOperationInfo.UNKNOWN);
117: new MBeanParameterInfo("identifier", " type", "description");
118: }
119:
120: public void testValidMBeanStarInfo1() throws Exception {
121: new MBeanAttributeInfo("name", "type", "description", true,
122: false, false);
123: new MBeanConstructorInfo("name", "description", null);
124: new MBeanNotificationInfo(new String[0], "type", "description");
125: new MBeanOperationInfo("name", "description", null, "type",
126: MBeanOperationInfo.UNKNOWN);
127: new MBeanParameterInfo("name", "type", "description");
128: }
129:
130: public void testValidMBeanStarInfo2() throws Exception {
131: new MBeanAttributeInfo("_", int.class.getName(), "description",
132: true, false, false);
133: new MBeanConstructorInfo("_", "description", null);
134: new MBeanNotificationInfo(new String[0], "java.lang.String",
135: "description");
136: new MBeanOperationInfo("_", "description", null, int[].class
137: .getName(), MBeanOperationInfo.UNKNOWN);
138: new MBeanParameterInfo("_", int[][].class.getName(),
139: "description");
140: }
141:
142: public void testValidMBeanStarInfo3() throws Exception {
143: new MBeanAttributeInfo("a", String.class.getName(),
144: "description", true, false, false);
145: new MBeanConstructorInfo("a", "description", null);
146: new MBeanNotificationInfo(new String[0], "java.lang.String",
147: "description");
148: new MBeanOperationInfo("a", "description", null, String[].class
149: .getName(), MBeanOperationInfo.UNKNOWN);
150: new MBeanParameterInfo("a", String[][].class.getName(),
151: "description");
152: }
153:
154: public void testValidMBeanStarInfo4() throws Exception {
155: new MBeanAttributeInfo("a", Map.Entry.class.getName(),
156: "description", true, false, false);
157: new MBeanConstructorInfo("a", "description", null);
158: new MBeanNotificationInfo(new String[0], "java.lang.String",
159: "description");
160: new MBeanOperationInfo("a", "description", null,
161: Map.Entry[].class.getName(), MBeanOperationInfo.UNKNOWN);
162: new MBeanParameterInfo("a", Map.Entry[][].class.getName(),
163: "description");
164: }
165:
166: // TODO: implements tests for MBeanInfo
167: }
|