public virtual void testStartInstanceWithVariableCondition() { // given a deployed process // when IList <ProcessInstance> instances = runtimeService.createConditionEvaluation().setVariable("foo", 1).evaluateStartConditions(); // then assertEquals(1, instances.Count); VariableInstance vars = runtimeService.createVariableInstanceQuery().singleResult(); assertEquals(vars.ProcessInstanceId, instances[0].Id); assertEquals(1, vars.Value); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testVariableBinaryForFileValues() public virtual void testVariableBinaryForFileValues() { // given BpmnModelInstance instance = createProcess(); testRule.deploy(instance); FileValue fileValue = createFile(); runtimeService.startProcessInstanceByKey("Process", Variables.createVariables().putValueTyped("fileVar", fileValue)); string byteArrayValueId = ((VariableInstanceEntity)runtimeService.createVariableInstanceQuery().singleResult()).ByteArrayValueId; // when ByteArrayEntity byteArrayEntity = configuration.CommandExecutorTxRequired.execute(new GetByteArrayCommand(byteArrayValueId)); checkBinary(byteArrayEntity); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setupTestData() public virtual void setupTestData() { runtimeServiceMock = mock(typeof(RuntimeService)); variableInstanceQueryMock = mock(typeof(VariableInstanceQuery)); // mock runtime service. when(processEngine.RuntimeService).thenReturn(runtimeServiceMock); when(runtimeServiceMock.createVariableInstanceQuery()).thenReturn(variableInstanceQueryMock); }
private void createVariableInstanceMock() { IList <VariableInstance> variables = new List <VariableInstance>(); VariableInstance mockInstance = MockProvider.createMockVariableInstance(); variables.Add(mockInstance); VariableInstanceQuery mockVariableInstanceQuery = mock(typeof(VariableInstanceQuery)); when(mockVariableInstanceQuery.list()).thenReturn(variables); when(mockRuntimeService.createVariableInstanceQuery()).thenReturn(mockVariableInstanceQuery); }
public virtual void testSignalPayloadStart() { // given IDictionary <string, object> variables = new Dictionary <string, object>(); variables["payloadVar1"] = "payloadVal1"; variables["payloadVar2"] = "payloadVal2"; // when runtimeService.startProcessInstanceByKey("throwPayloadSignal", variables); // then Task catchingPiUserTask = taskService.createTaskQuery().singleResult(); IList <VariableInstance> catchingPiVariables = runtimeService.createVariableInstanceQuery().processInstanceIdIn(catchingPiUserTask.ProcessInstanceId).list(); assertEquals(2, catchingPiVariables.Count); foreach (VariableInstance variable in catchingPiVariables) { if (variable.Name.Equals("payloadVar1Target")) { assertEquals("payloadVal1", variable.Value); } else { assertEquals("payloadVal2", variable.Value); } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testVariableAtScopeExecutionBecomeNonScope() public virtual void testVariableAtScopeExecutionBecomeNonScope() { // given ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(ONE_BOUNDARY_TASK); ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(ProcessModels.ONE_TASK_PROCESS); 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, processInstance.Id); // and the variable is concurrent local, i.e. expands on tree expansion runtimeService.createProcessInstanceModification(processInstance.Id).startBeforeActivity("userTask").execute(); VariableInstance variableAfterExpansion = runtimeService.createVariableInstanceQuery().singleResult(); Assert.assertNotNull(variableAfterExpansion); Assert.assertNotSame(processInstance.Id, variableAfterExpansion.ExecutionId); }
static RuntimeAuthorizationQueryPerformanceTest() { ProcessEngine processEngine = PerfTestProcessEngine.Instance; RuntimeService runtimeService = processEngine.RuntimeService; TaskService taskService = processEngine.TaskService; queryResourcesAndPermissions = Arrays.asList <object[]>(new object[] { "ProcessInstanceQuery", runtimeService.createProcessInstanceQuery(), PROCESS_INSTANCE, new Permission[] { READ } }, new object[] { "VariableInstanceQuery", runtimeService.createVariableInstanceQuery(), PROCESS_INSTANCE, new Permission[] { READ } }, new object[] { "TaskQuery", taskService.createTaskQuery(), TASK, new Permission[] { READ } }); authentications = Arrays.asList(new AuthenticationAnonymousInnerClass(System.Linq.Enumerable.Empty <string>()) , new AuthenticationAnonymousInnerClass2(System.Linq.Enumerable.Empty <string>()) , new AuthenticationAnonymousInnerClass3(Arrays.asList("g0", "g1")) , new AuthenticationAnonymousInnerClass4(Arrays.asList("g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", "g8", "g9"))); }
protected internal virtual void verifySetVariables() { verifyVariableInstanceCount(1); assertNotNull(runtimeService.createVariableInstanceQuery().singleResult()); }