@Test public void testGetNodes() { final DMNGraphProcessor processor = new DMNGraphProcessor(); final Graph graph = mock(Graph.class); final Decision decision1 = mock(Decision.class); final Decision decision2 = mock(Decision.class); final Node node1 = createNode(decision1, "id1"); final Node node2 = createNode(decision2, "id2"); final List<Node> graphNodes = createGraphNodes(node1, node2); when(graph.nodes()).thenReturn(graphNodes); final Iterable<? extends Node> nodes = processor.getNodes(graph); for (final Node node : nodes) { assertTrue(graphNodes.contains(node)); assertFalse(processor.isReplacedByAnotherNode(node.getUUID())); } }
@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); for (final Node o : childNodes) { replacedNodes.put(o.getUUID(), n.getUUID()); } } } return nodes; }
DMNGraphProcessor implements GraphProcessor { @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); for (final Node o : childNodes) { replacedNodes.put(o.getUUID(), n.getUUID()); } } } return nodes; } }
DMNGraphProcessor implements GraphProcessor { @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); for (final Node o : childNodes) { replacedNodes.put(o.getUUID(), n.getUUID()); } } } return nodes; } DMNGraphProcessor(); }
DMNGraphProcessor implements GraphProcessor { @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); for (final Node o : childNodes) { replacedNodes.put(o.getUUID(), n.getUUID()); } } } return nodes; } DMNGraphProcessor(); @Override Iterable<? extends Node> getNodes(final Graph<?, ?> graph); @Override boolean isReplacedByAnotherNode(final String uuid); @Override String getReplaceNodeId(final String uuid); }
DMNGraphProcessor implements GraphProcessor { @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); for (final Node o : childNodes) { replacedNodes.put(o.getUUID(), n.getUUID()); } } } return nodes; } DMNGraphProcessor(); @Override Iterable<? extends Node> getNodes(final Graph<?, ?> graph); @Override boolean isReplacedByAnotherNode(final String uuid); @Override String getReplaceNodeId(final String uuid);  }