View Javadoc
1   package org.melati.poem.test;
2   
3   
4   import org.melati.poem.Database;
5   
6   import junit.framework.Test;
7   
8   /**
9    * A TestCase that runs in a Database session.
10   * 
11   * @author timp
12   * @since 19-May-2006
13   */
14  public abstract class EverythingTestCase extends PoemTestCase implements Test {
15  
16    /** Default db name */
17    public static final String databaseName = "everything"; 
18  
19    /**
20     * Constructor.
21     */
22    public EverythingTestCase() {
23      super();
24    }
25  
26    public EverythingTestCase(String name) {
27      super(name);
28    }
29    
30    /**
31     * @return Returns the db.
32     */
33    public Database getDb() {
34      return getDb(databaseName);
35    }
36    /**
37     * @return the db name
38     */
39    public String getDatabaseName() {
40      return databaseName;
41    }
42    
43    protected void databaseUnchanged() { 
44      assertEquals("Setting changed",0, getDb().getSettingTable().count());
45      assertEquals("Group changed", 1, getDb().getGroupTable().count());
46      assertEquals("GroupMembership changed", 1, getDb().getGroupMembershipTable().count());
47      assertEquals("Capability changed", 5, getDb().getCapabilityTable().count());
48      assertEquals("GroupCapability changed", 1, getDb().getGroupCapabilityTable().count());
49      assertEquals("TableCategory changed", 4, getDb().getTableCategoryTable().count());
50      assertEquals("User changed", 2, getDb().getUserTable().count());
51      //dumpTable(getDb().getColumnInfoTable());
52      // Until table.dropColumnAndCommit() arrives...
53      if (getDb().getDbms().canDropColumns()) {
54        assertEquals("ColumnInfo changed", 161, getDb().getColumnInfoTable().count());
55        assertEquals("TableInfo changed", 25, getDb().getTableInfoTable().count());
56        checkTables(25);
57      }
58    }
59    
60  
61  }