@Test public void testMergeNodes() throws Exception { List<Node> fromParents = new ArrayList<>(); fromParents.add(ManifestTestUtils.createNode( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + " <sentinel3:alongtrackCoordinate>6059</sentinel3:alongtrackCoordinate>").getFirstChild()); fromParents.add(ManifestTestUtils.createNode( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + " <sentinel3:alongtrackCoordinate>6239</sentinel3:alongtrackCoordinate>").getFirstChild()); fromParents.add(ManifestTestUtils.createNode( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + " <sentinel3:alongtrackCoordinate>6419</sentinel3:alongtrackCoordinate>").getFirstChild()); Document manifest = ManifestTestUtils.createDocument(); final Element manifestElement = manifest.createElement("sentinel3:alongtrackCoordinate"); manifest.appendChild(manifestElement); new AlongTrackCoordinateMerger().mergeNodes(fromParents, manifestElement, manifest); assertEquals(0, manifestElement.getAttributes().getLength()); assertEquals(1, manifestElement.getChildNodes().getLength()); assertEquals("6059", manifestElement.getFirstChild().getNodeValue()); assertEquals("6059", manifestElement.getTextContent()); }
@Override public void mergeNodes(List<Node> fromParents, Element toParent, Document toDocument) throws PDUStitchingException { int minAlongtrackCoordinate = Integer.MAX_VALUE; for (Node node : fromParents) { try { final int alongTrackCoordinate = Integer.parseInt(node.getTextContent()); if (alongTrackCoordinate < minAlongtrackCoordinate) { minAlongtrackCoordinate = alongTrackCoordinate; } } catch (NumberFormatException nfe) { throw new PDUStitchingException("Could not parse duration: " + nfe.getMessage()); } } addTextToNode(toParent, String.valueOf(minAlongtrackCoordinate), toDocument); }
AlongTrackCoordinateMerger extends AbstractElementMerger { @Override public void mergeNodes(List<Node> fromParents, Element toParent, Document toDocument) throws PDUStitchingException { int minAlongtrackCoordinate = Integer.MAX_VALUE; for (Node node : fromParents) { try { final int alongTrackCoordinate = Integer.parseInt(node.getTextContent()); if (alongTrackCoordinate < minAlongtrackCoordinate) { minAlongtrackCoordinate = alongTrackCoordinate; } } catch (NumberFormatException nfe) { throw new PDUStitchingException("Could not parse duration: " + nfe.getMessage()); } } addTextToNode(toParent, String.valueOf(minAlongtrackCoordinate), toDocument); } }
AlongTrackCoordinateMerger extends AbstractElementMerger { @Override public void mergeNodes(List<Node> fromParents, Element toParent, Document toDocument) throws PDUStitchingException { int minAlongtrackCoordinate = Integer.MAX_VALUE; for (Node node : fromParents) { try { final int alongTrackCoordinate = Integer.parseInt(node.getTextContent()); if (alongTrackCoordinate < minAlongtrackCoordinate) { minAlongtrackCoordinate = alongTrackCoordinate; } } catch (NumberFormatException nfe) { throw new PDUStitchingException("Could not parse duration: " + nfe.getMessage()); } } addTextToNode(toParent, String.valueOf(minAlongtrackCoordinate), toDocument); }  }
AlongTrackCoordinateMerger extends AbstractElementMerger { @Override public void mergeNodes(List<Node> fromParents, Element toParent, Document toDocument) throws PDUStitchingException { int minAlongtrackCoordinate = Integer.MAX_VALUE; for (Node node : fromParents) { try { final int alongTrackCoordinate = Integer.parseInt(node.getTextContent()); if (alongTrackCoordinate < minAlongtrackCoordinate) { minAlongtrackCoordinate = alongTrackCoordinate; } } catch (NumberFormatException nfe) { throw new PDUStitchingException("Could not parse duration: " + nfe.getMessage()); } } addTextToNode(toParent, String.valueOf(minAlongtrackCoordinate), toDocument); }  @Override void mergeNodes(List<Node> fromParents, Element toParent, Document toDocument); }
AlongTrackCoordinateMerger extends AbstractElementMerger { @Override public void mergeNodes(List<Node> fromParents, Element toParent, Document toDocument) throws PDUStitchingException { int minAlongtrackCoordinate = Integer.MAX_VALUE; for (Node node : fromParents) { try { final int alongTrackCoordinate = Integer.parseInt(node.getTextContent()); if (alongTrackCoordinate < minAlongtrackCoordinate) { minAlongtrackCoordinate = alongTrackCoordinate; } } catch (NumberFormatException nfe) { throw new PDUStitchingException("Could not parse duration: " + nfe.getMessage()); } } addTextToNode(toParent, String.valueOf(minAlongtrackCoordinate), toDocument); }  @Override void mergeNodes(List<Node> fromParents, Element toParent, Document toDocument);  }