Esempio n. 1
0
        public virtual void testRepositoryService()
        {
            string processDefinitionId = repositoryService.CreateProcessDefinitionQuery(c => c.Key == PROCESS_KEY).First().Id;

            IBpmnModelInstance modelInstance = repositoryService.GetBpmnModelInstance(processDefinitionId);

            Assert.NotNull(modelInstance);

            IEnumerable <IEvent> events = modelInstance.GetModelElementsByType <IEvent>(typeof(IEvent));

            Assert.AreEqual(2, events.Count());

            IEnumerable <ISequenceFlow> sequenceFlows = modelInstance.GetModelElementsByType <ISequenceFlow>(typeof(ISequenceFlow));

            Assert.AreEqual(1, sequenceFlows.Count());

            IStartEvent startEvent = (IStartEvent)modelInstance.GetModelElementById/*<IStartEvent>*/ ("start");

            Assert.NotNull(startEvent);
        }
        private void assertFlowElementIs(Type elementClass)
        {
            IBpmnModelInstance modelInstance = ModelExecutionContextExecutionListener.ModelInstance;

            Assert.NotNull(modelInstance);

            IModel model = modelInstance.Model;
            IEnumerable <IModelElementInstance> events = modelInstance.GetModelElementsByType(model.GetType(typeof(IEvent)));

            Assert.AreEqual(3, events.Count());
            IEnumerable <IModelElementInstance> gateways = modelInstance.GetModelElementsByType(model.GetType(typeof(IGateway)));

            Assert.AreEqual(1, gateways.Count());
            IEnumerable <IModelElementInstance> tasks = modelInstance.GetModelElementsByType(model.GetType(typeof(ITask)));

            Assert.AreEqual(1, tasks.Count());

            IFlowElement flowElement = ModelExecutionContextExecutionListener.FlowElement;

            Assert.NotNull(flowElement);
            Assert.True(elementClass.IsAssignableFrom(flowElement.GetType()));
        }
 public virtual IEnumerable <T> GetModelElementsByType <T>(Type referencingClass) where T : IModelElementInstance
 {
     return(modelInstance.GetModelElementsByType <T>(referencingClass));
 }