1 22 package org.jboss.test.system.controller.configure.attribute.test; 23 24 import javax.management.MalformedObjectNameException ; 25 import javax.management.ObjectName ; 26 27 import org.jboss.deployment.DeploymentException; 28 import org.jboss.mx.util.ObjectNameFactory; 29 import org.jboss.test.system.controller.AbstractControllerTest; 30 import org.jboss.test.system.controller.support.Simple; 31 import org.jboss.test.system.controller.support.SimpleMBean; 32 33 39 public abstract class DependsAttributeTest extends AbstractControllerTest 40 { 41 static ObjectName DEPENDS1 = ObjectNameFactory.create("jboss.test:type=depends1"); 42 static ObjectName DEPENDS2 = ObjectNameFactory.create("jboss.test:type=depends2"); 43 44 public DependsAttributeTest(String name) 45 { 46 super(name); 47 } 48 49 public void testDependsAttributeNone() throws Exception 50 { 51 ObjectName name = SimpleMBean.OBJECT_NAME; 52 assertInstall(name); 53 try 54 { 55 Simple simple = getSimple(); 56 assertNull(simple.getObjectNameAttribute1()); 57 assertNull(simple.getObjectNameAttribute2()); 58 } 59 finally 60 { 61 assertUninstall(name); 62 } 63 } 64 65 public void testDependsAttributeOne() throws Exception 66 { 67 ObjectName name = SimpleMBean.OBJECT_NAME; 68 assertInstall(name); 69 try 70 { 71 Simple simple = getSimple(); 72 assertEquals(DEPENDS1, simple.getObjectNameAttribute1()); 73 assertNull(simple.getObjectNameAttribute2()); 74 } 75 finally 76 { 77 assertUninstall(name); 78 } 79 } 80 81 public void testDependsAttributeTwo() throws Exception 82 { 83 ObjectName name = SimpleMBean.OBJECT_NAME; 84 assertInstall(name); 85 try 86 { 87 Simple simple = getSimple(); 88 assertEquals(DEPENDS1, simple.getObjectNameAttribute1()); 89 assertEquals(DEPENDS2, simple.getObjectNameAttribute2()); 90 } 91 finally 92 { 93 assertUninstall(name); 94 } 95 } 96 97 public void testDependsAttributeNested() throws Exception 98 { 99 ObjectName name = SimpleMBean.OBJECT_NAME; 100 assertInstall(name); 101 try 102 { 103 Simple simple = getSimple(); 104 assertEquals(DEPENDS1, simple.getObjectNameAttribute1()); 105 assertNull(simple.getObjectNameAttribute2()); 106 } 107 finally 108 { 109 assertUninstall(name); 110 } 111 } 112 113 public void testDependsAttributeNoValue() throws Exception 114 { 115 assertDeployFailure(SimpleMBean.OBJECT_NAME, MalformedObjectNameException .class); 116 } 117 118 public void testDependsAttributeEmptyValue() throws Exception 119 { 120 assertDeployFailure(SimpleMBean.OBJECT_NAME, MalformedObjectNameException .class); 121 } 122 123 public void testDependsAttributeInvalidValue() throws Exception 124 { 125 assertDeployFailure(SimpleMBean.OBJECT_NAME, MalformedObjectNameException .class); 126 } 127 128 public void testDependsAttributeUnknownElement() throws Exception 129 { 130 assertDeployFailure(SimpleMBean.OBJECT_NAME, MalformedObjectNameException .class); 131 } 132 133 public void testDependsAttributePatternValue() throws Exception 134 { 135 assertDeployFailure(SimpleMBean.OBJECT_NAME, MalformedObjectNameException .class); 136 } 137 138 public void testDependsAttributeNotFound() throws Exception 139 { 140 assertDeployFailure(SimpleMBean.OBJECT_NAME, DeploymentException.class); 141 } 142 143 public void testDependsAttributeBrokenSetAttribute() throws Exception 144 { 145 assertDeployFailure(SimpleMBean.OBJECT_NAME, Error .class); 146 } 147 } 148 | Popular Tags |