1 18 package org.apache.activemq.xbean; 19 20 import java.net.URI ; 21 22 import junit.framework.TestCase; 23 24 import org.apache.activemq.broker.BrokerFactory; 25 import org.apache.activemq.broker.BrokerService; 26 import org.apache.activemq.store.PersistenceAdapter; 27 import org.apache.activemq.store.jdbc.JDBCPersistenceAdapter; 28 29 33 public class JDBCPersistenceXBeanConfigTest extends TestCase { 34 35 protected BrokerService brokerService; 36 37 public void testManagmentContextConfiguredCorrectly() throws Exception { 38 39 PersistenceAdapter persistenceAdapter = brokerService.getPersistenceAdapter(); 40 assertNotNull(persistenceAdapter); 41 assertTrue(persistenceAdapter instanceof JDBCPersistenceAdapter); 42 43 JDBCPersistenceAdapter jpa = (JDBCPersistenceAdapter) persistenceAdapter; 44 assertEquals("BROKER1.", jpa.getStatements().getTablePrefix()); 45 46 } 47 48 protected void setUp() throws Exception { 49 brokerService = createBroker(); 50 brokerService.start(); 51 } 52 53 protected void tearDown() throws Exception { 54 if (brokerService != null) { 55 brokerService.stop(); 56 } 57 } 58 59 protected BrokerService createBroker() throws Exception { 60 String uri = "org/apache/activemq/xbean/jdbc-persistence-test.xml"; 61 return BrokerFactory.createBroker(new URI ("xbean:"+uri)); 62 } 63 64 } 65 | Popular Tags |