1 22 package org.jboss.test.system.controller.instantiate.plain.test; 23 24 import java.util.Collections ; 25 26 import javax.management.NotCompliantMBeanException ; 27 import javax.management.ObjectName ; 28 29 import org.jboss.system.ConfigurationException; 30 import org.jboss.test.system.controller.AbstractControllerTest; 31 import org.jboss.test.system.controller.support.BrokenDynamicMBean; 32 import org.jboss.test.system.controller.support.PostDeregisterError; 33 import org.jboss.test.system.controller.support.PostRegisterError; 34 import org.jboss.test.system.controller.support.PreDeregisterError; 35 import org.jboss.test.system.controller.support.PreRegisterError; 36 import org.jboss.test.system.controller.support.SimpleMBean; 37 38 44 public abstract class PlainMBeanTest extends AbstractControllerTest 45 { 46 public PlainMBeanTest(String name) 47 { 48 super(name); 49 } 50 51 public void testPlainMBean() throws Exception 52 { 53 ObjectName name = SimpleMBean.OBJECT_NAME; 54 assertInstall(name); 55 assertUninstall(name); 56 } 57 58 public void testPlainMBeanCodeMissing() throws Exception 59 { 60 assertMaybeParseFailure(SimpleMBean.OBJECT_NAME, ConfigurationException.class); 61 } 62 63 public void testPlainMBeanCodeEmpty() throws Exception 64 { 65 assertMaybeParseFailure(SimpleMBean.OBJECT_NAME, ConfigurationException.class); 66 } 67 68 public void testPlainMBeanCodeClassNotFound() throws Exception 69 { 70 assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, ClassNotFoundException .class); 71 } 72 73 public void testPlainMBeanNotMBean() throws Exception 74 { 75 assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, NotCompliantMBeanException .class); 76 } 77 78 public void testPlainMBeanAbstractClass() throws Exception 79 { 80 assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, NotCompliantMBeanException .class); 81 } 82 83 public void testPlainMBeanConstructorError() throws Exception 84 { 85 assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, Error .class); 86 } 87 88 public void testPlainMBeanConstructorException() throws Exception 89 { 90 assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, RuntimeException .class); 91 } 92 93 public void testPlainMBeanConstructorTypeNotFound() throws Exception 94 { 95 assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, ClassNotFoundException .class); 96 } 97 98 public void testPlainMBeanConstructorInvalidType() throws Exception 99 { 100 assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, ConfigurationException.class); 101 } 102 103 public void testPlainMBeanConstructorInvalidValue() throws Exception 104 { 105 assertMaybeDeployFailure(SimpleMBean.OBJECT_NAME, NumberFormatException .class); 106 } 107 108 public void testPlainMBeanGetMBeanInfoError() throws Exception 109 { 110 assertMaybeDeployFailure(BrokenDynamicMBean.OBJECT_NAME, Error .class); 111 } 112 113 public void testPlainMBeanPreRegisterError() throws Exception 114 { 115 assertMaybeDeployFailure(PreRegisterError.OBJECT_NAME, Error .class); 116 } 117 118 public void testPlainMBeanPostRegisterError() throws Exception 119 { 120 assertMaybeDeployFailure(PostRegisterError.OBJECT_NAME, Error .class); 121 } 122 123 public void testPlainMBeanPreDeregisterError() throws Exception 124 { 125 ObjectName name = PreDeregisterError.OBJECT_NAME; 126 assertInstall(name); 127 uninstall(Collections.singletonList(name)); 128 assertNoService(name); 129 assertRegistered(name); 130 } 131 132 public void testPlainMBeanPostDeregisterError() throws Exception 133 { 134 ObjectName name = PostDeregisterError.OBJECT_NAME; 135 assertInstall(name); 136 assertUninstall(name); 137 } 138 } 139 | Popular Tags |