View Javadoc

1   package org.paneris.bibliomania.test;
2   
3   import org.melati.poem.Database;
4   import org.melati.poem.PoemDatabaseFactory;
5   import org.melati.poem.test.PoemTestCase;
6   import org.paneris.bibliomania.BibliomaniaDatabase;
7   
8   /**
9    * @author timp
10   * @since 10 Feb 2007
11   *
12   */
13  public class BibliomaniaTestCase extends PoemTestCase {
14  
15    public BibliomaniaTestCase(){ }
16    public BibliomaniaTestCase(String name) {
17      super(name);
18    }
19    
20    public Database getDb() {
21      return getTreeDatabase();
22    }
23  
24    public Database getTreeDatabase() { 
25      maxTrans = 4;
26      
27  
28      return PoemDatabaseFactory.getDatabase("tree",
29              "jdbc:postgresql:" + "bibliomania",
30              "postgres",
31              "*","org.paneris.bibliomania.test.BibliomaniaTestDatabase",
32              "org.paneris.bibliomania.poem.dbms.Postgresql", 
33              false, false, false, 4);
34  /*
35   * FIXME looks like there is a bug in HSQLDB's handling of 
36   * nullable unique, http://hsqldb.org/doc/guide/ch02.html appears to lie
37      return PoemDatabaseFactory.getDatabase("tree",
38              "jdbc:hsqldb:/dist/Bibliomania/db/" + "bibliomania",
39              "sa",
40              "","org.paneris.bibliomania.test.BibliomaniaTestDatabase",
41              "org.melati.poem.dbms.Hsqldb",false,false,false,4);
42  */
43    
44    }
45    
46  
47    protected void databaseUnchanged() { 
48      assertEquals("Setting changed", 41, getDb().getSettingTable().count());
49      assertEquals("Group changed", 4, getDb().getGroupTable().count());
50  //    assertEquals("GroupMembership changed", 2, getDb().getGroupMembershipTable().count());
51      assertEquals("Capability changed", 8, getDb().getCapabilityTable().count());
52      assertEquals("GroupCapability changed", 10, getDb().getGroupCapabilityTable().count());
53      assertEquals("TableCategory changed", 6, getDb().getTableCategoryTable().count());
54  //    assertEquals("User changed", 4, getDb().getUserTable().count());
55      assertEquals("ColumnInfo changed", 347, getDb().getColumnInfoTable().count());
56      assertEquals("TableInfo changed", 45, getDb().getTableInfoTable().count());
57      assertEquals("AuthorWebsite changed", 224, ((BibliomaniaDatabase)getDb()).getAuthorWebSiteTable().count());
58      checkTablesAndColumns(45,347);
59    }
60  
61  }