1 16 17 package org.springframework.jmx.export.assembler; 18 19 import javax.management.modelmbean.ModelMBeanAttributeInfo ; 20 import javax.management.modelmbean.ModelMBeanInfo ; 21 22 25 public class MethodNameBasedMBeanInfoAssemblerTests extends AbstractJmxAssemblerTests { 26 27 protected static final String OBJECT_NAME = "bean:name=testBean5"; 28 29 protected String getObjectName() { 30 return OBJECT_NAME; 31 } 32 33 protected int getExpectedOperationCount() { 34 return 5; 35 } 36 37 protected int getExpectedAttributeCount() { 38 return 2; 39 } 40 41 protected MBeanInfoAssembler getAssembler() { 42 MethodNameBasedMBeanInfoAssembler assembler = new MethodNameBasedMBeanInfoAssembler(); 43 assembler.setManagedMethods(new String [] {"add", "myOperation", "getName", "setName", "getAge"}); 44 return assembler; 45 } 46 47 public void testGetAgeIsReadOnly() throws Exception { 48 ModelMBeanInfo info = getMBeanInfoFromAssembler(); 49 ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE); 50 51 assertTrue(attr.isReadable()); 52 assertFalse(attr.isWritable()); 53 } 54 55 protected String getApplicationContextPath() { 56 return "org/springframework/jmx/export/assembler/methodNameAssembler.xml"; 57 } 58 59 } 60 | Popular Tags |