Flow { public Node getNode(final String nodeId) { return this.nodes.get(nodeId); } Flow(final String id); static Flow flowFromObject(final Object object); int getVersion(); void setVersion(final int version); void initialize(); Node getNode(final String nodeId); List<String> getSuccessEmails(); String getMailCreator(); void setMailCreator(final String mailCreator); List<String> getFailureEmails(); void addSuccessEmails(final Collection<String> emails); void addFailureEmails(final Collection<String> emails); int getNumLevels(); List<Node> getStartNodes(); List<Node> getEndNodes(); Set<Edge> getInEdges(final String id); Set<Edge> getOutEdges(final String id); void addAllNodes(final Collection<Node> nodes); void addNode(final Node node); void addAllFlowProperties(final Collection<FlowProps> props); String getId(); void addError(final String error); List<String> getErrors(); boolean hasErrors(); Collection<Node> getNodes(); Collection<Edge> getEdges(); void addAllEdges(final Collection<Edge> edges); void addEdge(final Edge edge); Map<String, Object> toObject(); boolean isLayedOut(); void setLayedOut(final boolean layedOut); boolean isEmbeddedFlow(); void setEmbeddedFlow(final boolean embeddedFlow); double getAzkabanFlowVersion(); void setAzkabanFlowVersion(final double azkabanFlowVersion); String getCondition(); void setCondition(final String condition); Map<String, Object> getMetadata(); void setMetadata(final Map<String, Object> metadata); Map<String, Node> getNodeMap(); Map<String, Set<Edge>> getOutEdgeMap(); Map<String, Set<Edge>> getInEdgeMap(); FlowProps getFlowProps(final String propSource); Map<String, FlowProps> getAllFlowProps(); int getProjectId(); void setProjectId(final int projectId); boolean isLocked(); void setLocked(boolean locked); String getFlowLockErrorMessage(); void setFlowLockErrorMessage(final String flowLockErrorMessage);  }
@Test public void testNodeLevelComputation() throws Exception { final Flow flow = FlowUtils.getFlow(this.getEmbeddedTestProject(), "jobe"); Assert.assertEquals(0, flow.getNode("joba").getLevel()); Assert.assertEquals(1, flow.getNode("jobb").getLevel()); Assert.assertEquals(1, flow.getNode("jobc").getLevel()); Assert.assertEquals(1, flow.getNode("jobd").getLevel()); Assert.assertEquals(2, flow.getNode("jobe").getLevel()); }