1 22 package org.jboss.test.jbossmq; 23 24 import javax.jms.Connection ; 25 import javax.jms.ConnectionFactory ; 26 27 import org.jboss.mq.SpyDestination; 28 import org.jboss.mq.SpyQueue; 29 import org.jboss.mq.server.JMSDestinationManager; 30 import org.jboss.mq.server.JMSQueue; 31 import org.jboss.test.AbstractTestDelegate; 32 import org.jboss.test.jbossmq.support.MockServerFailureInterceptor; 33 import org.jboss.test.kernel.junit.MicrocontainerTest; 34 35 41 public class JBossMQMicrocontainerTest extends MicrocontainerTest 42 { 43 50 public static AbstractTestDelegate getDelegate(Class clazz) throws Exception 51 { 52 return new JBossMQMicrocontainerTestDelegate(clazz); 53 } 54 55 60 public JBossMQMicrocontainerTest(String name) 61 { 62 super(name); 63 } 64 65 protected ConnectionFactory getConnectionFactory() throws Exception 66 { 67 return (ConnectionFactory ) getBean("ConnectionFactory"); 68 } 69 70 protected Connection createConnection() throws Exception 71 { 72 return getConnectionFactory().createConnection(); 73 } 74 75 protected JMSDestinationManager getJMSServer() throws Exception 76 { 77 return (JMSDestinationManager) getBean("JMSServer"); 78 } 79 80 protected SpyQueue createQueue(String name) throws Exception 81 { 82 SpyQueue queue = new SpyQueue(name); 83 JMSDestinationManager server = getJMSServer(); 84 JMSQueue realQueue = new JMSQueue(queue, null, server, server.getParameters()); 85 server.addDestination(realQueue); 86 return queue; 87 } 88 89 protected void removeDestination(SpyDestination destination) throws Exception 90 { 91 JMSDestinationManager server = getJMSServer(); 92 server.closeDestination(destination); 93 } 94 95 protected MockServerFailureInterceptor getMockServerFailure() throws Exception 96 { 97 return (MockServerFailureInterceptor) getBean("MockServerFailure"); 98 } 99 100 protected void raiseReceiveError(boolean value) throws Exception 101 { 102 getMockServerFailure().raiseReceiveError = value; 103 } 104 } 105 | Popular Tags |