public virtual void testQueryBySuspended() { JobDefinitionQuery query = managementService.createJobDefinitionQuery().suspended(); verifyQueryResults(query, 0); // suspend first one JobDefinition jobDefinition = managementService.createJobDefinitionQuery().jobType(AsyncContinuationJobHandler.TYPE).singleResult(); managementService.suspendJobDefinitionById(jobDefinition.Id); // only one is suspended verifyQueryResults(query, 1); // Suspend second one jobDefinition = managementService.createJobDefinitionQuery().jobType(TimerStartEventJobHandler.TYPE).singleResult(); managementService.suspendJobDefinitionById(jobDefinition.Id); // only two are suspended verifyQueryResults(query, 2); // suspend third one jobDefinition = managementService.createJobDefinitionQuery().jobType(TimerCatchIntermediateEventJobHandler.TYPE).singleResult(); managementService.suspendJobDefinitionById(jobDefinition.Id); // only three are suspended verifyQueryResults(query, 3); // suspend fourth one jobDefinition = managementService.createJobDefinitionQuery().jobType(TimerExecuteNestedActivityJobHandler.TYPE).singleResult(); managementService.suspendJobDefinitionById(jobDefinition.Id); // all are suspended verifyQueryResults(query, 4); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testExclusiveJobs() public virtual void testExclusiveJobs() { testRule.deploy(Bpmn.createExecutableProcess("testProcess").startEvent().serviceTask("task1").camundaExpression("${true}").camundaAsyncBefore().serviceTask("task2").camundaExpression("${true}").camundaAsyncBefore().endEvent().done()); JobDefinition jobDefinition = managementService.createJobDefinitionQuery().activityIdIn("task2").singleResult(); // given that the second task is suspended managementService.suspendJobDefinitionById(jobDefinition.Id); // if I start a process instance runtimeService.startProcessInstanceByKey("testProcess"); testRule.waitForJobExecutorToProcessAllJobs(10000); // then the second task is not executed assertEquals(1, runtimeService.createProcessInstanceQuery().count()); // there is a suspended job instance Job job = managementService.createJobQuery().singleResult(); assertEquals(job.JobDefinitionId, jobDefinition.Id); assertTrue(job.Suspended); // if I unsuspend the job definition, the job is executed: managementService.activateJobDefinitionById(jobDefinition.Id, true); testRule.waitForJobExecutorToProcessAllJobs(10000); assertEquals(0, runtimeService.createProcessInstanceQuery().count()); }
public virtual void testQueryByJobDefinitionId() { JobDefinition jobDefinition = managementService.createJobDefinitionQuery().jobType(TimerStartEventJobHandler.TYPE).singleResult(); JobDefinitionQuery query = managementService.createJobDefinitionQuery().jobDefinitionId(jobDefinition.Id); verifyQueryResults(query, 1); assertEquals(jobDefinition.Id, query.singleResult().Id); }
public virtual void testInitAsyncBeforeTaskJobDefinition() { // when the process is redeployed into the cache (instantiation should trigger that) rule.RuntimeService.startProcessInstanceByKey("AsyncBeforeSequentialMultiInstanceTask"); // then the old job definition referencing "miSubProcess" has been migrated JobDefinition asyncJobDefinition = rule.jobDefinitionQuery().singleResult(); Assert.assertEquals("miTask#multiInstanceBody", asyncJobDefinition.ActivityId); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void seedJobShouldGetPriorityFromOverridingJobDefinitionPriorityWithCascade() public virtual void seedJobShouldGetPriorityFromOverridingJobDefinitionPriorityWithCascade() { // given Batch batch = helper.migrateProcessInstancesAsync(1); JobDefinition seedJobDefinition = helper.getSeedJobDefinition(batch); // when managementService.setOverridingJobPriorityForJobDefinition(seedJobDefinition.Id, CUSTOM_PRIORITY, true); // then Job seedJob = helper.getSeedJob(batch); assertEquals(CUSTOM_PRIORITY, seedJob.Priority); }
public virtual JobDefinition build() { JobDefinition mockJobDefinition = mock(typeof(JobDefinition)); when(mockJobDefinition.Id).thenReturn(id_Renamed); when(mockJobDefinition.ActivityId).thenReturn(activityId_Renamed); when(mockJobDefinition.JobConfiguration).thenReturn(jobConfiguration_Renamed); when(mockJobDefinition.OverridingJobPriority).thenReturn(jobPriority_Renamed); when(mockJobDefinition.JobType).thenReturn(jobType_Renamed); when(mockJobDefinition.ProcessDefinitionId).thenReturn(processDefinitionId_Renamed); when(mockJobDefinition.ProcessDefinitionKey).thenReturn(processDefinitionKey_Renamed); when(mockJobDefinition.Suspended).thenReturn(suspended_Renamed); when(mockJobDefinition.TenantId).thenReturn(tenantId_Renamed); return(mockJobDefinition); }
public static JobDefinitionDto fromJobDefinition(JobDefinition definition) { JobDefinitionDto dto = new JobDefinitionDto(); dto.id = definition.Id; dto.processDefinitionId = definition.ProcessDefinitionId; dto.processDefinitionKey = definition.ProcessDefinitionKey; dto.jobType = definition.JobType; dto.jobConfiguration = definition.JobConfiguration; dto.activityId = definition.ActivityId; dto.suspended = definition.Suspended; dto.overridingJobPriority = definition.OverridingJobPriority; dto.tenantId = definition.TenantId; return(dto); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void executionJobShouldGetPriorityFromOverridingJobDefinitionPriority() public virtual void executionJobShouldGetPriorityFromOverridingJobDefinitionPriority() { // given Batch batch = helper.migrateProcessInstancesAsync(1); JobDefinition executionJobDefinition = helper.getExecutionJobDefinition(batch); managementService.setOverridingJobPriorityForJobDefinition(executionJobDefinition.Id, CUSTOM_PRIORITY, true); // when helper.executeSeedJob(batch); // then Job executionJob = helper.getExecutionJobs(batch)[0]; assertEquals(CUSTOM_PRIORITY, executionJob.Priority); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void monitorJobShouldGetPriorityOverridingJobDefinitionPriority() public virtual void monitorJobShouldGetPriorityOverridingJobDefinitionPriority() { // given Batch batch = helper.migrateProcessInstancesAsync(1); JobDefinition monitorJobDefinition = helper.getMonitorJobDefinition(batch); managementService.setOverridingJobPriorityForJobDefinition(monitorJobDefinition.Id, CUSTOM_PRIORITY); // when helper.executeSeedJob(batch); // then Job monitorJob = helper.getMonitorJob(batch); assertEquals(CUSTOM_PRIORITY, monitorJob.Priority); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSuspendSeedJobAndDefinition() public virtual void shouldSuspendSeedJobAndDefinition() { // given Batch batch = helper.migrateProcessInstancesAsync(1); // when managementService.suspendBatchById(batch.Id); // then JobDefinition seedJobDefinition = helper.getSeedJobDefinition(batch); assertTrue(seedJobDefinition.Suspended); Job seedJob = helper.getSeedJob(batch); assertTrue(seedJob.Suspended); }
public virtual void testQueryWithOverridingJobPriority() { // given JobDefinition jobDefinition = managementService.createJobDefinitionQuery().listPage(0, 1).get(0); managementService.setOverridingJobPriorityForJobDefinition(jobDefinition.Id, 42); // when JobDefinition queriedDefinition = managementService.createJobDefinitionQuery().withOverridingJobPriority().singleResult(); // then assertNotNull(queriedDefinition); assertEquals(jobDefinition.Id, queriedDefinition.Id); assertEquals(42L, (long)queriedDefinition.OverridingJobPriority); // and assertEquals(1, managementService.createJobDefinitionQuery().withOverridingJobPriority().count()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldActivateExecutionJobsAndDefinition() public virtual void shouldActivateExecutionJobsAndDefinition() { // given Batch batch = helper.migrateProcessInstancesAsync(1); managementService.suspendBatchById(batch.Id); helper.executeSeedJob(batch); // when managementService.activateBatchById(batch.Id); // then JobDefinition migrationJobDefinition = helper.getExecutionJobDefinition(batch); assertFalse(migrationJobDefinition.Suspended); Job migrationJob = helper.getExecutionJobs(batch)[0]; assertFalse(migrationJob.Suspended); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testMigrateHistoricIncident() public virtual void testMigrateHistoricIncident() { // given ProcessDefinition sourceProcess = testHelper.deployAndGetDefinition(AsyncProcessModels.ASYNC_BEFORE_USER_TASK_PROCESS); ProcessDefinition targetProcess = testHelper.deployAndGetDefinition(modify(AsyncProcessModels.ASYNC_BEFORE_USER_TASK_PROCESS).changeElementId(ProcessModels.PROCESS_KEY, "new" + ProcessModels.PROCESS_KEY).changeElementId("userTask", "newUserTask")); JobDefinition targetJobDefinition = managementService.createJobDefinitionQuery().processDefinitionId(targetProcess.Id).singleResult(); MigrationPlan migrationPlan = runtimeService.createMigrationPlan(sourceProcess.Id, targetProcess.Id).mapActivities("userTask", "newUserTask").build(); ProcessInstance processInstance = runtimeService.startProcessInstanceById(sourceProcess.Id); Job job = managementService.createJobQuery().singleResult(); managementService.setJobRetries(job.Id, 0); HistoricIncident incidentBeforeMigration = historyService.createHistoricIncidentQuery().singleResult(); // when runtimeService.newMigration(migrationPlan).processInstanceIds(Arrays.asList(processInstance.Id)).execute(); // then HistoricIncident historicIncident = historyService.createHistoricIncidentQuery().singleResult(); Assert.assertNotNull(historicIncident); Assert.assertEquals("newUserTask", historicIncident.ActivityId); Assert.assertEquals(targetJobDefinition.Id, historicIncident.JobDefinitionId); Assert.assertEquals(targetProcess.Id, historicIncident.ProcessDefinitionId); Assert.assertEquals(targetProcess.Key, historicIncident.ProcessDefinitionKey); Assert.assertEquals(processInstance.Id, historicIncident.ExecutionId); // and other properties have not changed Assert.assertEquals(incidentBeforeMigration.CreateTime, historicIncident.CreateTime); Assert.assertEquals(incidentBeforeMigration.ProcessInstanceId, historicIncident.ProcessInstanceId); }