コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void getEvent()
        public virtual void getEvent()
        {
            Stream inputStream            = ReflectUtil.getResourceAsStream("org/camunda/bpm/model/bpmn/EventDefinitionsTest.xml");
            IntermediateThrowEvent @event = Bpmn.readModelFromStream(inputStream).getModelElementById("event");

            eventDefinitionQuery = new QueryImpl <EventDefinition>(@event.EventDefinitions);
        }
コード例 #2
0
        protected internal virtual ISet <string> retrieveProcessKeysFromResources(IDictionary <string, ResourceEntity> resources)
        {
            ISet <string> keys = new HashSet <string>();

            foreach (ResourceEntity resource in resources.Values)
            {
                if (isBpmnResource(resource))
                {
                    MemoryStream      byteStream = new MemoryStream(resource.Bytes);
                    BpmnModelInstance model      = Bpmn.readModelFromStream(byteStream);
                    foreach (Process process in model.Definitions.getChildElementsByType(typeof(Process)))
                    {
                        keys.Add(process.Id);
                    }
                }
                else if (isCmmnResource(resource))
                {
                    MemoryStream      byteStream = new MemoryStream(resource.Bytes);
                    CmmnModelInstance model      = Cmmn.readModelFromStream(byteStream);
                    foreach (Case cmmnCase in model.Definitions.Cases)
                    {
                        keys.Add(cmmnCase.Id);
                    }
                }
            }

            return(keys);
        }
コード例 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before @SuppressWarnings("unchecked") public void getGateway()
        public virtual void getGateway()
        {
            Stream inputStream = ReflectUtil.getResourceAsStream("org/camunda/bpm/model/bpmn/GatewaysTest.xml");
            ICollection <ModelElementInstance> elementInstances = Bpmn.readModelFromStream(inputStream).getModelElementsByType(modelElementType);

            assertThat(elementInstances).hasSize(1);
            gateway = (G)elementInstances.GetEnumerator().next();
            assertThat(gateway.GatewayDirection).isEqualTo(GatewayDirection.Mixed);
        }
コード例 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReadTransaction()
        public virtual void shouldReadTransaction()
        {
            Stream      inputStream = ReflectUtil.getResourceAsStream("org/camunda/bpm/model/bpmn/TransactionTest.xml");
            Transaction transaction = Bpmn.readModelFromStream(inputStream).getModelElementById("transaction");

            assertThat(transaction).NotNull;
            assertThat(transaction.Method).isEqualTo(TransactionMethod.Image);
            assertThat(transaction.FlowElements).hasSize(1);
        }
コード例 #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void parseModel()
        public virtual void parseModel()
        {
            modelInstance        = Bpmn.readModelFromStream(this.GetType().getResourceAsStream(this.GetType().Name + ".xml"));
            flow1                = modelInstance.getModelElementById("flow1");
            flow2                = modelInstance.getModelElementById("flow2");
            flow3                = modelInstance.getModelElementById("flow3");
            conditionExpression1 = flow1.ConditionExpression;
            conditionExpression2 = flow2.ConditionExpression;
            conditionExpression3 = flow3.ConditionExpression;
        }
コード例 #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotImportWrongOrderedSequence()
        public virtual void shouldNotImportWrongOrderedSequence()
        {
            try
            {
                Bpmn.readModelFromStream(this.GetType().getResourceAsStream("DefinitionsTest.shouldNotImportWrongOrderedSequence.bpmn"));
                Assert.fail("Model is invalid and should not pass the validation");
            }
            catch (Exception e)
            {
                assertThat(e).isInstanceOf(typeof(ModelParseException));
            }
        }
コード例 #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void parseModel()
        public virtual void parseModel()
        {
            modelInstance        = Bpmn.readModelFromStream(this.GetType().getResourceAsStream(this.GetType().Name + ".xml"));
            collaboration        = modelInstance.getModelElementById(COLLABORATION_ID);
            participant          = modelInstance.getModelElementById(PARTICIPANT_ID + 1);
            process              = modelInstance.getModelElementById(PROCESS_ID + 1);
            serviceTask          = modelInstance.getModelElementById(SERVICE_TASK_ID);
            exclusiveGateway     = modelInstance.getModelElementById(EXCLUSIVE_GATEWAY);
            startEvent           = modelInstance.getModelElementById(START_EVENT_ID + 2);
            sequenceFlow         = modelInstance.getModelElementById(SEQUENCE_FLOW_ID + 3);
            messageFlow          = modelInstance.getModelElementById(MESSAGE_FLOW_ID);
            dataInputAssociation = modelInstance.getModelElementById(DATA_INPUT_ASSOCIATION_ID);
            association          = modelInstance.getModelElementById(ASSOCIATION_ID);
            endEvent             = modelInstance.getModelElementById(END_EVENT_ID + 2);
        }
