*/
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.";
*/
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.";
/**
*/
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.";
*/
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.";
/**
*/
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.";
/**
*/
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.";
/**
*/
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.";
/**
*/
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.";
/**
*/
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.";
/**
* 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.
*/
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";
/**
*/
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.";
*/
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.";
*/
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.";
/**
*/
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";
/**
--- /dev/null
+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());
+ }
+
+}
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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