Search in sources :

Example 41 with StopWatch

use of org.apache.commons.lang3.time.StopWatch in project records-management by Alfresco.

the class ScheduleFilingUnfiledRecordsUnitTest method testFileRecordsWithExistentFilingFromPaths.

@Test
public void testFileRecordsWithExistentFilingFromPaths() throws Exception {
    int maxActiveLoaders = 8;
    String configuredPath1 = "/e1/e2/e3";
    String entirePath1 = RECORD_CONTAINER_PATH + configuredPath1;
    String paths = configuredPath1;
    String recordId1 = "recordId1";
    String recordParentPath1 = "recordParentPath1";
    String recordParentFullPath1 = UNFILED_RECORD_CONTAINER_PATH + "/" + recordParentPath1;
    String recordId2 = "recordId2";
    String recordParentPath2 = "/recordParentPath2";
    String recordParentFullPath2 = UNFILED_RECORD_CONTAINER_PATH + recordParentPath2;
    String recordId3 = "recordId3";
    String recordParentPath3 = "/recordParentPath3";
    String recordParentFullPath3 = UNFILED_RECORD_CONTAINER_PATH + recordParentPath3;
    String recordId4 = "recordId4";
    String recordParentPath4 = "/recordParentPath4";
    String recordParentFullPath4 = UNFILED_RECORD_CONTAINER_PATH + recordParentPath4;
    String fileFromPathsStr = recordParentPath1 + "," + recordParentPath2 + "," + recordParentPath3 + "," + recordParentPath4;
    scheduleFilingUnfiledRecords.setFileUnfiledRecords(true);
    scheduleFilingUnfiledRecords.setMaxActiveLoaders(maxActiveLoaders);
    scheduleFilingUnfiledRecords.setRecordFilingLimit("4");
    scheduleFilingUnfiledRecords.setFileToRecordFolderPaths(paths);
    scheduleFilingUnfiledRecords.setFileFromUnfiledPaths(fileFromPathsStr);
    FolderData mockedRecordFolder1 = mock(FolderData.class);
    when(mockedRecordFolder1.getId()).thenReturn("recordFolder1Id");
    when(mockedRecordFolder1.getContext()).thenReturn(RECORD_FOLDER_CONTEXT);
    when(mockedRecordFolder1.getPath()).thenReturn(entirePath1);
    when(mockedFileFolderService.getFolder(RECORD_FOLDER_CONTEXT, entirePath1)).thenReturn(mockedRecordFolder1);
    RecordData mockedRecordData1 = mock(RecordData.class);
    when(mockedRecordData1.getId()).thenReturn(recordId1);
    when(mockedRecordData1.getParentPath()).thenReturn(recordParentFullPath1);
    RecordData mockedRecordData2 = mock(RecordData.class);
    when(mockedRecordData2.getId()).thenReturn(recordId2);
    when(mockedRecordData2.getParentPath()).thenReturn(recordParentFullPath2);
    RecordData mockedRecordData3 = mock(RecordData.class);
    when(mockedRecordData3.getId()).thenReturn(recordId3);
    when(mockedRecordData3.getParentPath()).thenReturn(recordParentFullPath3);
    RecordData mockedRecordData4 = mock(RecordData.class);
    when(mockedRecordData4.getId()).thenReturn(recordId4);
    when(mockedRecordData4.getParentPath()).thenReturn(recordParentFullPath4);
    when(mockedRecordService.getRecordsInPaths(ExecutionState.UNFILED_RECORD_DECLARED.name(), null, 0, 100)).thenReturn(Arrays.asList(mockedRecordData1, mockedRecordData2, mockedRecordData3, mockedRecordData4));
    when(mockedRecordService.getRecordsInPaths(ExecutionState.UNFILED_RECORD_DECLARED.name(), null, 100, 100)).thenReturn(new ArrayList<>());
    when(mockedRecordService.getRandomRecord(ExecutionState.UNFILED_RECORD_DECLARED.name(), Arrays.asList(recordParentFullPath1, recordParentFullPath2, recordParentFullPath3))).thenReturn(mockedRecordData1).thenReturn(mockedRecordData2).thenReturn(mockedRecordData3).thenReturn(null);
    FolderData mockedUnfiledRecordFolder = mock(FolderData.class);
    when(mockedUnfiledRecordFolder.getId()).thenReturn("folderId1");
    when(mockedUnfiledRecordFolder.getContext()).thenReturn(UNFILED_CONTEXT);
    when(mockedUnfiledRecordFolder.getPath()).thenReturn(recordParentFullPath1);
    when(mockedFileFolderService.getFolder(UNFILED_CONTEXT, recordParentFullPath1)).thenReturn(mockedUnfiledRecordFolder);
    FolderData mockedUnfiledRecordFolder1 = mock(FolderData.class);
    when(mockedUnfiledRecordFolder1.getId()).thenReturn("newfolderId2");
    when(mockedUnfiledRecordFolder1.getContext()).thenReturn(UNFILED_CONTEXT);
    when(mockedUnfiledRecordFolder1.getPath()).thenReturn(recordParentFullPath2);
    when(mockedFileFolderService.getFolder(UNFILED_CONTEXT, recordParentFullPath2)).thenReturn(mockedUnfiledRecordFolder1);
    FolderData mockedUnfiledRecordFolder2 = mock(FolderData.class);
    when(mockedUnfiledRecordFolder2.getId()).thenReturn("newfolderId3");
    when(mockedUnfiledRecordFolder2.getContext()).thenReturn(UNFILED_CONTEXT);
    when(mockedUnfiledRecordFolder2.getPath()).thenReturn(recordParentFullPath3);
    when(mockedFileFolderService.getFolder(UNFILED_CONTEXT, recordParentFullPath3)).thenReturn(mockedUnfiledRecordFolder2);
    EventResult result = scheduleFilingUnfiledRecords.processEvent(null, new StopWatch());
    verify(mockedFileFolderService, never()).getFoldersByCounts(any(String.class), any(Long.class), any(Long.class), any(Long.class), any(Long.class), any(Long.class), any(Long.class), any(Integer.class), any(Integer.class));
    verify(mockedRecordService, times(3)).updateRecord(any(RecordData.class));
    assertEquals(true, result.isSuccess());
    verify(mockedSessionService, times(3)).startSession(any(DBObject.class));
    assertEquals("Raised further " + (3) + " events and rescheduled self.", result.getData());
    assertEquals(4, result.getNextEvents().size());
    List<String> listOfIds = Arrays.asList(recordId1, recordId2, recordId3, recordId4);
    for (int i = 0; i < 3; i++) {
        Event event = result.getNextEvents().get(i);
        assertEquals(TEST_EVENT_FILE_UNFILED_RECORDS, event.getName());
        DBObject dataObj = (DBObject) event.getData();
        assertNotNull(dataObj);
        assertEquals(RECORD_FOLDER_CONTEXT, (String) dataObj.get(FIELD_CONTEXT));
        assertEquals(FILE_RECORD_OPERATION, dataObj.get(FIELD_LOAD_OPERATION));
        assertEquals(listOfIds.get(i), dataObj.get(FIELD_RECORD_ID));
    }
    assertEquals(TEST_EVENT_RESCHEDULE_SELF, result.getNextEvents().get(3).getName());
}
Also used : RecordData(org.alfresco.bm.dataload.rm.services.RecordData) EventResult(org.alfresco.bm.event.EventResult) FolderData(org.alfresco.bm.cm.FolderData) Event(org.alfresco.bm.event.Event) DBObject(com.mongodb.DBObject) StopWatch(org.apache.commons.lang3.time.StopWatch) Test(org.junit.Test)

