//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void createModel() public virtual void createModel() { testBpmnModelInstance = Bpmn.createEmptyModel(); Definitions definitions = testBpmnModelInstance.newInstance(typeof(Definitions)); testBpmnModelInstance.Definitions = definitions; message = testBpmnModelInstance.newInstance(typeof(Message)); message.Id = "message-id"; definitions.RootElements.Add(message); Process process = testBpmnModelInstance.newInstance(typeof(Process)); process.Id = "process-id"; definitions.RootElements.Add(process); startEvent = testBpmnModelInstance.newInstance(typeof(StartEvent)); startEvent.Id = "start-event-id"; process.FlowElements.Add(startEvent); messageEventDefinition = testBpmnModelInstance.newInstance(typeof(MessageEventDefinition)); messageEventDefinition.Id = "msg-def-id"; messageEventDefinition.Message = message; startEvent.EventDefinitions.Add(messageEventDefinition); startEvent.EventDefinitionRefs.Add(messageEventDefinition); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void createEmptyModel() public virtual void createEmptyModel() { modelInstance = Bpmn.createEmptyModel(); definitions = modelInstance.newInstance(typeof(Definitions)); definitions.TargetNamespace = "http://camunda.org/examples"; modelInstance.Definitions = definitions; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldAddParentChildElementInCorrectOrder() public virtual void shouldAddParentChildElementInCorrectOrder() { // create empty model BpmnModelInstance bpmnModelInstance = Bpmn.createEmptyModel(); // add definitions to model Definitions definitions = bpmnModelInstance.newInstance(typeof(Definitions)); definitions.TargetNamespace = "Examples"; bpmnModelInstance.Definitions = definitions; // add process Process process = bpmnModelInstance.newInstance(typeof(Process)); process.Id = "messageEventDefinition"; definitions.RootElements.Add(process); // add start event StartEvent startEvent = bpmnModelInstance.newInstance(typeof(StartEvent)); startEvent.Id = "theStart"; process.FlowElements.Add(startEvent); // create and add message Message message = bpmnModelInstance.newInstance(typeof(Message)); message.Id = "start-message-id"; definitions.RootElements.Add(message); // add message event definition to start event MessageEventDefinition startEventMessageEventDefinition = bpmnModelInstance.newInstance(typeof(MessageEventDefinition)); startEventMessageEventDefinition.Message = message; startEvent.EventDefinitions.Add(startEventMessageEventDefinition); // add property after message event definition Property property = bpmnModelInstance.newInstance(typeof(Property)); startEvent.Properties.Add(property); // finally add an extensions element ExtensionElements extensionElements = bpmnModelInstance.newInstance(typeof(ExtensionElements)); process.ExtensionElements = extensionElements; // validate model try { Bpmn.validateModel(bpmnModelInstance); } catch (ModelValidationException) { Assert.fail(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testExtendingTypeCalculation() public virtual void testExtendingTypeCalculation() { BpmnModelInstance bpmnModelInstance = Bpmn.createEmptyModel(); Model model = bpmnModelInstance.Model; IList <ModelElementType> baseInstanceTypes = new List <ModelElementType>(); baseInstanceTypes.Add(model.getType(typeof(Event))); baseInstanceTypes.Add(model.getType(typeof(CatchEvent))); baseInstanceTypes.Add(model.getType(typeof(ExtensionElements))); baseInstanceTypes.Add(model.getType(typeof(EventDefinition))); ICollection <ModelElementType> allExtendingTypes = ModelUtil.calculateAllExtendingTypes(bpmnModelInstance.Model, baseInstanceTypes); assertThat(allExtendingTypes).hasSize(17); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testBaseTypeCalculation() public virtual void testBaseTypeCalculation() { BpmnModelInstance bpmnModelInstance = Bpmn.createEmptyModel(); Model model = bpmnModelInstance.Model; ICollection <ModelElementType> allBaseTypes = ModelUtil.calculateAllBaseTypes(model.getType(typeof(StartEvent))); assertThat(allBaseTypes).hasSize(5); allBaseTypes = ModelUtil.calculateAllBaseTypes(model.getType(typeof(MessageEventDefinition))); assertThat(allBaseTypes).hasSize(3); allBaseTypes = ModelUtil.calculateAllBaseTypes(model.getType(typeof(BaseElement))); assertThat(allBaseTypes).hasSize(0); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testCreateEmptyModel() public virtual void testCreateEmptyModel() { BpmnModelInstance bpmnModelInstance = Bpmn.createEmptyModel(); Definitions definitions = bpmnModelInstance.Definitions; assertThat(definitions).Null; definitions = bpmnModelInstance.newInstance(typeof(Definitions)); bpmnModelInstance.Definitions = definitions; definitions = bpmnModelInstance.Definitions; assertThat(definitions).NotNull; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testClone() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testClone() { BpmnModelInstance modelInstance = Bpmn.createEmptyModel(); Definitions definitions = modelInstance.newInstance(typeof(Definitions)); definitions.Id = "TestId"; modelInstance.Definitions = definitions; BpmnModelInstance cloneInstance = modelInstance.clone(); cloneInstance.Definitions.Id = "TestId2"; assertThat(modelInstance.Definitions.Id, @is(equalTo("TestId"))); assertThat(cloneInstance.Definitions.Id, @is(equalTo("TestId2"))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldAddChildElementsInCorrectOrder() public virtual void shouldAddChildElementsInCorrectOrder() { // create an empty model BpmnModelInstance bpmnModelInstance = Bpmn.createEmptyModel(); // add definitions Definitions definitions = bpmnModelInstance.newInstance(typeof(Definitions)); definitions.TargetNamespace = "Examples"; bpmnModelInstance.Definitions = definitions; // create a Process element and add it to the definitions Process process = bpmnModelInstance.newInstance(typeof(Process)); process.Id = "some-process-id"; definitions.RootElements.Add(process); // create an Import element and add it to the definitions Import importElement = bpmnModelInstance.newInstance(typeof(Import)); importElement.Namespace = "Imports"; importElement.Location = "here"; importElement.ImportType = "example"; definitions.Imports.Add(importElement); // create another Process element and add it to the definitions process = bpmnModelInstance.newInstance(typeof(Process)); process.Id = "another-process-id"; definitions.RootElements.Add(process); // create another Import element and add it to the definitions importElement = bpmnModelInstance.newInstance(typeof(Import)); importElement.Namespace = "Imports"; importElement.Location = "there"; importElement.ImportType = "example"; definitions.Imports.Add(importElement); // validate model try { Bpmn.validateModel(bpmnModelInstance); } catch (ModelValidationException) { Assert.fail(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Override @SuppressWarnings("unchecked") protected void starting(org.junit.runner.Description description) protected internal override void starting(Description description) { string className = description.ClassName; className = className.replaceAll("Test", ""); Type instanceClass = null; try { instanceClass = (Type)Type.GetType(className); } catch (ClassNotFoundException e) { throw new Exception(e); } modelInstance = Bpmn.createEmptyModel(); model = modelInstance.Model; modelElementType = model.getType(instanceClass); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGenerateIdsOnCreate() public virtual void shouldGenerateIdsOnCreate() { BpmnModelInstance modelInstance = Bpmn.createEmptyModel(); Definitions definitions = modelInstance.newInstance(typeof(Definitions)); assertThat(definitions.Id).NotNull; Process process = modelInstance.newInstance(typeof(Process)); assertThat(process.Id).NotNull; StartEvent startEvent = modelInstance.newInstance(typeof(StartEvent)); assertThat(startEvent.Id).NotNull; UserTask userTask = modelInstance.newInstance(typeof(UserTask)); assertThat(userTask.Id).NotNull; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldAddMessageAndMessageEventDefinition() public virtual void shouldAddMessageAndMessageEventDefinition() { // create empty model BpmnModelInstance bpmnModelInstance = Bpmn.createEmptyModel(); // add definitions to model Definitions definitions = bpmnModelInstance.newInstance(typeof(Definitions)); definitions.TargetNamespace = "Examples"; bpmnModelInstance.Definitions = definitions; // create and add message Message message = bpmnModelInstance.newInstance(typeof(Message)); message.Id = "start-message-id"; definitions.RootElements.Add(message); // create and add message event definition MessageEventDefinition messageEventDefinition = bpmnModelInstance.newInstance(typeof(MessageEventDefinition)); messageEventDefinition.Id = "message-event-def-id"; messageEventDefinition.Message = message; definitions.RootElements.Add(messageEventDefinition); // test if message was set correctly Message setMessage = messageEventDefinition.Message; assertThat(setMessage).isEqualTo(message); // add process Process process = bpmnModelInstance.newInstance(typeof(Process)); process.Id = "messageEventDefinition"; definitions.RootElements.Add(process); // add start event StartEvent startEvent = bpmnModelInstance.newInstance(typeof(StartEvent)); startEvent.Id = "theStart"; process.FlowElements.Add(startEvent); // create and add message event definition to start event MessageEventDefinition startEventMessageEventDefinition = bpmnModelInstance.newInstance(typeof(MessageEventDefinition)); startEventMessageEventDefinition.Message = message; startEvent.EventDefinitions.Add(startEventMessageEventDefinition); // create another message but do not add it Message anotherMessage = bpmnModelInstance.newInstance(typeof(Message)); anotherMessage.Id = "another-message-id"; // create a message event definition and try to add last create message MessageEventDefinition anotherMessageEventDefinition = bpmnModelInstance.newInstance(typeof(MessageEventDefinition)); try { anotherMessageEventDefinition.Message = anotherMessage; Assert.fail("Message should not be added to message event definition, cause it is not part of the model"); } catch (Exception e) { assertThat(e).isInstanceOf(typeof(ModelReferenceException)); } // first add message to model than to event definition definitions.RootElements.Add(anotherMessage); anotherMessageEventDefinition.Message = anotherMessage; startEvent.EventDefinitions.Add(anotherMessageEventDefinition); // message event definition and add message by id to it anotherMessageEventDefinition = bpmnModelInstance.newInstance(typeof(MessageEventDefinition)); startEvent.EventDefinitions.Add(anotherMessageEventDefinition); // validate model try { Bpmn.validateModel(bpmnModelInstance); } catch (ModelValidationException) { Assert.fail(); } }