X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fio%2FBackupFilesTest.java;fp=test%2Fjalview%2Fio%2FBackupFilesTest.java;h=64cf902facc766a3b11073d27461eb8cf3307e80;hb=b419d3b17606d478c234678487ff34d97bfa83cc;hp=723279d83f547399020b8bef5c4bf25425b0eed7;hpb=b0716c75367a82443cd516ef3ea08708dacd92e9;p=jalview.git diff --git a/test/jalview/io/BackupFilesTest.java b/test/jalview/io/BackupFilesTest.java index 723279d..64cf902 100644 --- a/test/jalview/io/BackupFilesTest.java +++ b/test/jalview/io/BackupFilesTest.java @@ -34,7 +34,8 @@ public class BackupFilesTest } private static boolean actuallyDeleteTmpFiles = true; - private static String testDir = "examples"; + + private static String testDir = "test/jalview/io"; private static String testBasename = "backupfilestest"; @@ -61,7 +62,7 @@ public class BackupFilesTest private static String suffix = "_BACKUPTEST-%n"; - private static int digits = 8; + private static int digits = 6; private static int rollMax = 2; @@ -107,28 +108,28 @@ public class BackupFilesTest } // check 10 backup files - HashMap correctindexmap = new HashMap(); - correctindexmap.put(1, "backupfilestestTemp.fa_BACKUPTEST-00000001"); - correctindexmap.put(2, "backupfilestestTemp.fa_BACKUPTEST-00000002"); - correctindexmap.put(3, "backupfilestestTemp.fa_BACKUPTEST-00000003"); - correctindexmap.put(4, "backupfilestestTemp.fa_BACKUPTEST-00000004"); - correctindexmap.put(5, "backupfilestestTemp.fa_BACKUPTEST-00000005"); - correctindexmap.put(6, "backupfilestestTemp.fa_BACKUPTEST-00000006"); - correctindexmap.put(7, "backupfilestestTemp.fa_BACKUPTEST-00000007"); - correctindexmap.put(8, "backupfilestestTemp.fa_BACKUPTEST-00000008"); - correctindexmap.put(9, "backupfilestestTemp.fa_BACKUPTEST-00000009"); - correctindexmap.put(10, "backupfilestestTemp.fa_BACKUPTEST-00000010"); - HashMap wrongindexmap = new HashMap(); + HashMap correctindexmap = new HashMap<>(); + correctindexmap.put(1, "backupfilestestTemp.fa_BACKUPTEST-000001"); + correctindexmap.put(2, "backupfilestestTemp.fa_BACKUPTEST-000002"); + correctindexmap.put(3, "backupfilestestTemp.fa_BACKUPTEST-000003"); + correctindexmap.put(4, "backupfilestestTemp.fa_BACKUPTEST-000004"); + correctindexmap.put(5, "backupfilestestTemp.fa_BACKUPTEST-000005"); + correctindexmap.put(6, "backupfilestestTemp.fa_BACKUPTEST-000006"); + correctindexmap.put(7, "backupfilestestTemp.fa_BACKUPTEST-000007"); + correctindexmap.put(8, "backupfilestestTemp.fa_BACKUPTEST-000008"); + correctindexmap.put(9, "backupfilestestTemp.fa_BACKUPTEST-000009"); + correctindexmap.put(10, "backupfilestestTemp.fa_BACKUPTEST-000010"); + HashMap wrongindexmap = new HashMap<>(); wrongindexmap.put(1, "backupfilestestTemp.fa_BACKUPTEST-1"); - wrongindexmap.put(2, "backupfilestestTemp.fa_BACKUPTEST-00000002"); - wrongindexmap.put(3, "backupfilestestTemp.fa_BACKUPTEST-00000003"); - wrongindexmap.put(4, "backupfilestestTemp.fa_BACKUPTEST-00000004"); - wrongindexmap.put(5, "backupfilestestTemp.fa_BACKUPTEST-00000005"); - wrongindexmap.put(6, "backupfilestestTemp.fa_BACKUPTEST-00000006"); - wrongindexmap.put(7, "backupfilestestTemp.fa_BACKUPTEST-00000007"); - wrongindexmap.put(8, "backupfilestestTemp.fa_BACKUPTEST-00000008"); - wrongindexmap.put(9, "backupfilestestTemp.fa_BACKUPTEST-00000009"); - wrongindexmap.put(10, "backupfilestestTemp.fa_BACKUPTEST-00000010"); + wrongindexmap.put(2, "backupfilestestTemp.fa_BACKUPTEST-000002"); + wrongindexmap.put(3, "backupfilestestTemp.fa_BACKUPTEST-000003"); + wrongindexmap.put(4, "backupfilestestTemp.fa_BACKUPTEST-000004"); + wrongindexmap.put(5, "backupfilestestTemp.fa_BACKUPTEST-000005"); + wrongindexmap.put(6, "backupfilestestTemp.fa_BACKUPTEST-000006"); + wrongindexmap.put(7, "backupfilestestTemp.fa_BACKUPTEST-000007"); + wrongindexmap.put(8, "backupfilestestTemp.fa_BACKUPTEST-000008"); + wrongindexmap.put(9, "backupfilestestTemp.fa_BACKUPTEST-000009"); + wrongindexmap.put(10, "backupfilestestTemp.fa_BACKUPTEST-000010"); int[] indexes2 = { 3, 4, 5, 6, 7, 8, 9, 10 }; int[] indexes3 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; Assert.assertTrue(checkBackupFiles(correctindexmap)); @@ -158,9 +159,9 @@ public class BackupFilesTest // check there are "rollMax" backup files and they are all saved correctly // check 10 backup files - HashMap correctindexmap = new HashMap(); - correctindexmap.put(9, "backupfilestestTemp.fa_BACKUPTEST-00000009"); - correctindexmap.put(10, "backupfilestestTemp.fa_BACKUPTEST-00000010"); + HashMap correctindexmap = new HashMap<>(); + correctindexmap.put(9, "backupfilestestTemp.fa_BACKUPTEST-000009"); + correctindexmap.put(10, "backupfilestestTemp.fa_BACKUPTEST-000010"); int[] indexes2 = { 10 }; int[] indexes3 = { 8, 9, 10 }; Assert.assertTrue(checkBackupFiles(correctindexmap)); @@ -189,9 +190,9 @@ public class BackupFilesTest // check there are "rollMax" backup files and they are all saved correctly // check 10 backup files - HashMap correctindexmap = new HashMap(); - correctindexmap.put(1, "backupfilestestTemp.fa_BACKUPTEST-00000001"); - correctindexmap.put(2, "backupfilestestTemp.fa_BACKUPTEST-00000002"); + HashMap correctindexmap = new HashMap<>(); + correctindexmap.put(1, "backupfilestestTemp.fa_BACKUPTEST-000001"); + correctindexmap.put(2, "backupfilestestTemp.fa_BACKUPTEST-000002"); int[] indexes2 = { 1 }; int[] indexes3 = { 1, 2, 3 }; Assert.assertTrue(checkBackupFiles(correctindexmap)); @@ -209,6 +210,14 @@ public class BackupFilesTest { Cache.loadProperties("test/jalview/io/testProps.jvprops"); + BackupFilesPresetEntry bfpe = new BackupFilesPresetEntry(suffix, digits, + reverse, noMax, rollMax, false); + + Cache.applicationProperties.setProperty(BackupFiles.ENABLED, + Boolean.toString(enabled)); + Cache.applicationProperties.setProperty( + BackupFilesPresetEntry.SAVEDCONFIG, bfpe.toString()); + /* Cache.applicationProperties.setProperty(BackupFiles.ENABLED, Boolean.toString(enabled)); Cache.applicationProperties.setProperty(BackupFiles.SUFFIX, suffix); @@ -222,6 +231,7 @@ public class BackupFilesTest Integer.toString(rollMax)); Cache.applicationProperties.setProperty(BackupFiles.CONFIRM_DELETE_OLD, "false"); + */ } private void save()