Example 42 with StopWatch

use of org.apache.commons.lang3.time.StopWatch in project records-management by Alfresco.

the class ScheduleFilingUnfiledRecordsUnitTest method testFileRecordsWithLessRecordsThanRequestedInDb.

@Test
public void testFileRecordsWithLessRecordsThanRequestedInDb() throws Exception {
    int maxActiveLoaders = 8;
    String recordId1 = "recordId1";
    String recordId2 = "recordId2";
    String configuredPath1 = "/e1/e2/e3";
    String entirePath1 = RECORD_CONTAINER_PATH + configuredPath1;
    String paths = configuredPath1;
    scheduleFilingUnfiledRecords.setFileUnfiledRecords(true);
    scheduleFilingUnfiledRecords.setMaxActiveLoaders(maxActiveLoaders);
    scheduleFilingUnfiledRecords.setRecordFilingLimit("4");
    scheduleFilingUnfiledRecords.setFileToRecordFolderPaths(paths);
    FolderData mockedRecordFolder1 = mock(FolderData.class);
    when(mockedRecordFolder1.getId()).thenReturn("recordFolder1Id");
    when(mockedRecordFolder1.getContext()).thenReturn(RECORD_FOLDER_CONTEXT);
    when(mockedRecordFolder1.getPath()).thenReturn(entirePath1);
    when(mockedFileFolderService.getFolder(RECORD_FOLDER_CONTEXT, entirePath1)).thenReturn(mockedRecordFolder1);
    RecordData mockedRecordData1 = mock(RecordData.class);
    when(mockedRecordData1.getId()).thenReturn(recordId1);
    RecordData mockedRecordData2 = mock(RecordData.class);
    when(mockedRecordData2.getId()).thenReturn(recordId2);
    when(mockedRecordService.getRandomRecord(ExecutionState.UNFILED_RECORD_DECLARED.name(), null)).thenReturn(mockedRecordData1).thenReturn(mockedRecordData2).thenReturn(null);
    EventResult result = scheduleFilingUnfiledRecords.processEvent(null, new StopWatch());
    verify(mockedFileFolderService, never()).getFoldersByCounts(any(String.class), any(Long.class), any(Long.class), any(Long.class), any(Long.class), any(Long.class), any(Long.class), any(Integer.class), any(Integer.class));
    assertEquals(true, result.isSuccess());
    verify(mockedSessionService, times(2)).startSession(any(DBObject.class));
    assertEquals("Raised further " + (2) + " events and rescheduled self.", result.getData());
    assertEquals(3, result.getNextEvents().size());
    List<String> listOfIds = Arrays.asList(recordId1, recordId2);
    for (int i = 0; i < 2; i++) {
        Event event = result.getNextEvents().get(i);
        assertEquals(TEST_EVENT_FILE_UNFILED_RECORDS, event.getName());
        DBObject dataObj = (DBObject) event.getData();
        assertNotNull(dataObj);
        assertEquals(RECORD_FOLDER_CONTEXT, (String) dataObj.get(FIELD_CONTEXT));
        assertEquals(FILE_RECORD_OPERATION, dataObj.get(FIELD_LOAD_OPERATION));
        assertEquals(listOfIds.get(i), dataObj.get(FIELD_RECORD_ID));
    }
    assertEquals(TEST_EVENT_RESCHEDULE_SELF, result.getNextEvents().get(2).getName());
}
Also used : RecordData(org.alfresco.bm.dataload.rm.services.RecordData) EventResult(org.alfresco.bm.event.EventResult) FolderData(org.alfresco.bm.cm.FolderData) Event(org.alfresco.bm.event.Event) DBObject(com.mongodb.DBObject) StopWatch(org.apache.commons.lang3.time.StopWatch) Test(org.junit.Test)

