1 22 package org.jboss.test.system.controller.configure.attribute.test; 23 24 import javax.management.ObjectName ; 25 26 import org.jboss.deployment.DeploymentException; 27 import org.jboss.test.system.controller.AbstractControllerTest; 28 import org.jboss.test.system.controller.support.BrokenDynamicMBeanAttributes; 29 import org.jboss.test.system.controller.support.Simple; 30 import org.jboss.test.system.controller.support.SimpleMBean; 31 32 38 public abstract class AttributeTest extends AbstractControllerTest 39 { 40 public AttributeTest(String name) 41 { 42 super(name); 43 } 44 45 public void testAttributeNone() throws Exception 46 { 47 ObjectName name = SimpleMBean.OBJECT_NAME; 48 assertInstall(name); 49 try 50 { 51 Simple simple = getSimple(); 52 assertNull(simple.getAttribute1()); 53 assertNull(simple.getAttribute2()); 54 } 55 finally 56 { 57 assertUninstall(name); 58 } 59 } 60 61 public void testAttributeOne() throws Exception 62 { 63 ObjectName name = SimpleMBean.OBJECT_NAME; 64 assertInstall(name); 65 try 66 { 67 Simple simple = getSimple(); 68 assertEquals("value1", simple.getAttribute1()); 69 assertNull(simple.getAttribute2()); 70 } 71 finally 72 { 73 assertUninstall(name); 74 } 75 } 76 77 public void testAttributeTwo() throws Exception 78 { 79 ObjectName name = SimpleMBean.OBJECT_NAME; 80 assertInstall(name); 81 try 82 { 83 Simple simple = getSimple(); 84 assertEquals("value1", simple.getAttribute1()); 85 assertEquals("value2", simple.getAttribute2()); 86 } 87 finally 88 { 89 assertUninstall(name); 90 } 91 } 92 93 public void testAttributeNoValue() throws Exception 94 { 95 ObjectName name = SimpleMBean.OBJECT_NAME; 96 assertInstall(name); 97 try 98 { 99 Simple simple = getSimple(); 100 assertNull(simple.getAttribute1()); 101 assertNull(simple.getAttribute2()); 102 } 103 finally 104 { 105 assertUninstall(name); 106 } 107 } 108 109 public void testAttributeEmptyValue() throws Exception 110 { 111 ObjectName name = SimpleMBean.OBJECT_NAME; 112 assertInstall(name); 113 try 114 { 115 Simple simple = getSimple(); 116 assertNull(simple.getAttribute1()); 117 assertNull(simple.getAttribute2()); 118 } 119 finally 120 { 121 assertUninstall(name); 122 } 123 } 124 125 public void testAttributeNoName() throws Exception 126 { 127 assertDeployFailure(SimpleMBean.OBJECT_NAME, DeploymentException.class); 128 } 129 130 public void testAttributeEmptyName() throws Exception 131 { 132 assertDeployFailure(SimpleMBean.OBJECT_NAME, DeploymentException.class); 133 } 134 135 public void testAttributeBrokenGetAttributes() throws Exception 136 { 137 assertDeployFailure(BrokenDynamicMBeanAttributes.OBJECT_NAME, Error .class); 138 } 139 140 public void testAttributeNotFound() throws Exception 141 { 142 assertDeployFailure(SimpleMBean.OBJECT_NAME, DeploymentException.class); 143 } 144 145 public void testAttributeBrokenSetAttribute() throws Exception 146 { 147 assertDeployFailure(SimpleMBean.OBJECT_NAME, Error .class); 148 } 149 } 150 | Popular Tags |