コード例 #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void modifyingElementWithActivitiNsKeepsIt()
        public virtual void modifyingElementWithActivitiNsKeepsIt()
        {
            BpmnModelInstance modelInstance     = Bpmn.readModelFromStream(typeof(CamundaExtensionsTest).getResourceAsStream("CamundaExtensionsCompatabilityTest.xml"));
            ProcessImpl       process           = modelInstance.getModelElementById(PROCESS_ID);
            ExtensionElements extensionElements = process.ExtensionElements;
            ICollection <CamundaExecutionListener> listeners = extensionElements.getChildElementsByType(typeof(CamundaExecutionListener));
            string listenerClass = "org.foo.Bar";

            foreach (CamundaExecutionListener listener in listeners)
            {
                listener.CamundaClass = listenerClass;
            }
            foreach (CamundaExecutionListener listener in listeners)
            {
                assertThat(listener.getAttributeValueNs(BpmnModelConstants.ACTIVITI_NS, "class"), @is(listenerClass));
            }
        }
コード例 #9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void modifyingAttributeWithActivitiNsKeepsIt()
        public virtual void modifyingAttributeWithActivitiNsKeepsIt()
        {
            BpmnModelInstance modelInstance = Bpmn.readModelFromStream(typeof(CamundaExtensionsTest).getResourceAsStream("CamundaExtensionsCompatabilityTest.xml"));
            ProcessImpl       process       = modelInstance.getModelElementById(PROCESS_ID);
            string            priority      = "9000";

            process.CamundaJobPriority  = priority;
            process.CamundaTaskPriority = priority;
            int?historyTimeToLive = 10;

            process.CamundaHistoryTimeToLive     = historyTimeToLive;
            process.CamundaIsStartableInTasklist = false;
            process.CamundaVersionTag            = "v1.0.0";
            assertThat(process.getAttributeValueNs(BpmnModelConstants.ACTIVITI_NS, "jobPriority"), @is(priority));
            assertThat(process.getAttributeValueNs(BpmnModelConstants.ACTIVITI_NS, "taskPriority"), @is(priority));
            assertThat(process.getAttributeValueNs(BpmnModelConstants.ACTIVITI_NS, "historyTimeToLive"), @is(historyTimeToLive.ToString()));
            assertThat(process.CamundaStartableInTasklist, @is(false));
            assertThat(process.CamundaVersionTag, @is("v1.0.0"));
        }
コード例 #10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotGenerateIdsOnRead()
        public virtual void shouldNotGenerateIdsOnRead()
        {
            BpmnModelInstance modelInstance = Bpmn.readModelFromStream(typeof(GenerateIdTest).getResourceAsStream("GenerateIdTest.bpmn"));
            Definitions       definitions   = modelInstance.Definitions;

            assertThat(definitions.Id).Null;

            Process process = modelInstance.getModelElementsByType(typeof(Process)).GetEnumerator().next();

            assertThat(process.Id).Null;

            StartEvent startEvent = modelInstance.getModelElementsByType(typeof(StartEvent)).GetEnumerator().next();

            assertThat(startEvent.Id).Null;

            UserTask userTask = modelInstance.getModelElementsByType(typeof(UserTask)).GetEnumerator().next();

            assertThat(userTask.Id).Null;
        }
コード例 #11
0
        protected internal override void starting(Description description)
        {
            if (description.getAnnotation(typeof(BpmnModelResource)) != null)
            {
                Type   testClass  = description.TestClass;
                string methodName = description.MethodName;

//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
                string resourceFolderName = testClass.FullName.replaceAll("\\.", "/");
                string bpmnResourceName   = resourceFolderName + "." + methodName + ".bpmn";

                Stream resourceAsStream = this.GetType().ClassLoader.getResourceAsStream(bpmnResourceName);
                try
                {
                    bpmnModelInstance = Bpmn.readModelFromStream(resourceAsStream);
                }
                finally
                {
                    IoUtil.closeSilently(resourceAsStream);
                }
            }
        }
コード例 #12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @BeforeClass public static void parseModel()
        public static void parseModel()
        {
            modelInstance = Bpmn.readModelFromStream(typeof(DataObjectsTest).getResourceAsStream("DataObjectTest.bpmn"));
        }
コード例 #13
0
 protected internal override BpmnModelInstance readModelFromStream(Stream bpmnResourceInputStream)
 {
     return(Bpmn.readModelFromStream(bpmnResourceInputStream));
 }
コード例 #14
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @BeforeClass public static void parseModel()
        public static void parseModel()
        {
            modelInstance = Bpmn.readModelFromStream(typeof(TextAnnotationTest).getResourceAsStream("TextAnnotationTest.bpmn"));
        }
コード例 #15
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @BeforeClass public static void parseModel()
        public static void parseModel()
        {
            modelInstance = Bpmn.readModelFromStream(typeof(CollaborationParserTest).getResourceAsStream("CollaborationParserTest.bpmn"));
            collaboration = modelInstance.getModelElementById("collaboration1");
        }