private void verifyParameterQueryInvocations() { Map<String, Object> parameters = getCompleteParameters(); verify(mockQuery).jobId((String) parameters.get("jobId")); verify(mockQuery).processInstanceId((String) parameters.get("processInstanceId")); verify(mockQuery).processDefinitionId((String) parameters.get("processDefinitionId")); verify(mockQuery).processDefinitionKey((String) parameters.get("processDefinitionKey")); verify(mockQuery).executionId((String) parameters.get("executionId")); verify(mockQuery).activityId((String) parameters.get("activityId")); verify(mockQuery).withRetriesLeft(); verify(mockQuery).executable(); verify(mockQuery).timers(); verify(mockQuery).withException(); verify(mockQuery).exceptionMessage((String) parameters.get("exceptionMessage")); verify(mockQuery).noRetriesLeft(); verify(mockQuery).active(); verify(mockQuery).suspended(); verify(mockQuery).priorityLowerThanOrEquals(JOB_QUERY_MAX_PRIORITY); verify(mockQuery).priorityHigherThanOrEquals(JOB_QUERY_MIN_PRIORITY); verify(mockQuery).jobDefinitionId(MockProvider.EXAMPLE_JOB_DEFINITION_ID); }
@Test @Deployment(resources = {"org/camunda/bpm/engine/test/api/mgmt/ManagementServiceTest.testGetJobExceptionStacktrace.bpmn20.xml"}) public void testQueryByException() { JobQuery query = managementService.createJobQuery().withException(); verifyQueryResults(query, 0); ProcessInstance processInstance = startProcessInstanceWithFailingJob(); query = managementService.createJobQuery().withException(); verifyFailedJob(query, processInstance); }
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml"}) @Test public void testDeleteProcessInstancesAsyncWithNonExistingId() throws Exception { // given List<String> processIds = startTestProcesses(2); processIds.add("unknown"); // when Batch batch = runtimeService.deleteProcessInstancesAsync(processIds, null, TESTING_INSTANCE_DELETE); executeSeedJob(batch); List<Exception> exceptions = executeBatchJobs(batch); // then assertEquals(1, exceptions.size()); Exception e = exceptions.get(0); assertTrue(e.getMessage().startsWith("No process instance found for id 'unknown'")); assertThat(managementService.createJobQuery().withException().list().size(), is(1)); processIds.remove("unknown"); assertHistoricTaskDeletionPresent(processIds, TESTING_INSTANCE_DELETE, testRule); assertHistoricBatchExists(testRule); assertProcessInstancesAreDeleted(); }
protected void stillOneJobWithExceptionAndRetriesLeft() { assertEquals(1, managementService.createJobQuery().withException().count()); assertEquals(1, managementService.createJobQuery().withRetriesLeft().count()); }
@Test public void testJobQueryWithExceptions() throws Throwable { createJobWithoutExceptionMsg(); Job job = managementService.createJobQuery().jobId(timerEntity.getId()).singleResult(); assertNotNull(job); List<Job> list = managementService.createJobQuery().withException().list(); assertEquals(list.size(), 1); deleteJobInDatabase(); createJobWithoutExceptionStacktrace(); job = managementService.createJobQuery().jobId(timerEntity.getId()).singleResult(); assertNotNull(job); list = managementService.createJobQuery().withException().list(); assertEquals(list.size(), 1); deleteJobInDatabase(); }
protected void stillOneJobWithExceptionAndRetriesLeft(String jobId) { assertEquals(1, managementService.createJobQuery().jobId(jobId).withException().count()); assertEquals(1, managementService.createJobQuery().jobId(jobId).withRetriesLeft().count()); }
@Test public void testFailingJobBoundaryTimerWithDelegateVariables() throws InterruptedException { ProcessInstance pi = runtimeService.startProcessInstanceByKey("ImmediatelyFailing"); List<Job> jobs = managementService.createJobQuery().list(); assertEquals(1, jobs.size()); assertEquals(3, jobs.get(0).getRetries()); assertEquals(1, runtimeService.createExecutionQuery().processInstanceId(pi.getProcessInstanceId()).activityId("usertask1").count()); assertEquals(2, runtimeService.createExecutionQuery().processInstanceId(pi.getProcessInstanceId()).count()); assertEquals(1, managementService.createJobQuery().executable().count()); waitForJobExecutorToProcessAllJobs(); assertEquals(0, managementService.createJobQuery().executable().count()); // should be 0, because it has failed 3 times assertEquals(1, managementService.createJobQuery().withException().count()); // should be 1, because job failed! assertEquals(1, runtimeService.createExecutionQuery().processInstanceId(pi.getProcessInstanceId()).activityId("usertask1").count()); assertEquals(2, runtimeService.createExecutionQuery().processInstanceId(pi.getProcessInstanceId()).count()); taskService.complete(taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult().getId()); // complete task with failed job => complete process assertEquals(0, runtimeService.createExecutionQuery().processInstanceId(pi.getProcessInstanceId()).count()); assertEquals(0, managementService.createJobQuery().count()); // should be 0, because process is finished. }
assertEquals(1, managementService.createJobQuery().withException().count()); assertEquals(0, managementService.createJobQuery().noRetriesLeft().count()); assertEquals(2, managementService.createJobQuery().withRetriesLeft().count()); assertEquals(1, managementService.createJobQuery().withException().count()); assertEquals(0, managementService.createJobQuery().noRetriesLeft().count()); assertEquals(2, managementService.createJobQuery().withRetriesLeft().count());
assertEquals(1, managementService.createJobQuery().withException().count()); assertEquals(0, managementService.createJobQuery().noRetriesLeft().count()); assertEquals(2, managementService.createJobQuery().withRetriesLeft().count()); assertEquals(1, managementService.createJobQuery().withException().count()); assertEquals(0, managementService.createJobQuery().noRetriesLeft().count()); assertEquals(2, managementService.createJobQuery().withRetriesLeft().count());
assertEquals(1, managementService.createJobQuery().withException().count()); assertEquals(0, managementService.createJobQuery().noRetriesLeft().count()); assertEquals(2, managementService.createJobQuery().withRetriesLeft().count()); assertEquals(1, managementService.createJobQuery().withException().count()); assertEquals(0, managementService.createJobQuery().noRetriesLeft().count()); assertEquals(2, managementService.createJobQuery().withRetriesLeft().count());
@Deployment(resources = {"org/camunda/bpm/engine/test/api/mgmt/ManagementServiceTest.testGetJobExceptionStacktrace.bpmn20.xml"}) public void testQueryByException() { JobQuery query = managementService.createJobQuery().withException(); verifyQueryResults(query, 0); ProcessInstance processInstance = startProcessInstanceWithFailingJob(); query = managementService.createJobQuery().withException(); verifyFailedJob(query, processInstance); }
assertEquals(1, managementService.createJobQuery().withException().count()); assertEquals(0, managementService.createJobQuery().jobId(jobId).withRetriesLeft().count()); assertEquals(1, managementService.createJobQuery().noRetriesLeft().count());
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml"}) @Test public void testDeleteProcessInstancesAsyncWithNonExistingId() throws Exception { // given List<String> processIds = startTestProcesses(2); processIds.add("unknown"); // when Batch batch = runtimeService.deleteProcessInstancesAsync(processIds, null, TESTING_INSTANCE_DELETE); executeSeedJob(batch); List<Exception> exceptions = executeBatchJobs(batch); // then assertEquals(1, exceptions.size()); Exception e = exceptions.get(0); assertTrue(e.getMessage().startsWith("No process instance found for id 'unknown'")); assertThat(managementService.createJobQuery().withException().list().size(), is(1)); processIds.remove("unknown"); assertHistoricTaskDeletionPresent(processIds, TESTING_INSTANCE_DELETE, testRule); assertHistoricBatchExists(testRule); assertProcessInstancesAreDeleted(); }
protected void stillOneJobWithExceptionAndRetriesLeft() { assertEquals(1, managementService.createJobQuery().withException().count()); assertEquals(1, managementService.createJobQuery().withRetriesLeft().count()); }
public void testJobQueryWithExceptions() throws Throwable { createJobWithoutExceptionMsg(); Job job = managementService.createJobQuery().jobId(timerEntity.getId()).singleResult(); assertNotNull(job); List<Job> list = managementService.createJobQuery().withException().list(); assertEquals(list.size(), 1); deleteJobInDatabase(); createJobWithoutExceptionStacktrace(); job = managementService.createJobQuery().jobId(timerEntity.getId()).singleResult(); assertNotNull(job); list = managementService.createJobQuery().withException().list(); assertEquals(list.size(), 1); deleteJobInDatabase(); }
assertEquals(1, managementService.createJobQuery().withException().count()); assertEquals(0, managementService.createJobQuery().withRetriesLeft().count()); assertEquals(1, managementService.createJobQuery().noRetriesLeft().count());
protected void stillOneJobWithExceptionAndRetriesLeft(String jobId) { assertEquals(1, managementService.createJobQuery().jobId(jobId).withException().count()); assertEquals(1, managementService.createJobQuery().jobId(jobId).withRetriesLeft().count()); }
assertEquals(1, managementService.createJobQuery().withException().count()); assertEquals(0, managementService.createJobQuery().jobId(jobId).withRetriesLeft().count()); assertEquals(1, managementService.createJobQuery().noRetriesLeft().count());