diff options
author | Keuin <[email protected]> | 2021-01-12 15:03:23 +0800 |
---|---|---|
committer | keuin <[email protected]> | 2021-01-12 15:03:23 +0800 |
commit | 4a52f5e6ce06cb6717510c6a975d5490be627c98 (patch) | |
tree | 8fe3602acbaaf74e6946d8a970e84f7a3394c106 /src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier | |
parent | afd26cdd12fef4bd2aafa2ac8d708e18d277a2fe (diff) |
Add unit test for Sha256Identifier and ObjectCollection
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier')
3 files changed, 6 insertions, 0 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/ObjectIdentifier.java b/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/ObjectIdentifier.java index 62798e1..6744616 100644 --- a/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/ObjectIdentifier.java +++ b/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/ObjectIdentifier.java @@ -4,6 +4,7 @@ package com.keuin.kbackupfabric.util.backup.incremental.identifier; * The identifier distinguishing files in the object collection. * It should be based on cryptographic hash function in order to prevent possible attacks to the backup system. * All identifiers should be immutable and implement their own equals method. + * Immutable. */ public interface ObjectIdentifier { String getIdentification(); diff --git a/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/Sha256Identifier.java b/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/Sha256Identifier.java index 9f56b0e..64716ed 100644 --- a/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/Sha256Identifier.java +++ b/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/Sha256Identifier.java @@ -7,6 +7,10 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Objects; +/** + * Identifier based on sha256. + * Immutable. + */ public class Sha256Identifier extends SingleHashIdentifier { private static final int SHA256_LENGTH = 32; diff --git a/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/SingleHashIdentifier.java b/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/SingleHashIdentifier.java index 62ba47c..3b96f79 100644 --- a/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/SingleHashIdentifier.java +++ b/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/identifier/SingleHashIdentifier.java @@ -8,6 +8,7 @@ import java.util.Arrays; /** * A simple identifier based on a single hash function. + * Immutable. */ public abstract class SingleHashIdentifier implements ObjectIdentifier { |