public virtual IList <JobDefinitionDto> queryJobDefinitions(JobDefinitionQueryDto queryDto, int?firstResult, int?maxResults) { queryDto.ObjectMapper = ObjectMapper; JobDefinitionQuery query = queryDto.toQuery(ProcessEngine); IList <JobDefinition> matchingJobDefinitions; if (firstResult != null || maxResults != null) { matchingJobDefinitions = executePaginatedQuery(query, firstResult, maxResults); } else { matchingJobDefinitions = query.list(); } IList <JobDefinitionDto> jobDefinitionResults = new List <JobDefinitionDto>(); foreach (JobDefinition jobDefinition in matchingJobDefinitions) { JobDefinitionDto result = JobDefinitionDto.fromJobDefinition(jobDefinition); jobDefinitionResults.Add(result); } return(jobDefinitionResults); }
public virtual void testMultipleProcessDeployment() { JobDefinitionQuery query = managementService.createJobDefinitionQuery(); IList <JobDefinition> jobDefinitions = query.list(); assertEquals(3, jobDefinitions.Count); assertEquals(1, query.processDefinitionKey("testProcess").list().size()); assertEquals(2, query.processDefinitionKey("anotherTestProcess").list().size()); }
private JobDefinitionQuery setUpMockDefinitionQuery(IList <JobDefinition> mockedJobDefinitions) { JobDefinitionQuery query = mock(typeof(JobDefinitionQuery)); when(query.list()).thenReturn(mockedJobDefinitions); when(query.count()).thenReturn((long)mockedJobDefinitions.Count); when(processEngine.ManagementService.createJobDefinitionQuery()).thenReturn(query); return(query); }
private void createJobDefinitionMock() { IList <JobDefinition> jobDefinitions = new List <JobDefinition>(); JobDefinition mockJobDefinition = MockProvider.createMockJobDefinition(); jobDefinitions.Add(mockJobDefinition); JobDefinitionQuery mockJobDefinitionQuery = mock(typeof(JobDefinitionQuery)); when(mockJobDefinitionQuery.list()).thenReturn(jobDefinitions); when(mockManagementService.createJobDefinitionQuery()).thenReturn(mockJobDefinitionQuery); }