mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Add tests for RM-6929
This commit is contained in:
@@ -36,4 +36,10 @@ public class FilePlanComponentAspects
|
|||||||
{
|
{
|
||||||
// aspect present on completed records
|
// aspect present on completed records
|
||||||
public static final String ASPECTS_COMPLETED_RECORD = "rma:declaredRecord";
|
public static final String ASPECTS_COMPLETED_RECORD = "rma:declaredRecord";
|
||||||
|
|
||||||
|
// aspect present on record folders/categories with vital records
|
||||||
|
public static final String ASPECTS_VITAL_RECORD_DEFINITION= "rma:vitalRecordDefinition";
|
||||||
|
|
||||||
|
// aspect present on vital records
|
||||||
|
public static final String ASPECTS_VITAL_RECORD = "rma:vitalRecord";
|
||||||
}
|
}
|
||||||
|
@@ -82,6 +82,7 @@ public class FilePlanComponentFields
|
|||||||
public static final String PROPERTIES_CLASSIFICATION = "sc:classification";
|
public static final String PROPERTIES_CLASSIFICATION = "sc:classification";
|
||||||
public static final String PROPERTIES_DATE_FILED = "rma:dateFiled";
|
public static final String PROPERTIES_DATE_FILED = "rma:dateFiled";
|
||||||
public static final String PROPERTIES_ORIGINAL_NAME = "rma:origionalName";
|
public static final String PROPERTIES_ORIGINAL_NAME = "rma:origionalName";
|
||||||
|
public static final String PROPERTIES_REVIEW_AS_OF = "rma:reviewAsOf";
|
||||||
|
|
||||||
/** Electronic record properties */
|
/** Electronic record properties */
|
||||||
public static final String PROPERTIES_VERSION_TYPE = "cm:versionType";
|
public static final String PROPERTIES_VERSION_TYPE = "cm:versionType";
|
||||||
|
@@ -60,7 +60,11 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo
|
|||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_PERIOD;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_PERIOD;
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_PERIOD_EXPRESSION;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_DISPOSITION_PERIOD_EXPRESSION;
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE;
|
||||||
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD;
|
||||||
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION;
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RESOLUTION_UNIT;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RESOLUTION_UNIT;
|
||||||
|
|
||||||
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_REVIEW_AS_OF;
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_ROOT_NODE_REF;
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_SHELF;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_SHELF;
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_SOFTWARE;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_SOFTWARE;
|
||||||
@@ -77,14 +81,13 @@ import java.util.List;
|
|||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import org.alfresco.rest.rm.community.model.common.Owner;
|
|
||||||
import org.alfresco.utility.model.TestModel;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.alfresco.rest.rm.community.model.common.Owner;
|
||||||
|
import org.alfresco.utility.model.TestModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* POJO for record properties
|
* POJO for record properties
|
||||||
@@ -237,4 +240,13 @@ public class RecordProperties extends TestModel
|
|||||||
|
|
||||||
@JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_INSTRUCTIONS)
|
@JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_INSTRUCTIONS)
|
||||||
private String recordSearchDispositionInstructions;
|
private String recordSearchDispositionInstructions;
|
||||||
|
|
||||||
|
@JsonProperty (PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD)
|
||||||
|
private String recordSearchVitalRecordReviewPeriod;
|
||||||
|
|
||||||
|
@JsonProperty (PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION)
|
||||||
|
private String recordSearchVitalRecordReviewPeriodExpression;
|
||||||
|
|
||||||
|
@JsonProperty(PROPERTIES_REVIEW_AS_OF)
|
||||||
|
private Date reviewAsOf;
|
||||||
}
|
}
|
||||||
|
@@ -33,6 +33,10 @@ import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanCo
|
|||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IS_CLOSED;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_IS_CLOSED;
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_LOCATION;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_LOCATION;
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_OWNER;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_OWNER;
|
||||||
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields
|
||||||
|
.PROPERTIES_RECORD_SEARCH_DISPOSITION_AUTHORITY;
|
||||||
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields
|
||||||
|
.PROPERTIES_RECORD_SEARCH_DISPOSITION_INSTRUCTIONS;
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_HAS_DISPOSITION_SCHEDULE;
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD;
|
||||||
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION;
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentFields.PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION;
|
||||||
@@ -120,4 +124,11 @@ public class RecordFolderProperties extends TestModel
|
|||||||
|
|
||||||
@JsonProperty (PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION)
|
@JsonProperty (PROPERTIES_RECORD_SEARCH_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION)
|
||||||
private String recordSearchVitalRecordReviewPeriodExpression;
|
private String recordSearchVitalRecordReviewPeriodExpression;
|
||||||
|
|
||||||
|
@JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_AUTHORITY)
|
||||||
|
private String recordSearchDispositionAuthority;
|
||||||
|
|
||||||
|
@JsonProperty (PROPERTIES_RECORD_SEARCH_DISPOSITION_INSTRUCTIONS)
|
||||||
|
private String recordSearchDispositionInstructions;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -28,10 +28,18 @@ 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_DESCRIPTION;
|
||||||
import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON;
|
import static org.alfresco.rest.rm.community.base.TestData.HOLD_REASON;
|
||||||
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAspects.ASPECTS_VITAL_RECORD;
|
||||||
|
import static org.alfresco.rest.rm.community.model.fileplancomponents.FilePlanComponentAspects.ASPECTS_VITAL_RECORD_DEFINITION;
|
||||||
import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix;
|
import static org.alfresco.rest.rm.community.util.CommonTestUtils.generateTestPrefix;
|
||||||
import static org.alfresco.rest.rm.community.utils.CoreUtil.createBodyForMoveCopy;
|
import static org.alfresco.rest.rm.community.utils.CoreUtil.createBodyForMoveCopy;
|
||||||
|
import static org.alfresco.utility.data.RandomData.getRandomName;
|
||||||
import static org.alfresco.utility.report.log.Step.STEP;
|
import static org.alfresco.utility.report.log.Step.STEP;
|
||||||
|
import static org.springframework.http.HttpStatus.CREATED;
|
||||||
import static org.springframework.http.HttpStatus.FORBIDDEN;
|
import static org.springframework.http.HttpStatus.FORBIDDEN;
|
||||||
|
import static org.springframework.http.HttpStatus.OK;
|
||||||
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
import static org.testng.Assert.assertTrue;
|
||||||
|
import static org.testng.AssertJUnit.assertFalse;
|
||||||
|
|
||||||
import javax.json.Json;
|
import javax.json.Json;
|
||||||
import javax.json.JsonObject;
|
import javax.json.JsonObject;
|
||||||
@@ -40,7 +48,14 @@ import java.io.File;
|
|||||||
import org.alfresco.dataprep.CMISUtil;
|
import org.alfresco.dataprep.CMISUtil;
|
||||||
import org.alfresco.rest.core.JsonBodyGenerator;
|
import org.alfresco.rest.core.JsonBodyGenerator;
|
||||||
import org.alfresco.rest.rm.community.base.BaseRMRestTest;
|
import org.alfresco.rest.rm.community.base.BaseRMRestTest;
|
||||||
|
import org.alfresco.rest.rm.community.model.common.ReviewPeriod;
|
||||||
|
import org.alfresco.rest.rm.community.model.record.Record;
|
||||||
|
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategory;
|
||||||
|
import org.alfresco.rest.rm.community.model.recordcategory.RecordCategoryChild;
|
||||||
|
import org.alfresco.rest.rm.community.model.recordfolder.RecordFolder;
|
||||||
|
import org.alfresco.rest.rm.community.model.recordfolder.RecordFolderProperties;
|
||||||
import org.alfresco.rest.v0.HoldsAPI;
|
import org.alfresco.rest.v0.HoldsAPI;
|
||||||
|
import org.alfresco.rest.v0.service.DispositionScheduleService;
|
||||||
import org.alfresco.test.AlfrescoTest;
|
import org.alfresco.test.AlfrescoTest;
|
||||||
import org.alfresco.utility.Utility;
|
import org.alfresco.utility.Utility;
|
||||||
import org.alfresco.utility.model.FileModel;
|
import org.alfresco.utility.model.FileModel;
|
||||||
@@ -64,10 +79,15 @@ public class PreventActionsOnFrozenContentTests extends BaseRMRestTest
|
|||||||
private static FileModel contentHeld;
|
private static FileModel contentHeld;
|
||||||
private static File updatedFile;
|
private static File updatedFile;
|
||||||
private static FolderModel folderModel;
|
private static FolderModel folderModel;
|
||||||
|
private static RecordCategoryChild recordFolder;
|
||||||
|
private static Record recordFrozen, recordNotHeld;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private HoldsAPI holdsAPI;
|
private HoldsAPI holdsAPI;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DispositionScheduleService dispositionScheduleService;
|
||||||
|
|
||||||
@BeforeClass (alwaysRun = true)
|
@BeforeClass (alwaysRun = true)
|
||||||
public void preconditionForPreventActionsOnFrozenContent() throws Exception
|
public void preconditionForPreventActionsOnFrozenContent() throws Exception
|
||||||
{
|
{
|
||||||
@@ -90,6 +110,15 @@ public class PreventActionsOnFrozenContentTests extends BaseRMRestTest
|
|||||||
STEP("Create a folder withing the test site .");
|
STEP("Create a folder withing the test site .");
|
||||||
folderModel = dataContent.usingAdmin().usingSite(testSite)
|
folderModel = dataContent.usingAdmin().usingSite(testSite)
|
||||||
.createFolder();
|
.createFolder();
|
||||||
|
|
||||||
|
STEP("Create a record folder with some records");
|
||||||
|
recordFolder = createCategoryFolderInFilePlan();
|
||||||
|
recordFrozen = createElectronicRecord(recordFolder.getId(), getRandomName("elRecordFrozen"));
|
||||||
|
recordNotHeld = createElectronicRecord(recordFolder.getId(), getRandomName("elRecordNotHeld"));
|
||||||
|
assertStatusCode(CREATED);
|
||||||
|
|
||||||
|
STEP("Add the record to the hold.");
|
||||||
|
holdsAPI.addItemToHold(getAdminUser().getUsername(), getAdminUser().getPassword(), recordFrozen.getId(), HOLD_ONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -179,12 +208,80 @@ public class PreventActionsOnFrozenContentTests extends BaseRMRestTest
|
|||||||
getRestAPIFactory().getRmRestWrapper().assertLastError().containsSummary("Frozen nodes can not be moved.");
|
getRestAPIFactory().getRmRestWrapper().assertLastError().containsSummary("Frozen nodes can not be moved.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a record folder with a frozen record and another record not in held
|
||||||
|
* When I update the record folder and make the records as vital
|
||||||
|
* Then I am successful and the records not held are mark as vital
|
||||||
|
* And the frozen nodes have the vital record search properties updated
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
@AlfrescoTest (jira = "RM-6929")
|
||||||
|
public void updateRecordFolderVitalProperties() throws Exception
|
||||||
|
{
|
||||||
|
STEP("Update the vital record properties for the record folder");
|
||||||
|
// Create the record folder properties to update
|
||||||
|
RecordFolder recordFolderToUpdate = RecordFolder.builder()
|
||||||
|
.properties(RecordFolderProperties.builder()
|
||||||
|
.vitalRecordIndicator(true)
|
||||||
|
.reviewPeriod(new ReviewPeriod("month", "1"))
|
||||||
|
.build())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// Update the record folder
|
||||||
|
RecordFolder updatedRecordFolder = getRestAPIFactory().getRecordFolderAPI().updateRecordFolder
|
||||||
|
(recordFolderToUpdate,
|
||||||
|
recordFolder.getId());
|
||||||
|
assertStatusCode(OK);
|
||||||
|
assertTrue(updatedRecordFolder.getAspectNames().contains(ASPECTS_VITAL_RECORD_DEFINITION));
|
||||||
|
|
||||||
|
|
||||||
|
STEP("Check the frozen record was not mark as vital");
|
||||||
|
recordFrozen = getRestAPIFactory().getRecordsAPI().getRecord(recordFrozen.getId());
|
||||||
|
assertFalse(recordFrozen.getAspectNames().contains(ASPECTS_VITAL_RECORD));
|
||||||
|
assertTrue(recordFrozen.getProperties().getRecordSearchVitalRecordReviewPeriod().contains("month"));
|
||||||
|
assertTrue(recordFrozen.getProperties().getRecordSearchVitalRecordReviewPeriodExpression().contains("1"));
|
||||||
|
|
||||||
|
STEP("Check the record not held was mark as vital");
|
||||||
|
recordNotHeld = getRestAPIFactory().getRecordsAPI().getRecord(recordNotHeld.getId());
|
||||||
|
assertTrue(recordNotHeld.getAspectNames().contains(ASPECTS_VITAL_RECORD));
|
||||||
|
assertNotNull(recordNotHeld.getProperties().getReviewAsOf());
|
||||||
|
assertTrue(recordNotHeld.getProperties().getRecordSearchVitalRecordReviewPeriod().contains("month"));
|
||||||
|
assertTrue(recordNotHeld.getProperties().getRecordSearchVitalRecordReviewPeriodExpression().contains("1"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a record folder with a frozen record and another record not in held
|
||||||
|
* When I add a disposition schedule
|
||||||
|
* Then I am successful
|
||||||
|
* And the record search disposition schedule properties are updated
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
@AlfrescoTest (jira = "RM-6929")
|
||||||
|
public void createDispositionScheduleOnCategoryWithHeldChildren() throws Exception
|
||||||
|
{
|
||||||
|
STEP("Create a retention schedule on the category with frozen children");
|
||||||
|
RecordCategory categoryWithRS = getRestAPIFactory().getRecordCategoryAPI()
|
||||||
|
.getRecordCategory(recordFolder.getParentId());
|
||||||
|
dispositionScheduleService.createCategoryRetentionSchedule(categoryWithRS.getName(), false);
|
||||||
|
dispositionScheduleService.addCutOffAfterPeriodStep(categoryWithRS.getName(), "immediately");
|
||||||
|
dispositionScheduleService.addDestroyWithGhostingAfterPeriodStep(categoryWithRS.getName(), "immediately");
|
||||||
|
|
||||||
|
STEP("Check the record folder has a disposition schedule");
|
||||||
|
RecordFolder folderWithRS = getRestAPIFactory().getRecordFolderAPI().getRecordFolder(recordFolder.getId());
|
||||||
|
assertNotNull(folderWithRS.getProperties().getRecordSearchDispositionAuthority());
|
||||||
|
assertNotNull(folderWithRS.getProperties().getRecordSearchDispositionInstructions());
|
||||||
|
|
||||||
|
}
|
||||||
@AfterClass (alwaysRun = true)
|
@AfterClass (alwaysRun = true)
|
||||||
public void cleanUpPreventActionsOnFrozenContent() throws Exception
|
public void cleanUpPreventActionsOnFrozenContent() throws Exception
|
||||||
{
|
{
|
||||||
holdsAPI.deleteHold(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD_ONE);
|
holdsAPI.deleteHold(getAdminUser().getUsername(), getAdminUser().getPassword(), HOLD_ONE);
|
||||||
dataSite.usingAdmin().deleteSite(testSite);
|
dataSite.usingAdmin().deleteSite(testSite);
|
||||||
|
getRestAPIFactory().getRecordCategoryAPI().deleteRecordCategory(recordFolder.getParentId());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user