Skip to content

Commit b4096df

Browse files
committed
update to latest xmlunit-core, do not use xmlunit-legacy
1 parent d19dfe2 commit b4096df

7 files changed

Lines changed: 35 additions & 23 deletions

File tree

conga-aem-plugin/pom.xml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,7 @@
177177
<dependency>
178178
<groupId>org.xmlunit</groupId>
179179
<artifactId>xmlunit-core</artifactId>
180-
<version>2.6.3</version>
181-
<scope>test</scope>
182-
</dependency>
183-
<dependency>
184-
<groupId>org.xmlunit</groupId>
185-
<artifactId>xmlunit-legacy</artifactId>
186-
<version>2.6.3</version>
180+
<version>2.7.0</version>
187181
<scope>test</scope>
188182
</dependency>
189183
<dependency>

conga-aem-plugin/src/test/java/io/wcm/devops/conga/plugins/aem/postprocessor/ContentPackageOsgiConfigPostProcessorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
import static io.wcm.devops.conga.plugins.aem.postprocessor.ContentPackageOptions.PROPERTY_PACKAGE_NAME;
2525
import static io.wcm.devops.conga.plugins.aem.postprocessor.ContentPackageOptions.PROPERTY_PACKAGE_ROOT_PATH;
2626
import static io.wcm.devops.conga.plugins.aem.postprocessor.ContentPackageOptions.PROPERTY_PACKAGE_VERSION;
27+
import static io.wcm.devops.conga.plugins.aem.postprocessor.ContentPackageTestUtil.assertXpathEvaluatesTo;
2728
import static io.wcm.devops.conga.plugins.aem.postprocessor.ContentPackageTestUtil.getDataFromZip;
2829
import static io.wcm.devops.conga.plugins.aem.postprocessor.ContentPackageTestUtil.getXmlFromZip;
29-
import static org.custommonkey.xmlunit.XMLAssert.assertXpathEvaluatesTo;
3030
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
3131
import static org.junit.jupiter.api.Assertions.assertEquals;
3232
import static org.junit.jupiter.api.Assertions.assertFalse;

conga-aem-plugin/src/test/java/io/wcm/devops/conga/plugins/aem/postprocessor/ContentPackagePostProcessorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
import static io.wcm.devops.conga.plugins.aem.postprocessor.ContentPackageOptions.PROPERTY_PACKAGE_PROPERTIES;
2929
import static io.wcm.devops.conga.plugins.aem.postprocessor.ContentPackageOptions.PROPERTY_PACKAGE_ROOT_PATH;
3030
import static io.wcm.devops.conga.plugins.aem.postprocessor.ContentPackageOptions.PROPERTY_PACKAGE_THUMBNAIL_IMAGE;
31+
import static io.wcm.devops.conga.plugins.aem.postprocessor.ContentPackageTestUtil.assertXpathEvaluatesTo;
3132
import static io.wcm.devops.conga.plugins.aem.postprocessor.ContentPackageTestUtil.getDataFromZip;
3233
import static io.wcm.devops.conga.plugins.aem.postprocessor.ContentPackageTestUtil.getXmlFromZip;
33-
import static org.custommonkey.xmlunit.XMLAssert.assertXpathEvaluatesTo;
3434
import static org.junit.jupiter.api.Assertions.assertFalse;
3535
import static org.junit.jupiter.api.Assertions.assertNotNull;
3636
import static org.junit.jupiter.api.Assertions.assertTrue;

conga-aem-plugin/src/test/java/io/wcm/devops/conga/plugins/aem/postprocessor/ContentPackageTestUtil.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,30 @@
1919
*/
2020
package io.wcm.devops.conga.plugins.aem.postprocessor;
2121

22+
import static org.junit.jupiter.api.Assertions.assertEquals;
23+
2224
import java.io.ByteArrayInputStream;
2325
import java.io.File;
2426
import java.io.FileNotFoundException;
2527

2628
import javax.xml.parsers.DocumentBuilder;
2729
import javax.xml.parsers.DocumentBuilderFactory;
2830

29-
import org.custommonkey.xmlunit.SimpleNamespaceContext;
30-
import org.custommonkey.xmlunit.XMLUnit;
3131
import org.w3c.dom.Document;
32+
import org.w3c.dom.Node;
33+
import org.xmlunit.xpath.JAXPXPathEngine;
34+
import org.xmlunit.xpath.XPathEngine;
3235
import org.zeroturnaround.zip.ZipUtil;
3336

3437
import io.wcm.tooling.commons.contentpackagebuilder.XmlNamespaces;
3538

