Search in sources :

Example 6 with RecordData

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()));
}
Also used : RecordData(org.alfresco.bm.dataload.rm.services.RecordData) Test(org.junit.Test)

Example 7 with RecordData

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());
}
Also used : RecordData(org.alfresco.bm.dataload.rm.services.RecordData) Random(java.util.Random) Test(org.junit.Test)

Example 8 with RecordData

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);
}
Also used : RecordData(org.alfresco.bm.dataload.rm.services.RecordData) Test(org.junit.Test)

Example 9 with RecordData

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);
}
Also used : RecordData(org.alfresco.bm.dataload.rm.services.RecordData) Test(org.junit.Test)

Example 10 with RecordData

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);
}
Also used : RecordData(org.alfresco.bm.dataload.rm.services.RecordData) Test(org.junit.Test)

Aggregations

RecordData (org.alfresco.bm.dataload.rm.services.RecordData)31 Test (org.junit.Test)22 Event (org.alfresco.bm.event.Event)15 DBObject (com.mongodb.DBObject)14 EventResult (org.alfresco.bm.event.EventResult)14 StopWatch (org.apache.commons.lang3.time.StopWatch)12 FolderData (org.alfresco.bm.cm.FolderData)10 UserModel (org.alfresco.utility.model.UserModel)6 FilesAPI (org.alfresco.rest.rm.community.requests.gscore.api.FilesAPI)4 UnfiledContainerAPI (org.alfresco.rest.rm.community.requests.gscore.api.UnfiledContainerAPI)4 RMRestWrapper (org.alfresco.rest.core.RMRestWrapper)3 Record (org.alfresco.rest.rm.community.model.record.Record)3 ArrayList (java.util.ArrayList)2 Random (java.util.Random)2 LoadSingleComponentUnitTest (org.alfresco.bm.dataload.LoadSingleComponentUnitTest)2 RecordBodyFile (org.alfresco.rest.rm.community.model.record.RecordBodyFile)2 UnfiledContainer (org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainer)2 UnfiledContainerChild (org.alfresco.rest.rm.community.model.unfiledcontainer.UnfiledContainerChild)2 UnfiledRecordFolderAPI (org.alfresco.rest.rm.community.requests.gscore.api.UnfiledRecordFolderAPI)2 ContentModel (org.alfresco.utility.model.ContentModel)2