Search in sources :

Example 31 with Definition

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

the class ContentDefinitionIdUtilsTest method createNode.

private Node createNode(final String diagramId) {
    final Node node = mock(Node.class);
    final Definition definition = mock(Definition.class);
    final HasContentDefinitionId hasContentDefinitionId = mock(HasContentDefinitionId.class);
    when(node.getContent()).thenReturn(definition);
    when(hasContentDefinitionId.getDiagramId()).thenReturn(diagramId);
    when(definition.getDefinition()).thenReturn(hasContentDefinitionId);
    return node;
}
Also used : HasContentDefinitionId(org.kie.workbench.common.stunner.core.graph.content.HasContentDefinitionId) Node(org.kie.workbench.common.stunner.core.graph.Node) Definition(org.kie.workbench.common.stunner.core.graph.content.definition.Definition)

Example 32 with Definition

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

the class DMNSafeDeleteNodeCommandTest method createMock.

private DMNSafeDeleteNodeCommand createMock(final Object contentDefinition, final Node<Definition<?>, Edge> candidate) {
    final DMNSafeDeleteNodeCommand cmd = mock(DMNSafeDeleteNodeCommand.class);
    final Definition definition = mock(Definition.class);
    when(definition.getDefinition()).thenReturn(contentDefinition);
    when(candidate.getContent()).thenReturn(definition);
    when(cmd.shouldKeepChildren(candidate)).thenCallRealMethod();
    return cmd;
}
Also used : Definition(org.kie.workbench.common.stunner.core.graph.content.definition.Definition)

Example 33 with Definition

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

the class DMNSafeDeleteNodeCommandTest method testShouldKeepChildren.

@Test
public void testShouldKeepChildren() {
    final DecisionService decisionService = mock(DecisionService.class);
    final Node<Definition<?>, Edge> candidate = mock(Node.class);
    final DMNSafeDeleteNodeCommand cmd = createMock(decisionService, candidate);
    final boolean actual = cmd.shouldKeepChildren(candidate);
    assertTrue(actual);
}
Also used : Definition(org.kie.workbench.common.stunner.core.graph.content.definition.Definition) Edge(org.kie.workbench.common.stunner.core.graph.Edge) DecisionService(org.kie.workbench.common.dmn.api.definition.model.DecisionService) Test(org.junit.Test)

Example 34 with Definition

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

the class DecisionNavigatorItemsProviderTest method mockNode.

private Node mockNode(final Object definition) {
    final Node node = mock(Node.class);
    final Definition content = mock(Definition.class);
    when(node.getContent()).thenReturn(content);
    when(content.getDefinition()).thenReturn(definition);
    return node;
}
Also used : Node(org.kie.workbench.common.stunner.core.graph.Node) Definition(org.kie.workbench.common.stunner.core.graph.content.definition.Definition)

Example 35 with Definition

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

the class DMNDiagramsSessionTest method testDefinitionContainsDRGElement_WhenDefinitionIsNotDRGElement.

@Test
public void testDefinitionContainsDRGElement_WhenDefinitionIsNotDRGElement() {
    final Node nodeWithContentDefinition = mock(Node.class);
    final Definition definition = mock(Definition.class);
    final Object obj = mock(Object.class);
    when(nodeWithContentDefinition.getContent()).thenReturn(definition);
    when(definition.getDefinition()).thenReturn(obj);
    assertFalse(dmnDiagramsSession.definitionContainsDRGElement(nodeWithContentDefinition));
}
Also used : Node(org.kie.workbench.common.stunner.core.graph.Node) Definition(org.kie.workbench.common.stunner.core.graph.content.definition.Definition) Test(org.junit.Test)

Aggregations

Definition (org.kie.workbench.common.stunner.core.graph.content.definition.Definition)111 Node (org.kie.workbench.common.stunner.core.graph.Node)61 Test (org.junit.Test)46 Element (org.kie.workbench.common.stunner.core.graph.Element)31 Edge (org.kie.workbench.common.stunner.core.graph.Edge)25 Graph (org.kie.workbench.common.stunner.core.graph.Graph)20 ArrayList (java.util.ArrayList)16 Optional (java.util.Optional)14 DRGElement (org.kie.workbench.common.dmn.api.definition.model.DRGElement)14 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)14 Diagram (org.kie.workbench.common.stunner.core.diagram.Diagram)14 View (org.kie.workbench.common.stunner.core.graph.content.view.View)12 Decision (org.kie.workbench.common.dmn.api.definition.model.Decision)11 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)10 List (java.util.List)9 Before (org.junit.Before)9 DMNDiagram (org.kie.workbench.common.dmn.api.definition.model.DMNDiagram)9 HasContentDefinitionId (org.kie.workbench.common.stunner.core.graph.content.HasContentDefinitionId)9 NodeImpl (org.kie.workbench.common.stunner.core.graph.impl.NodeImpl)9 Stream (java.util.stream.Stream)8