diff options
author | Keuin <[email protected]> | 2021-01-22 20:08:29 +0800 |
---|---|---|
committer | keuin <[email protected]> | 2021-01-22 20:08:29 +0800 |
commit | 270dd70a0fa80fbea0f7985a551c1b453e3f9903 (patch) | |
tree | 2ea04b72edeb0c1eeb5b3f9e012448a33e8d3948 /src/test | |
parent | 1c23fc14be8a0ac9542f1412448c4d896756ba01 (diff) |
Fix a potential bug caused by the wrong implementation of compareTo method in ObjectElement
Diffstat (limited to 'src/test')
3 files changed, 55 insertions, 15 deletions
diff --git a/src/test/java/com/keuin/kbackupfabric/backup/incremental/ObjectCollectionFactoryTest.java b/src/test/java/com/keuin/kbackupfabric/backup/incremental/ObjectCollectionFactoryTest.java index 16fb258..5052a82 100644 --- a/src/test/java/com/keuin/kbackupfabric/backup/incremental/ObjectCollectionFactoryTest.java +++ b/src/test/java/com/keuin/kbackupfabric/backup/incremental/ObjectCollectionFactoryTest.java @@ -26,28 +26,48 @@ public class ObjectCollectionFactoryTest { @Test public void fromDirectory1() { - fromDirectory(1); + fromDirectory(1, 0); } @Test public void fromDirectory2() { - fromDirectory(2); + fromDirectory(2, 0); } @Test public void fromDirectory4() { - fromDirectory(4); + fromDirectory(4, 0); } @Test public void fromDirectory8() { - fromDirectory(8); + fromDirectory(8, 0); } - public void fromDirectory(int threads) { + @Test + public void fromDirectory1A() { + fromDirectory(1, 1000); + } + + @Test + public void fromDirectory2A() { + fromDirectory(2, 1000); + } + + @Test + public void fromDirectory4A() { + fromDirectory(4, 1000); + } + + @Test + public void fromDirectory8A() { + fromDirectory(8, 1000); + } + + public void fromDirectory(int threads, int multiThreadThreshold) { try { ObjectCollectionFactory<Sha256Identifier> factory = - new ObjectCollectionFactory<>(Sha256Identifier.getFactory(), threads); + new ObjectCollectionFactory<>(Sha256Identifier.getFactory(), threads, multiThreadThreshold); ObjectCollection collection = factory.fromDirectory(new File("./testfile/ObjectCollectionFactoryTest")); diff --git a/src/test/java/com/keuin/kbackupfabric/backup/incremental/ObjectCollectionSerializerTest.java b/src/test/java/com/keuin/kbackupfabric/backup/incremental/ObjectCollectionSerializerTest.java index 33f5a9c..d21e5b3 100644 --- a/src/test/java/com/keuin/kbackupfabric/backup/incremental/ObjectCollectionSerializerTest.java +++ b/src/test/java/com/keuin/kbackupfabric/backup/incremental/ObjectCollectionSerializerTest.java @@ -13,27 +13,47 @@ public class ObjectCollectionSerializerTest { @Test public void testSerializationConsistency1() throws IOException { - testSerializationConsistency(1); + testSerializationConsistency(1, 0); } @Test public void testSerializationConsistency2() throws IOException { - testSerializationConsistency(2); + testSerializationConsistency(2, 0); } @Test public void testSerializationConsistency4() throws IOException { - testSerializationConsistency(4); + testSerializationConsistency(4, 0); } @Test public void testSerializationConsistency8() throws IOException { - testSerializationConsistency(8); + testSerializationConsistency(8, 0); } - public void testSerializationConsistency(int threads) throws IOException { + @Test + public void testSerializationConsistency1A() throws IOException { + testSerializationConsistency(1, 1000); + } + + @Test + public void testSerializationConsistency2A() throws IOException { + testSerializationConsistency(2, 1000); + } + + @Test + public void testSerializationConsistency4A() throws IOException { + testSerializationConsistency(4, 1000); + } + + @Test + public void testSerializationConsistency8A() throws IOException { + testSerializationConsistency(8, 1000); + } + + public void testSerializationConsistency(int threads, int multiThreadThreshold) throws IOException { ObjectCollectionFactory<Sha256Identifier> factory = - new ObjectCollectionFactory<>(Sha256Identifier.getFactory(), threads); + new ObjectCollectionFactory<>(Sha256Identifier.getFactory(), threads, multiThreadThreshold); ObjectCollection collection = factory.fromDirectory(new File("./testfile/ObjectCollectionFactoryTest")); File file = new File("./testfile/serialized"); 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 2b4bd94..badc744 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 @@ -21,9 +21,9 @@ public class ConfiguredIncrementalBackupMethodTest { private final String destDirectoryName = "destination"; private final String indexFileName = "index"; - private final double directoryFactor = 0.03; - private final double fileFactor = 0.04; - private final int maxRandomFileSizeBytes = 1024 * 1024 * 4; + private final double directoryFactor = 0.05; + private final double fileFactor = 0.1; + private final int maxRandomFileSizeBytes = 1024 * 1024; private final Function<Integer, Integer> scaleDecayFunc = (x) -> x - 1; @Test |