@Override public Long getProperty(Job obj) { return obj.getPriority(); } });
@Test public void batchExecutionJobShouldHaveDefaultPriority() { // given Batch batch = helper.migrateProcessInstancesAsync(1); // when helper.executeSeedJob(batch); // then Job executionJob = helper.getExecutionJobs(batch).get(0); assertEquals(DefaultJobPriorityProvider.DEFAULT_PRIORITY, executionJob.getPriority()); }
@Test public void testPriorityOnProcessElement() { // given processInstance = runtimeService.startProcessInstanceByKey("priorityProcess"); Job job = managementService.createJobQuery().singleResult(); // then Assert.assertEquals(PriorityBean.PRIORITY, job.getPriority()); }
@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/job/boundaryTimerJobPrioProcess.bpmn20.xml") public void testBoundaryTimerEventPriority() { // given an active boundary event timer runtimeService.startProcessInstanceByKey("boundaryTimerJobPrioProcess"); Job job = managementService.createJobQuery().singleResult(); // then the job has the priority specified in the BPMN XML assertEquals(20, job.getPriority()); }
@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/job/eventSubprocessTimerJobPrioProcess.bpmn20.xml") public void testEventSubprocessTimerPriority() { // given an active event subprocess timer runtimeService.startProcessInstanceByKey("eventSubprocessTimerJobPrioProcess"); Job job = managementService.createJobQuery().singleResult(); // then the job has the priority specified in the BPMN XML assertEquals(25, job.getPriority()); }
@Test public void testPriorityOnProcessStart() { // given processInstance = runtimeService.startProcessInstanceByKey("serviceTaskProcess"); Job job = managementService.createJobQuery().singleResult(); // then Assert.assertEquals(PriorityBean.PRIORITY, job.getPriority()); }
@Test public void executionJobShouldGetPriorityFromOverridingJobDefinitionPriorityWithCascade() { // given Batch batch = helper.migrateProcessInstancesAsync(1); JobDefinition executionJobDefinition = helper.getExecutionJobDefinition(batch); helper.executeSeedJob(batch); // when managementService.setOverridingJobPriorityForJobDefinition(executionJobDefinition.getId(), CUSTOM_PRIORITY, true); // then Job executionJob = helper.getExecutionJobs(batch).get(0); assertEquals(CUSTOM_PRIORITY, executionJob.getPriority()); }
@Test public void monitorJobShouldGetPriorityFromProcessEngineConfiguration() { // given setBatchJobPriority(CUSTOM_PRIORITY); Batch batch = helper.migrateProcessInstancesAsync(1); // when helper.executeSeedJob(batch); // then Job monitorJob = helper.getMonitorJob(batch); assertEquals(CUSTOM_PRIORITY, monitorJob.getPriority()); }
@Test public void testPriorityOnAsyncAfterIntermediateCatchEvent() { // given processInstance = runtimeService.startProcessInstanceByKey("intermediateMessageProcess"); // when runtimeService.correlateMessage("Message"); // then Job asyncAfterJob = managementService.createJobQuery().singleResult(); Assert.assertEquals(PriorityBean.PRIORITY, asyncAfterJob.getPriority()); }
@Test public void testPriorityOnInstantiationAtActivity() { // when processInstance = runtimeService.createProcessInstanceByKey("serviceTaskProcess") .startBeforeActivity("serviceTask") .execute(); // then Job job = managementService.createJobQuery().singleResult(); Assert.assertEquals(PriorityBean.PRIORITY, job.getPriority()); }
public void testTimerStartEventPriorityOnActivity() { // given a timer start job org.camunda.bpm.engine.repository.Deployment deployment = repositoryService .createDeployment() .addClasspathResource("org/camunda/bpm/engine/test/bpmn/job/JobPrioritizationBpmnConstantValueTest.testTimerStartEventPriorityOnActivity.bpmn20.xml") .deploy(); Job job = managementService.createJobQuery().singleResult(); // then the timer start job has the priority defined in the process definition assertEquals(1515, job.getPriority()); // cleanup repositoryService.deleteDeployment(deployment.getId(), true); }
@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/job/jobPrioProcess.bpmn20.xml") public void testProcessDefinitionPrioritizationAsyncBefore() { // when runtimeService .createProcessInstanceByKey("jobPrioProcess") .startBeforeActivity("task1") .execute(); // then Job job = managementService.createJobQuery().singleResult(); assertNotNull(job); assertEquals(10, job.getPriority()); }
@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/job/jobPrioExpressionProcess.bpmn20.xml") public void testConstantValueExpressionPrioritization() { // when runtimeService .createProcessInstanceByKey("jobPrioExpressionProcess") .startBeforeActivity("task2") .execute(); // then Job job = managementService.createJobQuery().singleResult(); assertNotNull(job); assertEquals(15, job.getPriority()); }
@Test @OperateOnDeployment("timerStart") @InSequence(2) public void testAssertPriority() { // then the timer start event job has the priority resolved from the bean Job job = managementService.createJobQuery().activityId("timerStart").singleResult(); Assert.assertNotNull(job); Assert.assertEquals(PriorityBean.PRIORITY, job.getPriority()); } }
@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/job/oneTimerProcess.bpmn20.xml") public void testDefaultPrioritizationTimer() { // when runtimeService .createProcessInstanceByKey("oneTimerProcess") .startBeforeActivity("timer1") .execute(); // then Job job = managementService.createJobQuery().singleResult(); assertNotNull(job); assertEquals(EXPECTED_DEFAULT_PRIORITY, job.getPriority()); }
public void testTimerStartEventPriorityOnProcessDefinition() { // given a timer start job org.camunda.bpm.engine.repository.Deployment deployment = repositoryService .createDeployment() .addClasspathResource("org/camunda/bpm/engine/test/bpmn/job/JobPrioritizationBpmnConstantValueTest.testTimerStartEventPriorityOnProcessDefinition.bpmn20.xml") .deploy(); Job job = managementService.createJobQuery().singleResult(); // then the timer start job has the priority defined in the process definition assertEquals(8, job.getPriority()); // cleanup repositoryService.deleteDeployment(deployment.getId(), true); }
@Test public void testPriorityOnAsyncAfterUserTask() { // given processInstance = runtimeService.startProcessInstanceByKey("userTaskProcess"); Task task = taskService.createTaskQuery().singleResult(); // when taskService.complete(task.getId()); // then Job asyncAfterJob = managementService.createJobQuery().singleResult(); Assert.assertEquals(PriorityBean.PRIORITY, asyncAfterJob.getPriority()); }
@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/job/jobPrioExpressionProcess.bpmn20.xml") public void testVariableValueExpressionPrioritization() { // when runtimeService .createProcessInstanceByKey("jobPrioExpressionProcess") .startBeforeActivity("task1") .setVariable("priority", 22) .execute(); // then Job job = managementService.createJobQuery().singleResult(); assertNotNull(job); assertEquals(22, job.getPriority()); }
@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/job/jobPrioExpressionProcess.bpmn20.xml") public void testExecutionExpressionPrioritization() { // when runtimeService .createProcessInstanceByKey("jobPrioExpressionProcess") .startBeforeActivity("task1") .setVariable("priority", 25) .execute(); // then Job job = managementService.createJobQuery().singleResult(); assertNotNull(job); assertEquals(25, job.getPriority()); }
@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/job/miBodyAsyncProcess.bpmn20.xml") public void FAILING_testMultiInstanceBodyActivityPriority() { // given a process instance that executes an async mi body runtimeService.startProcessInstanceByKey("miBodyAsyncPriorityProcess"); // then there is a job that has the priority as defined on the activity assertEquals(1, managementService.createJobQuery().count()); Job miBodyJob = managementService.createJobQuery().singleResult(); assertNotNull(miBodyJob); assertEquals(5, miBodyJob.getPriority()); }