@Test public void testSerialization() { try { JobGraph jg = new JobGraph("The graph"); // add some configuration values { jg.getJobConfiguration().setString("some key", "some value"); jg.getJobConfiguration().setDouble("Life of ", Math.PI); } // add some vertices { AbstractJobVertex source1 = new AbstractJobVertex("source1"); AbstractJobVertex source2 = new AbstractJobVertex("source2"); AbstractJobVertex target = new AbstractJobVertex("target"); target.connectNewDataSetAsInput(source1, DistributionPattern.POINTWISE); target.connectNewDataSetAsInput(source2, DistributionPattern.ALL_TO_ALL); jg.addVertex(source1); jg.addVertex(source2); jg.addVertex(target); } // de-/serialize and compare JobGraph copy = CommonTestUtils.createCopySerializable(jg); assertEquals(jg.getName(), copy.getName()); assertEquals(jg.getJobID(), copy.getJobID()); assertEquals(jg.getJobConfiguration(), copy.getJobConfiguration()); assertEquals(jg.getNumberOfVertices(), copy.getNumberOfVertices()); for (AbstractJobVertex vertex : copy.getVertices()) { AbstractJobVertex original = jg.findVertexByID(vertex.getID()); assertNotNull(original); assertEquals(original.getName(), vertex.getName()); assertEquals(original.getNumberOfInputs(), vertex.getNumberOfInputs()); assertEquals( original.getNumberOfProducedIntermediateDataSets(), vertex.getNumberOfProducedIntermediateDataSets()); } } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } }