コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void setUp()
        {
            processEngineConfiguration = engineRule.ProcessEngineConfiguration;
            taskService    = engineRule.TaskService;
            runtimeService = engineRule.RuntimeService;

            authRule.createUserAndGroup("userId", "groupId");
            deploumentId = engineRule.RepositoryService.createDeployment().addClasspathResource(ONE_TASK_PROCESS).deployWithResult().Id;
            ensureSpecificVariablePermission = processEngineConfiguration.EnforceSpecificVariablePermission;

            // prerequisite of the whole test suite
            processEngineConfiguration.EnforceSpecificVariablePermission = true;
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void setUp()
        {
            ProcessEngine processEngine = rule.ProcessEngine;

            identityService   = processEngine.IdentityService;
            repositoryService = processEngine.RepositoryService;
            runtimeService    = processEngine.RuntimeService;
            taskService       = processEngine.TaskService;
            historyService    = processEngine.HistoryService;
            formService       = processEngine.FormService;

            identityService.clearAuthentication();
            identityService.setAuthentication("test", Arrays.asList("accounting"));
        }
コード例 #3
0
 protected internal virtual void initializeServices()
 {
     repositoryService    = processEngine.RepositoryService;
     runtimeService       = processEngine.RuntimeService;
     taskService          = processEngine.TaskService;
     historicDataService  = processEngine.HistoryService;
     historyService       = processEngine.HistoryService;
     identityService      = processEngine.IdentityService;
     managementService    = processEngine.ManagementService;
     formService          = processEngine.FormService;
     filterService        = processEngine.FilterService;
     authorizationService = processEngine.AuthorizationService;
     caseService          = processEngine.CaseService;
 }
コード例 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void setUp()
        {
            repositoryService   = engineRule.RepositoryService;
            historyService      = engineRule.HistoryService;
            runtimeService      = engineRule.RuntimeService;
            identityService     = engineRule.IdentityService;
            externalTaskService = engineRule.ExternalTaskService;

            testRule.deployForTenant(TENANT_ONE, ONE_EXTERNAL_TASK_PROCESS);
            testRule.deployForTenant(TENANT_TWO, ONE_EXTERNAL_TASK_PROCESS);

            startProcessInstanceAndFailExternalTask(TENANT_ONE);
            startProcessInstanceFailAndCompleteExternalTask(TENANT_TWO);
        }
コード例 #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void init()
        public virtual void init()
        {
            runtimeService      = engineRule.RuntimeService;
            formService         = engineRule.FormService;
            historyService      = engineRule.HistoryService;
            taskService         = engineRule.TaskService;
            managementService   = engineRule.ManagementService;
            repositoryService   = engineRule.RepositoryService;
            identityService     = engineRule.IdentityService;
            externalTaskService = engineRule.ExternalTaskService;
            decisionService     = engineRule.DecisionService;

            processEngineConfiguration = engineRule.ProcessEngineConfiguration;
        }
コード例 #6
0
        public virtual StartFormData createStartFormData(ProcessDefinitionEntity processDefinition)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration = Context.ProcessEngineConfiguration;
            IdentityService identityService = processEngineConfiguration.IdentityService;
            RuntimeService  runtimeService  = processEngineConfiguration.RuntimeService;

            logAuthentication(identityService);
            logInstancesCount(runtimeService);

            StartFormDataImpl result = new StartFormDataImpl();

            result.ProcessDefinition = processDefinition;
            return(result);
        }
コード例 #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void init()
        public virtual void init()
        {
            taskService = engineRule.TaskService;

            formService = engineRule.FormService;

            identityService = engineRule.IdentityService;

            runtimeService = engineRule.RuntimeService;

            repositoryService = engineRule.RepositoryService;

            processEngineConfiguration = engineRule.ProcessEngineConfiguration;
        }
コード例 #8
0
ファイル: TestFlowRunner.cs プロジェクト: spartajet/Testflow
 /// <summary>
 /// 销毁当前Runner
 /// </summary>
 public virtual void Dispose()
 {
     _runnerInst = null;
     DesignTimeService?.Dispose();
     RuntimeService?.Dispose();
     EngineController?.Dispose();
     DataMaintainer?.Dispose();
     SequenceManager?.Dispose();
     ComInterfaceManager?.Dispose();
     ResultManager?.Dispose();
     ParameterChecker?.Dispose();
     LogService?.Dispose();
     ConfigurationManager?.Dispose();
 }
