diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src')
30 files changed, 339 insertions, 16 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckinOnEntityLockedByOtherErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckinOnEntityLockedByOtherErrorBuilder.java index f0d80513f6..b46deeae87 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckinOnEntityLockedByOtherErrorBuilder.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckinOnEntityLockedByOtherErrorBuilder.java @@ -28,7 +28,7 @@ import org.openecomp.sdc.common.errors.ErrorCategory; */ public class CheckinOnEntityLockedByOtherErrorBuilder extends BaseErrorBuilder { - private static final String CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG = + static final String CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG = "Can not check in versionable entity %s with id %s since it is checked out by other " + "user: %s."; diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckinOnUnlockedEntityErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckinOnUnlockedEntityErrorBuilder.java index 4628febe2b..1ed8476534 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckinOnUnlockedEntityErrorBuilder.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckinOnUnlockedEntityErrorBuilder.java @@ -28,7 +28,7 @@ import org.openecomp.sdc.common.errors.ErrorCategory; */ public class CheckinOnUnlockedEntityErrorBuilder extends BaseErrorBuilder { - private static final String CHECKIN_ON_UNLOCKED_ENTITY_MSG = + static final String CHECKIN_ON_UNLOCKED_ENTITY_MSG = "Can not check in versionable entity %s with id %s since it is not checked out."; /** diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckoutOnLockedEntityErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckoutOnLockedEntityErrorBuilder.java index 9784782c70..c56b08f9f7 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckoutOnLockedEntityErrorBuilder.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/CheckoutOnLockedEntityErrorBuilder.java @@ -28,7 +28,7 @@ import org.openecomp.sdc.common.errors.ErrorCategory; */ public class CheckoutOnLockedEntityErrorBuilder extends BaseErrorBuilder { - private static final String CHECKOT_ON_LOCKED_ENTITY_MSG = + static final String CHECKOT_ON_LOCKED_ENTITY_MSG = "Can not check out versionable entity %s with id %s since it is checked out by " + "other user: %s."; diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/DeleteOnLockedEntityErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/DeleteOnLockedEntityErrorBuilder.java index a431e92ba4..da181ceb77 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/DeleteOnLockedEntityErrorBuilder.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/DeleteOnLockedEntityErrorBuilder.java @@ -28,7 +28,7 @@ import org.openecomp.sdc.common.errors.ErrorCategory; */ public class DeleteOnLockedEntityErrorBuilder extends BaseErrorBuilder { - private static final String DELETE_ON_LOCKED_ENTITY_MSG = + static final String DELETE_ON_LOCKED_ENTITY_MSG = "Can not delete versionable entity %s with id %s since it is checked out by other user: %s."; /** diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EditOnEntityLockedByOtherErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EditOnEntityLockedByOtherErrorBuilder.java index 2c41bdeab1..bfebfd2c31 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EditOnEntityLockedByOtherErrorBuilder.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EditOnEntityLockedByOtherErrorBuilder.java @@ -28,7 +28,7 @@ import org.openecomp.sdc.common.errors.ErrorCategory; */ public class EditOnEntityLockedByOtherErrorBuilder extends BaseErrorBuilder { - private static final String EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG = + static final String EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG = "Versionable entity %s with id %s can not be edited since it is locked by other user %s."; /** diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EditOnUnlockedEntityErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EditOnUnlockedEntityErrorBuilder.java index 367a93b630..c5ba6d84af 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EditOnUnlockedEntityErrorBuilder.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EditOnUnlockedEntityErrorBuilder.java @@ -30,7 +30,7 @@ import static org.openecomp.sdc.versioning.errors.VersioningErrorCodes.EDIT_ON_U */ public class EditOnUnlockedEntityErrorBuilder extends BaseErrorBuilder { - private static final String EDIT_ON_UNLOCKED_ENTITY_MSG = + static final String EDIT_ON_UNLOCKED_ENTITY_MSG = "Can not edit versionable entity %s with id %s since it is not checked out."; /** diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityAlreadyExistErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityAlreadyExistErrorBuilder.java index 8f80f6e14e..0e591598f7 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityAlreadyExistErrorBuilder.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityAlreadyExistErrorBuilder.java @@ -28,7 +28,7 @@ import org.openecomp.sdc.common.errors.ErrorCategory; */ public class EntityAlreadyExistErrorBuilder extends BaseErrorBuilder { - private static final String VERSIONABLE_ENTITY_ALREADY_EXIST_MSG = + static final String VERSIONABLE_ENTITY_ALREADY_EXIST_MSG = "Versionable entity %s with id %s already exist."; /** diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityAlreadyFinalizedErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityAlreadyFinalizedErrorBuilder.java index bff3e82f87..7cd97216eb 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityAlreadyFinalizedErrorBuilder.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityAlreadyFinalizedErrorBuilder.java @@ -28,7 +28,7 @@ import org.openecomp.sdc.common.errors.ErrorCategory; */ public class EntityAlreadyFinalizedErrorBuilder extends BaseErrorBuilder { - private static final String SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED_MSG = + static final String SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED_MSG = "Versionable entity %s with id %s can not be submitted since it is already final."; /** diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityNotExistErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityNotExistErrorBuilder.java index 806557f935..2eab4b5dac 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityNotExistErrorBuilder.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/EntityNotExistErrorBuilder.java @@ -28,7 +28,7 @@ import org.openecomp.sdc.common.errors.ErrorCategory; */ public class EntityNotExistErrorBuilder extends BaseErrorBuilder { - private static final String VERSIONABLE_ENTITY_NOT_EXIST_MSG = + static final String VERSIONABLE_ENTITY_NOT_EXIST_MSG = "Versionable entity %s with id %s does not exist."; /** diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/RequestedVersionInvalidErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/RequestedVersionInvalidErrorBuilder.java index d44b2c488b..aba3b8a17a 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/RequestedVersionInvalidErrorBuilder.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/RequestedVersionInvalidErrorBuilder.java @@ -27,7 +27,7 @@ import org.openecomp.sdc.common.errors.ErrorCategory; * The type Requested version invalid error builder. */ public class RequestedVersionInvalidErrorBuilder extends BaseErrorBuilder { - private static final String REQUESTED_VERSION_INVALID_MSG = "Invalid requested version."; + static final String REQUESTED_VERSION_INVALID_MSG = "Invalid requested version."; /** * Instantiates a new Requested version invalid error builder. diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/RevisionIdNotFoundErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/RevisionIdNotFoundErrorBuilder.java index 0075403acf..4ec51297a6 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/RevisionIdNotFoundErrorBuilder.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/RevisionIdNotFoundErrorBuilder.java @@ -28,7 +28,7 @@ import org.openecomp.sdc.common.errors.ErrorCategory; */ public class RevisionIdNotFoundErrorBuilder extends BaseErrorBuilder { - private static final String REVISION_ID_NOT_FOUND_MSG = + static final String REVISION_ID_NOT_FOUND_MSG = "Mandatory field revision id missing"; /** diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/SubmitLockedEntityNotAllowedErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/SubmitLockedEntityNotAllowedErrorBuilder.java index 959c277005..0bd1cb91ee 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/SubmitLockedEntityNotAllowedErrorBuilder.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/SubmitLockedEntityNotAllowedErrorBuilder.java @@ -28,7 +28,7 @@ import org.openecomp.sdc.common.errors.ErrorCategory; */ public class SubmitLockedEntityNotAllowedErrorBuilder extends BaseErrorBuilder { - private static final String SUBMIT_LOCKED_ENTITY_NOT_ALLOWED_MSG = + static final String SUBMIT_LOCKED_ENTITY_NOT_ALLOWED_MSG = "Versionable entity %s with id %s can not be submitted since it is currently" + " locked by user %s."; diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnEntityLockedByOtherErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnEntityLockedByOtherErrorBuilder.java index 2b90338ae2..3ec4b6d40b 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnEntityLockedByOtherErrorBuilder.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnEntityLockedByOtherErrorBuilder.java @@ -28,7 +28,7 @@ import org.openecomp.sdc.common.errors.ErrorCategory; */ public class UndoCheckoutOnEntityLockedByOtherErrorBuilder extends BaseErrorBuilder { - private static final String UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG = + static final String UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG = "Can not undo checkout on versionable entity %s with id %s since it is checked " + "out by other user: %s."; diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnUnlockedEntityErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnUnlockedEntityErrorBuilder.java index d56473f297..12771efc85 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnUnlockedEntityErrorBuilder.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnUnlockedEntityErrorBuilder.java @@ -28,7 +28,7 @@ import org.openecomp.sdc.common.errors.ErrorCategory; */ public class UndoCheckoutOnUnlockedEntityErrorBuilder extends BaseErrorBuilder { - private static final String UNDO_CHECKOUT_ON_UNLOCKED_ENTITY_MSG = + static final String UNDO_CHECKOUT_ON_UNLOCKED_ENTITY_MSG = "Can not undo checkout on versionable entity %s with id %s since it is not checked out."; /** diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/VersionableSubEntityNotFoundErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/VersionableSubEntityNotFoundErrorBuilder.java index f717e5dbdc..2fbb880cf8 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/VersionableSubEntityNotFoundErrorBuilder.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/errors/VersionableSubEntityNotFoundErrorBuilder.java @@ -32,9 +32,9 @@ import java.util.List; */ public class VersionableSubEntityNotFoundErrorBuilder extends BaseErrorBuilder { - private static final String SUB_ENTITY_NOT_FOUND_MSG = + static final String SUB_ENTITY_NOT_FOUND_MSG = "%s with Id %s does not exist for %s with id %s and version %s"; - private static final String SUB_ENTITIES_NOT_FOUND_MSG = + static final String SUB_ENTITIES_NOT_FOUND_MSG = "%ss with Ids %s do not exist for %s with id %s and version %s"; /** diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/CheckinOnEntityLockedByOtherErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/CheckinOnEntityLockedByOtherErrorBuilderTest.java new file mode 100644 index 0000000000..bc91614c21 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/CheckinOnEntityLockedByOtherErrorBuilderTest.java @@ -0,0 +1,22 @@ +package org.openecomp.sdc.versioning.errors; + + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +public class CheckinOnEntityLockedByOtherErrorBuilderTest { + + @Test + public void test() { + CheckinOnEntityLockedByOtherErrorBuilder builder = new CheckinOnEntityLockedByOtherErrorBuilder("entityType", + "entityId", "lockingUser"); + ErrorCode build = builder.build(); + + Assert.assertEquals(VersioningErrorCodes.CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(String.format(CheckinOnEntityLockedByOtherErrorBuilder.CHECKIN_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG, "entityType", "entityId", "lockingUser") , build.message()); + } + +} diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/CheckinOnUnlockedEntityErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/CheckinOnUnlockedEntityErrorBuilderTest.java new file mode 100644 index 0000000000..e72eefe784 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/CheckinOnUnlockedEntityErrorBuilderTest.java @@ -0,0 +1,22 @@ +package org.openecomp.sdc.versioning.errors; + + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +public class CheckinOnUnlockedEntityErrorBuilderTest { + + @Test + public void test() { + CheckinOnUnlockedEntityErrorBuilder builder = new CheckinOnUnlockedEntityErrorBuilder("entityType", + "entityId"); + + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.CHECKIN_ON_UNLOCKED_ENTITY, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(String.format(CheckinOnUnlockedEntityErrorBuilder.CHECKIN_ON_UNLOCKED_ENTITY_MSG, + "entityType", "entityId"), build.message()); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/CheckoutOnLockedEntityErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/CheckoutOnLockedEntityErrorBuilderTest.java new file mode 100644 index 0000000000..2a8cabbca8 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/CheckoutOnLockedEntityErrorBuilderTest.java @@ -0,0 +1,22 @@ +package org.openecomp.sdc.versioning.errors; + + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +public class CheckoutOnLockedEntityErrorBuilderTest { + @Test + public void test() { + CheckoutOnLockedEntityErrorBuilder builder = new CheckoutOnLockedEntityErrorBuilder("entityType", + "entityId", "lockingUser"); + + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.CHECKOT_ON_LOCKED_ENTITY, build.id() ); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category() ); + Assert.assertEquals(String.format(CheckoutOnLockedEntityErrorBuilder.CHECKOT_ON_LOCKED_ENTITY_MSG, + "entityType", "entityId", "lockingUser") , build.message()); + } + +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/DeleteOnLockedEntityErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/DeleteOnLockedEntityErrorBuilderTest.java new file mode 100644 index 0000000000..523b2261d0 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/DeleteOnLockedEntityErrorBuilderTest.java @@ -0,0 +1,22 @@ +package org.openecomp.sdc.versioning.errors; + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + + +public class DeleteOnLockedEntityErrorBuilderTest { + + @Test + public void test() { + DeleteOnLockedEntityErrorBuilder builder = new DeleteOnLockedEntityErrorBuilder("entityType", + "entityId", "lockingUser"); + + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.DELETE_ON_LOCKED_ENTITY, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(String.format(DeleteOnLockedEntityErrorBuilder.DELETE_ON_LOCKED_ENTITY_MSG, + "entityType", "entityId", "lockingUser"), build.message()); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EditOnEntityLockedByOtherErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EditOnEntityLockedByOtherErrorBuilderTest.java new file mode 100644 index 0000000000..b37a0e4423 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EditOnEntityLockedByOtherErrorBuilderTest.java @@ -0,0 +1,21 @@ +package org.openecomp.sdc.versioning.errors; + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + + +public class EditOnEntityLockedByOtherErrorBuilderTest { + @Test + public void test() { + EditOnEntityLockedByOtherErrorBuilder builder = new EditOnEntityLockedByOtherErrorBuilder("entityType", + "entityId", "lockingUser"); + + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(String.format(EditOnEntityLockedByOtherErrorBuilder.EDIT_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG, + "entityType", "entityId", "lockingUser"),build.message()); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EditOnUnlockedEntityErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EditOnUnlockedEntityErrorBuilderTest.java new file mode 100644 index 0000000000..b2287611fc --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EditOnUnlockedEntityErrorBuilderTest.java @@ -0,0 +1,21 @@ +package org.openecomp.sdc.versioning.errors; + + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +public class EditOnUnlockedEntityErrorBuilderTest { + @Test + public void test() { + EditOnUnlockedEntityErrorBuilder builder = new EditOnUnlockedEntityErrorBuilder("entityType", + "entityId"); + + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.EDIT_ON_UNLOCKED_ENTITY, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(String.format(EditOnUnlockedEntityErrorBuilder.EDIT_ON_UNLOCKED_ENTITY_MSG, + "entityType", "entityId"), build.message()); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EntityAlreadyExistErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EntityAlreadyExistErrorBuilderTest.java new file mode 100644 index 0000000000..17c01278bd --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EntityAlreadyExistErrorBuilderTest.java @@ -0,0 +1,20 @@ +package org.openecomp.sdc.versioning.errors; + + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +public class EntityAlreadyExistErrorBuilderTest { + @Test + public void test() { + EntityAlreadyExistErrorBuilder builder = new EntityAlreadyExistErrorBuilder("entityType", + "entityId"); + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.VERSIONABLE_ENTITY_ALREADY_EXIST, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(String.format(EntityAlreadyExistErrorBuilder.VERSIONABLE_ENTITY_ALREADY_EXIST_MSG, + "entityType", "entityId"), build.message()); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EntityAlreadyFinalizedErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EntityAlreadyFinalizedErrorBuilderTest.java new file mode 100644 index 0000000000..860219f85d --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EntityAlreadyFinalizedErrorBuilderTest.java @@ -0,0 +1,20 @@ +package org.openecomp.sdc.versioning.errors; + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +public class EntityAlreadyFinalizedErrorBuilderTest { + @Test + public void test() { + + EntityAlreadyFinalizedErrorBuilder builder = new EntityAlreadyFinalizedErrorBuilder("entityType", + "entityId"); + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(String.format(EntityAlreadyFinalizedErrorBuilder.SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED_MSG, + "entityType", "entityId"), build.message()); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EntityNotExistErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EntityNotExistErrorBuilderTest.java new file mode 100644 index 0000000000..9cf5cab361 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/EntityNotExistErrorBuilderTest.java @@ -0,0 +1,20 @@ +package org.openecomp.sdc.versioning.errors; + + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +public class EntityNotExistErrorBuilderTest { + @Test + public void test() { + EntityNotExistErrorBuilder builder = new EntityNotExistErrorBuilder("entityType", + "entityId"); + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.VERSIONABLE_ENTITY_NOT_EXIST, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(String.format(EntityNotExistErrorBuilder.VERSIONABLE_ENTITY_NOT_EXIST_MSG, + "entityType", "entityId"), build.message()); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/RequestedVersionInvalidErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/RequestedVersionInvalidErrorBuilderTest.java new file mode 100644 index 0000000000..5aa9ff8cd3 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/RequestedVersionInvalidErrorBuilderTest.java @@ -0,0 +1,18 @@ +package org.openecomp.sdc.versioning.errors; + + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +public class RequestedVersionInvalidErrorBuilderTest { + @Test + public void test() { + RequestedVersionInvalidErrorBuilder builder = new RequestedVersionInvalidErrorBuilder(); + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.REQUESTED_VERSION_INVALID, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(RequestedVersionInvalidErrorBuilder.REQUESTED_VERSION_INVALID_MSG, build.message()); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/RevisionIdNotFoundErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/RevisionIdNotFoundErrorBuilderTest.java new file mode 100644 index 0000000000..e648663ceb --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/RevisionIdNotFoundErrorBuilderTest.java @@ -0,0 +1,18 @@ +package org.openecomp.sdc.versioning.errors; + + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +public class RevisionIdNotFoundErrorBuilderTest { + @Test + public void test() { + RevisionIdNotFoundErrorBuilder builder = new RevisionIdNotFoundErrorBuilder(); + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.MANDATORY_FIELD_REVISION_ID_MISSING, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(RevisionIdNotFoundErrorBuilder.REVISION_ID_NOT_FOUND_MSG, build.message()); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/SubmitLockedEntityNotAllowedErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/SubmitLockedEntityNotAllowedErrorBuilderTest.java new file mode 100644 index 0000000000..0695cab76a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/SubmitLockedEntityNotAllowedErrorBuilderTest.java @@ -0,0 +1,21 @@ +package org.openecomp.sdc.versioning.errors; + + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +public class SubmitLockedEntityNotAllowedErrorBuilderTest { + @Test + public void test() { + SubmitLockedEntityNotAllowedErrorBuilder builder = new SubmitLockedEntityNotAllowedErrorBuilder("entityType", + "entityId", "lockingUser"); + + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.SUBMIT_LOCKED_ENTITY_NOT_ALLOWED, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(String.format(SubmitLockedEntityNotAllowedErrorBuilder.SUBMIT_LOCKED_ENTITY_NOT_ALLOWED_MSG, + "entityType", "entityId", "lockingUser"), build.message()); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnEntityLockedByOtherErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnEntityLockedByOtherErrorBuilderTest.java new file mode 100644 index 0000000000..e19fec0777 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnEntityLockedByOtherErrorBuilderTest.java @@ -0,0 +1,22 @@ +package org.openecomp.sdc.versioning.errors; + + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +public class UndoCheckoutOnEntityLockedByOtherErrorBuilderTest { + @Test + public void test() { + + UndoCheckoutOnEntityLockedByOtherErrorBuilder builder = new UndoCheckoutOnEntityLockedByOtherErrorBuilder("entityType", + "entityId", "lockingUser"); + + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(String.format(UndoCheckoutOnEntityLockedByOtherErrorBuilder.UNDO_CHECKOUT_ON_ENTITY_LOCKED_BY_OTHER_USER_MSG, + "entityType", "entityId", "lockingUser"), build.message()); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnUnlockedEntityErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnUnlockedEntityErrorBuilderTest.java new file mode 100644 index 0000000000..52599ecca4 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/UndoCheckoutOnUnlockedEntityErrorBuilderTest.java @@ -0,0 +1,20 @@ +package org.openecomp.sdc.versioning.errors; + + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; + +public class UndoCheckoutOnUnlockedEntityErrorBuilderTest { + @Test + public void test() { + UndoCheckoutOnUnlockedEntityErrorBuilder builder = new UndoCheckoutOnUnlockedEntityErrorBuilder("entityType", + "entityId"); + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.UNDO_CHECKOUT_ON_UNLOCKED_ENTITY, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(String.format(UndoCheckoutOnUnlockedEntityErrorBuilder.UNDO_CHECKOUT_ON_UNLOCKED_ENTITY_MSG, + "entityType", "entityId"), build.message()); + } +}
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/VersionableSubEntityNotFoundErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/VersionableSubEntityNotFoundErrorBuilderTest.java new file mode 100644 index 0000000000..d269204fba --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/test/java/org/openecomp/sdc/versioning/errors/VersionableSubEntityNotFoundErrorBuilderTest.java @@ -0,0 +1,34 @@ +package org.openecomp.sdc.versioning.errors; + + +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.sdc.common.errors.ErrorCategory; +import org.openecomp.sdc.common.errors.ErrorCode; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.util.Arrays; + +public class VersionableSubEntityNotFoundErrorBuilderTest { + @Test + public void test() { + VersionableSubEntityNotFoundErrorBuilder builder = new VersionableSubEntityNotFoundErrorBuilder("entityType", + "entityId", "containingEntityType", "ContainingEntityId", new Version("0.0")); + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category()); + Assert.assertEquals(String.format(VersionableSubEntityNotFoundErrorBuilder.SUB_ENTITY_NOT_FOUND_MSG, + "entityType", "entityId", "containingEntityType", "ContainingEntityId", "0.0"), build.message()); + } + + @Test + public void testWithListOfIds() { + VersionableSubEntityNotFoundErrorBuilder builder = new VersionableSubEntityNotFoundErrorBuilder("entityType", + Arrays.asList("entityId"), "containingEntityType", "ContainingEntityId", new Version("0.0")); + ErrorCode build = builder.build(); + Assert.assertEquals(VersioningErrorCodes.VERSIONABLE_SUB_ENTITY_NOT_FOUND, build.id()); + Assert.assertEquals(ErrorCategory.APPLICATION, build.category() ); + Assert.assertEquals(String.format(VersionableSubEntityNotFoundErrorBuilder.SUB_ENTITIES_NOT_FOUND_MSG, + "entityType", "entityId", "containingEntityType", "ContainingEntityId", "0.0"), build.message()); + } +}
\ No newline at end of file |