Ejemplo n.º 1
0
 // ----------------------------------------------------------
 public void testUpdateFrom1() throws SQLException {
   database.setVersionNumber(updates.subsystemName(), 1);
   UpdateEngine.instance().applyNecessaryUpdates(updates);
   assertEquals(2, database.currentVersionNumber(updates.subsystemName()));
   assertEquals(
       " hasTable(DBVERSION) tryToLock(mock)" + " executeSQL(v2) unlock(mock) close",
       database.history);
 }
Ejemplo n.º 2
0
 // ----------------------------------------------------------
 public void testUpdateFrom3() throws SQLException {
   database.setVersionNumber(updates.subsystemName(), 3);
   try {
     UpdateEngine.instance().applyNecessaryUpdates(updates);
     fail();
   } catch (IllegalStateException expected) {
     // should be thrown because of upsupported version number
   }
 }
Ejemplo n.º 3
0
 // ----------------------------------------------------------
 public void testUpdateFromEmpty() throws SQLException {
   database.tablesExist = false;
   UpdateEngine.instance().applyNecessaryUpdates(updates);
   assertEquals(2, database.currentVersionNumber(updates.subsystemName()));
   assertEquals(
       " hasTable(DBVERSION) initializeVersionTable tryToLock(mock)"
           + " executeSQL(v0) executeSQL(v1) executeSQL(v2) unlock(mock)"
           + " close",
       database.history);
 }
Ejemplo n.º 4
0
 // ----------------------------------------------------------
 protected void setUp() {
   updates = new MockUpdateSet();
   database = new MockDatabase();
   UpdateEngine.instance().setDatabase(database);
 }