use of org.alfresco.bm.dataload.rm.services.RecordData in project records-management by Alfresco.
the class RecordServiceTest method testUpdateNonExistingRecord.
/**
* Given a record object not stored in the database
* When calling the update method
* Then no error is returned and the record is not stored in the database
*/
@Test
public void testUpdateNonExistingRecord() {
RecordData nonExistingRecord = new RecordData("non_existing_id", RecordContext.IN_PLACE_RECORD, "test_name", "test_parentPath", "test_inPlaceRecord", ExecutionState.UNFILED_RECORD_DECLARED);
recordService.updateRecord(nonExistingRecord);
assertNull(recordService.getRecordOrNull(nonExistingRecord.getId()));
}
use of org.alfresco.bm.dataload.rm.services.RecordData in project records-management by Alfresco.
the class RecordServiceTest method testGetRecordsInPaths.
@Test
public void testGetRecordsInPaths() {
Random rand = new Random();
for (int j = 0; j < 50; j++) {
for (int i = 0; i < 50; i++) {
RecordData record = new RecordData("test_id(" + j + ")(" + i + ")", RecordContext.values()[rand.nextInt(2)], "test_name", "test_parentPath" + rand.nextInt(i + 1), null, ExecutionState.UNFILED_RECORD_DECLARED);
recordService.createRecord(record);
}
}
assertEquals(50 * 50, recordService.getRecordsInPaths(ExecutionState.UNFILED_RECORD_DECLARED.name(), null, 0, 2500).size());
}
use of org.alfresco.bm.dataload.rm.services.RecordData in project records-management by Alfresco.
the class RecordServiceTest method testAllowDuplicateInPlacePath.
@Test
public void testAllowDuplicateInPlacePath() {
String duplicateInPlacePath = "test_inPlacePath";
RecordData record1 = new RecordData("test_id_1", RecordContext.IN_PLACE_RECORD, "test_name_1", "test_parentPath_1", duplicateInPlacePath, ExecutionState.SCHEDULED);
recordService.createRecord(record1);
RecordData record2 = new RecordData("test_id_2", RecordContext.RECORD, "test_name_2", "test_parentPath_2", duplicateInPlacePath, ExecutionState.UNFILED_RECORD_DECLARED);
recordService.createRecord(record2);
doubleCheckOverwrittenMethods_notEqual(record1, record2);
}
use of org.alfresco.bm.dataload.rm.services.RecordData in project records-management by Alfresco.
the class RecordServiceTest method testAllowDuplicateName.
@Test
public void testAllowDuplicateName() {
String duplicateName = "test_name";
RecordData record1 = new RecordData("test_id_1", RecordContext.IN_PLACE_RECORD, duplicateName, "test_parentPath_1", "test_inPlacePath_1", ExecutionState.SCHEDULED);
recordService.createRecord(record1);
RecordData record2 = new RecordData("test_id_2", RecordContext.RECORD, duplicateName, "test_parentPath_2", "test_inPlacePath_2", ExecutionState.UNFILED_RECORD_DECLARED);
recordService.createRecord(record2);
doubleCheckOverwrittenMethods_notEqual(record1, record2);
}
use of org.alfresco.bm.dataload.rm.services.RecordData in project records-management by Alfresco.
the class RecordServiceTest method testRetrieveRecordObject.
/**
* Given we created a record and store it in mongo
* When we retrieve it by id
* The all the properties are correctly retrieved
*/
@Test
public void testRetrieveRecordObject() {
/*
* Given
*/
RecordData record1 = new RecordData("test_id", RecordContext.IN_PLACE_RECORD, "test_name", "test_parentPath", "test_inPlaceRecord", ExecutionState.SCHEDULED);
recordService.createRecord(record1);
/*
* When
*/
RecordData record2 = recordService.getRecord(record1.getId());
/*
* Then
*/
assertEquals(record1.getId(), record2.getId());
assertEquals(record1.getContext(), record2.getContext());
assertEquals(record1.getName(), record2.getName());
assertEquals(record1.getParentPath(), record2.getParentPath());
assertEquals(record1.getInPlacePath(), record2.getInPlacePath());
doubleCheckOverwrittenMethods_equal(record1, record2);
}
Aggregations