mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
MNT-21132 : Search Result points to incorrect link to Folder on Hold
This commit is contained in:
@@ -41,6 +41,7 @@ import static org.apache.commons.httpclient.HttpStatus.SC_INTERNAL_SERVER_ERROR;
|
|||||||
import static org.testng.AssertJUnit.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.testng.AssertJUnit.assertTrue;
|
import static org.testng.AssertJUnit.assertTrue;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -94,6 +95,7 @@ public class AuditAddToHoldTests extends BaseRMRestTest
|
|||||||
private RecordCategoryChild recordFolder;
|
private RecordCategoryChild recordFolder;
|
||||||
private List<AuditEntry> auditEntries;
|
private List<AuditEntry> auditEntries;
|
||||||
private List<String> holdsList = asList(HOLD1, HOLD2);
|
private List<String> holdsList = asList(HOLD1, HOLD2);
|
||||||
|
private List<String> holdsListRef = new ArrayList<>();
|
||||||
private String hold1NodeRef;
|
private String hold1NodeRef;
|
||||||
|
|
||||||
@BeforeClass (alwaysRun = true)
|
@BeforeClass (alwaysRun = true)
|
||||||
@@ -102,7 +104,8 @@ public class AuditAddToHoldTests extends BaseRMRestTest
|
|||||||
STEP("Create 2 holds.");
|
STEP("Create 2 holds.");
|
||||||
hold1NodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(),
|
hold1NodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(),
|
||||||
getAdminUser().getPassword(), HOLD1, HOLD_REASON, HOLD_DESCRIPTION);
|
getAdminUser().getPassword(), HOLD1, HOLD_REASON, HOLD_DESCRIPTION);
|
||||||
holdsAPI.createHold(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD2, HOLD_REASON, HOLD_DESCRIPTION);
|
String hold2NodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD2, HOLD_REASON, HOLD_DESCRIPTION);
|
||||||
|
holdsListRef = asList(hold1NodeRef, hold2NodeRef);
|
||||||
|
|
||||||
STEP("Create a new record category with a record folder.");
|
STEP("Create a new record category with a record folder.");
|
||||||
recordCategory = createRootCategory(getRandomName("recordCategory"));
|
recordCategory = createRootCategory(getRandomName("recordCategory"));
|
||||||
@@ -302,7 +305,7 @@ public class AuditAddToHoldTests extends BaseRMRestTest
|
|||||||
@AfterClass (alwaysRun = true)
|
@AfterClass (alwaysRun = true)
|
||||||
public void cleanUpAuditAddToHoldTests()
|
public void cleanUpAuditAddToHoldTests()
|
||||||
{
|
{
|
||||||
holdsList.forEach(hold -> holdsAPI.deleteHold(getAdminUser().getUsername(), getAdminUser().getPassword(), hold));
|
holdsListRef.forEach(hold -> holdsAPI.deleteHold(getAdminUser(), hold));
|
||||||
dataSite.usingAdmin().deleteSite(privateSite);
|
dataSite.usingAdmin().deleteSite(privateSite);
|
||||||
asList(rmAdmin, rmManagerNoReadOnHold, rmManagerNoReadOnNode).forEach(user -> getDataUser().usingAdmin().deleteUser(user));
|
asList(rmAdmin, rmManagerNoReadOnHold, rmManagerNoReadOnNode).forEach(user -> getDataUser().usingAdmin().deleteUser(user));
|
||||||
getRestAPIFactory().getRecordCategoryAPI().deleteRecordCategory(recordCategory.getId());
|
getRestAPIFactory().getRecordCategoryAPI().deleteRecordCategory(recordCategory.getId());
|
||||||
|
@@ -133,7 +133,7 @@ public class AuditDeleteHoldTests extends BaseRMRestTest
|
|||||||
@AfterClass (alwaysRun = true)
|
@AfterClass (alwaysRun = true)
|
||||||
public void cleanUpAuditDeleteHoldTests()
|
public void cleanUpAuditDeleteHoldTests()
|
||||||
{
|
{
|
||||||
holdsAPI.deleteHold(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD);
|
holdsAPI.deleteHold(getAdminUser(), holdNodeRef);
|
||||||
asList(rmAdmin, rmManager).forEach(user -> getDataUser().usingAdmin().deleteUser(user));
|
asList(rmAdmin, rmManager).forEach(user -> getDataUser().usingAdmin().deleteUser(user));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -41,6 +41,8 @@ import static org.apache.commons.httpclient.HttpStatus.SC_INTERNAL_SERVER_ERROR;
|
|||||||
import static org.testng.AssertJUnit.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.testng.AssertJUnit.assertTrue;
|
import static org.testng.AssertJUnit.assertTrue;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -97,6 +99,7 @@ public class AuditRemoveFromHoldTests extends BaseRMRestTest
|
|||||||
private Record heldRecord;
|
private Record heldRecord;
|
||||||
private List<AuditEntry> auditEntries;
|
private List<AuditEntry> auditEntries;
|
||||||
private List<String> holdsList = asList(HOLD1, HOLD2, HOLD3);
|
private List<String> holdsList = asList(HOLD1, HOLD2, HOLD3);
|
||||||
|
private List<String> holdsListRef = new ArrayList<>();
|
||||||
private FileModel heldContent;
|
private FileModel heldContent;
|
||||||
private String hold1NodeRef;
|
private String hold1NodeRef;
|
||||||
|
|
||||||
@@ -112,9 +115,10 @@ public class AuditRemoveFromHoldTests extends BaseRMRestTest
|
|||||||
STEP("Create new holds.");
|
STEP("Create new holds.");
|
||||||
hold1NodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(),
|
hold1NodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(),
|
||||||
HOLD1, HOLD_REASON, HOLD_DESCRIPTION);
|
HOLD1, HOLD_REASON, HOLD_DESCRIPTION);
|
||||||
holdsAPI.createHold(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD2, HOLD_REASON, HOLD_DESCRIPTION);
|
String hold2NodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD2, HOLD_REASON, HOLD_DESCRIPTION);
|
||||||
holdsAPI.createHold(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD3, HOLD_REASON, HOLD_DESCRIPTION);
|
String hold3NodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD3, HOLD_REASON, HOLD_DESCRIPTION);
|
||||||
holdsAPI.createHold(getAdminUser().getUsername(), getAdminUser().getPassword(), DELETED_HOLD, HOLD_REASON, HOLD_DESCRIPTION);
|
String deleteNodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(), DELETED_HOLD, HOLD_REASON, HOLD_DESCRIPTION);
|
||||||
|
holdsListRef = asList(hold1NodeRef, hold2NodeRef, hold3NodeRef);
|
||||||
|
|
||||||
STEP("Create a new record category with a record folder.");
|
STEP("Create a new record category with a record folder.");
|
||||||
recordCategory = createRootCategory(getRandomName("recordCategory"));
|
recordCategory = createRootCategory(getRandomName("recordCategory"));
|
||||||
@@ -317,7 +321,7 @@ public class AuditRemoveFromHoldTests extends BaseRMRestTest
|
|||||||
@AfterClass (alwaysRun = true)
|
@AfterClass (alwaysRun = true)
|
||||||
public void cleanUpAuditRemoveFromHoldTests()
|
public void cleanUpAuditRemoveFromHoldTests()
|
||||||
{
|
{
|
||||||
holdsList.forEach(hold -> holdsAPI.deleteHold(getAdminUser().getUsername(), getAdminUser().getPassword(), hold));
|
holdsListRef.forEach(hold -> holdsAPI.deleteHold(getAdminUser(), hold));
|
||||||
dataSite.usingAdmin().deleteSite(privateSite);
|
dataSite.usingAdmin().deleteSite(privateSite);
|
||||||
asList(rmAdmin, rmManagerNoReadOnHold, rmManagerNoReadOnNode).forEach(user -> getDataUser().usingAdmin().deleteUser(user));
|
asList(rmAdmin, rmManagerNoReadOnHold, rmManagerNoReadOnNode).forEach(user -> getDataUser().usingAdmin().deleteUser(user));
|
||||||
getRestAPIFactory().getRecordCategoryAPI().deleteRecordCategory(recordCategory.getId());
|
getRestAPIFactory().getRecordCategoryAPI().deleteRecordCategory(recordCategory.getId());
|
||||||
|
@@ -97,6 +97,7 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest
|
|||||||
private RecordCategory recordCategory;
|
private RecordCategory recordCategory;
|
||||||
private RecordCategoryChild recordFolder, subcategoryRecordFolder, subCategory, closedRecordFolder, recordFolderWithSpacesInName;
|
private RecordCategoryChild recordFolder, subcategoryRecordFolder, subCategory, closedRecordFolder, recordFolderWithSpacesInName;
|
||||||
private UnfiledContainerChild unfiledContainerFolder;
|
private UnfiledContainerChild unfiledContainerFolder;
|
||||||
|
private String holdNodeRef;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DockerHelper dockerHelper;
|
private DockerHelper dockerHelper;
|
||||||
@@ -406,7 +407,7 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest
|
|||||||
public void declareAndFileToHeldRecordFolderUsingFilesAPI() throws Exception
|
public void declareAndFileToHeldRecordFolderUsingFilesAPI() throws Exception
|
||||||
{
|
{
|
||||||
RecordCategoryChild heldRecordFolder = createFolder(recordCategory.getId(), getRandomName("heldRecordFolder"));
|
RecordCategoryChild heldRecordFolder = createFolder(recordCategory.getId(), getRandomName("heldRecordFolder"));
|
||||||
holdsAPI.createHold(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD_NAME, HOLD_REASON, HOLD_DESCRIPTION);
|
holdNodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD_NAME, HOLD_REASON, HOLD_DESCRIPTION);
|
||||||
holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), heldRecordFolder.getId(),
|
holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), heldRecordFolder.getId(),
|
||||||
HOLD_NAME);
|
HOLD_NAME);
|
||||||
|
|
||||||
@@ -457,7 +458,7 @@ public class DeclareAndFileDocumentAsRecordTests extends BaseRMRestTest
|
|||||||
public void declareAndFileDocumentAsRecordCleanup()
|
public void declareAndFileDocumentAsRecordCleanup()
|
||||||
{
|
{
|
||||||
//delete rm items
|
//delete rm items
|
||||||
holdsAPI.deleteHold(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD_NAME);
|
holdsAPI.deleteHold(getAdminUser(), holdNodeRef);
|
||||||
deleteRecordCategory(recordCategory.getId());
|
deleteRecordCategory(recordCategory.getId());
|
||||||
getRestAPIFactory().getUnfiledRecordFoldersAPI().deleteUnfiledRecordFolder(unfiledContainerFolder.getId());
|
getRestAPIFactory().getUnfiledRecordFoldersAPI().deleteUnfiledRecordFolder(unfiledContainerFolder.getId());
|
||||||
|
|
||||||
|
@@ -89,6 +89,7 @@ public class FileVersionAsRecordTests extends BaseRMRestTest
|
|||||||
private RecordCategory recordCategory;
|
private RecordCategory recordCategory;
|
||||||
private RecordCategoryChild recordFolder, closedRecordFolder, heldRecordFolder;
|
private RecordCategoryChild recordFolder, closedRecordFolder, heldRecordFolder;
|
||||||
private UnfiledContainerChild unfiledContainerFolder;
|
private UnfiledContainerChild unfiledContainerFolder;
|
||||||
|
private String holdNodeRef;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RoleService roleService;
|
private RoleService roleService;
|
||||||
@@ -114,7 +115,7 @@ public class FileVersionAsRecordTests extends BaseRMRestTest
|
|||||||
unfiledContainerFolder = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS,
|
unfiledContainerFolder = createUnfiledContainerChild(UNFILED_RECORDS_CONTAINER_ALIAS,
|
||||||
"Unfiled Folder " + getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE);
|
"Unfiled Folder " + getRandomAlphanumeric(), UNFILED_RECORD_FOLDER_TYPE);
|
||||||
heldRecordFolder = createFolder(recordCategory.getId(), getRandomName("heldRecordFolder"));
|
heldRecordFolder = createFolder(recordCategory.getId(), getRandomName("heldRecordFolder"));
|
||||||
holdsAPI.createHold(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD_NAME, HOLD_REASON, HOLD_DESCRIPTION);
|
holdNodeRef = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD_NAME, HOLD_REASON, HOLD_DESCRIPTION);
|
||||||
holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), heldRecordFolder.getId(),
|
holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), heldRecordFolder.getId(),
|
||||||
HOLD_NAME);
|
HOLD_NAME);
|
||||||
|
|
||||||
@@ -284,7 +285,7 @@ public class FileVersionAsRecordTests extends BaseRMRestTest
|
|||||||
@AfterClass (alwaysRun = true)
|
@AfterClass (alwaysRun = true)
|
||||||
public void declareAndFileVersionAsRecordCleanUp()
|
public void declareAndFileVersionAsRecordCleanUp()
|
||||||
{
|
{
|
||||||
holdsAPI.deleteHold(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD_NAME);
|
holdsAPI.deleteHold(getAdminUser(), holdNodeRef);
|
||||||
deleteRecordCategory(recordCategory.getId());
|
deleteRecordCategory(recordCategory.getId());
|
||||||
|
|
||||||
//delete created collaboration site
|
//delete created collaboration site
|
||||||
|
@@ -357,7 +357,7 @@ public class AddToHoldsTests extends BaseRMRestTest
|
|||||||
@AfterClass (alwaysRun = true)
|
@AfterClass (alwaysRun = true)
|
||||||
public void cleanUpAddContentToHold()
|
public void cleanUpAddContentToHold()
|
||||||
{
|
{
|
||||||
holdsAPI.deleteHold(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD);
|
holdsAPI.deleteHold(getAdminUser(), holdNodeRef);
|
||||||
dataSite.usingAdmin().deleteSite(testSite);
|
dataSite.usingAdmin().deleteSite(testSite);
|
||||||
users.forEach(user -> getDataUser().usingAdmin().deleteUser(user));
|
users.forEach(user -> getDataUser().usingAdmin().deleteUser(user));
|
||||||
nodesToBeClean.forEach( category -> getRestAPIFactory().getRecordCategoryAPI().deleteRecordCategory(category));
|
nodesToBeClean.forEach( category -> getRestAPIFactory().getRecordCategoryAPI().deleteRecordCategory(category));
|
||||||
|
@@ -324,7 +324,7 @@ public class PreventActionsOnFrozenContentTests extends BaseRMRestTest
|
|||||||
@AfterClass (alwaysRun = true)
|
@AfterClass (alwaysRun = true)
|
||||||
public void cleanUpPreventActionsOnFrozenContent()
|
public void cleanUpPreventActionsOnFrozenContent()
|
||||||
{
|
{
|
||||||
holdsAPI.deleteHold(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD_ONE);
|
holdsAPI.deleteHold(getAdminUser(), holdNodeRef);
|
||||||
dataSite.usingAdmin().deleteSite(testSite);
|
dataSite.usingAdmin().deleteSite(testSite);
|
||||||
getRestAPIFactory().getRecordCategoryAPI().deleteRecordCategory(recordFolder.getParentId());
|
getRestAPIFactory().getRecordCategoryAPI().deleteRecordCategory(recordFolder.getParentId());
|
||||||
getRestAPIFactory().getRecordCategoryAPI().deleteRecordCategory(categoryWithRS.getId());
|
getRestAPIFactory().getRecordCategoryAPI().deleteRecordCategory(categoryWithRS.getId());
|
||||||
|
@@ -86,6 +86,7 @@ public class RemoveFromHoldsTests extends BaseRMRestTest
|
|||||||
|
|
||||||
private SiteModel testSite, privateSite;
|
private SiteModel testSite, privateSite;
|
||||||
private String holdNodeRefOne;
|
private String holdNodeRefOne;
|
||||||
|
private String holdNodeRefTwo;
|
||||||
private FileModel contentHeld, contentAddToManyHolds;
|
private FileModel contentHeld, contentAddToManyHolds;
|
||||||
private Set<UserModel> usersToBeClean = new HashSet<>();
|
private Set<UserModel> usersToBeClean = new HashSet<>();
|
||||||
private Set<String> nodesToBeClean = new HashSet<>();
|
private Set<String> nodesToBeClean = new HashSet<>();
|
||||||
@@ -100,7 +101,7 @@ public class RemoveFromHoldsTests extends BaseRMRestTest
|
|||||||
STEP("Create two holds.");
|
STEP("Create two holds.");
|
||||||
holdNodeRefOne = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getUsername(),
|
holdNodeRefOne = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser().getUsername(),
|
||||||
HOLD_ONE, HOLD_REASON, HOLD_DESCRIPTION);
|
HOLD_ONE, HOLD_REASON, HOLD_DESCRIPTION);
|
||||||
holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser()
|
holdNodeRefTwo = holdsAPI.createHoldAndGetNodeRef(getAdminUser().getUsername(), getAdminUser()
|
||||||
.getUsername(), HOLD_TWO, HOLD_REASON, HOLD_DESCRIPTION);
|
.getUsername(), HOLD_TWO, HOLD_REASON, HOLD_DESCRIPTION);
|
||||||
|
|
||||||
STEP("Create test files.");
|
STEP("Create test files.");
|
||||||
@@ -326,8 +327,8 @@ public class RemoveFromHoldsTests extends BaseRMRestTest
|
|||||||
@AfterClass (alwaysRun = true)
|
@AfterClass (alwaysRun = true)
|
||||||
public void cleanUpRemoveContentFromHold()
|
public void cleanUpRemoveContentFromHold()
|
||||||
{
|
{
|
||||||
holdsAPI.deleteHold(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD_ONE);
|
holdsAPI.deleteHold(getAdminUser(), holdNodeRefOne);
|
||||||
holdsAPI.deleteHold(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD_TWO);
|
holdsAPI.deleteHold(getAdminUser(), holdNodeRefTwo);
|
||||||
dataSite.usingAdmin().deleteSite(testSite);
|
dataSite.usingAdmin().deleteSite(testSite);
|
||||||
dataSite.usingAdmin().deleteSite(privateSite);
|
dataSite.usingAdmin().deleteSite(privateSite);
|
||||||
usersToBeClean.forEach(user -> getDataUser().usingAdmin().deleteUser(user));
|
usersToBeClean.forEach(user -> getDataUser().usingAdmin().deleteUser(user));
|
||||||
|
@@ -98,6 +98,9 @@ public class HoldServiceImplUnitTest extends BaseUnitTest
|
|||||||
@Mock
|
@Mock
|
||||||
private CapabilityService mockedCapabilityService;
|
private CapabilityService mockedCapabilityService;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private ChildAssociationRef mockChildAssociationRef;
|
||||||
|
|
||||||
@Spy @InjectMocks HoldServiceImpl holdService;
|
@Spy @InjectMocks HoldServiceImpl holdService;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@@ -120,7 +123,9 @@ public class HoldServiceImplUnitTest extends BaseUnitTest
|
|||||||
QName contentSubtype = QName.createQName("contentSubtype", "contentSubtype");
|
QName contentSubtype = QName.createQName("contentSubtype", "contentSubtype");
|
||||||
when(mockedNodeService.getType(activeContent)).thenReturn(contentSubtype);
|
when(mockedNodeService.getType(activeContent)).thenReturn(contentSubtype);
|
||||||
when(mockedNodeTypeUtility.instanceOf(contentSubtype, ContentModel.TYPE_CONTENT)).thenReturn(true);
|
when(mockedNodeTypeUtility.instanceOf(contentSubtype, ContentModel.TYPE_CONTENT)).thenReturn(true);
|
||||||
|
when(mockedNodeService.getPrimaryParent(activeContent)).thenReturn(mockChildAssociationRef);
|
||||||
|
|
||||||
|
when(mockedNodeService.getPrimaryParent(recordFolder)).thenReturn(mockChildAssociationRef);
|
||||||
// setup interactions
|
// setup interactions
|
||||||
doReturn(holdContainer).when(mockedFilePlanService).getHoldContainer(filePlan);
|
doReturn(holdContainer).when(mockedFilePlanService).getHoldContainer(filePlan);
|
||||||
}
|
}
|
||||||
@@ -353,6 +358,7 @@ public class HoldServiceImplUnitTest extends BaseUnitTest
|
|||||||
public void addToHoldNotInHold()
|
public void addToHoldNotInHold()
|
||||||
{
|
{
|
||||||
mockPoliciesForAddToHold();
|
mockPoliciesForAddToHold();
|
||||||
|
when(mockedNodeService.getPrimaryParent(record)).thenReturn(mockChildAssociationRef);
|
||||||
|
|
||||||
holdService.addToHold(hold, recordFolder);
|
holdService.addToHold(hold, recordFolder);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user