ReleaseGraphManager { protected List<String> getEndVertices() { final List<String> endVertices = new ArrayList<>(); Set<String> vertices = _directedGraph.vertexSet(); for (String vertex : vertices) { Set<UpgradeProcessEdge> upgradeProcessEdges = _directedGraph.outgoingEdgesOf(vertex); if (upgradeProcessEdges.isEmpty()) { endVertices.add(vertex); } } return endVertices; } ReleaseGraphManager(final List<UpgradeInfo> upgradeInfos); List<UpgradeInfo> getUpgradeInfos(
		String fromVersionString, String toVersionString); List<List<UpgradeInfo>> getUpgradeInfosList(
		String fromVersionString);  }
@Test public void testGetSinkNodes() { UpgradeInfo upgradeInfo1 = createUpgradeInfo("0.0.0", "0.1.0"); UpgradeInfo upgradeInfo2 = createUpgradeInfo("0.1.0", "0.2.0"); UpgradeInfo upgradeInfo3 = createUpgradeInfo("0.2.0", "1.0.0"); UpgradeInfo upgradeInfo4 = createUpgradeInfo("1.0.0", "2.0.0"); ReleaseGraphManager releaseGraphManager = new ReleaseGraphManager( Arrays.asList( upgradeInfo1, upgradeInfo2, upgradeInfo3, upgradeInfo4)); List<String> sinkNodes = releaseGraphManager.getEndVertices(); Assert.assertTrue(sinkNodes.toString(), sinkNodes.contains("2.0.0")); }
@Test public void testgetSinkNodesWithMultipleEndNodes() { UpgradeInfo upgradeInfo1 = createUpgradeInfo("0.0.0", "0.1.0"); UpgradeInfo upgradeInfo2 = createUpgradeInfo("0.1.0", "0.2.0"); UpgradeInfo upgradeInfo3 = createUpgradeInfo("0.2.0", "1.0.0"); UpgradeInfo upgradeInfo4 = createUpgradeInfo("1.0.0", "2.0.0"); UpgradeInfo upgradeInfo5 = createUpgradeInfo("1.0.0", "2.2.0"); ReleaseGraphManager releaseGraphManager = new ReleaseGraphManager( Arrays.asList( upgradeInfo1, upgradeInfo2, upgradeInfo3, upgradeInfo4, upgradeInfo5)); List<String> sinkNodes = releaseGraphManager.getEndVertices(); Assert.assertTrue(sinkNodes.toString(), sinkNodes.contains("2.0.0")); Assert.assertTrue(sinkNodes.toString(), sinkNodes.contains("2.2.0")); }