mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-6918 View legal holds content UI tests
This commit is contained in:
@@ -127,7 +127,7 @@ public class HoldsAPI extends BaseAPI
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
return convertHTTPResponseToJSON(httpResponse).getString("persistedObject")
|
return convertHTTPResponseToJSON(httpResponse).getString("persistedObject")
|
||||||
.replaceAll(NODE_REF_WORKSPACE_SPACES_STORE, "");
|
.replace(NODE_REF_WORKSPACE_SPACES_STORE, "");
|
||||||
}
|
}
|
||||||
catch(JSONException error)
|
catch(JSONException error)
|
||||||
{
|
{
|
||||||
@@ -172,7 +172,22 @@ public class HoldsAPI extends BaseAPI
|
|||||||
/**
|
/**
|
||||||
* Adds a list of items (content/record/record folder) to a list of holds
|
* Adds a list of items (content/record/record folder) to a list of holds
|
||||||
*
|
*
|
||||||
* @param user the user who adds the item to the hold
|
* @param user the user who adds the items to the holds
|
||||||
|
* @param password the user's password
|
||||||
|
* @param itemNodeRefs the list of items nodeRefs to be added to holds
|
||||||
|
* @param holdNames the list of holds
|
||||||
|
* @return The HTTP response
|
||||||
|
*/
|
||||||
|
public HttpResponse addItemsToHolds(String user, String password, List<String> itemNodeRefs,
|
||||||
|
List<String> holdNames)
|
||||||
|
{
|
||||||
|
return addItemsToHolds(user, password, SC_OK, itemNodeRefs, holdNames);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a list of items (content/record/record folder) to a list of holds
|
||||||
|
*
|
||||||
|
* @param user the user who adds the items to the holds
|
||||||
* @param password the user's password
|
* @param password the user's password
|
||||||
* @param itemNodeRefs the list of items nodeRefs to be added to holds
|
* @param itemNodeRefs the list of items nodeRefs to be added to holds
|
||||||
* @param holdNames the list of holds
|
* @param holdNames the list of holds
|
||||||
@@ -241,6 +256,21 @@ public class HoldsAPI extends BaseAPI
|
|||||||
Collections.singletonList(holdName));
|
Collections.singletonList(holdName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a list of items (content/record/record folder) from a list of holds
|
||||||
|
*
|
||||||
|
* @param user the user who removes the item from the hold
|
||||||
|
* @param password the user's password
|
||||||
|
* @param itemNodeRefs the list of items nodeRefs to be removed from hold
|
||||||
|
* @param holdNames the list of hold names
|
||||||
|
* @return The HTTP response
|
||||||
|
*/
|
||||||
|
public HttpResponse removeItemsFromHolds(String user, String password, List<String> itemNodeRefs,
|
||||||
|
List<String> holdNames)
|
||||||
|
{
|
||||||
|
return removeItemsFromHolds(user, password, SC_OK, itemNodeRefs, holdNames);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a list of items (content/record/record folder) from a list of holds
|
* Remove a list of items (content/record/record folder) from a list of holds
|
||||||
*
|
*
|
||||||
|
@@ -26,6 +26,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.rest.rm.community.hold;
|
package org.alfresco.rest.rm.community.hold;
|
||||||
|
|
||||||
|
import static java.util.Arrays.asList;
|
||||||
|
|
||||||
import static org.alfresco.rest.rm.community.base.TestData.FROZEN_ASPECT;
|
import static org.alfresco.rest.rm.community.base.TestData.FROZEN_ASPECT;
|
||||||
import static org.alfresco.rest.rm.community.base.TestData.HOLD_DESCRIPTION;
|
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.base.TestData.HOLD_REASON;
|
||||||
@@ -43,7 +45,7 @@ import static org.springframework.http.HttpStatus.CREATED;
|
|||||||
import static org.testng.Assert.assertFalse;
|
import static org.testng.Assert.assertFalse;
|
||||||
import static org.testng.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -112,16 +114,15 @@ public class RemoveFromHoldsTests extends BaseRMRestTest
|
|||||||
STEP("Add content to the holds.");
|
STEP("Add content to the holds.");
|
||||||
holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), contentHeld
|
holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), contentHeld
|
||||||
.getNodeRefWithoutVersion(), HOLD_ONE);
|
.getNodeRefWithoutVersion(), HOLD_ONE);
|
||||||
holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), contentAddToManyHolds
|
holdsAPI.addItemsToHolds(getAdminUser().getUsername(), getAdminUser().getPassword(),
|
||||||
.getNodeRefWithoutVersion(), String.format("%s,%s", HOLD_ONE, HOLD_TWO));
|
Collections.singletonList(contentAddToManyHolds.getNodeRefWithoutVersion()), asList(HOLD_ONE, HOLD_TWO));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Valid nodes to be removed from hold
|
* Valid nodes to be removed from hold
|
||||||
*/
|
*/
|
||||||
@DataProvider (name = "validNodesToRemoveFromHold")
|
@DataProvider (name = "validNodesToRemoveFromHold")
|
||||||
public Object[][] getValidNodesToRemoveFromHold() throws Exception
|
public Object[][] getValidNodesToRemoveFromHold()
|
||||||
{
|
{
|
||||||
//create electronic and nonElectronic record in record folder
|
//create electronic and nonElectronic record in record folder
|
||||||
RecordCategoryChild recordFolder = createCategoryFolderInFilePlan();
|
RecordCategoryChild recordFolder = createCategoryFolderInFilePlan();
|
||||||
@@ -135,8 +136,8 @@ public class RemoveFromHoldsTests extends BaseRMRestTest
|
|||||||
|
|
||||||
RecordCategoryChild folderToHeld = createCategoryFolderInFilePlan();
|
RecordCategoryChild folderToHeld = createCategoryFolderInFilePlan();
|
||||||
nodesToBeClean.add(folderToHeld.getParentId());
|
nodesToBeClean.add(folderToHeld.getParentId());
|
||||||
Arrays.asList(electronicRecord.getId(), nonElectronicRecord.getId(), folderToHeld.getId()).forEach(item ->
|
holdsAPI.addItemsToHolds(getAdminUser().getUsername(), getAdminUser().getPassword(),
|
||||||
holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), item, HOLD_ONE));
|
asList(electronicRecord.getId(), nonElectronicRecord.getId(), folderToHeld.getId()), Collections.singletonList(HOLD_ONE));
|
||||||
|
|
||||||
return new String[][]
|
return new String[][]
|
||||||
{ // record folder
|
{ // record folder
|
||||||
@@ -215,11 +216,11 @@ public class RemoveFromHoldsTests extends BaseRMRestTest
|
|||||||
FileModel contentNoHoldCap = dataContent.usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
FileModel contentNoHoldCap = dataContent.usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||||
FileModel privateFile = dataContent.usingSite(privateSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
FileModel privateFile = dataContent.usingSite(privateSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||||
//add files to hold
|
//add files to hold
|
||||||
Arrays.asList(recordFolder.getId(), contentNoHoldCap.getNodeRefWithoutVersion(),
|
holdsAPI.addItemsToHolds(getAdminUser().getUsername(), getAdminUser().getPassword(),
|
||||||
contentNoHoldPerm.getNodeRefWithoutVersion(), privateFile.getNodeRefWithoutVersion()).forEach(
|
asList(recordFolder.getId(), contentNoHoldCap.getNodeRefWithoutVersion(),
|
||||||
node -> holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), node,
|
contentNoHoldPerm.getNodeRefWithoutVersion(), privateFile.getNodeRefWithoutVersion()),
|
||||||
HOLD_ONE)
|
Collections.singletonList(HOLD_ONE));
|
||||||
);
|
|
||||||
return new Object[][]
|
return new Object[][]
|
||||||
{
|
{
|
||||||
// user with read permission on the content, with remove from hold capability and without
|
// user with read permission on the content, with remove from hold capability and without
|
||||||
@@ -290,10 +291,8 @@ public class RemoveFromHoldsTests extends BaseRMRestTest
|
|||||||
FileModel contentPermission = dataContent.usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
FileModel contentPermission = dataContent.usingSite(testSite).createContent(CMISUtil.DocumentType.TEXT_PLAIN);
|
||||||
|
|
||||||
//add files to hold
|
//add files to hold
|
||||||
Arrays.asList(recordFolder.getId(), contentPermission.getNodeRefWithoutVersion()).forEach(
|
holdsAPI.addItemsToHolds(getAdminUser().getUsername(), getAdminUser().getPassword(),
|
||||||
node -> holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), node,
|
asList(recordFolder.getId(), contentPermission.getNodeRefWithoutVersion()), Collections.singletonList(HOLD_ONE));
|
||||||
HOLD_ONE)
|
|
||||||
);
|
|
||||||
|
|
||||||
return new Object[][]
|
return new Object[][]
|
||||||
{
|
{
|
||||||
@@ -325,7 +324,7 @@ public class RemoveFromHoldsTests extends BaseRMRestTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass (alwaysRun = true)
|
@AfterClass (alwaysRun = true)
|
||||||
public void cleanUpRemoveContentFromHold() throws Exception
|
public void cleanUpRemoveContentFromHold()
|
||||||
{
|
{
|
||||||
holdsAPI.deleteHold(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD_ONE);
|
holdsAPI.deleteHold(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD_ONE);
|
||||||
holdsAPI.deleteHold(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD_TWO);
|
holdsAPI.deleteHold(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD_TWO);
|
||||||
|
Reference in New Issue
Block a user