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 public void testQueryByNoRetriesLeft() { JobQuery query = managementService.createJobQuery().noRetriesLeft(); verifyQueryResults(query, 0); setRetries(processInstanceIdOne, 0); // Re-running the query should give only one jobs now, since three job has retries>0 verifyQueryResults(query, 1); }
public void testJobCommandsWith2Exceptions() { // create a job createJob(TweetExceptionHandler.TYPE); // execute the existing job executeAvailableJobs(); // the job was successfully executed JobQuery query = managementService.createJobQuery().noRetriesLeft(); assertEquals(0, query.count()); }
public void testJobCommandsWith3Exceptions() { // set the execptionsRemaining to 3 so that // the created job will fail 3 times and a failed // job exists tweetExceptionHandler.setExceptionsRemaining(3); // create a job createJob(TweetExceptionHandler.TYPE); // execute the existing job executeAvailableJobs(); // the job execution failed (job.retries = 0) Job job = managementService.createJobQuery().noRetriesLeft().singleResult(); assertNotNull(job); assertEquals(0, job.getRetries()); }
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/async/FoxJobRetryCmdTest.testBrokenFoxJobRetryValue.bpmn20.xml" }) public void testBrokenFoxJobRetryValue() { Job job = managementService.createJobQuery().list().get(0); assertNotNull(job); assertEquals(3, job.getRetries()); waitForExecutedJobWithRetriesLeft(0, job.getId()); job = refreshJob(job.getId()); assertEquals(0, job.getRetries()); assertEquals(1, managementService.createJobQuery().noRetriesLeft().count()); }
@Test public void testJobRetriesDecremented_multiple() { for(int i = 0; i < 50; i++) { runtimeService.startProcessInstanceByKey("theProcess"); } Assert.assertEquals(50, managementService.createJobQuery().withRetriesLeft().count()); waitForJobExecutorToProcessAllJobs(6 * 60 * 1000); // now the retries = 0 Assert.assertEquals(0, managementService.createJobQuery().withRetriesLeft().count()); Assert.assertEquals(51, managementService.createJobQuery().noRetriesLeft().count()); }
@Test public void testJobRetriesDecremented() { runtimeService.startProcessInstanceByKey("theProcess"); Assert.assertEquals(1, managementService.createJobQuery().withRetriesLeft().count()); waitForJobExecutorToProcessAllJobs(); // now the retries = 0 Assert.assertEquals(0, managementService.createJobQuery().withRetriesLeft().count()); Assert.assertEquals(1, managementService.createJobQuery().noRetriesLeft().count()); }
public void testJobCommandsWithNestedFailingCommand() { // create a job createJob(TweetNestedCommandExceptionHandler.TYPE); // execute the existing job Job job = managementService.createJobQuery().singleResult(); assertEquals(3, job.getRetries()); try { managementService.executeJob(job.getId()); fail("Exception expected"); } catch (Exception e) { // expected } job = managementService.createJobQuery().singleResult(); assertEquals(2, job.getRetries()); executeAvailableJobs(); // the job execution failed (job.retries = 0) job = managementService.createJobQuery().noRetriesLeft().singleResult(); assertNotNull(job); assertEquals(0, job.getRetries()); }
assertEquals(0, managementService.createJobQuery().noRetriesLeft().count()); assertEquals(2, managementService.createJobQuery().withRetriesLeft().count()); assertEquals(0, managementService.createJobQuery().noRetriesLeft().count()); assertEquals(2, managementService.createJobQuery().withRetriesLeft().count());
assertEquals(0, managementService.createJobQuery().noRetriesLeft().count()); assertEquals(2, managementService.createJobQuery().withRetriesLeft().count()); assertEquals(0, managementService.createJobQuery().noRetriesLeft().count()); assertEquals(2, managementService.createJobQuery().withRetriesLeft().count());
assertEquals(0, managementService.createJobQuery().noRetriesLeft().count()); assertEquals(2, managementService.createJobQuery().withRetriesLeft().count()); assertEquals(0, managementService.createJobQuery().noRetriesLeft().count()); assertEquals(2, managementService.createJobQuery().withRetriesLeft().count());
assertEquals(1, managementService.createJobQuery().withException().count()); assertEquals(0, managementService.createJobQuery().jobId(jobId).withRetriesLeft().count()); assertEquals(1, managementService.createJobQuery().noRetriesLeft().count());
public void testQueryByNoRetriesLeft() { JobQuery query = managementService.createJobQuery().noRetriesLeft(); verifyQueryResults(query, 0); setRetries(processInstanceIdOne, 0); // Re-running the query should give only one jobs now, since three job has retries>0 verifyQueryResults(query, 1); }
public void testJobCommandsWith2Exceptions() { // create a job createJob(TweetExceptionHandler.TYPE); // execute the existing job executeAvailableJobs(); // the job was successfully executed JobQuery query = managementService.createJobQuery().noRetriesLeft(); assertEquals(0, query.count()); }
assertEquals(1, managementService.createJobQuery().withException().count()); assertEquals(0, managementService.createJobQuery().withRetriesLeft().count()); assertEquals(1, managementService.createJobQuery().noRetriesLeft().count());
public void testJobCommandsWith3Exceptions() { // set the execptionsRemaining to 3 so that // the created job will fail 3 times and a failed // job exists tweetExceptionHandler.setExceptionsRemaining(3); // create a job createJob(TweetExceptionHandler.TYPE); // execute the existing job executeAvailableJobs(); // the job execution failed (job.retries = 0) Job job = managementService.createJobQuery().noRetriesLeft().singleResult(); assertNotNull(job); assertEquals(0, job.getRetries()); }
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/async/FoxJobRetryCmdTest.testBrokenFoxJobRetryValue.bpmn20.xml" }) public void testBrokenFoxJobRetryValue() { Job job = managementService.createJobQuery().list().get(0); assertNotNull(job); assertEquals(3, job.getRetries()); waitForExecutedJobWithRetriesLeft(0, job.getId()); job = refreshJob(job.getId()); assertEquals(0, job.getRetries()); assertEquals(1, managementService.createJobQuery().noRetriesLeft().count()); }
public void testJobCommandsWithNestedFailingCommand() { // create a job createJob(TweetNestedCommandExceptionHandler.TYPE); // execute the existing job Job job = managementService.createJobQuery().singleResult(); assertEquals(3, job.getRetries()); try { managementService.executeJob(job.getId()); fail("Exception expected"); } catch (Exception e) { // expected } job = managementService.createJobQuery().singleResult(); assertEquals(2, job.getRetries()); executeAvailableJobs(); // the job execution failed (job.retries = 0) job = managementService.createJobQuery().noRetriesLeft().singleResult(); assertNotNull(job); assertEquals(0, job.getRetries()); }