1 22 package org.jboss.test.aop.test; 23 24 import javax.management.MBeanServerConnection ; 25 import javax.management.ObjectName ; 26 27 28 import junit.framework.Test; 29 import junit.framework.TestSuite; 30 31 32 import org.jboss.test.JBossTestCase; 33 34 40 41 public class MicrocontainerDefaultAnnotationUnitTestCase 42 extends JBossTestCase 43 { 44 static boolean deployed = false; 45 static int test = 0; 46 47 public MicrocontainerDefaultAnnotationUnitTestCase(String name) 48 { 49 super(name); 50 } 51 52 public void testDefault() throws Exception 53 { 54 ObjectName testerName = new ObjectName ("jboss.aop:name=Bean"); 55 checkAnnotation(testerName, "Default"); 56 } 57 58 public void testOverridden() throws Exception 59 { 60 ObjectName testerName = new ObjectName ("jboss.aop:name=Bean2"); 61 checkAnnotation(testerName, "Overridden"); 62 } 63 64 private void checkAnnotation(ObjectName on, String expectedValue) throws Exception 65 { 66 MBeanServerConnection server = getServer(); 67 String value = (String )server.getAttribute(on, "AnnotationValue"); 68 assertNotNull(value); 69 assertEquals(expectedValue, value); 70 } 71 72 73 public static Test suite() throws Exception 74 { 75 TestSuite suite = new TestSuite(); 76 suite.addTest(new TestSuite(MicrocontainerDefaultAnnotationUnitTestCase.class)); 77 78 AOPTestSetup setup = new AOPTestSetup(suite, "aop-mc-defaultannotationtest.jar"); 79 return setup; 80 } 81 82 } 83 | Popular Tags |