コード例 #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void init()
        public virtual void init()
        {
            ProcessEngineConfigurationImpl config = engineRule.ProcessEngineConfiguration;

            optimizeService      = config.OptimizeService;
            identityService      = engineRule.IdentityService;
            runtimeService       = engineRule.RuntimeService;
            authorizationService = engineRule.AuthorizationService;
            taskService          = engineRule.TaskService;

            createUser(userId);
            createGroup();
            identityService.AuthenticatedUserId = userId;
        }
コード例 #10
0
        public virtual TaskFormData createTaskForm(TaskEntity task)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration = Context.ProcessEngineConfiguration;
            IdentityService identityService = processEngineConfiguration.IdentityService;
            RuntimeService  runtimeService  = processEngineConfiguration.RuntimeService;

            logAuthentication(identityService);
            logInstancesCount(runtimeService);

            TaskFormDataImpl result = new TaskFormDataImpl();

            result.Task = task;
            return(result);
        }
コード例 #11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test @Deployment public void ruleUsageExample()
        public virtual void ruleUsageExample()
        {
            RuntimeService runtimeService = engineRule.RuntimeService;

            runtimeService.startProcessInstanceByKey("ruleUsage");

            TaskService taskService = engineRule.TaskService;
            Task        task        = taskService.createTaskQuery().singleResult();

            assertEquals("My Task", task.Name);

            taskService.complete(task.Id);
            assertEquals(0, runtimeService.createProcessInstanceQuery().count());
        }
コード例 #12
0
        /// <summary>
        /// Setup will create
        ///   - 3 process instances, each with one timer, each firing at t1/t2/t3 + 1 hour (see process)
        ///   - 1 message
        /// </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void setUp()
        {
            processEngineConfiguration = rule.ProcessEngineConfiguration;
            runtimeService             = rule.RuntimeService;
            repositoryService          = rule.RepositoryService;
            managementService          = rule.ManagementService;
            commandExecutor            = processEngineConfiguration.CommandExecutorTxRequired;

            defaultEnsureJobDueDateSet = processEngineConfiguration.EnsureJobDueDateNotNull;
            processEngineConfiguration.EnsureJobDueDateNotNull = ensureJobDueDateSet;

            deploymentId = repositoryService.createDeployment().addClasspathResource("org/camunda/bpm/engine/test/api/mgmt/timerOnTask.bpmn20.xml").deploy().Id;

            // Create proc inst that has timer that will fire on t1 + 1 hour
            DateTime startTime = new DateTime();

            startTime.set(DateTime.MILLISECOND, 0);

            DateTime t1 = startTime;

            ClockUtil.CurrentTime = t1;
            processInstanceIdOne  = runtimeService.startProcessInstanceByKey("timerOnTask").Id;
            testStartTime         = t1;
            timerOneFireTime      = new DateTime(t1.Ticks + ONE_HOUR);

            // Create proc inst that has timer that will fire on t2 + 1 hour
            startTime.AddHours(1);
            DateTime t2 = startTime;     // t2 = t1 + 1 hour

            ClockUtil.CurrentTime = t2;
            processInstanceIdTwo  = runtimeService.startProcessInstanceByKey("timerOnTask").Id;
            timerTwoFireTime      = new DateTime(t2.Ticks + ONE_HOUR);

            // Create proc inst that has timer that will fire on t3 + 1 hour
            startTime.AddHours(1);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.Date t3 = startTime.getTime();
            DateTime t3 = startTime;     // t3 = t2 + 1 hour

            ClockUtil.CurrentTime  = t3;
            processInstanceIdThree = runtimeService.startProcessInstanceByKey("timerOnTask").Id;
            timerThreeFireTime     = new DateTime(t3.Ticks + ONE_HOUR);

            // Message.StartTime = Message.DueDate
            startTime.AddHours(2);
            messageDueDate = startTime;

            // Create one message
            messageId = commandExecutor.execute(new CommandAnonymousInnerClass(this));
        }
