Search in sources :

Example 1 with StunnerTestingGraphBackendAPI

use of org.kie.workbench.common.stunner.core.backend.StunnerTestingGraphBackendAPI in project kie-wb-common by kiegroup.

the class GraphBuilderTest method setUp.

@Before
@SuppressWarnings("unchecked")
public void setUp() throws Exception {
    when(diagram.getPlane()).thenReturn(plane);
    List<RootElement> rootElements = Collections.singletonList(process);
    List<BPMNDiagram> diagrams = Collections.singletonList(diagram);
    when(definitions.getId()).thenReturn(DIAGRAM_UUID);
    when(definitions.getRootElements()).thenReturn(rootElements);
    when(definitions.getDiagrams()).thenReturn(diagrams);
    when(definitions.getRelationships()).thenReturn(Collections.emptyList());
    definitionResolver = new DefinitionResolver(definitions, Collections.emptyList());
    StunnerTestingGraphBackendAPI api = StunnerTestingGraphBackendAPI.build(BPMNDefinitionSet.class, new BPMNTestDefinitionFactory());
    TypedFactoryManager typedFactoryManager = new TypedFactoryManager(api.getFactoryManager());
    Metadata metadata = new MetadataImpl.MetadataImplBuilder(BindableAdapterUtils.getDefinitionSetId(BPMNDefinitionSet.class)).build();
    Diagram<Graph<DefinitionSet, Node>, Metadata> diagram = api.getFactoryManager().newDiagram(definitionResolver.getDefinitions().getId(), BPMN_ID, metadata);
    graph = diagram.getGraph();
    graphBuilder = new GraphBuilder(graph, api.getDefinitionManager(), typedFactoryManager, api.getRuleManager(), api.commandFactory, api.commandManager);
}
Also used : TypedFactoryManager(org.kie.workbench.common.stunner.bpmn.backend.converters.TypedFactoryManager) BPMNTestDefinitionFactory(org.kie.workbench.common.stunner.bpmn.BPMNTestDefinitionFactory) StunnerTestingGraphBackendAPI(org.kie.workbench.common.stunner.core.backend.StunnerTestingGraphBackendAPI) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) BPMNDiagram(org.eclipse.bpmn2.di.BPMNDiagram) RootElement(org.eclipse.bpmn2.RootElement) MetadataImpl(org.kie.workbench.common.stunner.core.diagram.MetadataImpl) Graph(org.kie.workbench.common.stunner.core.graph.Graph) Before(org.junit.Before)

Example 2 with StunnerTestingGraphBackendAPI

use of org.kie.workbench.common.stunner.core.backend.StunnerTestingGraphBackendAPI in project kie-wb-common by kiegroup.

the class ProcessConverterDelegateTest method setUp.

@Before
public void setUp() throws Exception {
    parentNode = new BpmnNode.Simple(new NodeImpl<>("ParentNode"), basePropertyReader);
    when(diagram.getPlane()).thenReturn(plane);
    List<RootElement> rootElements = Collections.singletonList(process);
    List<BPMNDiagram> diagrams = Collections.singletonList(diagram);
    when(definitions.getRootElements()).thenReturn(rootElements);
    when(definitions.getDiagrams()).thenReturn(diagrams);
    when(definitions.getRelationships()).thenReturn(Collections.emptyList());
    when(plane.getPlaneElement()).thenReturn(new ArrayList<>());
    definitionResolver = new DefinitionResolver(definitions, Collections.emptyList());
    StunnerTestingGraphBackendAPI api = StunnerTestingGraphBackendAPI.build(BPMNDefinitionSet.class, new BPMNTestDefinitionFactory());
    TypedFactoryManager typedFactoryManager = new TypedFactoryManager(api.getFactoryManager());
    factory = new ConverterFactory(definitionResolver, typedFactoryManager);
    converterDelegate = new ProcessConverterDelegate(typedFactoryManager, propertyReaderFactory, definitionResolver, factory);
}
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) BPMNTestDefinitionFactory(org.kie.workbench.common.stunner.bpmn.BPMNTestDefinitionFactory) StunnerTestingGraphBackendAPI(org.kie.workbench.common.stunner.core.backend.StunnerTestingGraphBackendAPI) ConverterFactory(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.ConverterFactory) BaseConverterFactory(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BaseConverterFactory) BpmnNode(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BpmnNode) BPMNDiagram(org.eclipse.bpmn2.di.BPMNDiagram) RootElement(org.eclipse.bpmn2.RootElement) Before(org.junit.Before)

Aggregations

RootElement (org.eclipse.bpmn2.RootElement)2 BPMNDiagram (org.eclipse.bpmn2.di.BPMNDiagram)2 Before (org.junit.Before)2 BPMNTestDefinitionFactory (org.kie.workbench.common.stunner.bpmn.BPMNTestDefinitionFactory)2 TypedFactoryManager (org.kie.workbench.common.stunner.bpmn.backend.converters.TypedFactoryManager)2 StunnerTestingGraphBackendAPI (org.kie.workbench.common.stunner.core.backend.StunnerTestingGraphBackendAPI)2 BaseConverterFactory (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BaseConverterFactory)1 BpmnNode (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.BpmnNode)1 ConverterFactory (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.ConverterFactory)1 DefinitionResolver (org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.DefinitionResolver)1 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)1 MetadataImpl (org.kie.workbench.common.stunner.core.diagram.MetadataImpl)1 Graph (org.kie.workbench.common.stunner.core.graph.Graph)1 NodeImpl (org.kie.workbench.common.stunner.core.graph.impl.NodeImpl)1