use of org.camunda.bpm.engine.management.JobDefinitionQuery in project camunda-bpm-platform by camunda.
the class ProcessEngineRestServiceTest method createJobDefinitionMock.
private void createJobDefinitionMock() {
List<JobDefinition> jobDefinitions = new ArrayList<JobDefinition>();
JobDefinition mockJobDefinition = MockProvider.createMockJobDefinition();
jobDefinitions.add(mockJobDefinition);
JobDefinitionQuery mockJobDefinitionQuery = mock(JobDefinitionQuery.class);
when(mockJobDefinitionQuery.list()).thenReturn(jobDefinitions);
when(mockManagementService.createJobDefinitionQuery()).thenReturn(mockJobDefinitionQuery);
}
use of org.camunda.bpm.engine.management.JobDefinitionQuery in project camunda-bpm-platform by camunda.
the class JobDefinitionRestServiceInteractionTest method setUpMockJobDefinitionQuery.
private JobDefinitionQuery setUpMockJobDefinitionQuery(List<JobDefinition> mockedJobDefinitions) {
JobDefinitionQuery sampleJobDefinitionQuery = mock(JobDefinitionQuery.class);
when(sampleJobDefinitionQuery.list()).thenReturn(mockedJobDefinitions);
when(sampleJobDefinitionQuery.count()).thenReturn((long) mockedJobDefinitions.size());
if (mockedJobDefinitions.size() == 1) {
when(sampleJobDefinitionQuery.singleResult()).thenReturn(mockedJobDefinitions.get(0));
}
when(sampleJobDefinitionQuery.jobDefinitionId(MockProvider.EXAMPLE_JOB_DEFINITION_ID)).thenReturn(sampleJobDefinitionQuery);
when(processEngine.getManagementService().createJobDefinitionQuery()).thenReturn(sampleJobDefinitionQuery);
when(mockManagementService.createJobDefinitionQuery()).thenReturn(sampleJobDefinitionQuery);
return sampleJobDefinitionQuery;
}
use of org.camunda.bpm.engine.management.JobDefinitionQuery in project camunda-bpm-platform by camunda.
the class JobDefinitionRestServiceInteractionTest method testJobDefinitionGetIdDoesntExist.
@Test
public void testJobDefinitionGetIdDoesntExist() {
JobDefinitionQuery invalidQueryNonExistingJobDefinition;
invalidQueryNonExistingJobDefinition = mock(JobDefinitionQuery.class);
when(mockManagementService.createJobDefinitionQuery().jobDefinitionId(MockProvider.NON_EXISTING_JOB_DEFINITION_ID)).thenReturn(invalidQueryNonExistingJobDefinition);
when(invalidQueryNonExistingJobDefinition.singleResult()).thenReturn(null);
String jobDefinitionId = MockProvider.NON_EXISTING_JOB_DEFINITION_ID;
given().pathParam("id", jobDefinitionId).then().expect().statusCode(Status.NOT_FOUND.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(InvalidRequestException.class.getSimpleName())).body("message", equalTo("Job Definition with id " + jobDefinitionId + " does not exist")).when().get(SINGLE_JOB_DEFINITION_RESOURCE_URL);
}
use of org.camunda.bpm.engine.management.JobDefinitionQuery in project camunda-bpm-platform by camunda.
the class JobDefinitionRestServiceQueryTest method setUpMockDefinitionQuery.
private JobDefinitionQuery setUpMockDefinitionQuery(List<JobDefinition> mockedJobDefinitions) {
JobDefinitionQuery query = mock(JobDefinitionQuery.class);
when(query.list()).thenReturn(mockedJobDefinitions);
when(query.count()).thenReturn((long) mockedJobDefinitions.size());
when(processEngine.getManagementService().createJobDefinitionQuery()).thenReturn(query);
return query;
}
use of org.camunda.bpm.engine.management.JobDefinitionQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyJobDefinitionQueryTest method testQueryByDefinitionsWithoutTenantIds.
public void testQueryByDefinitionsWithoutTenantIds() {
JobDefinitionQuery query = managementService.createJobDefinitionQuery().withoutTenantId();
assertThat(query.count(), is(1L));
}
Aggregations