KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > xbean > JDBCPersistenceXBeanConfigTest


1 /**
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one or more
4  * contributor license agreements. See the NOTICE file distributed with
5  * this work for additional information regarding copyright ownership.
6  * The ASF licenses this file to You under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with
8  * the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.apache.activemq.xbean;
19
20 import java.net.URI JavaDoc;
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 /**
30  *
31  * @version $Revision: 1.1 $
32  */

33 public class JDBCPersistenceXBeanConfigTest extends TestCase {
34
35     protected BrokerService brokerService;
36
37     public void testManagmentContextConfiguredCorrectly() throws Exception JavaDoc {
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 JavaDoc {
49         brokerService = createBroker();
50         brokerService.start();
51     }
52
53     protected void tearDown() throws Exception JavaDoc {
54         if (brokerService != null) {
55             brokerService.stop();
56         }
57     }
58
59     protected BrokerService createBroker() throws Exception JavaDoc {
60         String JavaDoc uri = "org/apache/activemq/xbean/jdbc-persistence-test.xml";
61         return BrokerFactory.createBroker(new URI JavaDoc("xbean:"+uri));
62     }
63
64 }
65
Popular Tags