3639
public final class ContentPackageTestUtil {
3740

3841
private static final DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY = DocumentBuilderFactory.newInstance();
42+
private static final XPathEngine XPATH_ENGINE = new JAXPXPathEngine();
3943
static {
4044
DOCUMENT_BUILDER_FACTORY.setNamespaceAware(true);
41-
XMLUnit.setXpathNamespaceContext(new SimpleNamespaceContext(XmlNamespaces.DEFAULT_NAMESPACES));
45+
XPATH_ENGINE.setNamespaceContext(XmlNamespaces.DEFAULT_NAMESPACES);
4246
}
4347

4448
private ContentPackageTestUtil() {
@@ -59,4 +63,12 @@ public static Document getXmlFromZip(File file, String path) throws Exception {
5963
return documentBuilder.parse(new ByteArrayInputStream(data));
6064
}
6165

66+
public static void assertXpathEvaluatesTo(String expected, String xpath, Node node) throws Exception {
67+
assertEquals(expected, XPATH_ENGINE.evaluate(xpath, node));
68+
}
69+
70+
public static void assertXpathEvaluatesTo(String expected, String xpath, Document doc) throws Exception {
71+
assertXpathEvaluatesTo(expected, xpath, doc.getDocumentElement());
72+
}
73+
6274
}

tooling/conga-aem-maven-plugin/pom.xml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,7 @@
118118
<dependency>
119119
<groupId>org.xmlunit</groupId>
120120
<artifactId>xmlunit-core</artifactId>
121-
<version>2.6.3</version>
122-
<scope>test</scope>
123-
</dependency>
124-
<dependency>
125-
<groupId>org.xmlunit</groupId>
126-
<artifactId>xmlunit-legacy</artifactId>
127-
<version>2.6.3</version>
121+
<version>2.7.0</version>
128122
<scope>test</scope>
129123
</dependency>
130124
<dependency>

tooling/conga-aem-maven-plugin/src/test/java/io/wcm/devops/conga/plugins/aem/maven/allpackage/AllPackageBuilderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
*/
2020
package io.wcm.devops.conga.plugins.aem.maven.allpackage;
2121

22+
import static io.wcm.devops.conga.plugins.aem.maven.allpackage.ContentPackageTestUtil.assertXpathEvaluatesTo;
2223
import static io.wcm.devops.conga.plugins.aem.maven.allpackage.ContentPackageTestUtil.getXmlFromZip;
23-
import static org.custommonkey.xmlunit.XMLAssert.assertXpathEvaluatesTo;
2424
import static org.junit.jupiter.api.Assertions.assertEquals;
2525
import static org.junit.jupiter.api.Assertions.assertTrue;
2626

tooling/conga-aem-maven-plugin/src/test/java/io/wcm/devops/conga/plugins/aem/maven/allpackage/ContentPackageTestUtil.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,30 @@
1919
*/
2020
package io.wcm.devops.conga.plugins.aem.maven.allpackage;
2121

22+
import static org.junit.jupiter.api.Assertions.assertEquals;
23+
2224
import java.io.ByteArrayInputStream;
2325
import java.io.File;
2426
import java.io.FileNotFoundException;
2527

2628
import javax.xml.parsers.DocumentBuilder;
2729
import javax.xml.parsers.DocumentBuilderFactory;
2830

29-
import org.custommonkey.xmlunit.SimpleNamespaceContext;
30-
import org.custommonkey.xmlunit.XMLUnit;
3131
import org.w3c.dom.Document;
32+
import org.w3c.dom.Node;
33+
import org.xmlunit.xpath.JAXPXPathEngine;
34+
import org.xmlunit.xpath.XPathEngine;
3235
import org.zeroturnaround.zip.ZipUtil;
3336

3437
import io.wcm.tooling.commons.contentpackagebuilder.XmlNamespaces;
3538

3639
public final class ContentPackageTestUtil {
3740

3841
private static final DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY = DocumentBuilderFactory.newInstance();
42+
private static final XPathEngine XPATH_ENGINE = new JAXPXPathEngine();
3943
static {
4044
DOCUMENT_BUILDER_FACTORY.setNamespaceAware(true);
41-
XMLUnit.setXpathNamespaceContext(new SimpleNamespaceContext(XmlNamespaces.DEFAULT_NAMESPACES));
45+
XPATH_ENGINE.setNamespaceContext(XmlNamespaces.DEFAULT_NAMESPACES);
4246
}
4347

4448
private ContentPackageTestUtil() {
@@ -59,4 +63,12 @@ public static Document getXmlFromZip(File file, String path) throws Exception {
5963
return documentBuilder.parse(new ByteArrayInputStream(data));
6064
}
6165

66+
public static void assertXpathEvaluatesTo(String expected, String xpath, Node node) throws Exception {
67+
assertEquals(expected, XPATH_ENGINE.evaluate(xpath, node));
68+
}
69+
70+
public static void assertXpathEvaluatesTo(String expected, String xpath, Document doc) throws Exception {
71+
assertXpathEvaluatesTo(expected, xpath, doc.getDocumentElement());
72+
}
73+
6274
}

0 commit comments

Comments
 (0)