コード例 #13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUpRuntimeData()
        public virtual void setUpRuntimeData()
        {
            namedProcessEngine      = getProcessEngine(EXAMPLE_ENGINE_NAME);
            mockRepoService         = mock(typeof(RepositoryService));
            mockRuntimeService      = mock(typeof(RuntimeService));
            mockTaskService         = mock(typeof(TaskService));
            mockIdentityService     = mock(typeof(IdentityService));
            mockManagementService   = mock(typeof(ManagementService));
            mockHistoryService      = mock(typeof(HistoryService));
            mockCaseService         = mock(typeof(CaseService));
            mockFilterService       = mock(typeof(FilterService));
            mockExternalTaskService = mock(typeof(ExternalTaskService));

            when(namedProcessEngine.RepositoryService).thenReturn(mockRepoService);
            when(namedProcessEngine.RuntimeService).thenReturn(mockRuntimeService);
            when(namedProcessEngine.TaskService).thenReturn(mockTaskService);
            when(namedProcessEngine.IdentityService).thenReturn(mockIdentityService);
            when(namedProcessEngine.ManagementService).thenReturn(mockManagementService);
            when(namedProcessEngine.HistoryService).thenReturn(mockHistoryService);
            when(namedProcessEngine.CaseService).thenReturn(mockCaseService);
            when(namedProcessEngine.FilterService).thenReturn(mockFilterService);
            when(namedProcessEngine.ExternalTaskService).thenReturn(mockExternalTaskService);

            createProcessDefinitionMock();
            createProcessInstanceMock();
            createTaskMock();
            createIdentityMocks();
            createExecutionMock();
            createVariableInstanceMock();
            createJobDefinitionMock();
            createIncidentMock();
            createDeploymentMock();
            createMessageCorrelationBuilderMock();
            createCaseDefinitionMock();
            createCaseInstanceMock();
            createCaseExecutionMock();
            createFilterMock();
            createExternalTaskMock();

            createHistoricActivityInstanceMock();
            createHistoricProcessInstanceMock();
            createHistoricVariableInstanceMock();
            createHistoricActivityStatisticsMock();
            createHistoricDetailMock();
            createHistoricTaskInstanceMock();
            createHistoricIncidentMock();
            createHistoricJobLogMock();
            createHistoricExternalTaskLogMock();
        }
コード例 #14
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void deployTestProcesses() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void deployTestProcesses()
        {
            org.camunda.bpm.engine.repository.Deployment deployment = engineRule.RepositoryService.createDeployment().addClasspathResource("org/camunda/bpm/engine/test/api/externaltask/oneExternalTaskProcess.bpmn20.xml").addClasspathResource("org/camunda/bpm/engine/test/api/externaltask/externalTaskPriorityExpression.bpmn20.xml").deploy();

            engineRule.manageDeployment(deployment);

            RuntimeService runtimeService = engineRule.RuntimeService;

            processInstanceIds = new List <string>();
            for (int i = 0; i < 4; i++)
            {
                processInstanceIds.Add(runtimeService.startProcessInstanceByKey(PROCESS_DEFINITION_KEY, i + "").Id);
            }
            processInstanceIds.Add(runtimeService.startProcessInstanceByKey(PROCESS_DEFINITION_KEY_2).Id);
        }
コード例 #15
0
        public virtual void testSubProcessVariableSetValueOnParent()
        {
            //given process with intermediate conditional event and variable with wrong value
            IDictionary <string, object> variables = ESS.FW.Bpm.Engine.Variable.Variables.CreateVariables();

            variables[VariableName] = 0;
            IProcessInstance procInst = RuntimeService.StartProcessInstanceByKey(ConditionalEventProcessKey, variables);

            //when variable is set to correct value
            RuntimeService.SetVariable(procInst.Id, VariableName, 1);

            //then process instance is ended, since condition was true
            procInst = RuntimeService.CreateProcessInstanceQuery(c => c.ProcessDefinitionId == ConditionalEventProcessKey).First();
            Assert.IsNull(procInst);
        }
コード例 #16
0
        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());
        }
