1 18 package org.apache.activemq.broker.store; 19 20 import java.util.Properties ; 21 import junit.framework.Test; 22 import org.apache.activemq.broker.BrokerService; 23 import org.apache.activemq.broker.XARecoveryBrokerTest; 24 import org.apache.activemq.store.amq.AMQPersistenceAdapter; 25 import org.apache.activemq.store.jpa.JPAReferenceStoreAdapter; 26 27 32 public class QuickJPAStoreXARecoveryBrokerTest extends XARecoveryBrokerTest { 33 34 public static Test suite() { 35 return suite(QuickJPAStoreXARecoveryBrokerTest.class); 36 } 37 38 public static void main(String [] args) { 39 junit.textui.TestRunner.run(suite()); 40 } 41 42 protected BrokerService createBroker() throws Exception { 43 BrokerService service = new BrokerService(); 44 service.setDeleteAllMessagesOnStartup(true); 45 AMQPersistenceAdapter pa = new AMQPersistenceAdapter(); 46 47 JPAReferenceStoreAdapter rfa = new JPAReferenceStoreAdapter(); 48 Properties props = new Properties (); 49 props.setProperty("openjpa.ConnectionDriverName", "org.apache.derby.jdbc.EmbeddedDriver"); 50 props.setProperty("openjpa.ConnectionURL", "jdbc:derby:activemq-data/derby;create=true"); 51 props.setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema"); 52 props.setProperty("openjpa.Log", "DefaultLevel=WARN,SQL=TRACE"); 53 rfa.setEntityManagerProperties(props); 54 pa.setReferenceStoreAdapter(rfa); 55 56 service.setPersistenceAdapter(pa); 57 return service; 58 } 59 60 protected BrokerService createRestartedBroker() throws Exception { 61 BrokerService service = new BrokerService(); 62 AMQPersistenceAdapter pa = new AMQPersistenceAdapter(); 63 64 JPAReferenceStoreAdapter rfa = new JPAReferenceStoreAdapter(); 65 Properties props = new Properties (); 66 props.setProperty("openjpa.ConnectionDriverName", "org.apache.derby.jdbc.EmbeddedDriver"); 67 props.setProperty("openjpa.ConnectionURL", "jdbc:derby:activemq-data/derby;create=true"); 68 props.setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema"); 69 props.setProperty("openjpa.Log", "DefaultLevel=WARN,SQL=TRACE"); 70 rfa.setEntityManagerProperties(props); 71 pa.setReferenceStoreAdapter(rfa); 72 73 service.setPersistenceAdapter(pa); 74 return service; 75 } 76 77 } 78 | Popular Tags |