Exemple #1
0
        public virtual void executeSeedAndBatchJobs(IBatch batch)
        {
            ESS.FW.Bpm.Engine.Runtime.IJob job = engineRule.ManagementService.CreateJobQuery(c => c.JobDefinitionId == batch.SeedJobDefinitionId).First();
            // seed job
            engineRule.ManagementService.ExecuteJob(job.Id);

            foreach (ESS.FW.Bpm.Engine.Runtime.IJob pending in engineRule.ManagementService.CreateJobQuery(c => c.JobDefinitionId == batch.BatchJobDefinitionId).ToList())
            {
                engineRule.ManagementService.ExecuteJob(pending.Id);
            }
        }
        public virtual void deployProcessesAndCreateMigrationPlan()
        {
            IProcessDefinition sourceDefinition = testHelper.DeployAndGetDefinition(ProcessModels.OneTaskProcess);
            IProcessDefinition targetDefinition = testHelper.DeployAndGetDefinition(ProcessModels.OneTaskProcess);

            migrationPlan = engineRule.RuntimeService.CreateMigrationPlan(sourceDefinition.Id, targetDefinition.Id).MapEqualActivities().Build();

            IProcessInstance pi = engineRule.RuntimeService.StartProcessInstanceById(sourceDefinition.Id);

            batch1 = engineRule.RuntimeService.NewMigration(migrationPlan).ProcessInstanceIds((pi.Id)).ExecuteAsync();

            ESS.FW.Bpm.Engine.Runtime.IJob seedJob = engineRule.ManagementService.CreateJobQuery().First();
            engineRule.ManagementService.ExecuteJob(seedJob.Id);

            batch2 = engineRule.RuntimeService.NewMigration(migrationPlan).ProcessInstanceIds((pi.Id)).ExecuteAsync();
        }
Exemple #3
0
        public virtual void testSetJobPriority()
        {
            // given
            IProcessInstance processInstance = engineRule.RuntimeService.StartProcessInstanceByKey("process");

            ESS.FW.Bpm.Engine.Runtime.IJob job = engineRule.ManagementService.CreateJobQuery().First();

            // when
            authRule.Init(scenario).WithUser("userId").BindResource("ProcessInstanceId", processInstance.Id).BindResource("processDefinitionKey", "process").Start();

            engineRule.ManagementService.SetJobPriority(job.Id, 42);

            // then
            if (authRule.AssertScenario(scenario))
            {
                ESS.FW.Bpm.Engine.Runtime.IJob updatedJob = engineRule.ManagementService.CreateJobQuery().First();
                Assert.AreEqual(42, updatedJob.Priority);
            }
        }
        public virtual void testSetJobDefinitionPriority()
        {
            // given
            IJobDefinition   jobDefinition = engineRule.ManagementService.CreateJobDefinitionQuery().First();
            IProcessInstance instance      = engineRule.RuntimeService.StartProcessInstanceByKey("process");

            ESS.FW.Bpm.Engine.Runtime.IJob job = engineRule.ManagementService.CreateJobQuery().First();

            // when
            authRule.Init(scenario).WithUser("userId").BindResource("processDefinitionKey", "process").BindResource("ProcessInstanceId", instance.Id).Start();

            engineRule.ManagementService.SetOverridingJobPriorityForJobDefinition(jobDefinition.Id, 42, true);

            // then
            if (authRule.AssertScenario(scenario))
            {
                jobDefinition = engineRule.ManagementService.CreateJobDefinitionQuery().First();
                Assert.AreEqual(42L, (long)jobDefinition.OverridingJobPriority);

                job = engineRule.ManagementService.CreateJobQuery().First();
                Assert.AreEqual(42L, job.Priority);
            }
        }