Search in sources :

Example 46 with Definitions

use of org.kie.workbench.common.dmn.api.definition.v1_1.Definitions in project kie-wb-common by kiegroup.

the class RootProcessConverterTest method setUp.

@Before
@SuppressWarnings("all")
public void setUp() {
    Definitions definitions = bpmn2.createDefinitions();
    process = bpmn2.createProcess();
    definitions.getRootElements().add(process);
    BPMNDiagram bpmnDiagram = di.createBPMNDiagram();
    bpmnDiagram.setPlane(di.createBPMNPlane());
    definitions.getDiagrams().add(bpmnDiagram);
    ElementDefinition.getExtensionElements(process).add(DefaultImportsElement.extensionOf(new DefaultImport(getClass().getName())));
    definitionResolver = new DefinitionResolver(definitions, Collections.emptyList());
    Node node = new NodeImpl("");
    View<BPMNDiagramImpl> content = new ViewImpl<>(new BPMNDiagramImpl(), Bounds.create());
    node.setContent(content);
    FactoryManager factoryManager = mock(FactoryManager.class);
    when(factoryManager.newElement(any(), eq(getDefinitionId(BPMNDiagramImpl.class)))).thenReturn(node);
    TypedFactoryManager typedFactoryManager = new TypedFactoryManager(factoryManager);
    tested = new RootProcessConverter(typedFactoryManager, new PropertyReaderFactory(definitionResolver), definitionResolver, new ConverterFactory(definitionResolver, typedFactoryManager));
}
Also used : TypedFactoryManager(org.kie.workbench.common.stunner.bpmn.backend.converters.TypedFactoryManager) DefinitionResolver(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.DefinitionResolver) NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) Definitions(org.eclipse.bpmn2.Definitions) Node(org.kie.workbench.common.stunner.core.graph.Node) PropertyReaderFactory(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.PropertyReaderFactory) ConverterFactory(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.ConverterFactory) BPMNDiagram(org.eclipse.bpmn2.di.BPMNDiagram) DefaultImport(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.DefaultImport) ViewImpl(org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl) BPMNDiagramImpl(org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl) TypedFactoryManager(org.kie.workbench.common.stunner.bpmn.backend.converters.TypedFactoryManager) FactoryManager(org.kie.workbench.common.stunner.core.api.FactoryManager) Before(org.junit.Before)

Example 47 with Definitions

use of org.kie.workbench.common.dmn.api.definition.v1_1.Definitions in project kie-wb-common by kiegroup.

the class AdHocSubProcessPropertyReaderTest method setUp.

@Before
public void setUp() {
    Definitions definitions = bpmn2.createDefinitions();
    definitions.getRootElements().add(bpmn2.createProcess());
    BPMNDiagram bpmnDiagram = di.createBPMNDiagram();
    bpmnDiagram.setPlane(di.createBPMNPlane());
    definitions.getDiagrams().add(bpmnDiagram);
    definitionResolverReal = new DefinitionResolver(definitions, Collections.emptyList());
    propertyReader = new AdHocSubProcessPropertyReader(process, diagram, definitionResolver);
}
Also used : BPMNDiagram(org.eclipse.bpmn2.di.BPMNDiagram) DefinitionResolver(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.DefinitionResolver) Definitions(org.eclipse.bpmn2.Definitions) Before(org.junit.Before)

Example 48 with Definitions

use of org.kie.workbench.common.dmn.api.definition.v1_1.Definitions in project kie-wb-common by kiegroup.

the class EventSubprocessPropertyReaderTest method setUp.

@Before
public void setUp() {
    Definitions definitions = bpmn2.createDefinitions();
    definitions.getRootElements().add(bpmn2.createProcess());
    BPMNDiagram bpmnDiagram = di.createBPMNDiagram();
    bpmnDiagram.setPlane(di.createBPMNPlane());
    definitions.getDiagrams().add(bpmnDiagram);
    definitionResolverReal = new DefinitionResolver(definitions, Collections.emptyList());
}
Also used : BPMNDiagram(org.eclipse.bpmn2.di.BPMNDiagram) DefinitionResolver(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.DefinitionResolver) Definitions(org.eclipse.bpmn2.Definitions) Before(org.junit.Before)

Example 49 with Definitions

use of org.kie.workbench.common.dmn.api.definition.v1_1.Definitions in project kie-wb-common by kiegroup.

the class JBPMBpmn2ResourceFactory method createAndInitResource.

/*
     *
     * Creates a new BpmnResourceImpl and initializes it.
     *
     * The method creates a DocumentRoot and a Definitions element, as both are
     * mandatory.
     */
