KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > compliance > standard > AttributeInfoTEST


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7
8 package test.compliance.standard;
9
10 import junit.framework.TestCase;
11
12 import javax.management.MBeanAttributeInfo;
13 import javax.management.MBeanInfo;
14
15 /**
16  * @author <a HREF="mailto:trevor@protocool.com">Trevor Squires</a>.
17  */

18
19 public class AttributeInfoTEST extends TestCase
20 {
21    private String failureHint;
22    private MBeanInfo info;
23    private String attributeName;
24    private String type;
25    private boolean read;
26    private boolean write;
27    private boolean is;
28
29    public AttributeInfoTEST(String failureHint, MBeanInfo info, String attributeName, String type, boolean read, boolean write, boolean is)
30    {
31       super("testValidAttribute");
32       this.failureHint = failureHint;
33       this.info = info;
34       this.attributeName = attributeName;
35       this.type = type;
36       this.read= read;
37       this.write= write;
38       this.is= is;
39    }
40
41    public void testValidAttribute()
42    {
43       MBeanAttributeInfo[] attributes = info.getAttributes();
44       MBeanAttributeInfo attribute = InfoUtil.findAttribute(attributes, attributeName);
45
46       assertNotNull(failureHint + ": " + info.getClassName() + ": " + attributeName + " was not found", attribute);
47       assertEquals(failureHint + ": " + info.getClassName() + ": " + attributeName + " type", type, attribute.getType());
48       assertEquals(failureHint + ": " + info.getClassName() + ": " + attributeName + " readable", read, attribute.isReadable());
49       assertEquals(failureHint + ": " + info.getClassName() + ": " + attributeName + " writable", write, attribute.isWritable());
50       assertEquals(failureHint + ": " + info.getClassName() + ": " + attributeName + " isIS", is, attribute.isIs());
51    }
52 }
53
Popular Tags