public virtual IList <CaseExecutionDto> queryCaseExecutions(CaseExecutionQueryDto queryDto, int?firstResult, int?maxResults) { ProcessEngine engine = ProcessEngine; queryDto.ObjectMapper = ObjectMapper; CaseExecutionQuery query = queryDto.toQuery(engine); IList <CaseExecution> matchingExecutions; if (firstResult != null || maxResults != null) { matchingExecutions = executePaginatedQuery(query, firstResult, maxResults); } else { matchingExecutions = query.list(); } IList <CaseExecutionDto> executionResults = new List <CaseExecutionDto>(); foreach (CaseExecution execution in matchingExecutions) { CaseExecutionDto resultExecution = CaseExecutionDto.fromCaseExecution(execution); executionResults.Add(resultExecution); } return(executionResults); }
private CaseExecutionQuery setUpMockCaseExecutionQuery(IList <CaseExecution> mockedCaseExecutions) { CaseExecutionQuery query = mock(typeof(CaseExecutionQuery)); when(processEngine.CaseService.createCaseExecutionQuery()).thenReturn(query); when(query.list()).thenReturn(mockedCaseExecutions); when(query.count()).thenReturn((long)mockedCaseExecutions.Count); return(query); }
private void createCaseExecutionMock() { IList <CaseExecution> caseExecutions = new List <CaseExecution>(); CaseExecution mockCaseExecution = MockProvider.createMockCaseExecution(); caseExecutions.Add(mockCaseExecution); CaseExecutionQuery mockCaseExecutionQuery = mock(typeof(CaseExecutionQuery)); when(mockCaseExecutionQuery.list()).thenReturn(caseExecutions); when(mockCaseService.createCaseExecutionQuery()).thenReturn(mockCaseExecutionQuery); }
public virtual void testSequenceAutoStartStage() { // given string caseInstanceId = createCaseInstance().Id; CaseExecution firstHumanTask = queryCaseExecutionByActivityId("PI_HumanTask_1"); string firstHumanTaskId = firstHumanTask.Id; assertTrue(firstHumanTask.Active); CaseExecution stage = queryCaseExecutionByActivityId("PI_Stage_1"); string stageId = stage.Id; assertTrue(stage.Available); // (1) then stage = queryCaseExecutionById(stageId); assertTrue(stage.Available); assertNull(caseService.getVariable(caseInstanceId, "enable")); assertNull(caseService.getVariable(caseInstanceId, "start")); // (2) when complete(firstHumanTaskId); // (2) then stage = queryCaseExecutionById(stageId); assertTrue(stage.Active); assertNull(caseService.getVariable(caseInstanceId, "enable")); object startVariable = caseService.getVariable(caseInstanceId, "start"); assertNotNull(startVariable); assertTrue((bool?)startVariable); CaseExecutionQuery query = caseService.createCaseExecutionQuery().enabled(); assertEquals(2, query.count()); foreach (CaseExecution child in query.list()) { assertEquals(stageId, child.ParentId); } }