1 package org.sapia.soto.jmx.config; 2 3 import junit.framework.TestCase; 4 5 import org.sapia.soto.jmx.AttributeDescriptor; 6 import org.sapia.soto.jmx.MBeanDescriptor; 7 import org.sapia.soto.jmx.TestBean; 8 9 10 19 public class AttributesTest extends TestCase { 20 public AttributesTest(String arg0) { 21 super(arg0); 22 } 23 24 public void testExcludes() throws Exception { 25 MBeanDescriptor desc = MBeanDescriptor.newInstanceFor(new TestBean()); 26 Attributes attrs = new Attributes(); 27 Attribute exclude = attrs.createExclude(); 28 exclude.setName("firstname"); 29 attrs.init(desc); 30 desc.init(); 31 super.assertEquals(0, 32 desc.getAttributeDescriptorsFor("firstname", null).size()); 33 } 34 35 public void testIncludes() throws Exception { 36 MBeanDescriptor desc = MBeanDescriptor.newInstanceFor(new TestBean()); 37 Attributes attrs = new Attributes(); 38 Attribute exclude = attrs.createInclude(); 39 exclude.setName("firstname"); 40 exclude.setDescription("The first name"); 41 attrs.init(desc); 42 desc.init(); 43 44 AttributeDescriptor ad = (AttributeDescriptor) desc.getAttributeDescriptorsFor("firstname", 45 null).get(0); 46 super.assertEquals("The first name", ad.getInfo().getDescription()); 47 } 48 } 49 | Popular Tags |