//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Deployment @Test public void testSignalStartEventInEventSubProcess() public virtual void testSignalStartEventInEventSubProcess() { // start process instance ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("signalStartEventInEventSubProcess"); // check if execution exists ExecutionQuery executionQuery = runtimeService.createExecutionQuery().processInstanceId(processInstance.Id); assertEquals(1, executionQuery.count()); // check if user task exists TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(processInstance.Id); assertEquals(1, taskQuery.count()); // send interrupting signal to event sub process runtimeService.signalEventReceived("alert"); assertEquals(true, DummyServiceTask.wasExecuted); // check if user task doesn't exist because signal start event is interrupting taskQuery = taskService.createTaskQuery().processInstanceId(processInstance.Id); assertEquals(0, taskQuery.count()); // check if execution doesn't exist because signal start event is interrupting executionQuery = runtimeService.createExecutionQuery().processInstanceId(processInstance.Id); assertEquals(0, executionQuery.count()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testFailingJobBoundaryTimerWithDelegateVariables() throws InterruptedException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testFailingJobBoundaryTimerWithDelegateVariables() { ProcessInstance pi = runtimeService.startProcessInstanceByKey("ImmediatelyFailing"); IList <Job> jobs = managementService.createJobQuery().list(); assertEquals(1, jobs.Count); assertEquals(3, jobs[0].Retries); assertEquals(1, runtimeService.createExecutionQuery().processInstanceId(pi.ProcessInstanceId).activityId("usertask1").count()); assertEquals(2, runtimeService.createExecutionQuery().processInstanceId(pi.ProcessInstanceId).count()); assertEquals(1, managementService.createJobQuery().executable().count()); waitForJobExecutorToProcessAllJobs(); assertEquals(0, managementService.createJobQuery().executable().count()); // should be 0, because it has failed 3 times assertEquals(1, managementService.createJobQuery().withException().count()); // should be 1, because job failed! assertEquals(1, runtimeService.createExecutionQuery().processInstanceId(pi.ProcessInstanceId).activityId("usertask1").count()); assertEquals(2, runtimeService.createExecutionQuery().processInstanceId(pi.ProcessInstanceId).count()); taskService.complete(taskService.createTaskQuery().processInstanceId(pi.Id).singleResult().Id); // complete task with failed job => complete process assertEquals(0, runtimeService.createExecutionQuery().processInstanceId(pi.ProcessInstanceId).count()); assertEquals(0, managementService.createJobQuery().count()); // should be 0, because process is finished. }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testSignalCatchBoundaryWithVariables() throws InterruptedException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testSignalCatchBoundaryWithVariables() { Dictionary <string, object> variables1 = new Dictionary <string, object>(); variables1["processName"] = "catchSignal"; ProcessInstance piCatchSignal = runtimeService.startProcessInstanceByKey("catchSignal", variables1); Dictionary <string, object> variables2 = new Dictionary <string, object>(); variables2["processName"] = "throwSignal"; variables2["signalProcessInstanceId"] = piCatchSignal.ProcessInstanceId; ProcessInstance piThrowSignal = runtimeService.startProcessInstanceByKey("throwSignal", variables2); waitForJobExecutorToProcessAllJobs(); assertEquals(1, runtimeService.createExecutionQuery().processInstanceId(piCatchSignal.ProcessInstanceId).activityId("receiveTask").count()); assertEquals(1, runtimeService.createExecutionQuery().processInstanceId(piThrowSignal.ProcessInstanceId).activityId("receiveTask").count()); // TODO: THis fails because of http://jira.codehaus.org/browse/ACT-1257, // should be fixed and re-enabled :-) assertEquals("catchSignal-visited (was catchSignal)", runtimeService.getVariable(piCatchSignal.Id, "processName")); assertEquals("throwSignal-visited (was throwSignal)", runtimeService.getVariable(piThrowSignal.Id, "processName")); // clean up runtimeService.signal(piCatchSignal.Id); runtimeService.signal(piThrowSignal.Id); assertEquals(0, runtimeService.createExecutionQuery().processInstanceId(piCatchSignal.ProcessInstanceId).count()); assertEquals(0, runtimeService.createExecutionQuery().processInstanceId(piThrowSignal.ProcessInstanceId).count()); }
public virtual void testMigrateEventScopeVariable() { //given ProcessDefinition sourceDefinition = testHelper.deployAndGetDefinition(CompensationModels.COMPENSATION_ONE_TASK_SUBPROCESS_MODEL); ProcessDefinition targetDefinition = testHelper.deployAndGetDefinition(CompensationModels.COMPENSATION_ONE_TASK_SUBPROCESS_MODEL); MigrationPlan migrationPlan = rule.RuntimeService.createMigrationPlan(sourceDefinition.Id, targetDefinition.Id).mapActivities("userTask2", "userTask2").mapActivities("subProcess", "subProcess").mapActivities("compensationBoundary", "compensationBoundary").build(); ProcessInstance processInstance = runtimeService.startProcessInstanceById(sourceDefinition.Id); Execution subProcessExecution = runtimeService.createExecutionQuery().activityId("userTask1").singleResult(); runtimeService.setVariableLocal(subProcessExecution.Id, "foo", "bar"); testHelper.completeTask("userTask1"); Execution eventScopeExecution = runtimeService.createExecutionQuery().activityId("subProcess").singleResult(); HistoricVariableInstance eventScopeVariable = historyService.createHistoricVariableInstanceQuery().executionIdIn(eventScopeExecution.Id).singleResult(); //when runtimeService.newMigration(migrationPlan).processInstanceIds(processInstance.Id).execute(); // then HistoricVariableInstance historicVariableInstance = historyService.createHistoricVariableInstanceQuery().variableId(eventScopeVariable.Id).singleResult(); Assert.assertEquals(targetDefinition.Id, historicVariableInstance.ProcessDefinitionId); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testCancelWithoutFlag() public virtual void testCancelWithoutFlag() { // given this.instance = Bpmn.createExecutableProcess("process1").startEvent("start").serviceTask("ser").camundaExpression("${true}").userTask("user").endEvent("end").done(); ProcessDefinition processDefinition = testRule.deployAndGetDefinition(instance); IList <string> processInstanceIds = helper.startInstances("process1", 1); // when runtimeService.createModification(processDefinition.Id).startBeforeActivity("ser").cancelAllForActivity("user").processInstanceIds(processInstanceIds).execute(); // then assertEquals(0, runtimeService.createExecutionQuery().list().size()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception public virtual void execute(DelegateExecution execution) { businessProcess.setVariable("processName", "throwSignal-visited (was " + businessProcess.getVariable("processName") + ")"); string signalProcessInstanceId = (string)execution.getVariable("signalProcessInstanceId"); string executionId = runtimeService.createExecutionQuery().processInstanceId(signalProcessInstanceId).signalEventSubscriptionName("alert").singleResult().Id; runtimeService.signalEventReceived("alert", executionId); }
private void createExecutionMock() { Execution mockExecution = MockProvider.createMockExecution(); ExecutionQuery mockExecutionQuery = mock(typeof(ExecutionQuery)); when(mockExecutionQuery.processInstanceId(eq(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID))).thenReturn(mockExecutionQuery); when(mockExecutionQuery.singleResult()).thenReturn(mockExecution); when(mockRuntimeService.createExecutionQuery()).thenReturn(mockExecutionQuery); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Deployment @Test public void testSingleIntermediateMessageEvent() public virtual void testSingleIntermediateMessageEvent() { ProcessInstance pi = runtimeService.startProcessInstanceByKey("process"); IList <string> activeActivityIds = runtimeService.getActiveActivityIds(pi.Id); assertNotNull(activeActivityIds); assertEquals(1, activeActivityIds.Count); assertTrue(activeActivityIds.Contains("messageCatch")); string messageName = "newInvoiceMessage"; Execution execution = runtimeService.createExecutionQuery().messageEventSubscriptionName(messageName).singleResult(); assertNotNull(execution); runtimeService.messageEventReceived(messageName, execution.Id); Task task = taskService.createTaskQuery().singleResult(); assertNotNull(task); taskService.complete(task.Id); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testVariableAtConcurrentExecutionInTransition() public virtual void testVariableAtConcurrentExecutionInTransition() { // given ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(AsyncProcessModels.ASYNC_BEFORE_USER_TASK_PROCESS); ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(AsyncProcessModels.ASYNC_BEFORE_USER_TASK_PROCESS); MigrationPlan migrationPlan = rule.RuntimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapEqualActivities().build(); ProcessInstance processInstance = rule.RuntimeService.createProcessInstanceById(sourceProcessDefinition.Id).startBeforeActivity("userTask").startBeforeActivity("userTask").execute(); Execution concurrentExecution = runtimeService.createExecutionQuery().activityId("userTask").list().get(0); Job jobForExecution = rule.ManagementService.createJobQuery().executionId(concurrentExecution.Id).singleResult(); runtimeService.setVariableLocal(concurrentExecution.Id, "var", "value"); // when testHelper.migrateProcessInstance(migrationPlan, processInstance); // then Job jobAfterMigration = rule.ManagementService.createJobQuery().jobId(jobForExecution.Id).singleResult(); testHelper.assertVariableMigratedToExecution(testHelper.snapshotBeforeMigration.getSingleVariable("var"), jobAfterMigration.ExecutionId); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception public virtual void execute(DelegateExecution execution) { businessProcess.setVariable("processName", "throwSignal-visited (was " + businessProcess.getVariable("processName") + ")"); string signalProcessInstanceId = (string)execution.getVariable("signalProcessInstanceId"); string executionId = runtimeService.createExecutionQuery().processInstanceId(signalProcessInstanceId).signalEventSubscriptionName("alert").singleResult().Id; CommandContext commandContext = Context.CommandContext; IList <EventSubscriptionEntity> findSignalEventSubscriptionsByEventName = commandContext.EventSubscriptionManager.findSignalEventSubscriptionsByNameAndExecution("alert", executionId); foreach (EventSubscriptionEntity signalEventSubscriptionEntity in findSignalEventSubscriptionsByEventName) { signalEventSubscriptionEntity.eventReceived(null, true); } }
public virtual void testQueryByExecutionId() { Execution execution = runtimeService.createExecutionQuery().processInstanceId(processInstanceIds[0]).singleResult(); assertNotNull(execution); IncidentQuery query = runtimeService.createIncidentQuery().executionId(execution.Id); assertEquals(1, query.count()); IList <Incident> incidents = query.list(); assertFalse(incidents.Count == 0); assertEquals(1, incidents.Count); }
public virtual void testGetExecution() { IList <Execution> executions = runtimeService.createExecutionQuery().processInstanceBusinessKey(rule.BuisnessKey).processDefinitionKey(PROCESS_DEF_KEY).list(); assertFalse(executions.Count == 0); }
public virtual void testGetExecution() { IList <Execution> executions = runtimeService.createExecutionQuery().processDefinitionKey("oneTaskProcess").list(); assertFalse(executions.Count == 0); }