예제 #1
0
        public virtual void TestDeleteNonExistingAndCreateNewJobDefinitionWithParseListener()
        {
            //given
            //var modelFileName = "jobexecutor/jobCreationWithinParseListener.bpmn20.xml";
            //var @in = ReflectUtil.GetResourceAsStream(modelFileName);
            //var builder = EngineRule.RepositoryService.CreateDeployment().AddInputStream(modelFileName, @in);
            //var deployment = builder.Deploy();

            var deployment = EngineRule.RepositoryService.CreateDeployment()
                             .Name(ClassNameUtil.GetClassNameWithoutPackage(this.GetType()) + "." + TestContext.CurrentContext.Test.Name)
                             .AddClasspathResource("resources/jobexecutor/jobCreationWithinParseListener.bpmn20.xml").Deploy();

            //when the asyncBefore is set to false and the asyncAfter to true in the parse listener

            EngineRule.ManageDeployment(deployment);

            //then there exists one job definition
            var query  = EngineRule.ManagementService.CreateJobDefinitionQuery();
            var jobDef = query.First();

            Assert.NotNull(jobDef);
            Assert.AreEqual(jobDef.ProcessDefinitionKey, "oneTaskProcess");
            Assert.AreEqual(jobDef.ActivityId, "servicetask1");
            Assert.AreEqual(jobDef.JobConfiguration, MessageJobDeclaration.AsyncAfter);
        }
예제 #2
0
        public virtual void TestCreateBothAsyncJobDefinitionWithParseListener()
        {
            //given
            //var modelFileName = "jobexecutor/jobCreationWithinParseListener.bpmn20.xml";
            //var @in = ReflectUtil.GetResourceAsStream(modelFileName);
            //var builder = EngineRule.RepositoryService.CreateDeployment().AddInputStream(modelFileName, @in);
            ////when the asyncBefore and asyncAfter is set to true in the parse listener
            //var deployment = builder.Deploy();

            var deployment = EngineRule.RepositoryService.CreateDeployment()
                             .Name(ClassNameUtil.GetClassNameWithoutPackage(this.GetType()) + "." + TestContext.CurrentContext.Test.Name)
                             .AddClasspathResource("resources/jobexecutor/jobCreationWithinParseListener.bpmn20.xml").Deploy();

            EngineRule.ManageDeployment(deployment);

            //then there exists two job definitions
            var query       = EngineRule.ManagementService.CreateJobDefinitionQuery();
            var definitions = query.OrderBy(c => c.JobConfiguration).ToList();

            Assert.AreEqual(definitions.Count, 2);

            //asyncAfter
            var asyncAfterAfter = definitions[0];

            Assert.AreEqual(asyncAfterAfter.ProcessDefinitionKey, "oneTaskProcess");
            Assert.AreEqual(asyncAfterAfter.ActivityId, "servicetask1");
            Assert.AreEqual(asyncAfterAfter.JobConfiguration, MessageJobDeclaration.AsyncAfter);

            //asyncBefore
            var asyncAfterBefore = definitions[1];

            Assert.AreEqual(asyncAfterBefore.ProcessDefinitionKey, "oneTaskProcess");
            Assert.AreEqual(asyncAfterBefore.ActivityId, "servicetask1");
            Assert.AreEqual(asyncAfterBefore.JobConfiguration, MessageJobDeclaration.AsyncBefore);
        }
예제 #3
0
        protected internal virtual void DeployConditionalEventSubProcess(IBpmnModelInstance model, string parentId, string conditionExpr, bool isInterrupting)
        {
            //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
            //ORIGINAL LINE: final org.Camunda.bpm.Model.bpmn.IBpmnModelInstance modelInstance = addConditionalEventSubProcess(model, parentId, conditionExpr, TASK_AFTER_CONDITION_ID, isInterrupting);
            IBpmnModelInstance modelInstance = AddConditionalEventSubProcess(model, parentId, conditionExpr, TaskAfterConditionId, isInterrupting);

            Engine.ManageDeployment(RepositoryService.CreateDeployment().AddModelInstance(ConditionalModel, modelInstance).Deploy());
        }
 protected internal virtual void deployAndStartProcess(IBpmnModelInstance modelInstance,
                                                       IBpmnModelInstance testProcess)
 {
     engineRule.ManageDeployment(engineRule.RepositoryService.CreateDeployment()
                                 .AddModelInstance("process.bpmn", modelInstance)
                                 .Deploy());
     engineRule.ManageDeployment(engineRule.RepositoryService.CreateDeployment()
                                 .AddModelInstance("testProcess.bpmn", testProcess)
                                 .Deploy());
     engineRule.RuntimeService.StartProcessInstanceByKey(PROCESS_ID);
 }
        public virtual void TestDeleteNonExistingJobDefinitionWithParseListener()
        {
            ////given
            //var modelFileName = "jobexecutor/jobCreationWithinParseListener.bpmn20.xml";
            //var @in = ReflectUtil.GetResourceAsStream(modelFileName);
            //var builder = EngineRule.RepositoryService.CreateDeployment().AddInputStream(modelFileName, @in);
            ////when the asyncBefore is set to false in the parse listener
            //var deployment = builder.Deploy();

            var deployment = EngineRule.RepositoryService.CreateDeployment()
                             .Name(ClassNameUtil.GetClassNameWithoutPackage(this.GetType()) + "." + TestContext.CurrentContext.Test.Name)
                             .AddClasspathResource("resources/jobexecutor/jobCreationWithinParseListener.bpmn20.xml").Deploy();

            EngineRule.ManageDeployment(deployment);
            //then there exists no job definition
            var query = EngineRule.ManagementService.CreateJobDefinitionQuery();

            Assert.IsNull(query.SingleOrDefault());
        }
        //JAVA TO C# CONVERTER TODO Resources.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()
        {
            IDeployment deployment = engineRule.RepositoryService.CreateDeployment().AddClasspathResource("resources/api/externaltask/oneExternalTaskProcess.bpmn20.xml").AddClasspathResource("resources/api/externaltask/externalTaskPriorityExpression.bpmn20.xml").Deploy();

            engineRule.ManageDeployment(deployment);

            IRuntimeService 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);
        }
예제 #7
0
        public virtual void testProcessWithoutConditionalEvent()
        {
            //given
            //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.GetName method:
            IBpmnModelInstance modelInstance = ESS.FW.Bpm.Model.Bpmn.Bpmn.CreateExecutableProcess(AbstractConditionalEventTestCase.ConditionalEventProcessKey)
                                               .StartEvent().ServiceTask().CamundaClass(typeof(CheckNoDelayedVariablesDelegate).FullName).UserTask().EndEvent().Done();

            //when process is deployed and instance created
            rule.ManageDeployment(rule.RepositoryService.CreateDeployment().AddModelInstance(AbstractConditionalEventTestCase.ConditionalModel, modelInstance).Deploy());
            ProcessInstanceWithVariablesImpl processInstance = (ProcessInstanceWithVariablesImpl)rule.RuntimeService.StartProcessInstanceByKey(AbstractConditionalEventTestCase.ConditionalEventProcessKey);

            //then process definition contains no property which indicates that conditional events exists
            object property = (processInstance.ExecutionEntity as ExecutionEntity).ProcessDefinition.GetProperty(BpmnParse.PropertynameHasConditionalEvents);

            Assert.IsNull(property);
        }