diff options
author | Keuin <[email protected]> | 2021-01-22 18:59:47 +0800 |
---|---|---|
committer | keuin <[email protected]> | 2021-01-22 18:59:47 +0800 |
commit | 1c23fc14be8a0ac9542f1412448c4d896756ba01 (patch) | |
tree | 98a89f19f84877d24a99f9a256408e46b4c32f29 /src/test/java/com/keuin/kbackupfabric/operation/backup/method/ConfiguredIncrementalBackupMethodTest.java | |
parent | 2f1d2ec7ddaebbbd19cde6314afa873f6fb964f4 (diff) |
Speed up the incremental backup by using multiple CPU cores if available (use multiple threads to calculate the hash).
Diffstat (limited to 'src/test/java/com/keuin/kbackupfabric/operation/backup/method/ConfiguredIncrementalBackupMethodTest.java')
-rw-r--r-- | src/test/java/com/keuin/kbackupfabric/operation/backup/method/ConfiguredIncrementalBackupMethodTest.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/test/java/com/keuin/kbackupfabric/operation/backup/method/ConfiguredIncrementalBackupMethodTest.java b/src/test/java/com/keuin/kbackupfabric/operation/backup/method/ConfiguredIncrementalBackupMethodTest.java index 30f2d44..2b4bd94 100644 --- a/src/test/java/com/keuin/kbackupfabric/operation/backup/method/ConfiguredIncrementalBackupMethodTest.java +++ b/src/test/java/com/keuin/kbackupfabric/operation/backup/method/ConfiguredIncrementalBackupMethodTest.java @@ -1,5 +1,6 @@ package com.keuin.kbackupfabric.operation.backup.method; +import com.keuin.kbackupfabric.operation.backup.feedback.IncrementalBackupFeedback; import org.apache.commons.codec.digest.DigestUtils; import org.junit.Test; @@ -20,9 +21,9 @@ public class ConfiguredIncrementalBackupMethodTest { private final String destDirectoryName = "destination"; private final String indexFileName = "index"; - private final double directoryFactor = 0.02; - private final double fileFactor = 0.05; - private final int maxRandomFileSizeBytes = 1024 * 1024 * 16; + private final double directoryFactor = 0.03; + private final double fileFactor = 0.04; + private final int maxRandomFileSizeBytes = 1024 * 1024 * 4; private final Function<Integer, Integer> scaleDecayFunc = (x) -> x - 1; @Test @@ -66,11 +67,15 @@ public class ConfiguredIncrementalBackupMethodTest { testTempPath, destPath.toString() ); - method.backup(); + IncrementalBackupFeedback feedback = method.backup(); + assertNotNull("Feedback should not be null.", feedback); + if (!feedback.isSuccess()) + fail("Failed to backup. Cannot perform test."); + assertTrue("Index file was not generated by backup.", new File(testTempPath, indexFileName).exists()); // delete src forceDelete(sourcePath.toFile()); - assertFalse(sourcePath.toFile().isDirectory()); + assertFalse(sourcePath.toFile().exists()); // restore src if (!method.restore()) |