//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testQueryByJobDefinitionId() public virtual void testQueryByJobDefinitionId() { string processDefinitionId1 = testHelper.deployAndGetDefinition(FAILING_SERVICE_TASK_MODEL).Id; string processDefinitionId2 = testHelper.deployAndGetDefinition(FAILING_SERVICE_TASK_MODEL).Id; runtimeService.startProcessInstanceById(processDefinitionId1); runtimeService.startProcessInstanceById(processDefinitionId2); testHelper.executeAvailableJobs(); string jobDefinitionId1 = managementService.createJobQuery().processDefinitionId(processDefinitionId1).singleResult().JobDefinitionId; string jobDefinitionId2 = managementService.createJobQuery().processDefinitionId(processDefinitionId2).singleResult().JobDefinitionId; IncidentQuery query = runtimeService.createIncidentQuery().jobDefinitionIdIn(jobDefinitionId1, jobDefinitionId2); assertEquals(2, query.list().size()); assertEquals(2, query.count()); query = runtimeService.createIncidentQuery().jobDefinitionIdIn(jobDefinitionId1); assertEquals(1, query.list().size()); assertEquals(1, query.count()); query = runtimeService.createIncidentQuery().jobDefinitionIdIn(jobDefinitionId2); assertEquals(1, query.list().size()); assertEquals(1, query.count()); }
public virtual void testMigrateHistoryUserTaskInstance() { //given ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS); ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(modify(ProcessModels.ONE_TASK_PROCESS).changeElementId("Process", "Process2").changeElementId("userTask", "userTask2")); MigrationPlan migrationPlan = runtimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapActivities("userTask", "userTask2").build(); ProcessInstance processInstance = runtimeService.startProcessInstanceById(sourceProcessDefinition.Id); HistoricTaskInstanceQuery sourceHistoryTaskInstanceQuery = historyService.createHistoricTaskInstanceQuery().processDefinitionId(sourceProcessDefinition.Id); HistoricTaskInstanceQuery targetHistoryTaskInstanceQuery = historyService.createHistoricTaskInstanceQuery().processDefinitionId(targetProcessDefinition.Id); ActivityInstance activityInstance = runtimeService.getActivityInstance(processInstance.Id); //when assertEquals(1, sourceHistoryTaskInstanceQuery.count()); assertEquals(0, targetHistoryTaskInstanceQuery.count()); ProcessInstanceQuery sourceProcessInstanceQuery = runtimeService.createProcessInstanceQuery().processDefinitionId(sourceProcessDefinition.Id); runtimeService.newMigration(migrationPlan).processInstanceQuery(sourceProcessInstanceQuery).execute(); //then assertEquals(0, sourceHistoryTaskInstanceQuery.count()); assertEquals(1, targetHistoryTaskInstanceQuery.count()); HistoricTaskInstance instance = targetHistoryTaskInstanceQuery.singleResult(); assertEquals(targetProcessDefinition.Key, instance.ProcessDefinitionKey); assertEquals(targetProcessDefinition.Id, instance.ProcessDefinitionId); assertEquals("userTask2", instance.TaskDefinitionKey); assertEquals(activityInstance.getActivityInstances("userTask")[0].Id, instance.ActivityInstanceId); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testMigrationInterruptingTimerEvent() public virtual void testMigrationInterruptingTimerEvent() { // given BpmnModelInstance model = createModel(true, DUE_DATE_IN_THE_PAST); ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(model); ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(model); ProcessInstance processInstance = runtimeService.startProcessInstanceById(sourceProcessDefinition.Id); Job job = managementService.createJobQuery().singleResult(); assertNotNull(job); managementService.executeJob(job.Id); MigrationPlan migrationPlan = runtimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapEqualActivities().build(); // when testHelper.migrateProcessInstance(migrationPlan, processInstance); // then IList <Job> list = managementService.createJobQuery().list(); assertTrue(list.Count == 0); assertEquals(1, taskService.createTaskQuery().taskDefinitionKey("afterTimer").count()); assertEquals(0, taskService.createTaskQuery().taskDefinitionKey("userTask").count()); }
protected internal virtual ExternalTask startExternalTaskProcessGivenTopicName(string topicName) { BpmnModelInstance processModelWithCustomTopic = createDefaultExternalTaskModel().topic(topicName).build(); ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(processModelWithCustomTopic); ProcessInstance pi = runtimeService.startProcessInstanceById(sourceProcessDefinition.Id); return(externalTaskService.createExternalTaskQuery().processInstanceId(pi.Id).singleResult()); }
public virtual void testMigrateHistoryActivityInstance() { //given ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS); ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(modify(ProcessModels.ONE_TASK_PROCESS).changeElementId("Process", "Process2").changeElementId("userTask", "userTask2").changeElementName("userTask", "new activity name")); MigrationPlan migrationPlan = runtimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapActivities("userTask", "userTask2").build(); ProcessInstance processInstance = runtimeService.startProcessInstanceById(sourceProcessDefinition.Id); HistoricActivityInstanceQuery sourceHistoryActivityInstanceQuery = historyService.createHistoricActivityInstanceQuery().processDefinitionId(sourceProcessDefinition.Id); HistoricActivityInstanceQuery targetHistoryActivityInstanceQuery = historyService.createHistoricActivityInstanceQuery().processDefinitionId(targetProcessDefinition.Id); //when assertEquals(2, sourceHistoryActivityInstanceQuery.count()); assertEquals(0, targetHistoryActivityInstanceQuery.count()); ProcessInstanceQuery sourceProcessInstanceQuery = runtimeService.createProcessInstanceQuery().processDefinitionId(sourceProcessDefinition.Id); runtimeService.newMigration(migrationPlan).processInstanceQuery(sourceProcessInstanceQuery).execute(); // then one instance of the start event still belongs to the source process // and one active user task instances is now migrated to the target process assertEquals(1, sourceHistoryActivityInstanceQuery.count()); assertEquals(1, targetHistoryActivityInstanceQuery.count()); HistoricActivityInstance instance = targetHistoryActivityInstanceQuery.singleResult(); assertMigratedTo(instance, targetProcessDefinition, "userTask2"); assertEquals("new activity name", instance.ActivityName); assertEquals(processInstance.Id, instance.ParentActivityInstanceId); assertEquals("userTask", instance.ActivityType); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testBatchCreationWithOverlappingProcessInstanceIdsAndQuery() public virtual void testBatchCreationWithOverlappingProcessInstanceIdsAndQuery() { RuntimeService runtimeService = engineRule.RuntimeService; int processInstanceCount = 15; ProcessDefinition sourceProcessDefinition = migrationRule.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS); ProcessDefinition targetProcessDefinition = migrationRule.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS); IList <string> processInstanceIds = new List <string>(); for (int i = 0; i < processInstanceCount; i++) { processInstanceIds.Add(runtimeService.startProcessInstanceById(sourceProcessDefinition.Id).Id); } MigrationPlan migrationPlan = engineRule.RuntimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapEqualActivities().build(); ProcessInstanceQuery sourceProcessInstanceQuery = runtimeService.createProcessInstanceQuery().processDefinitionId(sourceProcessDefinition.Id); assertEquals(processInstanceCount, sourceProcessInstanceQuery.count()); // when Batch batch = runtimeService.newMigration(migrationPlan).processInstanceIds(processInstanceIds).processInstanceQuery(sourceProcessInstanceQuery).executeAsync(); // then a batch is created assertBatchCreated(batch, processInstanceCount); }
protected internal virtual ExternalTask startExternalTaskProcess() { BpmnModelInstance oneExternalTaskProcess = createDefaultExternalTaskModel().build(); ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(oneExternalTaskProcess); ProcessInstance pi = runtimeService.startProcessInstanceById(sourceProcessDefinition.Id); return(externalTaskService.createExternalTaskQuery().processInstanceId(pi.Id).singleResult()); }
//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()); }
// submitTaskForm //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testSubmitTaskFormWithAuthenticatedTenant() public virtual void testSubmitTaskFormWithAuthenticatedTenant() { testRule.deployForTenant(TENANT_ONE, "org/camunda/bpm/engine/test/api/authorization/formKeyProcess.bpmn20.xml"); string processDefinitionId = repositoryService.createProcessDefinitionQuery().singleResult().Id; runtimeService.startProcessInstanceById(processDefinitionId); assertEquals(taskService.createTaskQuery().processDefinitionId(processDefinitionId).count(), 1); string taskId = taskService.createTaskQuery().processDefinitionId(processDefinitionId).singleResult().Id; identityService.setAuthentication("aUserId", null, Arrays.asList(TENANT_ONE)); formService.submitTaskForm(taskId, null); // task gets completed on execution of submitTaskForm assertEquals(taskService.createTaskQuery().processDefinitionId(processDefinitionId).count(), 0); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testNoCreationOnSyncBatchJobExecution() public virtual void testNoCreationOnSyncBatchJobExecution() { // given ProcessDefinition processDefinition = testRule.deployAndGetDefinition(instance); ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinition.Id); Batch batch = runtimeService.createModification(processDefinition.Id).startAfterActivity("user2").processInstanceIds(Arrays.asList(processInstance.Id)).executeAsync(); helper.executeSeedJob(batch); // when rule.IdentityService.AuthenticatedUserId = "userId"; helper.executeJobs(batch); rule.IdentityService.clearAuthentication(); // then Assert.assertEquals(0, rule.HistoryService.createUserOperationLogQuery().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 testMigrateWithIdVarargsArray() public virtual void testMigrateWithIdVarargsArray() { ProcessDefinition sourceDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS); ProcessDefinition targetDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS); MigrationPlan migrationPlan = runtimeService.createMigrationPlan(sourceDefinition.Id, targetDefinition.Id).mapEqualActivities().build(); ProcessInstance processInstance1 = runtimeService.startProcessInstanceById(sourceDefinition.Id); ProcessInstance processInstance2 = runtimeService.startProcessInstanceById(sourceDefinition.Id); // when runtimeService.newMigration(migrationPlan).processInstanceIds(processInstance1.Id, processInstance2.Id).execute(); // then Assert.assertEquals(2, runtimeService.createProcessInstanceQuery().processDefinitionId(targetDefinition.Id).count()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testMigrateEventSubscription() public virtual void testMigrateEventSubscription() { // given ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(MessageReceiveModels.MESSAGE_START_PROCESS); string sourceProcessDefinitionId = sourceProcessDefinition.Id; MigrationPlan migrationPlan = runtimeService.createMigrationPlan(sourceProcessDefinitionId, sourceProcessDefinitionId).mapEqualActivities().build(); ProcessInstance processInstance = runtimeService.startProcessInstanceById(sourceProcessDefinitionId); EventSubscription eventSubscription = runtimeService.createEventSubscriptionQuery().activityId("startEvent").eventName(MessageReceiveModels.MESSAGE_NAME).singleResult(); // when runtimeService.newMigration(migrationPlan).processInstanceIds(processInstance.Id).execute(); // then assertEventSubscriptionMigrated(eventSubscription, "startEvent", MessageReceiveModels.MESSAGE_NAME); testHelper.completeTask("userTask"); testHelper.assertProcessEnded(processInstance.Id); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void initTest() public virtual void initTest() { runtimeService = rule.RuntimeService; historyService = rule.HistoryService; sourceProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS); ModifiableBpmnModelInstance modifiedModel = modify(ProcessModels.ONE_TASK_PROCESS).changeElementId("Process", "Process2").changeElementId("userTask", "userTask2"); targetProcessDefinition = testHelper.deployAndGetDefinition(modifiedModel); migrationPlan = runtimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapActivities("userTask", "userTask2").build(); runtimeService.startProcessInstanceById(sourceProcessDefinition.Id); }
public virtual void noHistoryUpdateOnSameStructureMigration() { // given ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(ONE_BOUNDARY_TASK); ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ONE_BOUNDARY_TASK); MigrationPlan migrationPlan = rule.RuntimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapEqualActivities().build(); ProcessInstance processInstance = runtimeService.startProcessInstanceById(sourceProcessDefinition.Id); ExecutionTree executionTreeBeforeMigration = ExecutionTree.forExecution(processInstance.Id, rule.ProcessEngine); ExecutionTree scopeExecution = executionTreeBeforeMigration.Executions[0]; runtimeService.setVariableLocal(scopeExecution.Id, "foo", 42); // when testHelper.migrateProcessInstance(migrationPlan, processInstance); // then there is still one historic variable instance Assert.assertEquals(1, historyService.createHistoricVariableInstanceQuery().count()); // and no additional historic details Assert.assertEquals(1, historyService.createHistoricDetailQuery().count()); }
//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); }
private Batch createFailingMigrationBatch() { BpmnModelInstance instance = createModelInstance(); ProcessDefinition sourceProcessDefinition = migrationRule.deployAndGetDefinition(instance); ProcessDefinition targetProcessDefinition = migrationRule.deployAndGetDefinition(instance); MigrationPlan migrationPlan = runtimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapEqualActivities().build(); ProcessInstance processInstance = runtimeService.startProcessInstanceById(sourceProcessDefinition.Id); Batch batch = runtimeService.newMigration(migrationPlan).processInstanceIds(Arrays.asList(processInstance.Id, "unknownId")).executeAsync(); return(batch); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDeleteHistoricIncidentByProcDefId() public virtual void testDeleteHistoricIncidentByProcDefId() { // given deployment = repositoryService.createDeployment().addModelInstance("process.bpmn", FAILING_SERVICE_TASK_MODEL).deployWithResult(); string processDefinitionId = deployment.DeployedProcessDefinitions[0].Id; runtimeService.startProcessInstanceById(processDefinitionId); executeAvailableJobs(); if (eventTypes != null) { HistoricIncident historicIncident = historyService.createHistoricIncidentQuery().singleResult(); assertNotNull(historicIncident); } // when repositoryService.deleteProcessDefinitions().byKey(PROCESS_DEFINITION_KEY).cascade().delete(); // then IList <HistoricIncident> incidents = historyService.createHistoricIncidentQuery().list(); assertEquals(0, incidents.Count); }
public virtual Batch migrateProcessInstancesAsync(int numberOfProcessInstances, ProcessDefinition sourceProcessDefinition, ProcessDefinition targetProcessDefinition) { RuntimeService runtimeService = engineRule.RuntimeService; IList <string> processInstanceIds = new List <string>(numberOfProcessInstances); for (int i = 0; i < numberOfProcessInstances; i++) { processInstanceIds.Add(runtimeService.startProcessInstanceById(sourceProcessDefinition.Id).Id); } MigrationPlan migrationPlan = engineRule.RuntimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapEqualActivities().build(); return(runtimeService.newMigration(migrationPlan).processInstanceIds(processInstanceIds).executeAsync()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testReportCompact() public virtual void testReportCompact() { // given IList <ProcessDefinition> pdList = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).list(); assertEquals(1, pdList.Count); runtimeService.startProcessInstanceById(pdList[0].Id); IList <CleanableHistoricProcessInstanceReportResult> resultWithZeros = historyService.createCleanableHistoricProcessInstanceReport().list(); assertEquals(1, resultWithZeros.Count); assertEquals(0, resultWithZeros[0].FinishedProcessInstanceCount); // when long resultCountWithoutZeros = historyService.createCleanableHistoricProcessInstanceReport().compact().count(); // then assertEquals(0, resultCountWithoutZeros); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testVariableAtScopeExecutionInScopeActivity() public virtual void testVariableAtScopeExecutionInScopeActivity() { // given ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(ONE_BOUNDARY_TASK); ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ONE_BOUNDARY_TASK); MigrationPlan migrationPlan = rule.RuntimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapEqualActivities().build(); ProcessInstance processInstance = runtimeService.startProcessInstanceById(sourceProcessDefinition.Id); ExecutionTree executionTreeBeforeMigration = ExecutionTree.forExecution(processInstance.Id, rule.ProcessEngine); ExecutionTree scopeExecution = executionTreeBeforeMigration.Executions[0]; runtimeService.setVariableLocal(scopeExecution.Id, "foo", 42); // when testHelper.migrateProcessInstance(migrationPlan, processInstance); // then VariableInstance beforeMigration = testHelper.snapshotBeforeMigration.getSingleVariable("foo"); Assert.assertEquals(1, testHelper.snapshotAfterMigration.getVariables().Count); testHelper.assertVariableMigratedToExecution(beforeMigration, beforeMigration.ExecutionId); }