1 24 25 package org.objectweb.cjdbc.scenario.raidb1.recovery; 26 27 import java.sql.Connection ; 28 import java.sql.ResultSet ; 29 import java.util.ArrayList ; 30 31 import org.objectweb.cjdbc.scenario.templates.Raidb1RecoveryTemplate; 32 import org.objectweb.cjdbc.scenario.tools.ScenarioUtility; 33 34 42 public class Raidb1BackupMetadataScenario extends Raidb1RecoveryTemplate 43 { 44 private static final String BACKUP_LOGIN = "user"; 45 private static final String BACKUP_PASSWORD = ""; 46 private static final String BACKUPER = "Octopus"; 47 private static final String BACKUP_PATH = "../backup"; 48 49 54 public void testBasicRecoveryScenario() throws Exception 55 { 56 String dump1 = "dump1" + System.currentTimeMillis(); 57 String dump2 = "dump2" + System.currentTimeMillis(); 58 mainVdb.backupBackend("localhost", BACKUP_LOGIN, BACKUP_PASSWORD, dump1, 59 BACKUPER, BACKUP_PATH, null); 60 mainVdb.restoreDumpOnBackend("localhost", BACKUP_LOGIN, BACKUP_PASSWORD, 61 dump1, null); 62 mainVdb.enableBackendFromCheckpoint("localhost"); 63 64 Connection con = getCJDBCConnection(); 65 ResultSet rs = con.createStatement().executeQuery("select * from document"); 66 ArrayList list1 = ScenarioUtility.convertResultSet(rs); 67 rs.close(); 68 69 mainVdb.backupBackend("localhost", BACKUP_LOGIN, BACKUP_PASSWORD, dump2, 70 BACKUPER, BACKUP_PATH, null); 71 mainVdb.restoreDumpOnBackend("localhost", BACKUP_LOGIN, BACKUP_PASSWORD, 72 dump2, null); 73 mainVdb.enableBackendFromCheckpoint("localhost"); 74 75 mainVdb.forceDisableBackend("localhost2"); 76 77 rs = con.createStatement().executeQuery("select * from document"); 78 ArrayList list2 = ScenarioUtility.convertResultSet(rs); 79 rs.close(); 80 assertEquals("ResultSets are different", list1, list2); 81 } 82 } 83 | Popular Tags |