Example 43 with StopWatch

use of org.apache.commons.lang3.time.StopWatch in project records-management by Alfresco.

the class ScheduleInPlaceRecordLoadersUnitTest method testDeclareRecordsFromDocumentLibrary.

@Test
public void testDeclareRecordsFromDocumentLibrary() throws Exception {
    String numberOfRecordsToDeclare = "2";
    int maxActiveLoaders = 8;
    String siteId = "testSiteId";
    String documentLibraryId = UUID.randomUUID().toString();
    scheduleInPlaceRecordLoaders.setEnabled(true);
    scheduleInPlaceRecordLoaders.setRecordDeclarationLimit(numberOfRecordsToDeclare);
    scheduleInPlaceRecordLoaders.setMaxActiveLoaders(maxActiveLoaders);
    scheduleInPlaceRecordLoaders.setCollabSiteId(siteId);
    scheduleInPlaceRecordLoaders.setCollabSitePaths(null);
    RestSiteModel mockedRestSiteModel = mock(RestSiteModel.class);
    RestSiteContainerModel mockedRestSiteContainerModel = mock(RestSiteContainerModel.class);
    when(mockedRestSiteContainerModel.getId()).thenReturn(documentLibraryId);
    Site mockedSite = mock(Site.class);
    when(mockedSite.getSite()).thenReturn(mockedRestSiteModel);
    when(mockedSite.getSiteContainer("documentLibrary")).thenReturn(mockedRestSiteContainerModel);
    RestCoreAPI mockedRestCoreAPI = mock(RestCoreAPI.class);
    when(mockedRestCoreAPI.usingSite(siteId.toLowerCase())).thenReturn(mockedSite);
    when(mockedRestWrapper.withCoreAPI()).thenReturn(mockedRestCoreAPI);
    when(mockedRestWrapper.getStatusCode()).thenReturn(Integer.toString(HttpStatus.SC_OK));
    SiteData mockedSiteData = mock(SiteData.class);
    when(mockedSiteDataService.getSite(siteId.toLowerCase())).thenReturn(mockedSiteData);
    RestPaginationModel mockedPagination = mock(RestPaginationModel.class);
    when(mockedPagination.isHasMoreItems()).thenReturn(false);
    RestNodeModelsCollection mockedCollection = mock(RestNodeModelsCollection.class);
    when(mockedCollection.getPagination()).thenReturn(mockedPagination);
    String childFileId1 = "childFileId1";
    RestNodeModel mockedOnModel1 = mock(RestNodeModel.class);
    when(mockedOnModel1.getIsFile()).thenReturn(true);
    when(mockedOnModel1.getId()).thenReturn(childFileId1);
    when(mockedOnModel1.getName()).thenReturn("fileName1");
    RestNodeModel mockedFile1 = mock(RestNodeModel.class);
    when(mockedFile1.onModel()).thenReturn(mockedOnModel1);
    String childFileId2 = "childFileId2";
    RestNodeModel mockedOnModel2 = mock(RestNodeModel.class);
    when(mockedOnModel2.getIsFile()).thenReturn(true);
    when(mockedOnModel2.getId()).thenReturn(childFileId2);
    when(mockedOnModel2.getName()).thenReturn("fileName2");
    RestNodeModel mockedFile2 = mock(RestNodeModel.class);
    when(mockedFile2.onModel()).thenReturn(mockedOnModel2);
    when(mockedCollection.getEntries()).thenReturn(Arrays.asList(mockedFile1, mockedFile2));
    Node mockedNode = mock(Node.class);
    when(mockedNode.listChildren()).thenReturn(mockedCollection);
    RestCoreAPI mockedRestCoreAPIWithParams = mock(RestCoreAPI.class);
    when(mockedRestCoreAPIWithParams.usingNode(any(RepoTestModel.class))).thenReturn(mockedNode);
    RestWrapper mockedRestWrapperWithParams = mock(RestWrapper.class);
    when(mockedRestWrapperWithParams.withCoreAPI()).thenReturn(mockedRestCoreAPIWithParams);
    when(mockedRestWrapper.withParams(any(String.class), any(String.class), any(String.class))).thenReturn(mockedRestWrapperWithParams);
    EventResult result = scheduleInPlaceRecordLoaders.processEvent(null, new StopWatch());
    verify(mockedSite, never()).createSite();
    verify(mockedSiteDataService, never()).addSite(any(SiteData.class));
    assertEquals(true, result.isSuccess());
    String template = "Preparing files to declare: \nSheduled file to be declared as record: {0}. Sheduled file to be declared as record: {1}. Raised further {2} events and rescheduled self.";
    assertEquals(MessageFormat.format(template, childFileId1, childFileId2, 2), result.getData());
    assertEquals(3, result.getNextEvents().size());
    assertEquals(scheduleInPlaceRecordLoaders.getEventNameDeclareInPlaceRecord(), result.getNextEvents().get(0).getName());
    assertEquals(scheduleInPlaceRecordLoaders.getEventNameDeclareInPlaceRecord(), result.getNextEvents().get(1).getName());
    assertEquals(scheduleInPlaceRecordLoaders.getEventNameRescheduleSelf(), result.getNextEvents().get(2).getName());
}
Also used : Site(org.alfresco.rest.requests.Site) SiteData(org.alfresco.bm.site.SiteData) RestCoreAPI(org.alfresco.rest.requests.coreAPI.RestCoreAPI) Node(org.alfresco.rest.requests.Node) RepoTestModel(org.alfresco.utility.model.RepoTestModel) RestWrapper(org.alfresco.rest.core.RestWrapper) RestNodeModelsCollection(org.alfresco.rest.model.RestNodeModelsCollection) StopWatch(org.apache.commons.lang3.time.StopWatch) RestPaginationModel(org.alfresco.rest.model.RestPaginationModel) EventResult(org.alfresco.bm.event.EventResult) RestSiteModel(org.alfresco.rest.model.RestSiteModel) RestNodeModel(org.alfresco.rest.model.RestNodeModel) RestSiteContainerModel(org.alfresco.rest.model.RestSiteContainerModel) Test(org.junit.Test)

