use of org.kie.workbench.common.stunner.core.graph.content.definition.Definition in project kie-wb-common by kiegroup.
the class TextAnnotationTextPropertyProviderImplTest method checkSupportsTextAnnotationElements.
@Test
@SuppressWarnings("unchecked")
public void checkSupportsTextAnnotationElements() {
assertTrue(provider.supports(element));
final Element other = mock(Element.class);
final Definition otherContent = mock(Definition.class);
final InputData otherDefinition = mock(InputData.class);
when(other.getContent()).thenReturn(otherContent);
when(otherContent.getDefinition()).thenReturn(otherDefinition);
assertFalse(provider.supports(other));
}
use of org.kie.workbench.common.stunner.core.graph.content.definition.Definition in project kie-wb-common by kiegroup.
the class DMNGraphProcessor method getNodes.
@Override
public Iterable<? extends Node> getNodes(final Graph<?, ?> graph) {
final List<Node> nodes = new ArrayList();
graph.nodes().forEach(nodes::add);
for (final Node n : graph.nodes()) {
final Definition def = (Definition) n.getContent();
if (def.getDefinition() instanceof DecisionService) {
final List<Node> childNodes = getChildNodes(n);
nodes.removeAll(childNodes);
// All edges that points to nodes inside DS now points to DS
for (final Node o : childNodes) {
replacedNodes.put(o.getUUID(), n.getUUID());
}
}
}
return nodes;
}
use of org.kie.workbench.common.stunner.core.graph.content.definition.Definition in project kie-wb-common by kiegroup.
the class DRGElementTextPropertyProviderImplTest method checkSupportsDRGElement.
@Test
@SuppressWarnings("unchecked")
public void checkSupportsDRGElement() {
assertTrue(provider.supports(element));
final Element other = mock(Element.class);
final Definition otherContent = mock(Definition.class);
final TextAnnotation otherDefinition = mock(TextAnnotation.class);
when(other.getContent()).thenReturn(otherContent);
when(otherContent.getDefinition()).thenReturn(otherDefinition);
assertFalse(provider.supports(other));
}
use of org.kie.workbench.common.stunner.core.graph.content.definition.Definition in project kie-wb-common by kiegroup.
the class DecisionTableEditorDefinitionEnricherTest method testModelEnrichmentWhenTopLevelDecisionTableWithoutInputData.
@Test
public void testModelEnrichmentWhenTopLevelDecisionTableWithoutInputData() {
final String uuid = UUID.uuid();
final Node<Definition, Edge> node = new NodeImpl<>(uuid);
graph.addNode(node);
final Optional<DecisionTable> oModel = definition.getModelClass();
definition.enrich(Optional.of(uuid), decision, oModel);
final DecisionTable model = oModel.get();
assertBasicEnrichment(model);
assertStandardInputClauseEnrichment(model);
assertStandardOutputClauseEnrichment(model);
assertStandardDecisionRuleEnrichment(model);
assertParentHierarchyEnrichment(model);
}
use of org.kie.workbench.common.stunner.core.graph.content.definition.Definition in project kie-wb-common by kiegroup.
the class DRDContextMenuServiceTest method testAddToExistingDRD.
@Test
public void testAddToExistingDRD() {
final DMNDiagramTuple diagramTuple = mockDmnDiagramTuple();
final Diagram diagram = mock(Diagram.class);
final Node graphNode = mock(Node.class);
final View graphNodeDefinition = mock(View.class);
final DMNDiagram dmnDiagram = spy(new DMNDiagram());
final Collection<Node<? extends Definition<?>, Edge>> selectedNodes = mockNodes();
selectedNodes.add(graphNode);
when(diagramTuple.getStunnerDiagram()).thenReturn(diagram);
when(diagram.getGraph()).thenReturn(graph);
when(graph.nodes()).thenReturn(selectedNodes);
when(graphNode.getContent()).thenReturn(graphNodeDefinition);
when(graphNodeDefinition.getDefinition()).thenReturn(dmnDiagram);
drdContextMenuService.addToExistingDRD(diagramTuple, selectedNodes);
verify(graph).addNode(Mockito.<Node>any());
verify(selectedEvent, times(1)).fire(Mockito.<DMNDiagramSelected>any());
}
Aggregations