/** * Normalize and pretty-print XML so that it can be compared using string * compare. The following code does the following: - Removes comments - * Makes sure attributes are ordered consistently - Trims every element - * Pretty print the document * * @param xml The XML to be normalized * @return The equivalent XML, but now normalized */ protected String normalizeXML(String xml) throws Exception { return ModelTestUtils.normalizeXML(xml); }
/** * Normalize and pretty-print XML so that it can be compared using string * compare. The following code does the following: - Removes comments - * Makes sure attributes are ordered consistently - Trims every element - * Pretty print the document * * @param xml The XML to be normalized * @return The equivalent XML, but now normalized */ protected String normalizeXML(String xml) throws Exception { return ModelTestUtils.normalizeXML(xml); }
/** * Normalize and pretty-print XML so that it can be compared using string * compare. The following code does the following: - Removes comments - * Makes sure attributes are ordered consistently - Trims every element - * Pretty print the document * * @param xml The XML to be normalized * @return The equivalent XML, but now normalized */ protected String normalizeXML(String xml) throws Exception { return ModelTestUtils.normalizeXML(xml); }
/** * Validate the marshalled xml without adjusting the namespaces for the original and marshalled xml. * * @param original the original subsystem xml * @param marshalled the marshalled subsystem xml * @param ignoreNamespace if {@code true} the subsystem's namespace is ignored, otherwise it is taken into account when comparing the normalized xml. * @throws Exception */ public static void compareXml(final String original, final String marshalled, final boolean ignoreNamespace) throws Exception { final String xmlOriginal; final String xmlMarshalled; if (ignoreNamespace) { xmlOriginal = removeNamespace(original); xmlMarshalled = removeNamespace(marshalled); } else { xmlOriginal = original; xmlMarshalled = marshalled; } Assert.assertEquals(normalizeXML(xmlOriginal), normalizeXML(xmlMarshalled)); }