コード例 #17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void init()
        public virtual void init()
        {
            taskService       = engineRule.TaskService;
            repositoryService = engineRule.RepositoryService;
            historyService    = engineRule.HistoryService;
            runtimeService    = engineRule.RuntimeService;

            // create sample identity link
            BpmnModelInstance oneTaskProcess = Bpmn.createExecutableProcess("testProcess").startEvent().userTask("task").camundaCandidateUsers(A_USER_ID).endEvent().done();

            // deploy tenants
            testRule.deployForTenant(TENANT_1, oneTaskProcess);
            testRule.deployForTenant(TENANT_2, oneTaskProcess);
            testRule.deployForTenant(TENANT_3, oneTaskProcess);
        }
コード例 #18
0
 protected internal virtual void clearServiceReferences()
 {
     processEngineConfiguration = null;
     repositoryService          = null;
     runtimeService             = null;
     taskService          = null;
     formService          = null;
     historyService       = null;
     identityService      = null;
     managementService    = null;
     authorizationService = null;
     caseService          = null;
     filterService        = null;
     externalTaskService  = null;
     decisionService      = null;
 }
コード例 #19
0
 protected internal virtual void initializeServices()
 {
     processEngineConfiguration = ((ProcessEngineImpl)processEngine).ProcessEngineConfiguration;
     repositoryService          = processEngine.RepositoryService;
     runtimeService             = processEngine.RuntimeService;
     taskService          = processEngine.TaskService;
     formService          = processEngine.FormService;
     historyService       = processEngine.HistoryService;
     identityService      = processEngine.IdentityService;
     managementService    = processEngine.ManagementService;
     authorizationService = processEngine.AuthorizationService;
     caseService          = processEngine.CaseService;
     filterService        = processEngine.FilterService;
     externalTaskService  = processEngine.ExternalTaskService;
     decisionService      = processEngine.DecisionService;
 }
コード例 #20
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setupMocks()
        public virtual void setupMocks()
        {
            runtimeServiceMock = mock(typeof(RuntimeService));
            when(processEngine.RuntimeService).thenReturn(runtimeServiceMock);

            conditionEvaluationBuilderMock = mock(typeof(ConditionEvaluationBuilderImpl));

            when(runtimeServiceMock.createConditionEvaluation()).thenReturn(conditionEvaluationBuilderMock);
            when(conditionEvaluationBuilderMock.processDefinitionId(anyString())).thenReturn(conditionEvaluationBuilderMock);
            when(conditionEvaluationBuilderMock.processInstanceBusinessKey(anyString())).thenReturn(conditionEvaluationBuilderMock);
            when(conditionEvaluationBuilderMock.setVariables(Matchers.any <IDictionary <string, object> >())).thenReturn(conditionEvaluationBuilderMock);
            when(conditionEvaluationBuilderMock.setVariable(anyString(), any())).thenReturn(conditionEvaluationBuilderMock);

            processInstancesMock = MockProvider.createAnotherMockProcessInstanceList();
            when(conditionEvaluationBuilderMock.evaluateStartConditions()).thenReturn(processInstancesMock);
        }
コード例 #21
0
            protected override int ExecuteCommand <TProgram>()
            {
                var service = new RuntimeService(typeof(TProgram).Assembly);

                var result = (int)HostFactory.Run(host =>
                {
                    host.UseSerilog(SerilogAdapter.Logger);

                    host.Service(() => service);

                    new TProgram().ConfigureHost(host);
                });

                Restarted = service.Restarted;

                return(result);
            }
コード例 #22
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testQueryWhen1InstanceActive()
        public virtual void testQueryWhen1InstanceActive()
        {
            // given
            Assume.assumeTrue(engineRule.ProcessEngineConfiguration.DatabaseType.Equals("oracle"));
            RuntimeService runtimeService = engineRule.RuntimeService;

            testRule.deploy(ProcessModels.TWO_TASKS_PROCESS);

            // when
            ProcessInstance processInstance    = runtimeService.startProcessInstanceByKey("Process", Variables.createVariables().putValue("foo", "bar"));
            string          activityInstanceId = runtimeService.getActivityInstance(processInstance.Id).Id;

            // then
            IList <VariableInstance> variables = engineRule.RuntimeService.createVariableInstanceQuery().activityInstanceIdIn(activityInstanceId).list();

            assertEquals(1, variables.Count);
        }
