Пример #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);
 }
Пример #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
   }
 }
Пример #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);
 }
Пример #4
0
 // ----------------------------------------------------------
 protected void setUp() {
   updates = new MockUpdateSet();
   database = new MockDatabase();
   UpdateEngine.instance().setDatabase(database);
 }