//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void occurredAfterParameterWorks() public virtual void occurredAfterParameterWorks() { // given BpmnModelInstance simpleDefinition = Bpmn.createExecutableProcess("process").startEvent().userTask("userTask").camundaAssignee(userId).endEvent().done(); testHelper.deploy(simpleDefinition); DateTime now = DateTime.Now; ClockUtil.CurrentTime = now; engineRule.RuntimeService.startProcessInstanceByKey("process"); unclaimAllUserTasks(); DateTime nowPlus2Seconds = new DateTime(now.Ticks + 2000L); ClockUtil.CurrentTime = nowPlus2Seconds; claimAllUserTasks(); DateTime nowPlus4Seconds = new DateTime(now.Ticks + 4000L); ClockUtil.CurrentTime = nowPlus4Seconds; completeAllUserTasks(); // when IList <UserOperationLogEntry> userOperationsLog = optimizeService.getHistoricUserOperationLogs(now, null, 10); // then ISet <string> allowedOperationsTypes = new HashSet <string>(Arrays.asList(OPERATION_TYPE_CLAIM, OPERATION_TYPE_COMPLETE)); assertThat(userOperationsLog.Count, @is(2)); assertTrue(allowedOperationsTypes.Contains(userOperationsLog[0].OperationType)); assertTrue(allowedOperationsTypes.Contains(userOperationsLog[1].OperationType)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCompleteParentProcessWithParallelGateway() public virtual void shouldCompleteParentProcessWithParallelGateway() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.model.bpmn.BpmnModelInstance modelInstance = org.camunda.bpm.model.bpmn.Bpmn.createExecutableProcess("parentProcess").startEvent().parallelGateway().serviceTask("doNothingServiceTask").camundaExpression("${true}").moveToLastGateway().callActivity("callActivity").calledElement("subprocess").parallelGateway("mergingParallelGateway").endEvent().done(); BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("parentProcess").startEvent().parallelGateway().serviceTask("doNothingServiceTask").camundaExpression("${true}").moveToLastGateway().callActivity("callActivity").calledElement("subprocess").parallelGateway("mergingParallelGateway").endEvent().done(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.model.bpmn.BpmnModelInstance parentProcessInstance = modify(modelInstance).flowNodeBuilder("doNothingServiceTask").connectTo("mergingParallelGateway").done(); BpmnModelInstance parentProcessInstance = modify(modelInstance).flowNodeBuilder("doNothingServiceTask").connectTo("mergingParallelGateway").done(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.model.bpmn.BpmnModelInstance subprocessInstance = org.camunda.bpm.model.bpmn.Bpmn.createExecutableProcess("subprocess").startEvent().userTask("userTask").endEvent("subEnd").done(); BpmnModelInstance subprocessInstance = Bpmn.createExecutableProcess("subprocess").startEvent().userTask("userTask").endEvent("subEnd").done(); testHelper.deploy(parentProcessInstance, subprocessInstance); // given I start the process, which waits at user task in subprocess runtimeService.startProcessInstanceByKey("parentProcess"); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.runtime.ProcessInstance subprocess = runtimeService.createProcessInstanceQuery().processDefinitionKey("subprocess").singleResult(); ProcessInstance subprocess = runtimeService.createProcessInstanceQuery().processDefinitionKey("subprocess").singleResult(); assertNotNull(subprocess); assertNotNull(taskService.createTaskQuery().taskName("userTask").singleResult()); // when I do process instance modification runtimeService.createProcessInstanceModification(subprocess.ProcessInstanceId).cancelAllForActivity("userTask").startAfterActivity("userTask").execute(); // then the process should be finished assertThat(runtimeService.createProcessInstanceQuery().count(), @is(0L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCancelConcurrentExecutionInCallingProcess() public virtual void shouldCancelConcurrentExecutionInCallingProcess() { // given //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.model.bpmn.BpmnModelInstance parentProcessInstance = org.camunda.bpm.model.bpmn.Bpmn.createExecutableProcess("parentProcess").startEvent().parallelGateway("split").callActivity("callActivity").calledElement("subprocess").endEvent().moveToLastGateway().userTask("parentUserTask").endEvent().done(); BpmnModelInstance parentProcessInstance = Bpmn.createExecutableProcess("parentProcess").startEvent().parallelGateway("split").callActivity("callActivity").calledElement("subprocess").endEvent().moveToLastGateway().userTask("parentUserTask").endEvent().done(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.model.bpmn.BpmnModelInstance subprocessInstance = org.camunda.bpm.model.bpmn.Bpmn.createExecutableProcess("subprocess").startEvent().userTask("childUserTask").endEvent("subEnd").done(); BpmnModelInstance subprocessInstance = Bpmn.createExecutableProcess("subprocess").startEvent().userTask("childUserTask").endEvent("subEnd").done(); testHelper.deploy(parentProcessInstance, subprocessInstance); ProcessInstance callingInstance = runtimeService.startProcessInstanceByKey("parentProcess"); ProcessInstance calledInstance = runtimeService.createProcessInstanceQuery().superProcessInstanceId(callingInstance.Id).singleResult(); // when runtimeService.createProcessInstanceModification(calledInstance.Id).cancelAllForActivity("childUserTask").execute(); // then ProcessInstance calledInstanceAfterModification = runtimeService.createProcessInstanceQuery().processInstanceId(calledInstance.Id).singleResult(); Assert.assertNull(calledInstanceAfterModification); ExecutionTree executionTree = ExecutionTree.forExecution(callingInstance.Id, rule.ProcessEngine); assertThat(executionTree).matches(describeExecutionTree("parentUserTask").scope().done()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void createBatchModification() public virtual void createBatchModification() { //given BpmnModelInstance instance = Bpmn.createExecutableProcess("process1").startEvent().userTask("user1").userTask("user2").endEvent().done(); ProcessDefinition processDefinition = testHelper.deployAndGetDefinition(instance); IList <string> instances = new List <string>(); for (int i = 0; i < 2; i++) { ProcessInstance processInstance = engineRule.RuntimeService.startProcessInstanceByKey("process1"); instances.Add(processInstance.Id); } authRule.init(scenario).withUser("userId").bindResource("batchId", "*").start(); // when engineRule.RuntimeService.createModification(processDefinition.Id).startAfterActivity("user1").processInstanceIds(instances).executeAsync(); // then if (authRule.assertScenario(scenario)) { Batch batch = engineRule.ManagementService.createBatchQuery().singleResult(); assertEquals("userId", batch.CreateUserId); } }
private void deploy() { //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(PROCESS_ID).startEvent().serviceTask().camundaClass(typeof(ModelExecutionContextServiceTask).FullName).endEvent().done(); deploymentId = repositoryService.createDeployment().addModelInstance("process.bpmn", modelInstance).deploy().Id; }
// Updating the bpmn20 file should lead to a new deployment when restarting the Spring container //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testResourceRedeploymentAfterProcessDefinitionChange() throws Exception public virtual void testResourceRedeploymentAfterProcessDefinitionChange() { // given BpmnModelInstance model1 = Bpmn.createExecutableProcess("model1").startEvent("oldId").endEvent().done(); BpmnModelInstance model2 = Bpmn.createExecutableProcess("model1").startEvent("newId").endEvent().done(); BpmnModelInstance model3 = Bpmn.createExecutableProcess("model2").startEvent().endEvent().done(); DynamicResourceProducer.addResource("a.bpmn", model1); DynamicResourceProducer.addResource("b.bpmn", model3); createAppContext(CTX_DYNAMIC_DEPLOY_PATH); assertEquals(1, repositoryService.createDeploymentQuery().count()); ((AbstractXmlApplicationContext)applicationContext).destroy(); // when DynamicResourceProducer.clearResources(); DynamicResourceProducer.addResource("a.bpmn", model2); DynamicResourceProducer.addResource("b.bpmn", model3); applicationContext = new ClassPathXmlApplicationContext(CTX_DYNAMIC_DEPLOY_PATH); repositoryService = (RepositoryService)applicationContext.getBean("repositoryService"); // then // Assertions come AFTER the file write! Otherwise the process file is messed up if the assertions fail. assertEquals(2, repositoryService.createDeploymentQuery().count()); assertEquals(4, repositoryService.createProcessDefinitionQuery().count()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDeleteCascadeProcessDefinitionDisabledTenantCheck() public virtual void testDeleteCascadeProcessDefinitionDisabledTenantCheck() { //given deployment with a process definition and process instances BpmnModelInstance bpmnModel = Bpmn.createExecutableProcess("process").startEvent().userTask().endEvent().done(); testRule.deployForTenant(TENANT_ONE, bpmnModel); //tenant check disabled processEngineConfiguration.TenantCheckEnabled = false; ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery(); ProcessDefinition processDefinition = processDefinitionQuery.processDefinitionKey("process").singleResult(); engineRule.RuntimeService.createProcessInstanceByKey("process").executeWithVariablesInReturn(); //user with no authentication identityService.setAuthentication("user", null, null); //when the corresponding process definition is cascading deleted from the deployment repositoryService.deleteProcessDefinition(processDefinition.Id, true); //then exist no process instance and one definition, because test case deployes per default one definition identityService.clearAuthentication(); assertEquals(0, engineRule.RuntimeService.createProcessInstanceQuery().count()); if (processEngineConfiguration.HistoryLevel.Id >= org.camunda.bpm.engine.impl.history.HistoryLevel_Fields.HISTORY_LEVEL_ACTIVITY.Id) { assertEquals(0, engineRule.HistoryService.createHistoricActivityInstanceQuery().count()); } assertThat(repositoryService.createProcessDefinitionQuery().count(), @is(1L)); assertThat(repositoryService.createProcessDefinitionQuery().tenantIdIn(TENANT_ONE).count(), @is(1L)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testDeployAndGetProcessDefinition() throws Exception public virtual void testDeployAndGetProcessDefinition() { // given process model //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.model.bpmn.BpmnModelInstance modelInstance = org.camunda.bpm.model.bpmn.Bpmn.createExecutableProcess("foo").startEvent().userTask().endEvent().done(); BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("foo").startEvent().userTask().endEvent().done(); // when process model is deployed DeploymentWithDefinitions deployment = repositoryService.createDeployment().addModelInstance("foo.bpmn", modelInstance).deployWithResult(); deploymentIds.Add(deployment.Id); // then deployment contains deployed process definitions IList <ProcessDefinition> deployedProcessDefinitions = deployment.DeployedProcessDefinitions; assertEquals(1, deployedProcessDefinitions.Count); assertNull(deployment.DeployedCaseDefinitions); assertNull(deployment.DeployedDecisionDefinitions); assertNull(deployment.DeployedDecisionRequirementsDefinitions); // and persisted process definition is equal to deployed process definition ProcessDefinition persistedProcDef = repositoryService.createProcessDefinitionQuery().processDefinitionResourceName("foo.bpmn").singleResult(); assertEquals(persistedProcDef.Id, deployedProcessDefinitions[0].Id); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void performAssigneeOperations() public virtual void performAssigneeOperations() { // given BpmnModelInstance simpleDefinition = Bpmn.createExecutableProcess("process").startEvent("startEvent").userTask("userTask").name("task").endEvent("endEvent").done(); testHelper.deploy(simpleDefinition); runtimeService.startProcessInstanceByKey("process"); identityService.AuthenticatedUserId = assignerId; DateTime now = DateTime.Now; ClockUtil.CurrentTime = now; claimAllUserTasks(); DateTime nowPlus2Seconds = new DateTime(now.Ticks + 2000L); ClockUtil.CurrentTime = nowPlus2Seconds; unclaimAllUserTasks(); // when IList <OptimizeHistoricIdentityLinkLogEntity> identityLinkLogs = optimizeService.getHistoricIdentityLinkLogs(pastDate(), null, 10); // then assertThat(identityLinkLogs.Count, @is(2)); assertThat(identityLinkLogs[0].UserId, @is(userId)); assertThat(identityLinkLogs[0].OperationType, @is(IDENTITY_LINK_ADD)); assertThat(identityLinkLogs[0].Type, @is(IdentityLinkType.ASSIGNEE)); assertThat(identityLinkLogs[1].UserId, @is(userId)); assertThat(identityLinkLogs[1].OperationType, @is(IDENTITY_LINK_DELETE)); assertThat(identityLinkLogs[0].Type, @is(IdentityLinkType.ASSIGNEE)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldRestartProcessInstanceWithInitialVariables() public virtual void shouldRestartProcessInstanceWithInitialVariables() { // given //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: BpmnModelInstance instance = Bpmn.createExecutableProcess("Process").startEvent("startEvent").userTask("userTask1").camundaExecutionListenerClass([email protected]_Fields.EVENTNAME_END, typeof(SetVariableExecutionListenerImpl).FullName).userTask("userTask2").endEvent().done(); ProcessDefinition processDefinition = testRule.deployAndGetDefinition(instance); // initial variable ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("Process", Variables.createVariables().putValue("var", "bar")); // variable update Task task = taskService.createTaskQuery().processInstanceId(processInstance.Id).active().singleResult(); taskService.complete(task.Id); // delete process instance runtimeService.deleteProcessInstance(processInstance.Id, "test"); // when runtimeService.restartProcessInstances(processDefinition.Id).startBeforeActivity("userTask1").initialSetOfVariables().processInstanceIds(processInstance.Id).execute(); // then ProcessInstance restartedProcessInstance = runtimeService.createProcessInstanceQuery().active().singleResult(); VariableInstance variableInstance = runtimeService.createVariableInstanceQuery().processInstanceIdIn(restartedProcessInstance.Id).singleResult(); assertEquals(variableInstance.ExecutionId, restartedProcessInstance.Id); assertEquals("var", variableInstance.Name); assertEquals("bar", variableInstance.Value); }
public virtual void testPartialChangesDeployAll() { BpmnModelInstance model1 = Bpmn.createExecutableProcess("process1").done(); BpmnModelInstance model2 = Bpmn.createExecutableProcess("process2").done(); org.camunda.bpm.engine.repository.Deployment deployment1 = repositoryService.createDeployment().enableDuplicateFiltering().addModelInstance("process1.bpmn20.xml", model1).addModelInstance("process2.bpmn20.xml", model2).name("twice").deploy(); IList <string> deploymentResources = repositoryService.getDeploymentResourceNames(deployment1.Id); assertEquals(2, deploymentResources.Count); BpmnModelInstance changedModel2 = Bpmn.createExecutableProcess("process2").startEvent().done(); org.camunda.bpm.engine.repository.Deployment deployment2 = repositoryService.createDeployment().enableDuplicateFiltering().addModelInstance("process1.bpmn20.xml", model1).addModelInstance("process2.bpmn20.xml", changedModel2).name("twice").deploy(); IList <org.camunda.bpm.engine.repository.Deployment> deploymentList = repositoryService.createDeploymentQuery().list(); assertEquals(2, deploymentList.Count); // there should be new versions of both processes assertEquals(2, repositoryService.createProcessDefinitionQuery().processDefinitionKey("process1").count()); assertEquals(2, repositoryService.createProcessDefinitionQuery().processDefinitionKey("process2").count()); repositoryService.deleteDeployment(deployment1.Id); repositoryService.deleteDeployment(deployment2.Id); }
private void InitializeInstanceFields() { testRule = new ProcessEngineTestRule(engineRule); ruleChain = RuleChain.outerRule(bootstrapRule).around(engineRule).around(testRule); PROCESS = Bpmn.createExecutableProcess(PROCESS_KEY).camundaHistoryTimeToLive(5).startEvent().userTask().endEvent().done(); CALLING_PROCESS = Bpmn.createExecutableProcess(CALLING_PROCESS_KEY).startEvent().callActivity().calledElement(PROCESS_KEY).multiInstance().cardinality("5").multiInstanceDone().endEvent().done(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void resultIsSortedByTimestamp() public virtual void resultIsSortedByTimestamp() { // given BpmnModelInstance simpleDefinition = Bpmn.createExecutableProcess("process").startEvent().userTask("userTask").camundaAssignee(userId).endEvent().done(); testHelper.deploy(simpleDefinition); DateTime now = DateTime.Now; ClockUtil.CurrentTime = now; engineRule.RuntimeService.startProcessInstanceByKey("process"); unclaimAllUserTasks(); DateTime nowPlus2Seconds = new DateTime(now.Ticks + 2000L); ClockUtil.CurrentTime = nowPlus2Seconds; claimAllUserTasks(); DateTime nowPlus4Seconds = new DateTime(now.Ticks + 4000L); ClockUtil.CurrentTime = nowPlus4Seconds; completeAllUserTasks(); // when IList <UserOperationLogEntry> userOperationsLog = optimizeService.getHistoricUserOperationLogs(pastDate(), null, 4); // then assertThat(userOperationsLog.Count, @is(3)); assertThat(userOperationsLog[0].OperationType, @is(OPERATION_TYPE_ASSIGN)); assertThat(userOperationsLog[1].OperationType, @is(OPERATION_TYPE_CLAIM)); assertThat(userOperationsLog[2].OperationType, @is(OPERATION_TYPE_COMPLETE)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void occurredAtParameterWorks() public virtual void occurredAtParameterWorks() { // given BpmnModelInstance simpleDefinition = Bpmn.createExecutableProcess("process").startEvent().userTask("userTask").endEvent().done(); testHelper.deploy(simpleDefinition); DateTime now = DateTime.Now; ClockUtil.CurrentTime = now; engineRule.RuntimeService.startProcessInstanceByKey("process"); claimAllUserTasks(); DateTime nowPlus2Seconds = new DateTime(now.Ticks + 2000L); ClockUtil.CurrentTime = nowPlus2Seconds; completeAllUserTasks(); // when IList <UserOperationLogEntry> userOperationsLog = optimizeService.getHistoricUserOperationLogs(null, now, 10); // then assertThat(userOperationsLog.Count, @is(1)); assertThat(userOperationsLog[0].OperationType, @is(OPERATION_TYPE_CLAIM)); assertThat(userOperationsLog[0].Category, @is(CATEGORY_TASK_WORKER)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldPointToRootWithInitialCallAfterParallelGateway() public virtual void shouldPointToRootWithInitialCallAfterParallelGateway() { // given testRule.deploy(CALLED_PROCESS); testRule.deploy(CALLED_AND_CALLING_PROCESS); testRule.deploy(Bpmn.createExecutableProcess("callingProcessWithGateway").startEvent().parallelGateway("split").callActivity().calledElement(CALLED_AND_CALLING_PROCESS_KEY).moveToNode("split").callActivity().calledElement(CALLED_AND_CALLING_PROCESS_KEY).endEvent().done()); // when runtimeService.startProcessInstanceByKey("callingProcessWithGateway"); IList <ProcessInstance> calledProcessInstances = runtimeService.createProcessInstanceQuery().processDefinitionKey(CALLED_PROCESS_KEY).list(); IList <ProcessInstance> calledAndCallingProcessInstances = runtimeService.createProcessInstanceQuery().processDefinitionKey(CALLED_AND_CALLING_PROCESS_KEY).list(); ProcessInstance callingProcessInstance = runtimeService.createProcessInstanceQuery().processDefinitionKey("callingProcessWithGateway").singleResult(); // assume assertThat(runtimeService.createProcessInstanceQuery().count(), @is(5L)); assertThat(callingProcessInstance.ProcessInstanceId, notNullValue()); assertThat(calledProcessInstances.Count, @is(2)); assertThat(calledAndCallingProcessInstances.Count, @is(2)); // then assertThat(callingProcessInstance.RootProcessInstanceId, @is(callingProcessInstance.ProcessInstanceId)); assertThat(calledProcessInstances[0].RootProcessInstanceId, @is(callingProcessInstance.ProcessInstanceId)); assertThat(calledProcessInstances[1].RootProcessInstanceId, @is(callingProcessInstance.ProcessInstanceId)); assertThat(calledAndCallingProcessInstances[0].RootProcessInstanceId, @is(callingProcessInstance.ProcessInstanceId)); assertThat(calledAndCallingProcessInstances[1].RootProcessInstanceId, @is(callingProcessInstance.ProcessInstanceId)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void occurredAfterAndOccurredAtParameterWorks() public virtual void occurredAfterAndOccurredAtParameterWorks() { // given BpmnModelInstance simpleDefinition = Bpmn.createExecutableProcess("process").startEvent().userTask("userTask").endEvent().done(); testHelper.deploy(simpleDefinition); runtimeService.startProcessInstanceByKey("process"); string taskId = taskService.createTaskQuery().singleResult().Id; DateTime now = DateTime.Now; ClockUtil.CurrentTime = now; taskService.addCandidateUser(taskId, userId); DateTime nowPlus2Seconds = new DateTime(now.Ticks + 2000L); ClockUtil.CurrentTime = nowPlus2Seconds; taskService.deleteCandidateUser(taskId, userId); DateTime nowPlus4Seconds = new DateTime(now.Ticks + 4000L); ClockUtil.CurrentTime = nowPlus4Seconds; taskService.addCandidateUser(taskId, userId); // when IList <OptimizeHistoricIdentityLinkLogEntity> identityLinkLogs = optimizeService.getHistoricIdentityLinkLogs(now, now, 10); // then assertThat(identityLinkLogs.Count, @is(0)); }
// when deployChangeOnly=true, new deployment should be created only for the changed resources //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testDeployChangeOnly() throws Exception public virtual void testDeployChangeOnly() { // given BpmnModelInstance model1 = Bpmn.createExecutableProcess("model1").startEvent("oldId").endEvent().done(); BpmnModelInstance model2 = Bpmn.createExecutableProcess("model1").startEvent("newId").endEvent().done(); BpmnModelInstance model3 = Bpmn.createExecutableProcess("model2").startEvent().endEvent().done(); DynamicResourceProducer.addResource("a.bpmn", model1); DynamicResourceProducer.addResource("b.bpmn", model3); createAppContext(CTX_DEPLOY_CHANGE_ONLY_PATH); // assume assertEquals(1, repositoryService.createDeploymentQuery().count()); // when ((AbstractXmlApplicationContext)applicationContext).destroy(); DynamicResourceProducer.clearResources(); DynamicResourceProducer.addResource("a.bpmn", model2); DynamicResourceProducer.addResource("b.bpmn", model3); applicationContext = new ClassPathXmlApplicationContext(CTX_DEPLOY_CHANGE_ONLY_PATH); repositoryService = (RepositoryService)applicationContext.getBean("repositoryService"); // then assertEquals(2, repositoryService.createDeploymentQuery().count()); assertEquals(3, repositoryService.createProcessDefinitionQuery().count()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void resultIsSortedByTimestamp() public virtual void resultIsSortedByTimestamp() { // given BpmnModelInstance simpleDefinition = Bpmn.createExecutableProcess("process").startEvent().userTask("userTask").endEvent().done(); testHelper.deploy(simpleDefinition); runtimeService.startProcessInstanceByKey("process"); string taskId = taskService.createTaskQuery().singleResult().Id; DateTime now = DateTime.Now; ClockUtil.CurrentTime = now; taskService.addCandidateUser(taskId, userId); DateTime nowPlus2Seconds = new DateTime(now.Ticks + 2000L); ClockUtil.CurrentTime = nowPlus2Seconds; taskService.deleteCandidateUser(taskId, userId); DateTime nowPlus4Seconds = new DateTime(now.Ticks + 4000L); ClockUtil.CurrentTime = nowPlus4Seconds; taskService.addCandidateUser(taskId, userId); // when IList <OptimizeHistoricIdentityLinkLogEntity> identityLinkLogs = optimizeService.getHistoricIdentityLinkLogs(pastDate(), null, 4); // then assertThat(identityLinkLogs.Count, @is(3)); assertThat(identityLinkLogs[0].OperationType, @is(IDENTITY_LINK_ADD)); assertThat(identityLinkLogs[1].OperationType, @is(IDENTITY_LINK_DELETE)); assertThat(identityLinkLogs[2].OperationType, @is(IDENTITY_LINK_ADD)); }
public static BpmnModelInstance prepareSignalEventProcess() { //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(PROCESS_ID).startEvent().intermediateThrowEvent(FAILING_EVENT).camundaAsyncBefore(true).camundaFailedJobRetryTimeCycle(SCHEDULE).signal(MESSAGE).serviceTask().camundaClass(typeof(FailingDelegate).FullName).endEvent().done(); return(modelInstance); }
public virtual void testInsertDeleteInsertTheSameVariable() { BpmnModelInstance bpmnModel = Bpmn.createExecutableProcess("serviceTaskProcess").startEvent().userTask("userTask").serviceTask("service").camundaClass(typeof(InsertDeleteInsertVariableDelegate)).userTask("userTask1").endEvent().done(); ProcessDefinition processDefinition = testHelper.deployAndGetDefinition(bpmnModel); VariableMap variables = Variables.createVariables().putValue("listVar", Arrays.asList(new int[] { 1, 2, 3 })); ProcessInstance instance = engineRule.RuntimeService.startProcessInstanceById(processDefinition.Id, variables); Task task = engineRule.TaskService.createTaskQuery().singleResult(); engineRule.TaskService.complete(task.Id); VariableInstance variable = engineRule.RuntimeService.createVariableInstanceQuery().processInstanceIdIn(instance.Id).variableName("foo").singleResult(); assertNotNull(variable); assertEquals("bar", variable.Value); IList <HistoricVariableInstance> historyVariables = engineRule.HistoryService.createHistoricVariableInstanceQuery().list(); foreach (HistoricVariableInstance historicVariable in historyVariables) { if (variable.Name.Equals(historicVariable.Name)) { assertEquals(org.camunda.bpm.engine.history.HistoricVariableInstance_Fields.STATE_CREATED, historicVariable.State); break; } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDeleteProcessDefinitionCascade() public virtual void testDeleteProcessDefinitionCascade() { // given process definition and a process instance BpmnModelInstance bpmnModel = Bpmn.createExecutableProcess(PROCESS_DEFINITION_KEY).startEvent().userTask().endEvent().done(); testHelper.deploy(bpmnModel); ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).singleResult(); runtimeService.createProcessInstanceByKey(PROCESS_DEFINITION_KEY).executeWithVariablesInReturn(); authRule.init(scenario).withUser("userId").start(); //when the corresponding process definition is cascading deleted from the deployment repositoryService.deleteProcessDefinition(processDefinition.Id, true); //then exist no process instance and no definition if (authRule.assertScenario(scenario)) { assertEquals(0, runtimeService.createProcessInstanceQuery().count()); assertEquals(0, repositoryService.createProcessDefinitionQuery().count()); if (processEngineConfiguration.HistoryLevel.Id >= org.camunda.bpm.engine.impl.history.HistoryLevel_Fields.HISTORY_LEVEL_ACTIVITY.Id) { assertEquals(0, engineRule.HistoryService.createHistoricActivityInstanceQuery().count()); } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void occurredAfterAndOccurredAtParameterWorks() public virtual void occurredAfterAndOccurredAtParameterWorks() { // given BpmnModelInstance simpleDefinition = Bpmn.createExecutableProcess("process").startEvent().endEvent().done(); testHelper.deploy(simpleDefinition); DateTime now = DateTime.Now; ClockUtil.CurrentTime = now; IDictionary <string, object> variables = new Dictionary <string, object>(); variables["stringVar"] = "value1"; runtimeService.startProcessInstanceByKey("process", variables); DateTime nowPlus2Seconds = new DateTime(now.Ticks + 2000L); ClockUtil.CurrentTime = nowPlus2Seconds; variables["stringVar"] = "value2"; runtimeService.startProcessInstanceByKey("process", variables); // when IList <HistoricVariableUpdate> variableUpdates = optimizeService.getHistoricVariableUpdates(now, now, 10); // then assertThat(variableUpdates.Count, @is(0)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void resultIsSortedByStartTime() public virtual void resultIsSortedByStartTime() { // given BpmnModelInstance simpleDefinition = Bpmn.createExecutableProcess("process").startEvent().userTask().endEvent().done(); testHelper.deploy(simpleDefinition); DateTime now = DateTime.Now; DateTime nowPlus1Second = new DateTime(now.Ticks + 1000L); ClockUtil.CurrentTime = nowPlus1Second; ProcessInstance processInstance1 = runtimeService.startProcessInstanceByKey("process"); DateTime nowPlus2Seconds = new DateTime(now.Ticks + 2000L); ClockUtil.CurrentTime = nowPlus2Seconds; ProcessInstance processInstance2 = runtimeService.startProcessInstanceByKey("process"); DateTime nowPlus4Seconds = new DateTime(nowPlus2Seconds.Ticks + 2000L); ClockUtil.CurrentTime = nowPlus4Seconds; ProcessInstance processInstance3 = runtimeService.startProcessInstanceByKey("process"); // when IList <HistoricProcessInstance> runningHistoricProcessInstances = optimizeService.getRunningHistoricProcessInstances(new DateTime(now.Ticks), null, 10); // then assertThat(runningHistoricProcessInstances.Count, @is(3)); assertThat(runningHistoricProcessInstances[0].Id, @is(processInstance1.Id)); assertThat(runningHistoricProcessInstances[1].Id, @is(processInstance2.Id)); assertThat(runningHistoricProcessInstances[2].Id, @is(processInstance3.Id)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void getHistoricVariableByteArrayUpdates() public virtual void getHistoricVariableByteArrayUpdates() { // given BpmnModelInstance simpleDefinition = Bpmn.createExecutableProcess("process").startEvent().endEvent().done(); testHelper.deploy(simpleDefinition); IList <string> serializable = new List <string>(); serializable.Add("one"); serializable.Add("two"); serializable.Add("three"); IDictionary <string, object> variables = new Dictionary <string, object>(); variables["var"] = serializable; runtimeService.startProcessInstanceByKey("process", variables); runtimeService.startProcessInstanceByKey("process", variables); runtimeService.startProcessInstanceByKey("process", variables); runtimeService.startProcessInstanceByKey("process", variables); // when IList <HistoricVariableUpdate> historicVariableUpdates = optimizeService.getHistoricVariableUpdates(new DateTime(1L), null, 10); // then assertThat(historicVariableUpdates.Count, @is(4)); foreach (HistoricVariableUpdate variableUpdate in historicVariableUpdates) { ObjectValue typedValue = (ObjectValue)variableUpdate.TypedValue; assertThat(typedValue.Deserialized, @is(false)); assertThat(typedValue.ValueSerialized, notNullValue()); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldContinueParentProcess() public virtual void shouldContinueParentProcess() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.model.bpmn.BpmnModelInstance parentProcessInstance = org.camunda.bpm.model.bpmn.Bpmn.createExecutableProcess("parentProcess").startEvent().callActivity("callActivity").calledElement("subprocess").userTask().endEvent().done(); BpmnModelInstance parentProcessInstance = Bpmn.createExecutableProcess("parentProcess").startEvent().callActivity("callActivity").calledElement("subprocess").userTask().endEvent().done(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.model.bpmn.BpmnModelInstance subprocessInstance = org.camunda.bpm.model.bpmn.Bpmn.createExecutableProcess("subprocess").startEvent().userTask("userTask").endEvent("subEnd").done(); BpmnModelInstance subprocessInstance = Bpmn.createExecutableProcess("subprocess").startEvent().userTask("userTask").endEvent("subEnd").done(); testHelper.deploy(parentProcessInstance, subprocessInstance); // given I start the process, which wait as user task in subprocess ProcessInstance parentPI = runtimeService.startProcessInstanceByKey("parentProcess"); assertNotNull(taskService.createTaskQuery().taskName("userTask").singleResult()); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.runtime.ProcessInstance subprocess = runtimeService.createProcessInstanceQuery().processDefinitionKey("subprocess").singleResult(); ProcessInstance subprocess = runtimeService.createProcessInstanceQuery().processDefinitionKey("subprocess").singleResult(); assertNotNull(subprocess); // when I do process instance modification runtimeService.createProcessInstanceModification(subprocess.ProcessInstanceId).cancelAllForActivity("userTask").startAfterActivity("userTask").execute(); // then the parent process instance is still active assertThat(runtimeService.createProcessInstanceQuery().count(), @is(1L)); Task task = taskService.createTaskQuery().singleResult(); assertThat(task.ProcessInstanceId, @is(parentPI.Id)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @After public void validateModel() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void validateModel() { if (instance != null) { Bpmn.validateModel(instance); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldContinueParentProcessWithMultiInstanceEmbeddedSubProcess() public virtual void shouldContinueParentProcessWithMultiInstanceEmbeddedSubProcess() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.model.bpmn.BpmnModelInstance parentProcessInstance = org.camunda.bpm.model.bpmn.Bpmn.createExecutableProcess("parentProcess").startEvent().subProcess().embeddedSubProcess().startEvent().callActivity("callActivity").calledElement("subprocess").endEvent().subProcessDone().multiInstance().cardinality("3").multiInstanceDone().userTask().endEvent().done(); BpmnModelInstance parentProcessInstance = Bpmn.createExecutableProcess("parentProcess").startEvent().subProcess().embeddedSubProcess().startEvent().callActivity("callActivity").calledElement("subprocess").endEvent().subProcessDone().multiInstance().cardinality("3").multiInstanceDone().userTask().endEvent().done(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.model.bpmn.BpmnModelInstance subprocessInstance = org.camunda.bpm.model.bpmn.Bpmn.createExecutableProcess("subprocess").startEvent().userTask("userTask").endEvent("subEnd").done(); BpmnModelInstance subprocessInstance = Bpmn.createExecutableProcess("subprocess").startEvent().userTask("userTask").endEvent("subEnd").done(); testHelper.deploy(parentProcessInstance, subprocessInstance); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final String subprocessPrDefId = repositoryService.createProcessDefinitionQuery().processDefinitionKey("subprocess").singleResult().getId(); string subprocessPrDefId = repositoryService.createProcessDefinitionQuery().processDefinitionKey("subprocess").singleResult().Id; // given I start the process, which waits at user task inside multiinstance subprocess ProcessInstance parentPI = runtimeService.startProcessInstanceByKey("parentProcess"); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.List<org.camunda.bpm.engine.runtime.ProcessInstance> subprocesses = runtimeService.createProcessInstanceQuery().processDefinitionKey("subprocess").list(); IList <ProcessInstance> subprocesses = runtimeService.createProcessInstanceQuery().processDefinitionKey("subprocess").list(); assertEquals(3, subprocesses.Count); // when I do process instance modification runtimeService.createModification(subprocessPrDefId).cancelAllForActivity("userTask").startAfterActivity("userTask").processInstanceIds(collectIds(subprocesses)).execute(); // then the parent process instance is still active assertThat(runtimeService.createProcessInstanceQuery().count(), @is(1L)); Task task = taskService.createTaskQuery().singleResult(); assertThat(task.ProcessInstanceId, @is(parentPI.Id)); }
public virtual void testFailingAfterDeleteDeployment() { //given //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.model.bpmn.BpmnModelInstance model = org.camunda.bpm.model.bpmn.Bpmn.createExecutableProcess().startEvent().userTask().endEvent().done(); BpmnModelInstance model = Bpmn.createExecutableProcess().startEvent().userTask().endEvent().done(); deploymentId = processEngine.RepositoryService.createDeployment().addModelInstance("model.bpmn", model).deploy().Id; //when // 1. delete deployment // 2. it fails in post command interceptor (see FailDeleteDeploymentsPlugin) // 3. transaction is rolling back // 4. DeleteDeploymentFailListener is called try { processEngine.RepositoryService.deleteDeployment(deploymentId); } catch (Exception) { //expected exception } //then // DeleteDeploymentFailListener succeeded to registered deployments back assertEquals(1, processEngineConfiguration.RegisteredDeployments.Count); }
public virtual void testCommandContextNestedFailingCommandsNotExceptions() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.model.bpmn.BpmnModelInstance modelInstance = org.camunda.bpm.model.bpmn.Bpmn.createExecutableProcess("processThrowingThrowable").startEvent().serviceTask().camundaClass(ThrowErrorJavaDelegate.class).endEvent().done(); BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("processThrowingThrowable").startEvent().serviceTask().camundaClass(typeof(ThrowErrorJavaDelegate)).endEvent().done(); deployment(modelInstance); bool errorThrown = false; try { processEngineConfiguration.CommandExecutorTxRequired.execute(new CommandAnonymousInnerClass4(this)); fail("Exception expected"); } catch (StackOverflowError) { //OK errorThrown = true; } assertTrue(ThrowErrorJavaDelegate.executed); assertTrue(errorThrown); // Check data base consistency assertEquals(0, historyService.createHistoricProcessInstanceQuery().count()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testActivityInstanceIdOnDeleteInCalledProcess() public virtual void testActivityInstanceIdOnDeleteInCalledProcess() { // given RecorderTaskListener.clear(); BpmnModelInstance callActivityProcess = Bpmn.createExecutableProcess("calling").startEvent().callActivity().calledElement("called").endEvent().done(); //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: BpmnModelInstance calledProcess = Bpmn.createExecutableProcess("called").startEvent().userTask().camundaTaskListenerClass([email protected]_Fields.EVENTNAME_CREATE, typeof(RecorderTaskListener).FullName).camundaTaskListenerClass([email protected]_Fields.EVENTNAME_DELETE, typeof(RecorderTaskListener).FullName).endEvent().done(); testRule.deploy(callActivityProcess, calledProcess); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("calling"); // when runtimeService.deleteProcessInstance(processInstance.Id, null); // then IList <RecorderTaskListener.RecordedTaskEvent> recordedEvents = RecorderTaskListener.RecordedEvents; assertEquals(2, recordedEvents.Count); string createActivityInstanceId = recordedEvents[0].ActivityInstanceId; string deleteActivityInstanceId = recordedEvents[1].ActivityInstanceId; assertEquals(createActivityInstanceId, deleteActivityInstanceId); }