コード例 #23
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void initMetrics() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void initMetrics()
        {
            runtimeService             = ENGINE_RULE.RuntimeService;
            processEngineConfiguration = ENGINE_RULE.ProcessEngineConfiguration;
            managementService          = ENGINE_RULE.ManagementService;

            //clean up before start
            clearMetrics();

            //init metrics
            processEngineConfiguration.DbMetricsReporterActivate = true;
            lastReporterId = processEngineConfiguration.DbMetricsReporter.MetricsCollectionTask.Reporter;
            processEngineConfiguration.DbMetricsReporter.ReporterId = REPORTER_ID;
            metricsRegistry = processEngineConfiguration.MetricsRegistry;
            rand            = new Random((DateTime.Now).Ticks);
            generateMeterData(3, DEFAULT_INTERVAL_MILLIS);
        }
コード例 #24
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void init()
        public virtual void init()
        {
            processEngineConfiguration = engineRule.ProcessEngineConfiguration;
            identityService            = engineRule.IdentityService;
            authorizationService       = engineRule.AuthorizationService;
            taskService    = engineRule.TaskService;
            runtimeService = engineRule.RuntimeService;

            enforceSpecificVariablePermission = processEngineConfiguration.EnforceSpecificVariablePermission;
            processEngineConfiguration.EnforceSpecificVariablePermission = true;

            User user = identityService.newUser(userId);

            identityService.saveUser(user);
            identityService.AuthenticatedUserId = userId;
            authRule.createGrantAuthorization(Resources.AUTHORIZATION, "*", userId, Permissions.CREATE);
        }
コード例 #25
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUpRuntimeData()
        public virtual void setUpRuntimeData()
        {
            runtimeServiceMock = mock(typeof(RuntimeService));
            when(processEngine.RuntimeService).thenReturn(runtimeServiceMock);

            modificationBuilderMock = mock(typeof(ModificationBuilder));
            when(modificationBuilderMock.cancelAllForActivity(anyString())).thenReturn(modificationBuilderMock);
            when(modificationBuilderMock.startAfterActivity(anyString())).thenReturn(modificationBuilderMock);
            when(modificationBuilderMock.startBeforeActivity(anyString())).thenReturn(modificationBuilderMock);
            when(modificationBuilderMock.startTransition(anyString())).thenReturn(modificationBuilderMock);
            when(modificationBuilderMock.processInstanceIds(anyListOf(typeof(string)))).thenReturn(modificationBuilderMock);

            Batch batchMock = createMockBatch();

            when(modificationBuilderMock.executeAsync()).thenReturn(batchMock);

            when(runtimeServiceMock.createModification(anyString())).thenReturn(modificationBuilderMock);
        }
コード例 #26
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @After public void tearDownCdiProcessEngineTestCase() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        public virtual void tearDownCdiProcessEngineTestCase()
        {
            org.camunda.bpm.container.RuntimeContainerDelegate_Fields.INSTANCE.get().unregisterProcessEngine(processEngine);
            beanManager   = null;
            processEngine = null;
            processEngineConfiguration = null;
            formService          = null;
            historyService       = null;
            identityService      = null;
            managementService    = null;
            repositoryService    = null;
            runtimeService       = null;
            taskService          = null;
            authorizationService = null;
            filterService        = null;
            externalTaskService  = null;
            caseService          = null;
            decisionService      = null;
            processEngineRule    = null;
        }
コード例 #27
0
        public virtual void testFalseCondition()
        {
            //given process with intermediate conditional event
            IProcessInstance procInst = RuntimeService.StartProcessInstanceByKey(ConditionalEventProcessKey);

            IQueryable <ITask> taskQuery = TaskService.CreateTaskQuery();
            ITask task = taskQuery.Where(c => c.ProcessInstanceId == procInst.Id).First();

            Assert.NotNull(task);
            Assert.AreEqual(TaskBeforeCondition, task.Name);

            //when task before condition is completed
            TaskService.Complete(task.Id);

            //then next wait state is on conditional event, since condition is false
            //and a condition event subscription is create
            IExecution execution = RuntimeService.CreateExecutionQuery(c => c.ProcessInstanceId == procInst.Id && c.ActivityId == ConditionalEvent).First();

            Assert.NotNull(execution);
            Assert.AreEqual(1, ConditionEventSubscriptionQuery.Count());
        }
