ManagementGraph extends ManagementAttachment implements IOReadableWritable { public ManagementGraph(final JobID jobID) { this.jobID = jobID; } ManagementGraph(final JobID jobID);  ManagementGraph(); JobID getJobID(); ManagementVertex getVertexByID(final ManagementVertexID id); ManagementGroupVertex getGroupVertexByID(final ManagementGroupVertexID id); int getNumberOfStages(); ManagementStage getStage(final int index); int getNumberOfInputGroupVertices(final int stage); int getNumberOfOutputGroupVertices(final int stage); ManagementGroupVertex getInputGroupVertex(final int stage, final int index); ManagementGroupVertex getOutputGroupVertex(final int stage, final int index); int getNumberOfInputVertices(final int stage); int getNumberOfOutputVertices(final int stage); ManagementVertex getInputVertex(final int stage, final int index); ManagementVertex getOutputVertex(final int stage, final int index); Collection<ManagementGroupVertex> getGroupVertices(); List<ManagementGroupVertex> getGroupVerticesInTopologicalOrder(); List<ManagementGroupVertex> getGroupVerticesInReverseTopologicalOrder(); @Override void read(final DataInput in); @Override void write(final DataOutput out);  }
@Test public void testManagementGraph() { final ManagementGraph orig = constructTestManagementGraph(); final ManagementGraph copy = (ManagementGraph) ManagementTestUtils.createCopy(orig); assertEquals(orig.getJobID(), copy.getJobID()); assertEquals(orig.getNumberOfStages(), copy.getNumberOfStages()); for (int i = 0; i < orig.getNumberOfStages(); i++) { final ManagementStage origStage = orig.getStage(i); final ManagementStage copyStage = copy.getStage(i); assertEquals(origStage.getNumberOfGroupVertices(), copyStage.getNumberOfGroupVertices()); assertEquals(origStage.getNumberOfInputGroupVertices(), copyStage.getNumberOfInputGroupVertices()); assertEquals(origStage.getNumberOfOutputGroupVertices(), copyStage.getNumberOfOutputGroupVertices()); for (int j = 0; j < origStage.getNumberOfInputGroupVertices(); j++) { final ManagementGroupVertex origGroupVertex = origStage.getInputGroupVertex(j); final ManagementGroupVertex copyGroupVertex = copyStage.getInputGroupVertex(j); assertEquals(origGroupVertex.getID(), copyGroupVertex.getID()); } for (int j = 0; j < origStage.getNumberOfOutputGroupVertices(); j++) { final ManagementGroupVertex origGroupVertex = origStage.getOutputGroupVertex(j); final ManagementGroupVertex copyGroupVertex = copyStage.getOutputGroupVertex(j); assertEquals(origGroupVertex.getID(), copyGroupVertex.getID()); } for (int j = 0; j < origStage.getNumberOfGroupVertices(); j++) { final ManagementGroupVertex origGroupVertex = origStage.getGroupVertex(j); final ManagementGroupVertex copyGroupVertex = copyStage.getGroupVertex(j); testGroupVertex(origGroupVertex, copyGroupVertex); } } }