1 package org.apache.torque.engine.database.model;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import junit.framework.TestCase;
20
21 import org.apache.torque.engine.database.transform.XmlToAppData;
22
23 /***
24 * Tests for package handling.
25 *
26 * @author <a href="mailto:mpoeschl@marmot.at>Martin Poeschl</a>
27 * @version $Id: TableTest.java,v 1.1.2.2 2004/05/20 04:35:16 seade Exp $
28 */
29 public class TableTest extends TestCase
30 {
31 private XmlToAppData xmlToAppData = null;
32 private AppData appData = null;
33
34 public TableTest(String name)
35 {
36 super(name);
37 }
38
39 protected void setUp() throws Exception
40 {
41 super.setUp();
42 }
43
44 protected void tearDown() throws Exception
45 {
46 xmlToAppData = null;
47 super.tearDown();
48 }
49
50 /***
51 * test if the tables get the package name from the properties file
52 */
53 public void testIdMethodHandling()
54 throws Exception
55 {
56 xmlToAppData = new XmlToAppData("mysql", "defaultpackage", null);
57 appData = xmlToAppData.parseFile(
58 "src/test/org/apache/torque/engine/database/model/tabletest-schema.xml");
59 Database db = appData.getDatabase("iddb");
60 assertEquals(IDMethod.ID_BROKER, db.getDefaultIdMethod());
61 Table table = db.getTable("table_idbroker");
62 assertEquals(IDMethod.ID_BROKER, table.getIdMethod());
63 Table table2 = db.getTable("table_native");
64 assertEquals(IDMethod.NATIVE, table2.getIdMethod());
65 }
66 }