public Definitions createAndInitResource(URI uri) {
    DroolsFactoryImpl.init();
    BpsimFactoryImpl.init();
    Resource resource = createResource(uri);
    Bpmn2Factory factory = Bpmn2Factory.eINSTANCE;
    Definitions definitions = factory.createDefinitions();
    DocumentRoot docummentRoot = factory.createDocumentRoot();
    docummentRoot.setDefinitions(definitions);
    resource.getContents().add(docummentRoot);
    return definitions;
}
Also used : Bpmn2Factory(org.eclipse.bpmn2.Bpmn2Factory) DocumentRoot(org.eclipse.bpmn2.DocumentRoot) Definitions(org.eclipse.bpmn2.Definitions) XMLResource(org.eclipse.emf.ecore.xmi.XMLResource) Resource(org.eclipse.emf.ecore.resource.Resource)

Example 50 with Definitions

use of org.kie.workbench.common.dmn.api.definition.v1_1.Definitions in project kie-wb-common by kiegroup.

the class AssociationsTest method marshallAssociations.

@Test
public void marshallAssociations() throws Exception {
    Diagram<Graph, Metadata> d = unmarshall(marshaller, BPMN_FILE_PATH);
    DefinitionsConverter definitionsConverter = new DefinitionsConverter(d.getGraph());
    Definitions definitions = definitionsConverter.toDefinitions();
    Process p = (Process) definitions.getRootElements().get(0);
    org.eclipse.bpmn2.UserTask flowElement = (org.eclipse.bpmn2.UserTask) p.getFlowElements().stream().filter(e -> e.getId().equals(TASK_ID)).findFirst().get();
    List<DataInputAssociation> associations = flowElement.getDataInputAssociations();
    assertEquals("myprocvar", findVar(associations, "From"));
    assertEquals("<![CDATA[HELLO]]>", findAssignment(associations, "Body"));
}
Also used : StartEvent(org.eclipse.bpmn2.StartEvent) FormalExpression(org.eclipse.bpmn2.FormalExpression) FlatVariableScope(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.FlatVariableScope) UserTask(org.kie.workbench.common.stunner.bpmn.definition.UserTask) View(org.kie.workbench.common.stunner.core.graph.content.view.View) HashSet(java.util.HashSet) DataInput(org.eclipse.bpmn2.DataInput) Property(org.eclipse.bpmn2.Property) DefinitionsConverter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.DefinitionsConverter) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) Definitions(org.eclipse.bpmn2.Definitions) Ids(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Ids) AssignmentsInfo(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo) Process(org.eclipse.bpmn2.Process) DataInputAssociation(org.eclipse.bpmn2.DataInputAssociation) Factories.bpmn2(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpmn2) Test(org.junit.Test) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) List(java.util.List) Graph(org.kie.workbench.common.stunner.core.graph.Graph) Assignment(org.eclipse.bpmn2.Assignment) CatchEventPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CatchEventPropertyWriter) BPMNDiagramMarshallerBaseTest(org.kie.workbench.common.stunner.bpmn.backend.service.diagram.marshalling.BPMNDiagramMarshallerBaseTest) Node(org.kie.workbench.common.stunner.core.graph.Node) TestCase.assertEquals(junit.framework.TestCase.assertEquals) Definitions(org.eclipse.bpmn2.Definitions) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) UserTask(org.kie.workbench.common.stunner.bpmn.definition.UserTask) Process(org.eclipse.bpmn2.Process) DefinitionsConverter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.DefinitionsConverter) Graph(org.kie.workbench.common.stunner.core.graph.Graph) Factories.bpmn2(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpmn2) DataInputAssociation(org.eclipse.bpmn2.DataInputAssociation) Test(org.junit.Test) BPMNDiagramMarshallerBaseTest(org.kie.workbench.common.stunner.bpmn.backend.service.diagram.marshalling.BPMNDiagramMarshallerBaseTest)

Aggregations

Definitions (org.eclipse.bpmn2.Definitions)42 Process (org.eclipse.bpmn2.Process)16 Test (org.junit.Test)15 Graph (org.kie.workbench.common.stunner.core.graph.Graph)12 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)11 Before (org.junit.Before)9 IOException (java.io.IOException)8 List (java.util.List)8 DefinitionsConverter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.DefinitionsConverter)8 RootElement (org.eclipse.bpmn2.RootElement)7 BPMNDiagram (org.eclipse.bpmn2.di.BPMNDiagram)6 BusinessProcessFormModel (org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel)6 DefinitionResolver (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.DefinitionResolver)6 HashMap (java.util.HashMap)5 Optional (java.util.Optional)5 DataInput (org.eclipse.bpmn2.DataInput)5 XMLResource (org.eclipse.emf.ecore.xmi.XMLResource)5 Definitions (org.kie.dmn.model.v1_1.Definitions)5 TaskFormModel (org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel)5 Path (org.uberfire.backend.vfs.Path)5