Search in sources :

Example 41 with Element

use of org.kie.workbench.common.stunner.core.graph.Element in project kie-wb-common by kiegroup.

the class EdgeBuilderImplTest method testDoBuildReturnNull.

@Test
public void testDoBuildReturnNull() {
    when(context.getIndex().getEdge(EDGE_ID)).thenReturn(edge);
    edgeBuilder.nodeId(EDGE_ID);
    Element edge1 = edgeBuilder.build(context);
    Assert.assertEquals(edge1, null);
}
Also used : Element(org.kie.workbench.common.stunner.core.graph.Element) Test(org.junit.Test)

Example 42 with Element

use of org.kie.workbench.common.stunner.core.graph.Element in project kie-wb-common by kiegroup.

the class NodeBuilderImplTest method testDoBuildNewNode.

@Test
public void testDoBuildNewNode() {
    when(context.getIndex().getNode(NODE_ID)).thenReturn(null);
    when(context.getOryxManager()).thenReturn(oryxManager);
    when(context.getOryxManager().getMappingsManager()).thenReturn(oryxIdMappings);
    when(context.getOryxManager().getMappingsManager().getDefinitionId(any(Class.class))).thenReturn(DEFINITION_ID);
    when(factoryManager.newElement(null, DEFINITION_ID)).thenReturn(node);
    when(node.getContent()).thenReturn(view);
    when(view.getDefinition()).thenReturn(definition);
    when(context.getDefinitionManager()).thenReturn(definitionManager);
    when(context.getDefinitionManager().adapters()).thenReturn(adapters);
    when(context.getDefinitionManager().adapters().forDefinition()).thenReturn(forDefinition);
    when(context.getDefinitionManager().adapters().forDefinition().getProperties(definition)).thenReturn(set);
    when(context.execute(any())).thenReturn(res);
    when(context.getCommandFactory()).thenReturn(graphCommandFactory);
    Element node1 = nodeBuilder.build(context);
    Assert.assertEquals(node1, node);
}
Also used : Element(org.kie.workbench.common.stunner.core.graph.Element) Test(org.junit.Test)

Example 43 with Element

use of org.kie.workbench.common.stunner.core.graph.Element in project kie-wb-common by kiegroup.

the class NodeBuilderImplTest method testDoBuildExistingNode.

@Test
public void testDoBuildExistingNode() {
    when(context.getIndex().getNode(NODE_ID)).thenReturn(node);
    nodeBuilder.nodeId(NODE_ID);
    Element node1 = nodeBuilder.build(context);
    Assert.assertEquals(node1, node);
}
Also used : Element(org.kie.workbench.common.stunner.core.graph.Element) Test(org.junit.Test)

Example 44 with Element

use of org.kie.workbench.common.stunner.core.graph.Element in project kie-wb-common by kiegroup.

the class StartEventFilterProvider method provideFilters.

@Override
public Collection<FormElementFilter> provideFilters(String elementUUID, Element<? extends Definition<?>> element, Object definition) {
    Predicate predicate = o -> isParentAnEventSubProcess(elementUUID);
    FormElementFilter isInterruptingFilter = new FormElementFilter("executionSet.isInterrupting", predicate);
    return Arrays.asList(isInterruptingFilter);
}
Also used : Arrays(java.util.Arrays) StunnerFormElementFilterProvider(org.kie.workbench.common.stunner.forms.client.formFilters.StunnerFormElementFilterProvider) Predicate(java.util.function.Predicate) Collection(java.util.Collection) Edge(org.kie.workbench.common.stunner.core.graph.Edge) FormElementFilter(org.kie.workbench.common.forms.adf.engine.shared.FormElementFilter) AbstractCanvasHandler(org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler) Supplier(java.util.function.Supplier) Definition(org.kie.workbench.common.stunner.core.graph.content.definition.Definition) View(org.kie.workbench.common.stunner.core.graph.content.view.View) GraphUtils(org.kie.workbench.common.stunner.core.graph.util.GraphUtils) EventSubprocess(org.kie.workbench.common.stunner.bpmn.definition.EventSubprocess) Element(org.kie.workbench.common.stunner.core.graph.Element) SessionManager(org.kie.workbench.common.stunner.core.client.api.SessionManager) Node(org.kie.workbench.common.stunner.core.graph.Node) FormElementFilter(org.kie.workbench.common.forms.adf.engine.shared.FormElementFilter) Predicate(java.util.function.Predicate)

Example 45 with Element

use of org.kie.workbench.common.stunner.core.graph.Element in project kie-wb-common by kiegroup.

the class AbstractProcessFilteredNodeProviderBaseTest method testGetSelectorDataWithValues.

@Test
public void testGetSelectorDataWithValues() {
    List<Element> nodes = mockModes();
    when(graph.nodes()).thenReturn(nodes);
    SelectorData selectorData = provider.getSelectorData(renderingContext);
    Map values = selectorData.getValues();
    assertEquals(nodes.size(), values.size());
    verifyValues(values);
}
Also used : Element(org.kie.workbench.common.stunner.core.graph.Element) Map(java.util.Map) SelectorData(org.kie.workbench.common.forms.dynamic.model.config.SelectorData) Test(org.junit.Test)

Aggregations

Element (org.kie.workbench.common.stunner.core.graph.Element)85 Test (org.junit.Test)55 View (org.kie.workbench.common.stunner.core.graph.content.view.View)34 Graph (org.kie.workbench.common.stunner.core.graph.Graph)27 FlowElement (org.eclipse.bpmn2.FlowElement)24 ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)24 RootElement (org.eclipse.bpmn2.RootElement)24 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)24 Definition (org.kie.workbench.common.stunner.core.graph.content.definition.Definition)14 Edge (org.kie.workbench.common.stunner.core.graph.Edge)12 Node (org.kie.workbench.common.stunner.core.graph.Node)11 Map (java.util.Map)7 Optional (java.util.Optional)6 Before (org.junit.Before)6 Collection (java.util.Collection)5 AbstractCanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler)5 Shape (org.kie.workbench.common.stunner.core.client.shape.Shape)5 Matchers.anyString (org.mockito.Matchers.anyString)5 Logger (java.util.logging.Logger)4 BPMNDiagram (org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagram)4