1 22 package org.jboss.ejb3.test.consumer; 23 24 import javax.ejb.Remote ; 25 import javax.ejb.Stateless ; 26 import org.jboss.annotation.JndiInject; 27 import org.jboss.ejb3.mdb.ProducerManager; 28 import org.jboss.ejb3.mdb.ProducerObject; 29 30 36 @Stateless 37 @Remote (TestStatus.class) 38 public class TestStatusBean implements TestStatus 39 { 40 public static String queueRan = null; 41 public static String topicRan = null; 42 public static String interceptedTopic = null; 43 public static String interceptedQueue = null; 44 public static boolean postConstruct = false; 45 public static boolean preDestroy = false; 46 public static boolean fieldMessage = false; 47 public static boolean setterMessage = false; 48 49 50 public void clear() 51 { 52 queueRan = null; 53 topicRan = null; 54 interceptedTopic = null; 55 interceptedQueue = null; 56 postConstruct = false; 57 preDestroy = false; 58 fieldMessage = setterMessage = false; 59 } 60 61 private QueueTestXA xa; 62 private ProducerManager xaManager; 63 64 @JndiInject(jndiName="org.jboss.ejb3.test.consumer.QueueTestXA") 65 public void setXa(QueueTestXA xa) 66 { 67 this.xa = xa; 68 this.xaManager = ((ProducerObject)xa).getProducerManager(); 69 } 70 71 private QueueTest local; 72 private ProducerManager localManager; 73 74 @JndiInject(jndiName="org.jboss.ejb3.test.consumer.QueueTestLocal") 75 public void setLocal(QueueTest local) 76 { 77 this.local = local; 78 this.localManager = ((ProducerObject)local).getProducerManager(); 79 } 80 81 private DeploymentDescriptorQueueTestXA xaDeploymentDescriptor; 82 private ProducerManager xaManagerDeploymentDescriptor; 83 84 @JndiInject(jndiName="org.jboss.ejb3.test.consumer.DeploymentDescriptorQueueTestXA") 85 public void setXaDeploymentDescriptor(DeploymentDescriptorQueueTestXA xa) 86 { 87 this.xaDeploymentDescriptor = xa; 88 this.xaManagerDeploymentDescriptor = ((ProducerObject)xa).getProducerManager(); 89 } 90 91 private DeploymentDescriptorQueueTestLocal localDeploymentDescriptor; 92 private ProducerManager localManagerDeploymentDescriptor; 93 94 @JndiInject(jndiName="org.jboss.ejb3.test.consumer.DeploymentDescriptorQueueTestLocal") 95 public void setLocalDeploymentDescriptor(DeploymentDescriptorQueueTestLocal local) 96 { 97 this.localDeploymentDescriptor = local; 98 this.localManagerDeploymentDescriptor = ((ProducerObject)local).getProducerManager(); 99 } 100 101 public void testXA() throws Exception 102 { 103 104 xaManager.connect(); 105 xa.method1("testXA", 1); 106 Thread.sleep(1000); 107 xa.method2("testXA2", 4.4F); 108 System.out.println("end TESTXA **"); 109 xaManager.close(); 110 } 111 112 public void testLocal() throws Exception 113 { 114 115 localManager.connect(); 116 local.method1("testLocal", 1); 117 Thread.sleep(1000); 118 local.method2("testLocal2", 4.4F); 119 localManager.close(); 120 } 121 122 public void testDeploymentDescriptorXA() throws Exception 123 { 124 125 xaManagerDeploymentDescriptor.connect(); 126 xaDeploymentDescriptor.method1("testXA", 1); 127 Thread.sleep(1000); 128 xaDeploymentDescriptor.method2("testXA2", 4.4F); 129 System.out.println("end TESTXA **"); 130 xaManagerDeploymentDescriptor.close(); 131 } 132 133 public void testDeploymentDescriptorLocal() throws Exception 134 { 135 136 localManagerDeploymentDescriptor.connect(); 137 localDeploymentDescriptor.method1("testLocal", 1); 138 Thread.sleep(1000); 139 localDeploymentDescriptor.method2("testLocal2", 4.4F); 140 localManagerDeploymentDescriptor.close(); 141 } 142 143 public String queueFired() 144 { 145 return queueRan; 146 } 147 148 public String topicFired() 149 { 150 return topicRan; 151 } 152 153 public String interceptedTopic() 154 { 155 return interceptedTopic; 156 } 157 158 public String interceptedQueue() 159 { 160 return interceptedQueue; 161 } 162 163 public boolean postConstruct() 164 { 165 return postConstruct; 166 } 167 168 public boolean preDestroy() 169 { 170 return preDestroy; 171 } 172 173 public boolean fieldMessage() 174 { 175 return fieldMessage; 176 } 177 178 public boolean setterMessage() 179 { 180 return setterMessage; 181 } 182 } 183 | Popular Tags |