public virtual void testBatchActivationByHistoricProcessInstanceQuery() { // given ProcessInstance processInstance1 = runtimeService.startProcessInstanceByKey("oneExternalTaskProcess"); ProcessInstance processInstance2 = runtimeService.startProcessInstanceByKey("twoExternalTaskProcess"); // when Batch suspendprocess = runtimeService.updateProcessInstanceSuspensionState().byHistoricProcessInstanceQuery(historyService.createHistoricProcessInstanceQuery().processInstanceIds(Sets.newHashSet(processInstance1.Id, processInstance2.Id))).suspendAsync(); helper.executeSeedJob(suspendprocess); helper.executeJobs(suspendprocess); Batch activateprocess = runtimeService.updateProcessInstanceSuspensionState().byHistoricProcessInstanceQuery(historyService.createHistoricProcessInstanceQuery().processInstanceIds(Sets.newHashSet(processInstance1.Id, processInstance2.Id))).activateAsync(); helper.executeSeedJob(activateprocess); helper.executeJobs(activateprocess); // then ProcessInstance p1c = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance1.Id).singleResult(); assertFalse(p1c.Suspended); ProcessInstance p2c = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance2.Id).singleResult(); assertFalse(p2c.Suspended); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDontWriteDuplicateLogOnBatchMigrationJobExecution() public virtual void testDontWriteDuplicateLogOnBatchMigrationJobExecution() { // given ProcessDefinition sourceDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS); ProcessDefinition targetDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS); ProcessInstance processInstance = runtimeService.startProcessInstanceById(sourceDefinition.Id); MigrationPlan migrationPlan = runtimeService.createMigrationPlan(sourceDefinition.Id, targetDefinition.Id).mapEqualActivities().build(); batch = runtimeService.newMigration(migrationPlan).processInstanceIds(Arrays.asList(processInstance.Id)).executeAsync(); Job seedJob = managementService.createJobQuery().singleResult(); managementService.executeJob(seedJob.Id); Job migrationJob = managementService.createJobQuery().jobDefinitionId(batch.BatchJobDefinitionId).singleResult(); // when managementService.executeJob(migrationJob.Id); // then assertEquals(9, userOperationLogQuery().count()); assertEquals(2, userOperationLogQuery().operationType(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_CREATE).entityType(EntityTypes.DEPLOYMENT).count()); assertEquals(1, userOperationLogQuery().operationType(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_CREATE).entityType(EntityTypes.PROCESS_INSTANCE).count()); assertEquals(3, userOperationLogQuery().operationType(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_MIGRATE).entityType(EntityTypes.PROCESS_INSTANCE).count()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void seedJobShouldHaveDefaultPriority() public virtual void seedJobShouldHaveDefaultPriority() { // when Batch batch = helper.migrateProcessInstancesAsync(1); // then Job seedJob = helper.getSeedJob(batch); assertEquals(DefaultJobPriorityProvider.DEFAULT_PRIORITY, seedJob.Priority); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSuspendBatch() public virtual void shouldSuspendBatch() { // given Batch batch = helper.migrateProcessInstancesAsync(1); // when managementService.suspendBatchById(batch.Id); // then batch = managementService.createBatchQuery().batchId(batch.Id).singleResult(); assertTrue(batch.Suspended); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCreateActivatedSeedJob() public virtual void shouldCreateActivatedSeedJob() { // given Batch batch = helper.migrateProcessInstancesAsync(2); // when helper.executeSeedJob(batch); // then Job seedJob = helper.getSeedJob(batch); assertFalse(seedJob.Suspended); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setUpBatchQueryMock() public virtual void setUpBatchQueryMock() { Batch batchMock = MockProvider.createMockBatch(); queryMock = mock(typeof(BatchQuery)); when(queryMock.batchId(eq(MockProvider.EXAMPLE_BATCH_ID))).thenReturn(queryMock); when(queryMock.singleResult()).thenReturn(batchMock); managementServiceMock = mock(typeof(ManagementService)); when(managementServiceMock.createBatchQuery()).thenReturn(queryMock); when(processEngine.ManagementService).thenReturn(managementServiceMock); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCreateActivatedExecutionJobs() public virtual void shouldCreateActivatedExecutionJobs() { // given Batch batch = helper.migrateProcessInstancesAsync(1); // when helper.executeSeedJob(batch); // then 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 seedJobShouldGetPriorityFromProcessEngineConfiguration() public virtual void seedJobShouldGetPriorityFromProcessEngineConfiguration() { // given BatchJobPriority = CUSTOM_PRIORITY; // when Batch batch = helper.migrateProcessInstancesAsync(1); // then Job seedJob = helper.getSeedJob(batch); assertEquals(CUSTOM_PRIORITY, seedJob.Priority); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void batchExecutionJobShouldHaveDefaultPriority() public virtual void batchExecutionJobShouldHaveDefaultPriority() { // given Batch batch = helper.migrateProcessInstancesAsync(1); // when helper.executeSeedJob(batch); // then Job executionJob = helper.getExecutionJobs(batch)[0]; assertEquals(DefaultJobPriorityProvider.DEFAULT_PRIORITY, executionJob.Priority); }
//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); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCreateSuspendedExecutionJobs() public virtual void shouldCreateSuspendedExecutionJobs() { // given Batch batch = helper.migrateProcessInstancesAsync(1); managementService.suspendBatchById(batch.Id); // when helper.executeSeedJob(batch); // then Job migrationJob = helper.getExecutionJobs(batch)[0]; assertTrue(migrationJob.Suspended); }
//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: @After public void cleanBatch() public virtual void cleanBatch() { Batch batch = engineRule.ManagementService.createBatchQuery().singleResult(); if (batch != null) { engineRule.ManagementService.deleteBatch(batch.Id, true); } HistoricBatch historicBatch = engineRule.HistoryService.createHistoricBatchQuery().singleResult(); if (historicBatch != null) { engineRule.HistoryService.deleteHistoricBatch(historicBatch.Id); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @After public void removeBatch() public virtual void removeBatch() { Batch batch = managementService.createBatchQuery().singleResult(); if (batch != null) { managementService.deleteBatch(batch.Id, true); } HistoricBatch historicBatch = historyService.createHistoricBatchQuery().singleResult(); if (historicBatch != null) { historyService.deleteHistoricBatch(historicBatch.Id); } }
//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 testRestartProcessInstanceAsyncWithTenantId() { // given ProcessInstance processInstance = startAndDeleteProcessInstance(TENANT_ONE, PROCESS); identityService.setAuthentication("user", null, Collections.singletonList(TENANT_ONE)); // when Batch batch = runtimeService.restartProcessInstances(processInstance.ProcessDefinitionId).startBeforeActivity("userTask").processInstanceIds(processInstance.Id).executeAsync(); batchHelper.completeBatch(batch); // then ProcessInstance restartedInstance = runtimeService.createProcessInstanceQuery().active().processDefinitionId(processInstance.ProcessDefinitionId).singleResult(); assertNotNull(restartedInstance); assertEquals(restartedInstance.TenantId, TENANT_ONE); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDontWriteDuplicateLogOnBatchDeletionJobExecution() public virtual void testDontWriteDuplicateLogOnBatchDeletionJobExecution() { ProcessDefinition definition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS); ProcessInstance processInstance = runtimeService.startProcessInstanceById(definition.Id); batch = runtimeService.deleteProcessInstancesAsync(Arrays.asList(processInstance.Id), null, "test reason"); Job seedJob = managementService.createJobQuery().singleResult(); managementService.executeJob(seedJob.Id); foreach (Job pending in managementService.createJobQuery().list()) { managementService.executeJob(pending.Id); } assertEquals(5, userOperationLogQuery().entityTypeIn(EntityTypes.PROCESS_INSTANCE, EntityTypes.DEPLOYMENT).count()); }
public virtual Batch build() { Batch batch = mock(typeof(Batch)); when(batch.Id).thenReturn(id_Renamed); when(batch.Type).thenReturn(type_Renamed); when(batch.TotalJobs).thenReturn(totalJobs_Renamed); when(batch.JobsCreated).thenReturn(jobsCreated_Renamed); when(batch.BatchJobsPerSeed).thenReturn(batchJobsPerSeed_Renamed); when(batch.InvocationsPerBatchJob).thenReturn(invocationsPerBatchJob_Renamed); when(batch.SeedJobDefinitionId).thenReturn(seedJobDefinitionId_Renamed); when(batch.MonitorJobDefinitionId).thenReturn(monitorJobDefinitionId_Renamed); when(batch.BatchJobDefinitionId).thenReturn(batchJobDefinitionId_Renamed); when(batch.Suspended).thenReturn(suspended_Renamed); when(batch.TenantId).thenReturn(tenantId_Renamed); when(batch.CreateUserId).thenReturn(createUserId_Renamed); return(batch); }
public static BatchDto fromBatch(Batch batch) { BatchDto dto = new BatchDto(); dto.id = batch.Id; dto.type = batch.Type; dto.totalJobs = batch.TotalJobs; dto.jobsCreated = batch.JobsCreated; dto.batchJobsPerSeed = batch.BatchJobsPerSeed; dto.invocationsPerBatchJob = batch.InvocationsPerBatchJob; dto.seedJobDefinitionId = batch.SeedJobDefinitionId; dto.monitorJobDefinitionId = batch.MonitorJobDefinitionId; dto.batchJobDefinitionId = batch.BatchJobDefinitionId; dto.suspended = batch.Suspended; dto.tenantId = batch.TenantId; dto.createUserId = batch.CreateUserId; return(dto); }
public virtual void testUserOperationLogQueryByBatchEntityType() { // given Batch batch1 = helper.migrateProcessInstancesAsync(1); Batch batch2 = helper.migrateProcessInstancesAsync(1); // when identityService.AuthenticatedUserId = USER_ID; managementService.suspendBatchById(batch1.Id); managementService.suspendBatchById(batch2.Id); managementService.activateBatchById(batch1.Id); identityService.clearAuthentication(); // then UserOperationLogQuery query = historyService.createUserOperationLogQuery().entityType(BATCH); assertEquals(3, query.count()); assertEquals(3, query.list().size()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void canMigrateInstanceBetweenSameTenantCase1() public virtual void canMigrateInstanceBetweenSameTenantCase1() { // given ProcessDefinition sourceDefinition = defaultTestRule.deployForTenantAndGetDefinition(TENANT_ONE, ProcessModels.ONE_TASK_PROCESS); ProcessDefinition targetDefinition = defaultTestRule.deployForTenantAndGetDefinition(TENANT_ONE, ProcessModels.ONE_TASK_PROCESS); ProcessInstance processInstance = defaultEngineRule.RuntimeService.startProcessInstanceById(sourceDefinition.Id); MigrationPlan migrationPlan = defaultEngineRule.RuntimeService.createMigrationPlan(sourceDefinition.Id, targetDefinition.Id).mapEqualActivities().build(); Batch batch = defaultEngineRule.RuntimeService.newMigration(migrationPlan).processInstanceIds(Arrays.asList(processInstance.Id)).executeAsync(); batchHelper.executeSeedJob(batch); // when batchHelper.executeJobs(batch); // then assertMigratedTo(processInstance, targetDefinition); }
public virtual void shouldCreateUserOperationLogForBatchSuspension() { // given Batch batch = helper.migrateProcessInstancesAsync(1); // when identityService.AuthenticatedUserId = USER_ID; managementService.suspendBatchById(batch.Id); identityService.clearAuthentication(); // then UserOperationLogEntry entry = historyService.createUserOperationLogQuery().singleResult(); assertNotNull(entry); assertEquals(batch.Id, entry.BatchId); assertEquals(AbstractSetBatchStateCmd.SUSPENSION_STATE_PROPERTY, entry.Property); assertNull(entry.OrgValue); assertEquals(org.camunda.bpm.engine.impl.persistence.entity.SuspensionState_Fields.SUSPENDED.Name, entry.NewValue); }
//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); }
public virtual void testBatchSuspensionById() { // given ProcessInstance processInstance1 = runtimeService.startProcessInstanceByKey("oneExternalTaskProcess"); ProcessInstance processInstance2 = runtimeService.startProcessInstanceByKey("twoExternalTaskProcess"); // when Batch suspendprocess = runtimeService.updateProcessInstanceSuspensionState().byProcessInstanceIds(Arrays.asList(processInstance1.Id, processInstance2.Id)).suspendAsync(); helper.executeSeedJob(suspendprocess); helper.executeJobs(suspendprocess); // then ProcessInstance p1c = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance1.Id).singleResult(); assertTrue(p1c.Suspended); ProcessInstance p2c = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance2.Id).singleResult(); assertTrue(p2c.Suspended); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void cannotMigrateInstanceWithoutTenantIdToDifferentTenant() public virtual void cannotMigrateInstanceWithoutTenantIdToDifferentTenant() { // given ProcessDefinition sourceDefinition = defaultTestRule.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS); ProcessDefinition targetDefinition = defaultTestRule.deployForTenantAndGetDefinition(TENANT_ONE, ProcessModels.ONE_TASK_PROCESS); ProcessInstance processInstance = defaultEngineRule.RuntimeService.startProcessInstanceById(sourceDefinition.Id); MigrationPlan migrationPlan = defaultEngineRule.RuntimeService.createMigrationPlan(sourceDefinition.Id, targetDefinition.Id).mapEqualActivities().build(); Batch batch = defaultEngineRule.RuntimeService.newMigration(migrationPlan).processInstanceIds(Arrays.asList(processInstance.Id)).executeAsync(); batchHelper.executeSeedJob(batch); // when batchHelper.executeJobs(batch); // then Job migrationJob = batchHelper.getExecutionJobs(batch)[0]; Assert.assertThat(migrationJob.ExceptionMessage, CoreMatchers.containsString("Cannot migrate process instance '" + processInstance.Id + "' without tenant to a process definition with a tenant ('tenant1')")); }
public virtual BatchDto modifyProcessInstanceAsync(ProcessInstanceModificationDto dto) { Batch batch = null; if (dto.Instructions != null && dto.Instructions.Count > 0) { ProcessInstanceModificationBuilder modificationBuilder = engine.RuntimeService.createProcessInstanceModification(processInstanceId); dto.applyTo(modificationBuilder, engine, objectMapper); try { batch = modificationBuilder.executeAsync(dto.SkipCustomListeners, dto.SkipIoMappings); } catch (BadUserRequestException e) { throw new InvalidRequestException(Status.BAD_REQUEST, e.Message); } return(BatchDto.fromBatch(batch)); } throw new InvalidRequestException(Status.BAD_REQUEST, "The provided instuctions are invalid."); }
public override JobDefinition getExecutionJobDefinition(Batch batch) { return(ManagementService.createJobDefinitionQuery().jobDefinitionId(batch.BatchJobDefinitionId).jobType(org.camunda.bpm.engine.batch.Batch_Fields.TYPE_PROCESS_INSTANCE_UPDATE_SUSPENSION_STATE).singleResult()); }