mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-17 14:21:39 +00:00
ACS-9652 [Es Connector] Prepare ACS 23.N for release (with ES Connector 5.1.0) (#3354)
Co-authored-by: Belal Ansari <belal.ansari@hyland.com>
This commit is contained in:
@@ -26,13 +26,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.rest.rm.community.hold;
|
package org.alfresco.rest.rm.community.hold;
|
||||||
|
|
||||||
import static org.alfresco.rest.rm.community.base.TestData.HOLD_DESCRIPTION;
|
|
||||||
import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON;
|
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
|
|
||||||
import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_FILING;
|
|
||||||
import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_READ_RECORDS;
|
|
||||||
import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix;
|
|
||||||
import static org.alfresco.utility.report.log.Step.STEP;
|
|
||||||
import static org.awaitility.Awaitility.await;
|
import static org.awaitility.Awaitility.await;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
@@ -44,12 +37,25 @@ import static org.springframework.http.HttpStatus.NOT_FOUND;
|
|||||||
import static org.springframework.http.HttpStatus.OK;
|
import static org.springframework.http.HttpStatus.OK;
|
||||||
import static org.springframework.http.HttpStatus.UNAUTHORIZED;
|
import static org.springframework.http.HttpStatus.UNAUTHORIZED;
|
||||||
|
|
||||||
|
import static org.alfresco.rest.rm.community.base.TestData.HOLD_DESCRIPTION;
|
||||||
|
import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON;
|
||||||
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAlias.FILE_PLAN_ALIAS;
|
||||||
|
import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_FILING;
|
||||||
|
import static org.alfresco.rest.rm.community.model.user.UserPermissions.PERMISSION_READ_RECORDS;
|
||||||
|
import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix;
|
||||||
|
import static org.alfresco.utility.report.log.Step.STEP;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.testng.annotations.AfterClass;
|
||||||
|
import org.testng.annotations.BeforeClass;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import org.alfresco.dataprep.CMISUtil;
|
import org.alfresco.dataprep.CMISUtil;
|
||||||
import org.alfresco.dataprep.ContentActions;
|
import org.alfresco.dataprep.ContentActions;
|
||||||
import org.alfresco.rest.rm.community.base.BaseRMRestTest;
|
import org.alfresco.rest.rm.community.base.BaseRMRestTest;
|
||||||
@@ -71,10 +77,6 @@ import org.alfresco.utility.constants.UserRole;
|
|||||||
import org.alfresco.utility.model.FileModel;
|
import org.alfresco.utility.model.FileModel;
|
||||||
import org.alfresco.utility.model.FolderModel;
|
import org.alfresco.utility.model.FolderModel;
|
||||||
import org.alfresco.utility.model.UserModel;
|
import org.alfresco.utility.model.UserModel;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.testng.annotations.AfterClass;
|
|
||||||
import org.testng.annotations.BeforeClass;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API tests for adding items to holds via the bulk process
|
* API tests for adding items to holds via the bulk process
|
||||||
@@ -103,7 +105,8 @@ public class AddToHoldsBulkV1Tests extends BaseRMRestTest
|
|||||||
STEP("Create a hold.");
|
STEP("Create a hold.");
|
||||||
hold = getRestAPIFactory().getFilePlansAPI(getAdminUser()).createHold(
|
hold = getRestAPIFactory().getFilePlansAPI(getAdminUser()).createHold(
|
||||||
Hold.builder().name("HOLD" + generateTestPrefix(AddToHoldsV1Tests.class)).description(HOLD_DESCRIPTION)
|
Hold.builder().name("HOLD" + generateTestPrefix(AddToHoldsV1Tests.class)).description(HOLD_DESCRIPTION)
|
||||||
.reason(HOLD_REASON).build(), FILE_PLAN_ALIAS);
|
.reason(HOLD_REASON).build(),
|
||||||
|
FILE_PLAN_ALIAS);
|
||||||
holds.add(hold);
|
holds.add(hold);
|
||||||
|
|
||||||
STEP("Create test files.");
|
STEP("Create test files.");
|
||||||
@@ -131,15 +134,22 @@ public class AddToHoldsBulkV1Tests extends BaseRMRestTest
|
|||||||
.until(() -> getRestAPIFactory().getSearchAPI(null).search(searchRequest).getPagination()
|
.until(() -> getRestAPIFactory().getSearchAPI(null).search(searchRequest).getPagination()
|
||||||
.getTotalItems() == NUMBER_OF_FILES);
|
.getTotalItems() == NUMBER_OF_FILES);
|
||||||
|
|
||||||
|
RestRequestQueryModel ancestorReq = getContentFromFolderAndAllSubfoldersQuery(rootFolder.getNodeRefWithoutVersion());
|
||||||
|
SearchRequest ancestorSearchRequest = new SearchRequest();
|
||||||
|
ancestorSearchRequest.setQuery(ancestorReq);
|
||||||
|
|
||||||
|
STEP("Wait until paths are indexed.");
|
||||||
|
await().atMost(30, TimeUnit.SECONDS)
|
||||||
|
.until(() -> getRestAPIFactory().getSearchAPI(null).search(ancestorSearchRequest).getPagination()
|
||||||
|
.getTotalItems() == NUMBER_OF_FILES);
|
||||||
|
|
||||||
holdBulkOperation = HoldBulkOperation.builder()
|
holdBulkOperation = HoldBulkOperation.builder()
|
||||||
.query(queryReq)
|
.query(queryReq)
|
||||||
.op(HoldBulkOperationType.ADD).build();
|
.op(HoldBulkOperationType.ADD).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a user with the add to hold capability and hold filing permission
|
* Given a user with the add to hold capability and hold filing permission When the user adds content from a site to a hold using the bulk API Then the content is added to the hold and the status of the bulk operation is DONE
|
||||||
* When the user adds content from a site to a hold using the bulk API
|
|
||||||
* Then the content is added to the hold and the status of the bulk operation is DONE
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void addContentFromTestSiteToHoldUsingBulkAPI()
|
public void addContentFromTestSiteToHoldUsingBulkAPI()
|
||||||
@@ -158,11 +168,11 @@ public class AddToHoldsBulkV1Tests extends BaseRMRestTest
|
|||||||
|
|
||||||
STEP("Wait until all files are added to the hold.");
|
STEP("Wait until all files are added to the hold.");
|
||||||
await().atMost(20, TimeUnit.SECONDS).until(
|
await().atMost(20, TimeUnit.SECONDS).until(
|
||||||
() -> getRestAPIFactory().getHoldsAPI(getAdminUser()).getChildren(hold.getId()).getEntries().size()
|
() -> getRestAPIFactory().getHoldsAPI(getAdminUser()).getChildren(hold.getId()).getEntries().size() == NUMBER_OF_FILES);
|
||||||
== NUMBER_OF_FILES);
|
|
||||||
List<String> holdChildrenNodeRefs = getRestAPIFactory().getHoldsAPI(userAddHoldPermission)
|
List<String> holdChildrenNodeRefs = getRestAPIFactory().getHoldsAPI(userAddHoldPermission)
|
||||||
.getChildren(hold.getId()).getEntries().stream().map(HoldChildEntry::getEntry).map(
|
.getChildren(hold.getId()).getEntries().stream().map(HoldChildEntry::getEntry).map(
|
||||||
HoldChild::getId).toList();
|
HoldChild::getId)
|
||||||
|
.toList();
|
||||||
assertEquals(addedFiles.stream().map(FileModel::getNodeRefWithoutVersion).sorted().toList(),
|
assertEquals(addedFiles.stream().map(FileModel::getNodeRefWithoutVersion).sorted().toList(),
|
||||||
holdChildrenNodeRefs.stream().sorted().toList());
|
holdChildrenNodeRefs.stream().sorted().toList());
|
||||||
|
|
||||||
@@ -179,16 +189,15 @@ public class AddToHoldsBulkV1Tests extends BaseRMRestTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a user with the add to hold capability and hold filing permission
|
* Given a user with the add to hold capability and hold filing permission When the user adds content from a folder and all subfolders to a hold using the bulk API Then the content is added to the hold and the status of the bulk operation is DONE
|
||||||
* When the user adds content from a folder and all subfolders to a hold using the bulk API
|
|
||||||
* Then the content is added to the hold and the status of the bulk operation is DONE
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void addContentFromFolderAndAllSubfoldersToHoldUsingBulkAPI()
|
public void addContentFromFolderAndAllSubfoldersToHoldUsingBulkAPI()
|
||||||
{
|
{
|
||||||
hold3 = getRestAPIFactory().getFilePlansAPI(getAdminUser()).createHold(
|
hold3 = getRestAPIFactory().getFilePlansAPI(getAdminUser()).createHold(
|
||||||
Hold.builder().name("HOLD" + generateTestPrefix(AddToHoldsV1Tests.class)).description(HOLD_DESCRIPTION)
|
Hold.builder().name("HOLD" + generateTestPrefix(AddToHoldsV1Tests.class)).description(HOLD_DESCRIPTION)
|
||||||
.reason(HOLD_REASON).build(), FILE_PLAN_ALIAS);
|
.reason(HOLD_REASON).build(),
|
||||||
|
FILE_PLAN_ALIAS);
|
||||||
holds.add(hold3);
|
holds.add(hold3);
|
||||||
|
|
||||||
UserModel userAddHoldPermission = roleService.createUserWithSiteRoleRMRoleAndPermission(testSite,
|
UserModel userAddHoldPermission = roleService.createUserWithSiteRoleRMRoleAndPermission(testSite,
|
||||||
@@ -209,11 +218,11 @@ public class AddToHoldsBulkV1Tests extends BaseRMRestTest
|
|||||||
|
|
||||||
STEP("Wait until all files are added to the hold.");
|
STEP("Wait until all files are added to the hold.");
|
||||||
await().atMost(20, TimeUnit.SECONDS).until(
|
await().atMost(20, TimeUnit.SECONDS).until(
|
||||||
() -> getRestAPIFactory().getHoldsAPI(getAdminUser()).getChildren(hold3.getId()).getEntries().size()
|
() -> getRestAPIFactory().getHoldsAPI(getAdminUser()).getChildren(hold3.getId()).getEntries().size() == NUMBER_OF_FILES);
|
||||||
== NUMBER_OF_FILES);
|
|
||||||
List<String> holdChildrenNodeRefs = getRestAPIFactory().getHoldsAPI(userAddHoldPermission)
|
List<String> holdChildrenNodeRefs = getRestAPIFactory().getHoldsAPI(userAddHoldPermission)
|
||||||
.getChildren(hold3.getId()).getEntries().stream().map(HoldChildEntry::getEntry).map(
|
.getChildren(hold3.getId()).getEntries().stream().map(HoldChildEntry::getEntry).map(
|
||||||
HoldChild::getId).toList();
|
HoldChild::getId)
|
||||||
|
.toList();
|
||||||
assertEquals(addedFiles.stream().map(FileModel::getNodeRefWithoutVersion).sorted().toList(),
|
assertEquals(addedFiles.stream().map(FileModel::getNodeRefWithoutVersion).sorted().toList(),
|
||||||
holdChildrenNodeRefs.stream().sorted().toList());
|
holdChildrenNodeRefs.stream().sorted().toList());
|
||||||
|
|
||||||
@@ -230,16 +239,13 @@ public class AddToHoldsBulkV1Tests extends BaseRMRestTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a user without the add to hold capability
|
* Given a user without the add to hold capability When the user adds content from a site to a hold using the bulk API Then the user receives access denied error
|
||||||
* When the user adds content from a site to a hold using the bulk API
|
|
||||||
* Then the user receives access denied error
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testBulkProcessWithUserWithoutAddToHoldCapability()
|
public void testBulkProcessWithUserWithoutAddToHoldCapability()
|
||||||
{
|
{
|
||||||
UserModel userWithoutAddToHoldCapability = roleService.createUserWithSiteRoleRMRoleAndPermission(testSite,
|
UserModel userWithoutAddToHoldCapability = roleService.createUserWithSiteRoleRMRoleAndPermission(testSite,
|
||||||
UserRole
|
UserRole.SiteCollaborator,
|
||||||
.SiteCollaborator,
|
|
||||||
hold.getId(), UserRoles.ROLE_RM_POWER_USER, PERMISSION_FILING);
|
hold.getId(), UserRoles.ROLE_RM_POWER_USER, PERMISSION_FILING);
|
||||||
users.add(userWithoutAddToHoldCapability);
|
users.add(userWithoutAddToHoldCapability);
|
||||||
|
|
||||||
@@ -253,9 +259,7 @@ public class AddToHoldsBulkV1Tests extends BaseRMRestTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a user without the filing permission on a hold
|
* Given a user without the filing permission on a hold When the user adds content from a site to a hold using the bulk API Then the user receives access denied error
|
||||||
* When the user adds content from a site to a hold using the bulk API
|
|
||||||
* Then the user receives access denied error
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testBulkProcessWithUserWithoutFilingPermissionOnAHold()
|
public void testBulkProcessWithUserWithoutFilingPermissionOnAHold()
|
||||||
@@ -276,9 +280,7 @@ public class AddToHoldsBulkV1Tests extends BaseRMRestTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a user without the write permission on all the content
|
* Given a user without the write permission on all the content When the user adds content from a site to a hold using the bulk API Then all processed items are marked as errors and the last error message contains access denied error
|
||||||
* When the user adds content from a site to a hold using the bulk API
|
|
||||||
* Then all processed items are marked as errors and the last error message contains access denied error
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testBulkProcessWithUserWithoutWritePermissionOnTheContent()
|
public void testBulkProcessWithUserWithoutWritePermissionOnTheContent()
|
||||||
@@ -303,8 +305,7 @@ public class AddToHoldsBulkV1Tests extends BaseRMRestTest
|
|||||||
STEP("Verify the response.");
|
STEP("Verify the response.");
|
||||||
assertStatusCode(ACCEPTED);
|
assertStatusCode(ACCEPTED);
|
||||||
|
|
||||||
await().atMost(20, TimeUnit.SECONDS).until(() ->
|
await().atMost(20, TimeUnit.SECONDS).until(() -> Objects.equals(getRestAPIFactory().getHoldsAPI(userWithoutPermission)
|
||||||
Objects.equals(getRestAPIFactory().getHoldsAPI(userWithoutPermission)
|
|
||||||
.getBulkStatus(hold.getId(), bulkOperationEntry.getBulkStatusId()).getStatus(), "DONE"));
|
.getBulkStatus(hold.getId(), bulkOperationEntry.getBulkStatusId()).getStatus(), "DONE"));
|
||||||
|
|
||||||
HoldBulkStatus holdBulkStatus = getRestAPIFactory().getHoldsAPI(userWithoutPermission)
|
HoldBulkStatus holdBulkStatus = getRestAPIFactory().getHoldsAPI(userWithoutPermission)
|
||||||
@@ -314,17 +315,15 @@ public class AddToHoldsBulkV1Tests extends BaseRMRestTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a user without the write permission on one file
|
* Given a user without the write permission on one file When the user adds content from a site to a hold using the bulk API Then all processed items are added to the hold except the one that the user does not have write permission And the status of the bulk operation is DONE, contains the error message and the number of errors is 1
|
||||||
* When the user adds content from a site to a hold using the bulk API
|
|
||||||
* Then all processed items are added to the hold except the one that the user does not have write permission
|
|
||||||
* And the status of the bulk operation is DONE, contains the error message and the number of errors is 1
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testBulkProcessWithUserWithoutWritePermissionOnOneFile()
|
public void testBulkProcessWithUserWithoutWritePermissionOnOneFile()
|
||||||
{
|
{
|
||||||
hold2 = getRestAPIFactory().getFilePlansAPI(getAdminUser()).createHold(
|
hold2 = getRestAPIFactory().getFilePlansAPI(getAdminUser()).createHold(
|
||||||
Hold.builder().name("HOLD" + generateTestPrefix(AddToHoldsV1Tests.class)).description(HOLD_DESCRIPTION)
|
Hold.builder().name("HOLD" + generateTestPrefix(AddToHoldsV1Tests.class)).description(HOLD_DESCRIPTION)
|
||||||
.reason(HOLD_REASON).build(), FILE_PLAN_ALIAS);
|
.reason(HOLD_REASON).build(),
|
||||||
|
FILE_PLAN_ALIAS);
|
||||||
holds.add(hold2);
|
holds.add(hold2);
|
||||||
|
|
||||||
UserModel userAddHoldPermission = roleService.createUserWithSiteRoleRMRoleAndPermission(testSite,
|
UserModel userAddHoldPermission = roleService.createUserWithSiteRoleRMRoleAndPermission(testSite,
|
||||||
@@ -345,15 +344,14 @@ public class AddToHoldsBulkV1Tests extends BaseRMRestTest
|
|||||||
|
|
||||||
STEP("Wait until all files are added to the hold.");
|
STEP("Wait until all files are added to the hold.");
|
||||||
await().atMost(30, TimeUnit.SECONDS).until(
|
await().atMost(30, TimeUnit.SECONDS).until(
|
||||||
() -> getRestAPIFactory().getHoldsAPI(getAdminUser()).getChildren(hold2.getId()).getEntries().size()
|
() -> getRestAPIFactory().getHoldsAPI(getAdminUser()).getChildren(hold2.getId()).getEntries().size() == NUMBER_OF_FILES - 1);
|
||||||
== NUMBER_OF_FILES - 1);
|
|
||||||
await().atMost(30, TimeUnit.SECONDS).until(
|
await().atMost(30, TimeUnit.SECONDS).until(
|
||||||
() -> getRestAPIFactory().getHoldsAPI(userAddHoldPermission)
|
() -> getRestAPIFactory().getHoldsAPI(userAddHoldPermission)
|
||||||
.getBulkStatus(hold2.getId(), bulkOperationEntry.getBulkStatusId()).getProcessedItems()
|
.getBulkStatus(hold2.getId(), bulkOperationEntry.getBulkStatusId()).getProcessedItems() == NUMBER_OF_FILES);
|
||||||
== NUMBER_OF_FILES);
|
|
||||||
List<String> holdChildrenNodeRefs = getRestAPIFactory().getHoldsAPI(userAddHoldPermission)
|
List<String> holdChildrenNodeRefs = getRestAPIFactory().getHoldsAPI(userAddHoldPermission)
|
||||||
.getChildren(hold2.getId()).getEntries().stream().map(HoldChildEntry::getEntry).map(
|
.getChildren(hold2.getId()).getEntries().stream().map(HoldChildEntry::getEntry).map(
|
||||||
HoldChild::getId).toList();
|
HoldChild::getId)
|
||||||
|
.toList();
|
||||||
assertEquals(addedFiles.stream().skip(1).map(FileModel::getNodeRefWithoutVersion).sorted().toList(),
|
assertEquals(addedFiles.stream().skip(1).map(FileModel::getNodeRefWithoutVersion).sorted().toList(),
|
||||||
holdChildrenNodeRefs.stream().sorted().toList());
|
holdChildrenNodeRefs.stream().sorted().toList());
|
||||||
|
|
||||||
@@ -375,9 +373,7 @@ public class AddToHoldsBulkV1Tests extends BaseRMRestTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given an unauthenticated user
|
* Given an unauthenticated user When the user adds content from a site to a hold using the bulk API Then the user receives unauthorized error
|
||||||
* When the user adds content from a site to a hold using the bulk API
|
|
||||||
* Then the user receives unauthorized error
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testBulkProcessAsUnauthenticatedUser()
|
public void testBulkProcessAsUnauthenticatedUser()
|
||||||
@@ -391,10 +387,7 @@ public class AddToHoldsBulkV1Tests extends BaseRMRestTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a user with the add to hold capability and hold filing permission
|
* Given a user with the add to hold capability and hold filing permission When the user adds content from a site to a hold using the bulk API And the hold does not exist Then the user receives not found error
|
||||||
* When the user adds content from a site to a hold using the bulk API
|
|
||||||
* And the hold does not exist
|
|
||||||
* Then the user receives not found error
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testBulkProcessForNonExistentHold()
|
public void testBulkProcessForNonExistentHold()
|
||||||
@@ -407,10 +400,7 @@ public class AddToHoldsBulkV1Tests extends BaseRMRestTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a user with the add to hold capability and hold filing permission
|
* Given a user with the add to hold capability and hold filing permission When the user adds content from a site to a hold using the bulk API and the bulk operation is invalid Then the user receives bad request error
|
||||||
* When the user adds content from a site to a hold using the bulk API
|
|
||||||
* and the bulk operation is invalid
|
|
||||||
* Then the user receives bad request error
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetBulkStatusesForInvalidOperation()
|
public void testGetBulkStatusesForInvalidOperation()
|
||||||
@@ -426,10 +416,7 @@ public class AddToHoldsBulkV1Tests extends BaseRMRestTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a user with the add to hold capability and hold filing permission
|
* Given a user with the add to hold capability and hold filing permission When the user adds content from a site to a hold using the bulk API And the hold does not exist Then the user receives not found error
|
||||||
* When the user adds content from a site to a hold using the bulk API
|
|
||||||
* And the hold does not exist
|
|
||||||
* Then the user receives not found error
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetBulkStatusForNonExistentHold()
|
public void testGetBulkStatusForNonExistentHold()
|
||||||
@@ -442,10 +429,7 @@ public class AddToHoldsBulkV1Tests extends BaseRMRestTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a user with the add to hold capability and hold filing permission
|
* Given a user with the add to hold capability and hold filing permission When the user adds content from a site to a hold using the bulk API And the bulk status does not exist Then the user receives not found error
|
||||||
* When the user adds content from a site to a hold using the bulk API
|
|
||||||
* And the bulk status does not exist
|
|
||||||
* Then the user receives not found error
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetBulkStatusForNonExistentBulkStatus()
|
public void testGetBulkStatusForNonExistentBulkStatus()
|
||||||
@@ -458,10 +442,7 @@ public class AddToHoldsBulkV1Tests extends BaseRMRestTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a user with the add to hold capability and hold filing permission
|
* Given a user with the add to hold capability and hold filing permission When the user adds content from a site to a hold using the bulk API And the hold does not exist Then the user receives not found error
|
||||||
* When the user adds content from a site to a hold using the bulk API
|
|
||||||
* And the hold does not exist
|
|
||||||
* Then the user receives not found error
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetBulkStatusesForNonExistentHold()
|
public void testGetBulkStatusesForNonExistentHold()
|
||||||
@@ -474,9 +455,7 @@ public class AddToHoldsBulkV1Tests extends BaseRMRestTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a user with the add to hold capability and hold filing permission
|
* Given a user with the add to hold capability and hold filing permission When the user adds content from all sites to a hold using the bulk API to exceed the limit (30 items) Then the user receives bad request error
|
||||||
* When the user adds content from all sites to a hold using the bulk API to exceed the limit (30 items)
|
|
||||||
* Then the user receives bad request error
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testExceedingBulkOperationLimit()
|
public void testExceedingBulkOperationLimit()
|
||||||
@@ -497,17 +476,15 @@ public class AddToHoldsBulkV1Tests extends BaseRMRestTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a user with the add to hold capability and hold filing permission
|
* Given a user with the add to hold capability and hold filing permission When the user adds content from a site to a hold using the bulk API And then the user cancels the bulk operation Then the user receives OK status code
|
||||||
* When the user adds content from a site to a hold using the bulk API
|
|
||||||
* And then the user cancels the bulk operation
|
|
||||||
* Then the user receives OK status code
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testBulkProcessCancellationWithAllowedUser()
|
public void testBulkProcessCancellationWithAllowedUser()
|
||||||
{
|
{
|
||||||
Hold hold4 = getRestAPIFactory().getFilePlansAPI(getAdminUser()).createHold(
|
Hold hold4 = getRestAPIFactory().getFilePlansAPI(getAdminUser()).createHold(
|
||||||
Hold.builder().name("HOLD" + generateTestPrefix(AddToHoldsV1Tests.class)).description(HOLD_DESCRIPTION)
|
Hold.builder().name("HOLD" + generateTestPrefix(AddToHoldsV1Tests.class)).description(HOLD_DESCRIPTION)
|
||||||
.reason(HOLD_REASON).build(), FILE_PLAN_ALIAS);
|
.reason(HOLD_REASON).build(),
|
||||||
|
FILE_PLAN_ALIAS);
|
||||||
holds.add(hold4);
|
holds.add(hold4);
|
||||||
|
|
||||||
UserModel userAddHoldPermission = roleService.createUserWithSiteRoleRMRoleAndPermission(testSite,
|
UserModel userAddHoldPermission = roleService.createUserWithSiteRoleRMRoleAndPermission(testSite,
|
||||||
@@ -531,17 +508,15 @@ public class AddToHoldsBulkV1Tests extends BaseRMRestTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a user with the add to hold capability and hold filing permission
|
* Given a user with the add to hold capability and hold filing permission When the user adds content from a site to a hold using the bulk API And a 2nd user without the add to hold capability cancels the bulk operation Then the 2nd user receives access denied error
|
||||||
* When the user adds content from a site to a hold using the bulk API
|
|
||||||
* And a 2nd user without the add to hold capability cancels the bulk operation
|
|
||||||
* Then the 2nd user receives access denied error
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testBulkProcessCancellationWithUserWithoutAddToHoldCapability()
|
public void testBulkProcessCancellationWithUserWithoutAddToHoldCapability()
|
||||||
{
|
{
|
||||||
Hold hold5 = getRestAPIFactory().getFilePlansAPI(getAdminUser()).createHold(
|
Hold hold5 = getRestAPIFactory().getFilePlansAPI(getAdminUser()).createHold(
|
||||||
Hold.builder().name("HOLD" + generateTestPrefix(AddToHoldsV1Tests.class)).description(HOLD_DESCRIPTION)
|
Hold.builder().name("HOLD" + generateTestPrefix(AddToHoldsV1Tests.class)).description(HOLD_DESCRIPTION)
|
||||||
.reason(HOLD_REASON).build(), FILE_PLAN_ALIAS);
|
.reason(HOLD_REASON).build(),
|
||||||
|
FILE_PLAN_ALIAS);
|
||||||
holds.add(hold5);
|
holds.add(hold5);
|
||||||
|
|
||||||
UserModel userAddHoldPermission = roleService.createUserWithSiteRoleRMRoleAndPermission(testSite,
|
UserModel userAddHoldPermission = roleService.createUserWithSiteRoleRMRoleAndPermission(testSite,
|
||||||
@@ -557,8 +532,7 @@ public class AddToHoldsBulkV1Tests extends BaseRMRestTest
|
|||||||
assertEquals(NUMBER_OF_FILES, bulkOperationEntry.getTotalItems());
|
assertEquals(NUMBER_OF_FILES, bulkOperationEntry.getTotalItems());
|
||||||
|
|
||||||
UserModel userWithoutAddToHoldCapability = roleService.createUserWithSiteRoleRMRoleAndPermission(testSite,
|
UserModel userWithoutAddToHoldCapability = roleService.createUserWithSiteRoleRMRoleAndPermission(testSite,
|
||||||
UserRole
|
UserRole.SiteCollaborator,
|
||||||
.SiteCollaborator,
|
|
||||||
hold5.getId(), UserRoles.ROLE_RM_POWER_USER, PERMISSION_FILING);
|
hold5.getId(), UserRoles.ROLE_RM_POWER_USER, PERMISSION_FILING);
|
||||||
users.add(userWithoutAddToHoldCapability);
|
users.add(userWithoutAddToHoldCapability);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user