1 22 package org.jboss.test.system.controller.configure.value.jbxb.test; 23 24 import javax.management.ObjectName ; 25 26 import org.jboss.test.system.controller.AbstractControllerTest; 27 import org.jboss.test.system.controller.support.JavaBean; 28 import org.jboss.test.system.controller.support.Simple; 29 import org.jboss.test.system.controller.support.SimpleMBean; 30 31 37 public abstract class JBXBValueTest extends AbstractControllerTest 38 { 39 public JBXBValueTest(String name) 40 { 41 super(name); 42 } 43 44 public void testBasic() throws Exception 45 { 46 javaBean(); 47 } 48 49 public void testClassNotFound() throws Exception 50 { 51 assertDeployFailure(SimpleMBean.OBJECT_NAME, ClassNotFoundException .class); 52 } 53 54 public void testAbstractClass() throws Exception 55 { 56 assertDeployFailure(SimpleMBean.OBJECT_NAME, IllegalArgumentException .class); 57 } 58 59 public void testErrorInConstructor() throws Exception 60 { 61 assertDeployFailure(SimpleMBean.OBJECT_NAME, Error .class); 62 } 63 64 public void testNoPropertyName() throws Exception 65 { 66 assertDeployFailure(SimpleMBean.OBJECT_NAME, IllegalArgumentException .class); 67 } 68 69 public void testEmptyPropertyName() throws Exception 70 { 71 assertDeployFailure(SimpleMBean.OBJECT_NAME, IllegalArgumentException .class); 72 } 73 74 public void testPropertyNotFound() throws Exception 75 { 76 assertDeployFailure(SimpleMBean.OBJECT_NAME, IllegalArgumentException .class); 77 } 78 79 public void testNoPropertyEditor() throws Exception 80 { 81 assertDeployFailure(SimpleMBean.OBJECT_NAME, IllegalArgumentException .class); 82 } 83 84 public void testNoPropertyValue() throws Exception 85 { 86 ObjectName name = SimpleMBean.OBJECT_NAME; 87 88 assertInstall(name); 89 try 90 { 91 Simple test = getSimple(); 92 93 JavaBean bean = test.getJavaBean(); 94 assertNotNull(bean); 95 assertNull(bean.getProperty1()); 96 } 97 finally 98 { 99 assertUninstall(name); 100 } 101 } 102 103 public void testErrorInProperty() throws Exception 104 { 105 assertDeployFailure(SimpleMBean.OBJECT_NAME, Error .class); 106 } 107 108 protected void javaBean() throws Exception 109 { 110 ObjectName name = SimpleMBean.OBJECT_NAME; 111 112 assertInstall(name); 113 try 114 { 115 Simple test = getSimple(); 116 117 JavaBean bean = test.getJavaBean(); 118 assertNotNull(bean); 119 assertEquals("property1", bean.getProperty1()); 120 assertEquals(new Integer (10), bean.getProperty2()); 121 } 122 finally 123 { 124 assertUninstall(name); 125 } 126 } 127 } 128 | Popular Tags |