コード例 #28
0
        public virtual void TestTimerJobsArePreferred()
        {
            // first start process with timer job
            RuntimeService.StartProcessInstanceByKey("testProcess");
            // then start process with async task
            RuntimeService.StartProcessInstanceByKey("simpleAsyncProcess");
            // then start process with timer job
            RuntimeService.StartProcessInstanceByKey("testProcess");
            // and another process with async task
            RuntimeService.StartProcessInstanceByKey("simpleAsyncProcess");

            // increment clock so that timer events are acquirable
            ClockTestUtil.IncrementClock(70);

            var acquirableJobs = FindAcquirableJobs();

            Assert.AreEqual(4, acquirableJobs.Count);
            Assert.True(acquirableJobs[0] is TimerEntity);
            Assert.True(acquirableJobs[1] is TimerEntity);
            Assert.True(acquirableJobs[2] is MessageEntity);
            Assert.True(acquirableJobs[3] is MessageEntity);
        }
コード例 #29
0
        public virtual void TestTimerAndOldJobsArePreferred()
        {
            // first start process with timer job
            var timerProcess1 = RuntimeService.StartProcessInstanceByKey("testProcess");

            // then start process with async task
            ClockTestUtil.IncrementClock(1);
            var asyncProcess1 = RuntimeService.StartProcessInstanceByKey("simpleAsyncProcess");

            // then start process with timer job
            ClockTestUtil.IncrementClock(1);
            var timerProcess2 = RuntimeService.StartProcessInstanceByKey("testProcess");

            // and another process with async task after the timers are acquirable
            ClockTestUtil.IncrementClock(61);
            var asyncProcess2 = RuntimeService.StartProcessInstanceByKey("simpleAsyncProcess");

            var timerJob1   = ManagementService.CreateJobQuery(c => c.ProcessInstanceId == timerProcess1.Id).First();
            var timerJob2   = ManagementService.CreateJobQuery(c => c.ProcessInstanceId == timerProcess2.Id).First();
            var messageJob1 = ManagementService.CreateJobQuery(c => c.ProcessInstanceId == asyncProcess1.Id).First();
            var messageJob2 = ManagementService.CreateJobQuery(c => c.ProcessInstanceId == asyncProcess2.Id).First();

            Assert.NotNull(timerJob1.Duedate);
            Assert.NotNull(timerJob2.Duedate);
            Assert.NotNull(messageJob1.Duedate);
            Assert.NotNull(messageJob2.Duedate);

            Assert.True(messageJob1.Duedate < timerJob1.Duedate);
            Assert.True(timerJob1.Duedate < timerJob2.Duedate);
            Assert.True(timerJob2.Duedate < messageJob2.Duedate);

            var acquirableJobs = FindAcquirableJobs();

            Assert.AreEqual(4, acquirableJobs.Count);
            Assert.AreEqual(timerJob1.Id, acquirableJobs[0].Id);
            Assert.AreEqual(timerJob2.Id, acquirableJobs[1].Id);
            Assert.AreEqual(messageJob1.Id, acquirableJobs[2].Id);
            Assert.AreEqual(messageJob2.Id, acquirableJobs[3].Id);
        }
コード例 #30
0
        public virtual void signalExecution(ExecutionTriggerDto triggerDto)
        {
            RuntimeService runtimeService = engine.RuntimeService;

            try
            {
                VariableMap variables = VariableValueDto.toMap(triggerDto.Variables, engine, objectMapper);
                runtimeService.signal(executionId, variables);
            }
            catch (RestException e)
            {
                string errorMessage = string.Format("Cannot signal execution {0}: {1}", executionId, e.Message);
                throw new InvalidRequestException(e.Status, e, errorMessage);
            }
            catch (AuthorizationException e)
            {
                throw e;
            }
            catch (ProcessEngineException e)
            {
                throw new RestException(Status.INTERNAL_SERVER_ERROR, e, "Cannot signal execution " + executionId + ": " + e.Message);
            }
        }
コード例 #31
0
 public RuntimeServiceBuilder()
 {
     context = new RuntimeService();
 }