1 22 package org.jboss.test.aop.bean; 23 24 import javax.management.MBeanRegistration ; 25 import javax.management.MBeanServer ; 26 import javax.management.ObjectName ; 27 import org.jboss.logging.Logger; 28 import org.jboss.system.ServiceMBeanSupport; 29 35 public class TxTester 36 extends ServiceMBeanSupport 37 implements TxTesterMBean, MBeanRegistration 38 { 39 static Logger log = Logger.getLogger(TxTester.class); 42 MBeanServer m_mbeanServer; 43 44 46 public TxTester() 48 {} 49 50 52 public ObjectName preRegister(MBeanServer server, ObjectName name) 54 throws Exception 55 { 56 m_mbeanServer = server; 57 return name; 58 } 59 60 public void postRegister(Boolean registrationDone) 61 {} 62 public void preDeregister() throws Exception 63 {} 64 public void postDeregister() 65 {} 66 67 protected void startService() 68 throws Exception 69 { 70 } 71 72 protected void stopService() { 73 } 74 75 public void testXml() 76 { 77 try{ 78 log.info("TESTING Tx XML"); 79 TxPOJO pojo = new TxPOJO(); 80 log.info("TESTING Never"); 81 pojo.callNever(); 82 log.info("TESTING NotSupprted"); 83 pojo.callNotSupported(); 84 log.info("TESTING Supports"); 85 pojo.callSupportsWithTx(); 86 pojo.callSupportsWithoutTx(); 87 88 log.info("TESTING Required"); 89 pojo.required(); 90 91 log.info("TESTING RequiresNew"); 92 pojo.callRequiresNew(); 93 94 log.info("TESTING Mandatory"); 95 pojo.callMandatoryNoTx(); 96 pojo.callMandatoryWithTx(); 97 } 98 catch (Throwable ex) 99 { 100 log.error("failed", ex); 101 throw new RuntimeException (ex.getMessage()); 102 } 103 } 104 105 public void testAnnotated() 106 { 107 try{ 108 log.info("TESTING Tx Annotated"); 109 AnnotatedTxPOJO pojo = new AnnotatedTxPOJO(); 110 log.info("TESTING Never"); 111 pojo.callNever(); 112 log.info("TESTING NotSupprted"); 113 pojo.callNotSupported(); 114 log.info("TESTING Supports"); 115 pojo.callSupportsWithTx(); 116 pojo.callSupportsWithoutTx(); 117 118 log.info("TESTING Required"); 119 pojo.required(); 120 121 log.info("TESTING RequiresNew"); 122 pojo.callRequiresNew(); 123 124 log.info("TESTING Mandatory"); 125 pojo.callMandatoryNoTx(); 126 pojo.callMandatoryWithTx(); 127 } 128 catch (Throwable ex) 129 { 130 log.error("failed", ex); 131 throw new RuntimeException (ex); 132 } 133 } 134 135 } 136 137 | Popular Tags |