L3Mapper extends Mapper<NullWritable, NullWritable, LongWritable, L3SpatialBin> { static String extractProcessingGraphXml(Product product) { final MetadataElement metadataRoot = product.getMetadataRoot(); final MetadataElement processingGraph = metadataRoot.getElement("Processing_Graph"); final MetadataSerializer metadataSerializer = new MetadataSerializer(); return metadataSerializer.toXml(processingGraph); }  @Override void run(Context context);  }
@Test public void testExtractProcessingGraphXml() { final Product product = new Product("bla", "blub", 3, 3); final MetadataElement processingGraph = new MetadataElement("Processing_Graph"); final MetadataAttribute metadataAttribute = new MetadataAttribute("test_attrib", ProductData.createInstance(new double[]{ 1.98 }), true); processingGraph.addAttribute(metadataAttribute); product.getMetadataRoot().addElement(processingGraph); final String metadataXml = L3Mapper.extractProcessingGraphXml(product); assertEquals(2304, metadataXml.length()); assertTrue(metadataXml.contains("1.98")); }