}
@Test
public void testReplaceOriginals() throws Exception {
StorageFile storagePRJ1 = shpFiles1.getStorageFile(PRJ);
StorageFile storageSHP1 = shpFiles1.getStorageFile(SHP);
StorageFile storagePRJ2 = shpFiles2.getStorageFile(PRJ);
StorageFile storageSHP2 = shpFiles2.getStorageFile(SHP);
try {
String sPRJ1 = "storagePRJ1";
String sSHP1 = "storageSHP1";
String sPRJ2 = "storagePRJ2";
String sSHP2 = "storageSHP2";
writeData(storagePRJ1, sPRJ1);
writeData(storageSHP1, sSHP1);
writeData(storagePRJ2, sPRJ2);
writeData(storageSHP2, sSHP2);
StorageFile.replaceOriginals(storagePRJ1, storagePRJ2, storageSHP1,
storageSHP2, storageSHP2);
this.assertCorrectData(shpFiles1, PRJ, sPRJ1);
this.assertCorrectData(shpFiles1, SHP, sSHP1);
this.assertCorrectData(shpFiles2, PRJ, sPRJ2);
this.assertCorrectData(shpFiles2, SHP, sSHP2);
assertEquals(0, shpFiles1.numberOfLocks());
assertEquals(0, shpFiles2.numberOfLocks());
} finally {
storagePRJ1.getFile().delete();
storagePRJ2.getFile().delete();
storageSHP1.getFile().delete();
storageSHP2.getFile().delete();
}
}