Search in sources :

Example 21 with BPMNDiagram

use of org.eclipse.bpmn2.di.BPMNDiagram in project kie-wb-common by kiegroup.

the class SubProcessConverterTest 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);
    definitionResolver = new DefinitionResolver(definitions, Collections.emptyList());
    Node adHocNode = new NodeImpl("");
    View<AdHocSubprocess> adHocContent = new ViewImpl<>(new AdHocSubprocess(), Bounds.create());
    adHocNode.setContent(adHocContent);
    Node multipleInstanceNode = new NodeImpl("");
    View<MultipleInstanceSubprocess> miContent = new ViewImpl<>(new MultipleInstanceSubprocess(), Bounds.create());
    multipleInstanceNode.setContent(miContent);
    Node embeddedNode = new NodeImpl("");
    View<EmbeddedSubprocess> embeddedContent = new ViewImpl<>(new EmbeddedSubprocess(), Bounds.create());
    embeddedNode.setContent(embeddedContent);
    Node eventNode = new NodeImpl("");
    View<EventSubprocess> eventSubprocess = new ViewImpl<>(new EventSubprocess(), Bounds.create());
    eventNode.setContent(eventSubprocess);
    FactoryManager factoryManager = mock(FactoryManager.class);
    when(factoryManager.newElement(any(), eq(getDefinitionId(AdHocSubprocess.class)))).thenReturn(adHocNode);
    when(factoryManager.newElement(any(), eq(getDefinitionId(MultipleInstanceSubprocess.class)))).thenReturn(multipleInstanceNode);
    when(factoryManager.newElement(any(), eq(getDefinitionId(EmbeddedSubprocess.class)))).thenReturn(embeddedNode);
    when(factoryManager.newElement(any(), eq(getDefinitionId(EventSubprocess.class)))).thenReturn(eventNode);
    TypedFactoryManager typedFactoryManager = new TypedFactoryManager(factoryManager);
    tested = new SubProcessConverter(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) BpmnNode(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BpmnNode) Node(org.kie.workbench.common.stunner.core.graph.Node) AdHocSubprocess(org.kie.workbench.common.stunner.bpmn.definition.AdHocSubprocess) PropertyReaderFactory(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.PropertyReaderFactory) ConverterFactory(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.ConverterFactory) MultipleInstanceSubprocess(org.kie.workbench.common.stunner.bpmn.definition.MultipleInstanceSubprocess) BPMNDiagram(org.eclipse.bpmn2.di.BPMNDiagram) EventSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EventSubprocess) EmbeddedSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EmbeddedSubprocess) ViewImpl(org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl) TypedFactoryManager(org.kie.workbench.common.stunner.bpmn.backend.converters.TypedFactoryManager) FactoryManager(org.kie.workbench.common.stunner.core.api.FactoryManager) Before(org.junit.Before)

Example 22 with BPMNDiagram

use of org.eclipse.bpmn2.di.BPMNDiagram 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 23 with BPMNDiagram

use of org.eclipse.bpmn2.di.BPMNDiagram 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 24 with BPMNDiagram

use of org.eclipse.bpmn2.di.BPMNDiagram 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)

Aggregations

BPMNDiagram (org.eclipse.bpmn2.di.BPMNDiagram)16 Before (org.junit.Before)12 DefinitionResolver (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.DefinitionResolver)11 Definitions (org.eclipse.bpmn2.Definitions)8 RootElement (org.eclipse.bpmn2.RootElement)8 FlowElement (org.eclipse.bpmn2.FlowElement)6 BPMNDiagram (org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagram)6 Test (org.junit.Test)5 BPMNDiagramImpl (org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl)5 ArrayList (java.util.ArrayList)4 ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)4 TypedFactoryManager (org.kie.workbench.common.stunner.bpmn.backend.converters.TypedFactoryManager)4 Element (org.kie.workbench.common.stunner.core.graph.Element)4 View (org.kie.workbench.common.stunner.core.graph.content.view.View)4 Process (org.eclipse.bpmn2.Process)3 BPMNPlane (org.eclipse.bpmn2.di.BPMNPlane)3 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)3 Graph (org.kie.workbench.common.stunner.core.graph.Graph)3 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)2 Artifact (org.eclipse.bpmn2.Artifact)2