use of org.camunda.bpm.engine.impl.jobexecutor.AcquiredJobs in project camunda-bpm-platform by camunda.
the class JobExecutorTest method testAcquiredJobs.
public void testAcquiredJobs() {
List<String> firstBatch = new ArrayList<String>(Arrays.asList("a", "b", "c"));
List<String> secondBatch = new ArrayList<String>(Arrays.asList("d", "e", "f"));
List<String> thirdBatch = new ArrayList<String>(Arrays.asList("g"));
AcquiredJobs acquiredJobs = new AcquiredJobs(0);
acquiredJobs.addJobIdBatch(firstBatch);
acquiredJobs.addJobIdBatch(secondBatch);
acquiredJobs.addJobIdBatch(thirdBatch);
assertEquals(firstBatch, acquiredJobs.getJobIdBatches().get(0));
assertEquals(secondBatch, acquiredJobs.getJobIdBatches().get(1));
assertEquals(thirdBatch, acquiredJobs.getJobIdBatches().get(2));
acquiredJobs.removeJobId("a");
assertEquals(Arrays.asList("b", "c"), acquiredJobs.getJobIdBatches().get(0));
assertEquals(secondBatch, acquiredJobs.getJobIdBatches().get(1));
assertEquals(thirdBatch, acquiredJobs.getJobIdBatches().get(2));
assertEquals(3, acquiredJobs.getJobIdBatches().size());
acquiredJobs.removeJobId("g");
assertEquals(2, acquiredJobs.getJobIdBatches().size());
}
use of org.camunda.bpm.engine.impl.jobexecutor.AcquiredJobs in project camunda-bpm-platform by camunda.
the class IndependentJobExecutionTest method testDeploymentUnawareJobAcquisition.
@OperateOnDeployment("pa1")
@Test
public void testDeploymentUnawareJobAcquisition() {
JobExecutor defaultJobExecutor = processEngineConfiguration.getJobExecutor();
ProcessInstance instance1 = engine1.getRuntimeService().startProcessInstanceByKey("archive1Process");
ProcessInstance instance2 = processEngine.getRuntimeService().startProcessInstanceByKey("archive2Process");
Job job1 = managementService.createJobQuery().processInstanceId(instance1.getId()).singleResult();
Job job2 = managementService.createJobQuery().processInstanceId(instance2.getId()).singleResult();
// the deployment unaware configuration should return both jobs
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
processEngineConfiguration.setJobExecutorDeploymentAware(false);
try {
AcquiredJobs acquiredJobs = commandExecutor.execute(new AcquireJobsCmd(defaultJobExecutor));
Assert.assertEquals(2, acquiredJobs.size());
Assert.assertTrue(acquiredJobs.contains(job1.getId()));
Assert.assertTrue(acquiredJobs.contains(job2.getId()));
} finally {
processEngineConfiguration.setJobExecutorDeploymentAware(true);
}
}
Aggregations