Example 44 with StopWatch

use of org.apache.commons.lang3.time.StopWatch in project records-management by Alfresco.

the class ScheduleInPlaceRecordLoadersUnitTest method testDeclareRecordsColabSiteDoesNotExistsAndLoadedInDb.

@Test
public void testDeclareRecordsColabSiteDoesNotExistsAndLoadedInDb() throws Exception {
    String numberOfRecordsToDeclare = "1";
    int maxActiveLoaders = 8;
    String siteId = "testSiteId";
    String documentLibraryId = UUID.randomUUID().toString();
    scheduleInPlaceRecordLoaders.setEnabled(true);
    scheduleInPlaceRecordLoaders.setRecordDeclarationLimit(numberOfRecordsToDeclare);
    scheduleInPlaceRecordLoaders.setMaxActiveLoaders(maxActiveLoaders);
    scheduleInPlaceRecordLoaders.setCollabSiteId(siteId);
    scheduleInPlaceRecordLoaders.setCollabSitePaths(null);
    RestSiteModel mockedRestSiteModel = mock(RestSiteModel.class);
    RestSiteContainerModel mockedRestSiteContainerModel = mock(RestSiteContainerModel.class);
    when(mockedRestSiteContainerModel.getId()).thenReturn(documentLibraryId);
    Site mockedSite = mock(Site.class);
    when(mockedSite.getSite()).thenReturn(null);
    when(mockedSite.createSite()).thenReturn(mockedRestSiteModel);
    when(mockedSite.getSiteContainer("documentLibrary")).thenReturn(mockedRestSiteContainerModel);
    RestCoreAPI mockedRestCoreAPI = mock(RestCoreAPI.class);
    when(mockedRestCoreAPI.usingSite(siteId.toLowerCase())).thenReturn(mockedSite);
    when(mockedRestWrapper.withCoreAPI()).thenReturn(mockedRestCoreAPI);
    when(mockedRestWrapper.getStatusCode()).thenReturn(Integer.toString(HttpStatus.SC_NOT_FOUND));
    SiteData mockedSiteData = mock(SiteData.class);
    when(mockedSiteDataService.getSite(siteId.toLowerCase())).thenReturn(mockedSiteData);
    RestPaginationModel mockedPagination = mock(RestPaginationModel.class);
    when(mockedPagination.isHasMoreItems()).thenReturn(false);
    RestNodeModelsCollection mockedCollection = mock(RestNodeModelsCollection.class);
    when(mockedCollection.getPagination()).thenReturn(mockedPagination);
    Node mockedNode = mock(Node.class);
    when(mockedNode.listChildren()).thenReturn(mockedCollection);
    RestCoreAPI mockedRestCoreAPIWithParams = mock(RestCoreAPI.class);
    when(mockedRestCoreAPIWithParams.usingNode(any(RepoTestModel.class))).thenReturn(mockedNode);
    RestWrapper mockedRestWrapperWithParams = mock(RestWrapper.class);
    when(mockedRestWrapperWithParams.withCoreAPI()).thenReturn(mockedRestCoreAPIWithParams);
    when(mockedRestWrapper.withParams(any(String.class), any(String.class), any(String.class))).thenReturn(mockedRestWrapperWithParams);
    // for creating files
    NodeDetail mockedTargetNodeDetail = mock(NodeDetail.class);
    NodesBuilder mockedNodeBuilder = mock(NodesBuilder.class);
    when(mockedNodeBuilder.folder("AutoGeneratedFiles")).thenReturn(mockedTargetNodeDetail);
    when(mockedNode.defineNodes()).thenReturn(mockedNodeBuilder);
    when(mockedRestCoreAPI.usingNode(any(RepoTestModel.class))).thenReturn(mockedNode);
    NodeDetail mockedFile = mock(NodeDetail.class);
    String fileID = UUID.randomUUID().toString();
    when(mockedFile.getId()).thenReturn(fileID);
    when(mockedFile.getName()).thenReturn("fileName");
    when(mockedTargetNodeDetail.file("recordToBe")).thenReturn(mockedFile);
    EventResult result = scheduleInPlaceRecordLoaders.processEvent(null, new StopWatch());
    verify(mockedSite, times(1)).createSite();
    verify(mockedSiteDataService, never()).addSite(any(SiteData.class));
    assertEquals(true, result.isSuccess());
    String template = "Preparing files to declare: \nCreated file {0}.Sheduled file to be declared as record: {1}. Raised further {2} events and rescheduled self.";
    assertEquals(MessageFormat.format(template, fileID, fileID, 1), result.getData());
    assertEquals(2, result.getNextEvents().size());
    assertEquals(scheduleInPlaceRecordLoaders.getEventNameDeclareInPlaceRecord(), result.getNextEvents().get(0).getName());
    assertEquals(scheduleInPlaceRecordLoaders.getEventNameRescheduleSelf(), result.getNextEvents().get(1).getName());
}
Also used : Site(org.alfresco.rest.requests.Site) SiteData(org.alfresco.bm.site.SiteData) RestCoreAPI(org.alfresco.rest.requests.coreAPI.RestCoreAPI) Node(org.alfresco.rest.requests.Node) RepoTestModel(org.alfresco.utility.model.RepoTestModel) RestWrapper(org.alfresco.rest.core.RestWrapper) RestNodeModelsCollection(org.alfresco.rest.model.RestNodeModelsCollection) StopWatch(org.apache.commons.lang3.time.StopWatch) RestPaginationModel(org.alfresco.rest.model.RestPaginationModel) EventResult(org.alfresco.bm.event.EventResult) RestSiteModel(org.alfresco.rest.model.RestSiteModel) NodeDetail(org.alfresco.rest.model.builder.NodesBuilder.NodeDetail) NodesBuilder(org.alfresco.rest.model.builder.NodesBuilder) RestSiteContainerModel(org.alfresco.rest.model.RestSiteContainerModel) Test(org.junit.Test)

