1 22 package org.jboss.test.system.controller.instantiate.standard.test; 23 24 import javax.management.NotCompliantMBeanException ; 25 import javax.management.ObjectName ; 26 27 import org.jboss.system.ConfigurationException; 28 import org.jboss.test.system.controller.AbstractControllerTest; 29 import org.jboss.test.system.controller.support.SimpleMBean; 30 31 37 public abstract class StandardMBeanTest extends AbstractControllerTest 38 { 39 public StandardMBeanTest(String name) 40 { 41 super(name); 42 } 43 44 public void testStandardMBean() throws Exception 45 { 46 ObjectName name = SimpleMBean.OBJECT_NAME; 47 assertInstall(name); 48 assertUninstall(name); 49 } 50 51 public void testStandardMBeanInterface() throws Exception 52 { 53 ObjectName name = SimpleMBean.OBJECT_NAME; 54 assertInstall(name); 55 String result = (String ) getServer().invoke(name, "echoReverse", new Object [] { "12345" }, new String [] { String .class.getName() }); 56 assertEquals("54321", result); 57 assertUninstall(name); 58 } 59 60 public void testStandardMBeanInterfaceNotFound() throws Exception 61 { 62 assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, ClassNotFoundException .class); 63 } 64 65 public void testStandardMBeanInterfaceNotImplemented() throws Exception 66 { 67 assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, NotCompliantMBeanException .class); 68 } 69 70 public void testStandardMBeanCodeMissing() throws Exception 71 { 72 assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, ConfigurationException.class); 73 } 74 75 public void testStandardMBeanCodeEmpty() throws Exception 76 { 77 assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, ConfigurationException.class); 78 } 79 80 public void testStandardMBeanCodeClassNotFound() throws Exception 81 { 82 assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, ClassNotFoundException .class); 83 } 84 85 public void testStandardMBeanAbstractClass() throws Exception 86 { 87 assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, InstantiationException .class); 88 } 89 90 public void testStandardMBeanConstructorError() throws Exception 91 { 92 assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, Error .class); 93 } 94 95 public void testStandardMBeanConstructorException() throws Exception 96 { 97 assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, RuntimeException .class); 98 } 99 100 public void testStandardMBeanConstructorTypeNotFound() throws Exception 101 { 102 assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, ClassNotFoundException .class); 103 } 104 105 public void testStandardMBeanConstructorInvalidType() throws Exception 106 { 107 assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, ConfigurationException.class); 108 } 109 110 public void testStandardMBeanConstructorInvalidValue() throws Exception 111 { 112 assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, NumberFormatException .class); 113 } 114 } 115 | Popular Tags |