Search in sources :

Example 1 with MockJobBuilder

use of org.camunda.bpm.engine.rest.helper.MockJobBuilder in project camunda-bpm-platform by camunda.

the class JobRestServiceInteractionTest method setUpRuntimeData.

@Before
public void setUpRuntimeData() {
    mockQuery = mock(JobQuery.class);
    Job mockedJob = new MockJobBuilder().id(MockProvider.EXAMPLE_JOB_ID).processInstanceId(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID).executionId(MockProvider.EXAMPLE_EXECUTION_ID).retries(MockProvider.EXAMPLE_JOB_RETRIES).exceptionMessage(MockProvider.EXAMPLE_JOB_NO_EXCEPTION_MESSAGE).dueDate(new Date()).priority(MockProvider.EXAMPLE_JOB_PRIORITY).jobDefinitionId(MockProvider.EXAMPLE_JOB_DEFINITION_ID).tenantId(MockProvider.EXAMPLE_TENANT_ID).build();
    when(mockQuery.singleResult()).thenReturn(mockedJob);
    when(mockQuery.jobId(MockProvider.EXAMPLE_JOB_ID)).thenReturn(mockQuery);
    mockManagementService = mock(ManagementService.class);
    when(mockManagementService.createJobQuery()).thenReturn(mockQuery);
    mockSuspensionStateSelectBuilder = mock(UpdateJobSuspensionStateSelectBuilder.class);
    when(mockManagementService.updateJobSuspensionState()).thenReturn(mockSuspensionStateSelectBuilder);
    mockSuspensionStateBuilder = mock(UpdateJobSuspensionStateTenantBuilder.class);
    when(mockSuspensionStateSelectBuilder.byJobId(anyString())).thenReturn(mockSuspensionStateBuilder);
    when(mockSuspensionStateSelectBuilder.byJobDefinitionId(anyString())).thenReturn(mockSuspensionStateBuilder);
    when(mockSuspensionStateSelectBuilder.byProcessInstanceId(anyString())).thenReturn(mockSuspensionStateBuilder);
    when(mockSuspensionStateSelectBuilder.byProcessDefinitionId(anyString())).thenReturn(mockSuspensionStateBuilder);
    when(mockSuspensionStateSelectBuilder.byProcessDefinitionKey(anyString())).thenReturn(mockSuspensionStateBuilder);
    namedProcessEngine = getProcessEngine(MockProvider.EXAMPLE_PROCESS_ENGINE_NAME);
    when(namedProcessEngine.getManagementService()).thenReturn(mockManagementService);
}
Also used : UpdateJobSuspensionStateTenantBuilder(org.camunda.bpm.engine.management.UpdateJobSuspensionStateTenantBuilder) ManagementService(org.camunda.bpm.engine.ManagementService) UpdateJobSuspensionStateSelectBuilder(org.camunda.bpm.engine.management.UpdateJobSuspensionStateSelectBuilder) JobQuery(org.camunda.bpm.engine.runtime.JobQuery) Job(org.camunda.bpm.engine.runtime.Job) MockJobBuilder(org.camunda.bpm.engine.rest.helper.MockJobBuilder) Date(java.util.Date) Before(org.junit.Before)

Aggregations

Date (java.util.Date)1 ManagementService (org.camunda.bpm.engine.ManagementService)1 UpdateJobSuspensionStateSelectBuilder (org.camunda.bpm.engine.management.UpdateJobSuspensionStateSelectBuilder)1 UpdateJobSuspensionStateTenantBuilder (org.camunda.bpm.engine.management.UpdateJobSuspensionStateTenantBuilder)1 MockJobBuilder (org.camunda.bpm.engine.rest.helper.MockJobBuilder)1 Job (org.camunda.bpm.engine.runtime.Job)1 JobQuery (org.camunda.bpm.engine.runtime.JobQuery)1 Before (org.junit.Before)1