Example 45 with StopWatch

use of org.apache.commons.lang3.time.StopWatch in project records-management by Alfresco.

the class ScheduleInPlaceRecordLoadersUnitTest method testDeclareAllExistingFiles.

/**
 * Given the collaboration site exists and contains undeclared files with the following structure
 * - documentLibrary
 *   - file1
 *   - file2
 *   - folder
 *     - file3
 *     - file4
 * When running the scheduler with numberOfRecordsToDeclare=0
 * Then all existing files should be scheduled for declaring
 *
 * @throws Exception
 */
@Test
public void testDeclareAllExistingFiles() throws Exception {
    String file1Id = "file1_id";
    String file2Id = "file2_id";
    String folderId = "folder_id";
    String file3Id = "file3_id";
    String file4Id = "file4_id";
    /*
         * Given
         */
    scheduleInPlaceRecordLoaders.setEnabled(true);
    scheduleInPlaceRecordLoaders.setMaxActiveLoaders(8);
    scheduleInPlaceRecordLoaders.setCollabSiteId(DEFAULT_COLLABORATION_SITE_ID);
    scheduleInPlaceRecordLoaders.setRecordDeclarationLimit("0");
    scheduleInPlaceRecordLoaders.setCollabSitePaths(null);
    // mock the collaboration site
    RestCoreAPI mockedCoreApi = mockCoreApi();
    Site collabSite = mockSitesEndpoint(mockedCoreApi, DEFAULT_COLLABORATION_SITE_ID);
    String documentLibrary = mockExistingCollaborationSite(collabSite, DEFAULT_COLLABORATION_SITE_ID, true);
    // mock listing the document library
    Node doclibNode = mockNodesEndpoint(mockedCoreApi, documentLibrary);
    List<RestNodeModel> level0Nodes = Arrays.asList(mockNodeModel(file1Id, true), mockNodeModel(file2Id, true), mockNodeModel(folderId, false));
    mockListChildren(doclibNode, false, level0Nodes);
    // mock listing the folder
    Node folderNode = mockNodesEndpoint(mockedCoreApi, folderId);
    List<RestNodeModel> level1Nodes = Arrays.asList(mockNodeModel(file3Id, true), mockNodeModel(file4Id, true));
    mockListChildren(folderNode, false, level1Nodes);
    /*
         * When
         */
    EventResult result = scheduleInPlaceRecordLoaders.processEvent(null, new StopWatch());
    /*
         * Then
         */
    assertEquals(true, result.isSuccess());
    List<String> scheduledFiles = Arrays.asList(file1Id, file2Id, file3Id, file4Id);
    validateScheduleFilesOutputMessage(new ArrayList<String>(), scheduledFiles, (String) result.getData());
    validateFiredEvents(true, scheduledFiles, result.getNextEvents());
}
Also used : Site(org.alfresco.rest.requests.Site) EventResult(org.alfresco.bm.event.EventResult) RestNodeModel(org.alfresco.rest.model.RestNodeModel) RestCoreAPI(org.alfresco.rest.requests.coreAPI.RestCoreAPI) Node(org.alfresco.rest.requests.Node) StopWatch(org.apache.commons.lang3.time.StopWatch) Test(org.junit.Test)

Aggregations

StopWatch (org.apache.commons.lang3.time.StopWatch)500 Test (org.junit.Test)149 EventResult (org.alfresco.bm.event.EventResult)97 DBObject (com.mongodb.DBObject)90 Event (org.alfresco.bm.event.Event)87 FolderData (org.alfresco.bm.cm.FolderData)75 File (java.io.File)72 ArrayList (java.util.ArrayList)48 HashSet (java.util.HashSet)31 Gene (ubic.gemma.model.genome.Gene)31 Vertex (org.apache.tinkerpop.gremlin.structure.Vertex)26 BaseTest (org.umlg.sqlg.test.BaseTest)26 Element (org.w3c.dom.Element)25 LoadSingleComponentUnitTest (org.alfresco.bm.dataload.LoadSingleComponentUnitTest)23 UserModel (org.alfresco.utility.model.UserModel)23 IOException (java.io.IOException)20 Collectors (java.util.stream.Collectors)19 HashMap (java.util.HashMap)18 List (java.util.List)18 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)18