commit 15a3a5f01ffed3d748f40d23b8ae59407a7c3c57
Author: Michal Srb <msrb(a)redhat.com>
Date: Wed Sep 18 14:44:31 2013 +0200
pom_macros_test: compare XML files with formencode.doctest_xml_compare
test/data/pom_macros/pom_add_dep.xml-want | 24 +++
test/data/pom_macros/pom_add_dep2.xml-want | 27 ++++
test/data/pom_macros/pom_add_dep_fail.xml-want | 13 ++
test/data/pom_macros/pom_add_dep_mgmt.xml-want | 30 ++++
test/data/pom_macros/pom_add_dep_mgmt2.xml-want | 26 ++++
.../data/pom_macros/pom_add_dep_mgmt_nons.xml-want | 26 ++++
test/data/pom_macros/pom_add_dep_nons.xml-want | 24 +++
test/data/pom_macros/pom_add_parent.xml-want | 29 ++++
test/data/pom_macros/pom_add_parent_fail.xml-want | 22 +++
test/data/pom_macros/pom_add_parent_nons.xml-want | 29 ++++
.../data/pom_macros/pom_add_parent_second.xml-want | 34 +++++
test/data/pom_macros/pom_add_plugin.xml-want | 32 ++++
test/data/pom_macros/pom_add_plugin2.xml-want | 26 ++++
.../pom_macros/pom_add_plugin_default_gid.xml-want | 26 ++++
test/data/pom_macros/pom_add_plugin_nons.xml-want | 29 ++++
test/data/pom_macros/pom_disable_module.xml-want | 23 +++
.../pom_macros/pom_disable_module_nons.xml-want | 23 +++
.../pom_macros/pom_disable_module_ret1.xml-want | 23 +++
test/data/pom_macros/pom_remove_dep.xml-want | 23 +++
test/data/pom_macros/pom_remove_dep2.xml-want | 29 ++++
test/data/pom_macros/pom_remove_dep_nons.xml-want | 22 +++
test/data/pom_macros/pom_remove_dep_ret1.xml-want | 27 ++++
test/data/pom_macros/pom_remove_parent.xml-want | 19 +++
.../pom_macros/pom_remove_parent_fail.xml-want | 17 ++
.../pom_macros/pom_remove_parent_nons.xml-want | 19 +++
test/data/pom_macros/pom_remove_plugin.xml-want | 22 +++
test/data/pom_macros/pom_remove_plugin2.xml-want | 23 +++
.../pom_macros/pom_remove_plugin_nons.xml-want | 25 +++
.../pom_macros/pom_remove_plugin_ret1.xml-want | 25 +++
test/data/pom_macros/pom_set_parent.xml-want | 25 +++
test/data/pom_macros/pom_set_parent_fail.xml-want | 17 ++
test/data/pom_macros/pom_set_parent_nons.xml-want | 25 +++
test/data/pom_macros/pom_xpath_remove.xml-want | 32 ++++
test/pom_macros_test.py | 156 ++++++++------------
34 files changed, 876 insertions(+), 96 deletions(-)
---
diff --git a/test/data/pom_macros/pom_add_dep.xml-want
b/test/data/pom_macros/pom_add_dep.xml-want
new file mode 100644
index 0000000..4bbd51b
--- /dev/null
+++ b/test/data/pom_macros/pom_add_dep.xml-want
@@ -0,0 +1,24 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <!-- section added by maintainer -->
+ <dependencies>
+ <!-- begin of code added by maintainer -->
+ <dependency>
+ <groupId>gdep</groupId>
+ <artifactId>adep</artifactId>
+ <version>3.2</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- end of code added by maintainer -->
+ </dependencies>
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+</project>
diff --git a/test/data/pom_macros/pom_add_dep2.xml-want
b/test/data/pom_macros/pom_add_dep2.xml-want
new file mode 100644
index 0000000..7e53bfc
--- /dev/null
+++ b/test/data/pom_macros/pom_add_dep2.xml-want
@@ -0,0 +1,27 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <dependencies>
+ <!-- begin of code added by maintainer -->
+ <dependency>
+ <groupId>gdep</groupId>
+ <artifactId>adep</artifactId>
+ <version>any</version>
+ </dependency>
+ <!-- end of code added by maintainer -->
+ <dependency>
+ <groupId>G</groupId>
+ <artifactId>G</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/test/data/pom_macros/pom_add_dep_fail.xml-want
b/test/data/pom_macros/pom_add_dep_fail.xml-want
new file mode 100644
index 0000000..45736ef
--- /dev/null
+++ b/test/data/pom_macros/pom_add_dep_fail.xml-want
@@ -0,0 +1,13 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+</project>
diff --git a/test/data/pom_macros/pom_add_dep_mgmt.xml-want
b/test/data/pom_macros/pom_add_dep_mgmt.xml-want
new file mode 100644
index 0000000..ac17912
--- /dev/null
+++ b/test/data/pom_macros/pom_add_dep_mgmt.xml-want
@@ -0,0 +1,30 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <dependencyManagement>
+ <dependencies>
+ <!-- begin of code added by maintainer -->
+ <dependency>
+ <groupId>gdep</groupId>
+ <artifactId>adep</artifactId>
+ <version>3.2</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- end of code added by maintainer -->
+ <dependency>
+ <groupId>GGG</groupId>
+ <artifactId>GGG</artifactId>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+</project>
diff --git a/test/data/pom_macros/pom_add_dep_mgmt2.xml-want
b/test/data/pom_macros/pom_add_dep_mgmt2.xml-want
new file mode 100644
index 0000000..bc519e9
--- /dev/null
+++ b/test/data/pom_macros/pom_add_dep_mgmt2.xml-want
@@ -0,0 +1,26 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <!-- section added by maintainer -->
+ <dependencyManagement>
+ <!-- section added by maintainer -->
+ <dependencies>
+ <!-- begin of code added by maintainer -->
+ <dependency>
+ <groupId>gdep</groupId>
+ <artifactId>adep</artifactId>
+ <version>any</version>
+ </dependency>
+ <!-- end of code added by maintainer -->
+ </dependencies>
+ </dependencyManagement>
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+</project>
diff --git a/test/data/pom_macros/pom_add_dep_mgmt_nons.xml-want
b/test/data/pom_macros/pom_add_dep_mgmt_nons.xml-want
new file mode 100644
index 0000000..5ae8f14
--- /dev/null
+++ b/test/data/pom_macros/pom_add_dep_mgmt_nons.xml-want
@@ -0,0 +1,26 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<!-- section added by maintainer -->
+<dependencyManagement>
+<!-- section added by maintainer -->
+<dependencies>
+<!-- begin of code added by maintainer -->
+<dependency>
+<groupId>gdep</groupId>
+<artifactId>adep</artifactId>
+<version>any</version>
+</dependency>
+<!-- end of code added by maintainer -->
+</dependencies>
+</dependencyManagement>
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+</project>
diff --git a/test/data/pom_macros/pom_add_dep_nons.xml-want
b/test/data/pom_macros/pom_add_dep_nons.xml-want
new file mode 100644
index 0000000..b85e9ac
--- /dev/null
+++ b/test/data/pom_macros/pom_add_dep_nons.xml-want
@@ -0,0 +1,24 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<!-- section added by maintainer -->
+<dependencies>
+<!-- begin of code added by maintainer -->
+<dependency>
+<groupId>A</groupId>
+<artifactId>B</artifactId>
+<version>any</version>
+<scope>compile</scope>
+</dependency>
+<!-- end of code added by maintainer -->
+</dependencies>
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+</project>
diff --git a/test/data/pom_macros/pom_add_parent.xml-want
b/test/data/pom_macros/pom_add_parent.xml-want
new file mode 100644
index 0000000..0a3affe
--- /dev/null
+++ b/test/data/pom_macros/pom_add_parent.xml-want
@@ -0,0 +1,29 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <!-- begin of code added by maintainer -->
+ <parent>
+ <groupId>pg</groupId>
+ <artifactId>pa</artifactId>
+ <version>21</version>
+ </parent>
+ <!-- end of code added by maintainer -->
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.2</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/test/data/pom_macros/pom_add_parent_fail.xml-want
b/test/data/pom_macros/pom_add_parent_fail.xml-want
new file mode 100644
index 0000000..d1d76d3
--- /dev/null
+++ b/test/data/pom_macros/pom_add_parent_fail.xml-want
@@ -0,0 +1,22 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.2</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/test/data/pom_macros/pom_add_parent_nons.xml-want
b/test/data/pom_macros/pom_add_parent_nons.xml-want
new file mode 100644
index 0000000..e99dfac
--- /dev/null
+++ b/test/data/pom_macros/pom_add_parent_nons.xml-want
@@ -0,0 +1,29 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<!-- begin of code added by maintainer -->
+<parent>
+<groupId>pg</groupId>
+<artifactId>pa</artifactId>
+<version>any</version>
+</parent>
+<!-- end of code added by maintainer -->
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.2</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/test/data/pom_macros/pom_add_parent_second.xml-want
b/test/data/pom_macros/pom_add_parent_second.xml-want
new file mode 100644
index 0000000..56d79f7
--- /dev/null
+++ b/test/data/pom_macros/pom_add_parent_second.xml-want
@@ -0,0 +1,34 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <!-- begin of code added by maintainer -->
+ <parent>
+ <groupId>pg</groupId>
+ <artifactId>p-a</artifactId>
+ <version>1</version>
+ </parent>
+ <!-- end of code added by maintainer -->
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.2</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/test/data/pom_macros/pom_add_plugin.xml-want
b/test/data/pom_macros/pom_add_plugin.xml-want
new file mode 100644
index 0000000..fb4afb1
--- /dev/null
+++ b/test/data/pom_macros/pom_add_plugin.xml-want
@@ -0,0 +1,32 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <build>
+ <plugins>
+ <!-- begin of code added by maintainer -->
+ <plugin>
+ <groupId>plugin</groupId>
+ <artifactId>plug</artifactId>
+ <version>3</version>
+ </plugin>
+ <!-- end of code added by maintainer -->
+ <plugin>
+ <groupId>my.group</groupId>
+ <artifactId>my-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>my.group</groupId>
+ <artifactId>My-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/test/data/pom_macros/pom_add_plugin2.xml-want
b/test/data/pom_macros/pom_add_plugin2.xml-want
new file mode 100644
index 0000000..8f5b823
--- /dev/null
+++ b/test/data/pom_macros/pom_add_plugin2.xml-want
@@ -0,0 +1,26 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <!-- section added by maintainer -->
+ <build>
+ <!-- section added by maintainer -->
+ <plugins>
+ <!-- begin of code added by maintainer -->
+ <plugin>
+ <groupId>plug</groupId>
+ <artifactId>plug</artifactId>
+ <version>any</version>
+ </plugin>
+ <!-- end of code added by maintainer -->
+ </plugins>
+ </build>
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+</project>
diff --git a/test/data/pom_macros/pom_add_plugin_default_gid.xml-want
b/test/data/pom_macros/pom_add_plugin_default_gid.xml-want
new file mode 100644
index 0000000..e903699
--- /dev/null
+++ b/test/data/pom_macros/pom_add_plugin_default_gid.xml-want
@@ -0,0 +1,26 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <!-- section added by maintainer -->
+ <build>
+ <!-- section added by maintainer -->
+ <plugins>
+ <!-- begin of code added by maintainer -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>A-A</artifactId>
+ <version>any</version>
+ </plugin>
+ <!-- end of code added by maintainer -->
+ </plugins>
+ </build>
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+</project>
diff --git a/test/data/pom_macros/pom_add_plugin_nons.xml-want
b/test/data/pom_macros/pom_add_plugin_nons.xml-want
new file mode 100644
index 0000000..452efe0
--- /dev/null
+++ b/test/data/pom_macros/pom_add_plugin_nons.xml-want
@@ -0,0 +1,29 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <build>
+ <plugins>
+ <!-- begin of code added by maintainer -->
+ <plugin>
+ <groupId>g</groupId>
+ <artifactId>a</artifactId>
+ <version>15</version>
+ </plugin>
+ <!-- end of code added by maintainer -->
+ <plugin>
+ <groupId>gG</groupId>
+ <artifactId>AA</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+</project>
diff --git a/test/data/pom_macros/pom_disable_module.xml-want
b/test/data/pom_macros/pom_disable_module.xml-want
new file mode 100644
index 0000000..b1c68d8
--- /dev/null
+++ b/test/data/pom_macros/pom_disable_module.xml-want
@@ -0,0 +1,23 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <modules>
+ <module>module1</module>
+ <!-- module disabled by maintainer: module -->
+ <module>module2</module>
+ <module>module3</module>
+ <module>module4</module>
+ <module>module5</module>
+ <module>Module</module>
+ </modules>
+
+</project>
diff --git a/test/data/pom_macros/pom_disable_module_nons.xml-want
b/test/data/pom_macros/pom_disable_module_nons.xml-want
new file mode 100644
index 0000000..2332165
--- /dev/null
+++ b/test/data/pom_macros/pom_disable_module_nons.xml-want
@@ -0,0 +1,23 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <modules>
+ <!-- module disabled by maintainer: module -->
+ <!-- module disabled by maintainer: module -->
+ <module>mod ule</module>
+ <!-- module disabled by maintainer: module -->
+ <!-- module disabled by maintainer: module -->
+ <!-- module disabled by maintainer: module -->
+ <!-- module disabled by maintainer: module -->
+ </modules>
+
+</project>
diff --git a/test/data/pom_macros/pom_disable_module_ret1.xml-want
b/test/data/pom_macros/pom_disable_module_ret1.xml-want
new file mode 100644
index 0000000..949a6e3
--- /dev/null
+++ b/test/data/pom_macros/pom_disable_module_ret1.xml-want
@@ -0,0 +1,23 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <modules>
+ <module>module1</module>
+ <module>module</module>
+ <module>module2</module>
+ <module>module3</module>
+ <module>module4</module>
+ <module>module5</module>
+ <module>Module</module>
+ </modules>
+
+</project>
diff --git a/test/data/pom_macros/pom_remove_dep.xml-want
b/test/data/pom_macros/pom_remove_dep.xml-want
new file mode 100644
index 0000000..d6eaae4
--- /dev/null
+++ b/test/data/pom_macros/pom_remove_dep.xml-want
@@ -0,0 +1,23 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- dependency disabled by maintainer: commons-io:commons-io -->
+ </dependencies>
+
+</project>
diff --git a/test/data/pom_macros/pom_remove_dep2.xml-want
b/test/data/pom_macros/pom_remove_dep2.xml-want
new file mode 100644
index 0000000..237cce3
--- /dev/null
+++ b/test/data/pom_macros/pom_remove_dep2.xml-want
@@ -0,0 +1,29 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <dependencies>
+ <!-- dependency disabled by maintainer: commons-io:commons-io -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- dependency disabled by maintainer: commons-io:commons-io -->
+ <dependency>
+ <groupId>commons-ioX</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.2</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/test/data/pom_macros/pom_remove_dep_nons.xml-want
b/test/data/pom_macros/pom_remove_dep_nons.xml-want
new file mode 100644
index 0000000..43a14d8
--- /dev/null
+++ b/test/data/pom_macros/pom_remove_dep_nons.xml-want
@@ -0,0 +1,22 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <dependencies>
+ <!-- dependency disabled by maintainer: junit:junit -->
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.2</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/test/data/pom_macros/pom_remove_dep_ret1.xml-want
b/test/data/pom_macros/pom_remove_dep_ret1.xml-want
new file mode 100644
index 0000000..de3ebdf
--- /dev/null
+++ b/test/data/pom_macros/pom_remove_dep_ret1.xml-want
@@ -0,0 +1,27 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.2</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/test/data/pom_macros/pom_remove_parent.xml-want
b/test/data/pom_macros/pom_remove_parent.xml-want
new file mode 100644
index 0000000..4617370
--- /dev/null
+++ b/test/data/pom_macros/pom_remove_parent.xml-want
@@ -0,0 +1,19 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <!-- parent POM reference removed by maintainer -->
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- dependency disabled by maintainer: commons-io:commons-io -->
+ </dependencies>
+
+</project>
diff --git a/test/data/pom_macros/pom_remove_parent_fail.xml-want
b/test/data/pom_macros/pom_remove_parent_fail.xml-want
new file mode 100644
index 0000000..5bc8ec2
--- /dev/null
+++ b/test/data/pom_macros/pom_remove_parent_fail.xml-want
@@ -0,0 +1,17 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/test/data/pom_macros/pom_remove_parent_nons.xml-want
b/test/data/pom_macros/pom_remove_parent_nons.xml-want
new file mode 100644
index 0000000..3db55f2
--- /dev/null
+++ b/test/data/pom_macros/pom_remove_parent_nons.xml-want
@@ -0,0 +1,19 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <!-- parent POM reference removed by maintainer -->
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- dependency disabled by maintainer: commons-io:commons-io -->
+ </dependencies>
+
+</project>
diff --git a/test/data/pom_macros/pom_remove_plugin.xml-want
b/test/data/pom_macros/pom_remove_plugin.xml-want
new file mode 100644
index 0000000..05a9a5e
--- /dev/null
+++ b/test/data/pom_macros/pom_remove_plugin.xml-want
@@ -0,0 +1,22 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <build>
+ <plugins>
+ <!-- plugin disabled by maintainer: my.group:my-plugin -->
+ <plugin>
+ <groupId>my.group</groupId>
+ <artifactId>My-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/test/data/pom_macros/pom_remove_plugin2.xml-want
b/test/data/pom_macros/pom_remove_plugin2.xml-want
new file mode 100644
index 0000000..4adb99c
--- /dev/null
+++ b/test/data/pom_macros/pom_remove_plugin2.xml-want
@@ -0,0 +1,23 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <build>
+ <plugins>
+ <!-- plugin disabled by maintainer: my.group:my-plugin -->
+ <!-- plugin disabled by maintainer: my.group:my-plugin -->
+ <plugin>
+ <groupId>my.group</groupId>
+ <artifactId>My-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/test/data/pom_macros/pom_remove_plugin_nons.xml-want
b/test/data/pom_macros/pom_remove_plugin_nons.xml-want
new file mode 100644
index 0000000..c5c886d
--- /dev/null
+++ b/test/data/pom_macros/pom_remove_plugin_nons.xml-want
@@ -0,0 +1,25 @@
+<project>
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>my.group</groupId>
+ <artifactId>my-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>my.group</groupId>
+ <artifactId>My-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/test/data/pom_macros/pom_remove_plugin_ret1.xml-want
b/test/data/pom_macros/pom_remove_plugin_ret1.xml-want
new file mode 100644
index 0000000..68752f4
--- /dev/null
+++ b/test/data/pom_macros/pom_remove_plugin_ret1.xml-want
@@ -0,0 +1,25 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>my.group</groupId>
+ <artifactId>my-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>my.group</groupId>
+ <artifactId>My-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/test/data/pom_macros/pom_set_parent.xml-want
b/test/data/pom_macros/pom_set_parent.xml-want
new file mode 100644
index 0000000..85027aa
--- /dev/null
+++ b/test/data/pom_macros/pom_set_parent.xml-want
@@ -0,0 +1,25 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <!-- begin of code added by maintainer -->
+ <parent>
+ <groupId>pg</groupId>
+ <artifactId>aa</artifactId>
+ <version>5</version>
+ </parent>
+ <!-- end of code added by maintainer -->
+ <!-- parent POM reference replaced by maintainer -->
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/test/data/pom_macros/pom_set_parent_fail.xml-want
b/test/data/pom_macros/pom_set_parent_fail.xml-want
new file mode 100644
index 0000000..5bc8ec2
--- /dev/null
+++ b/test/data/pom_macros/pom_set_parent_fail.xml-want
@@ -0,0 +1,17 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/test/data/pom_macros/pom_set_parent_nons.xml-want
b/test/data/pom_macros/pom_set_parent_nons.xml-want
new file mode 100644
index 0000000..863f66f
--- /dev/null
+++ b/test/data/pom_macros/pom_set_parent_nons.xml-want
@@ -0,0 +1,25 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <!-- begin of code added by maintainer -->
+ <parent>
+ <groupId>pg</groupId>
+ <artifactId>aa</artifactId>
+ <version>any</version>
+ </parent>
+ <!-- end of code added by maintainer -->
+ <!-- parent POM reference replaced by maintainer -->
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/test/data/pom_macros/pom_xpath_remove.xml-want
b/test/data/pom_macros/pom_xpath_remove.xml-want
new file mode 100644
index 0000000..2b8cd7e
--- /dev/null
+++ b/test/data/pom_macros/pom_xpath_remove.xml-want
@@ -0,0 +1,32 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-parent</artifactId>
+ <version>17</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <name>Commons Lang</name>
+
+ <prerequisities>
+ <maven>3.0</maven>
+ <!-- element removed by maintainer: pom:maven-old -->
+ </prerequisities>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.2</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/test/pom_macros_test.py b/test/pom_macros_test.py
index 2a90426..717759f 100644
--- a/test/pom_macros_test.py
+++ b/test/pom_macros_test.py
@@ -52,189 +52,163 @@ class PomMacrosTest(unittest.TestCase):
def test_remove_dep(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:dependencies/a:dependency', namespaces=ns)
- self.assertEqual(len(r), 1)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_remove_dep commons-io:commons-io",
"pom_remove_dep2.xml")
def test_remove_deps(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:dependencies/a:dependency', namespaces=ns)
- self.assertEqual(len(r), 2)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_remove_dep junit:", "pom_remove_dep_nons.xml")
def test_remove_dep_nons(self, stdin, stderr, returncode, pom_path):
# no namespace
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:dependencies/a:dependency', namespaces=ns)
- self.assertEqual(len(r), 1)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_remove_dep not:there",
"pom_remove_dep_ret1.xml")
def test_remove_dep_no_effect(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 1, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:dependencies/a:dependency', namespaces=ns)
- self.assertEqual(len(r), 2)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_remove_plugin :my-plugin",
"pom_remove_plugin.xml")
def test_remove_plugin(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:build/a:plugins/a:plugin', namespaces=ns)
- self.assertEqual(len(r), 1)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_remove_plugin my.group:my-plugin",
"pom_remove_plugin2.xml")
def test_remove_plugins(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:build/a:plugins/a:plugin', namespaces=ns)
- self.assertEqual(len(r), 1)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_remove_plugin :my-plugin",
"pom_remove_plugin_nons.xml")
def test_remove_plugin_nons(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:build/a:plugins/a:plugin', namespaces=ns)
- self.assertEqual(len(r), 1)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_remove_plugin not:there",
"pom_remove_plugin_ret1.xml")
def test_remove_plugin_nons(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 1)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:build/a:plugins/a:plugin', namespaces=ns)
- self.assertEqual(len(r), 2)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_disable_module module",
"pom_disable_module.xml")
def test_disable_module(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:modules/a:module', namespaces=ns)
- self.assertEqual(len(r), 6)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_disable_module module",
"pom_disable_module_nons.xml")
def test_disable_module_nons(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:modules/a:module', namespaces=ns)
- self.assertEqual(len(r), 1)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_disable_module notthere",
"pom_disable_module_ret1.xml")
def test_disable_module_no_effect(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 1)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:modules/a:module', namespaces=ns)
- self.assertEqual(len(r), 7)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_add_dep gdep:adep:3.2:test", "pom_add_dep.xml")
def test_add_dep(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:dependencies/a:dependency', namespaces=ns)
- self.assertEqual(len(r), 1)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_add_dep gdep:adep", "pom_add_dep2.xml")
def test_add_dep2(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:dependencies/a:dependency', namespaces=ns)
- self.assertEqual(len(r), 2)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_add_dep A:B::compile", "pom_add_dep_nons.xml")
def test_add_dep_nons(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:dependencies/a:dependency', namespaces=ns)
- self.assertEqual(len(r), 1)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_add_dep_mgmt gdep:adep:3.2:test",
"pom_add_dep_mgmt.xml")
def test_add_dep_mgmt(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:dependencyManagement/a:dependencies/a:dependency',
namespaces=ns)
- self.assertEqual(len(r), 2)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_add_dep_mgmt gdep:adep",
"pom_add_dep_mgmt2.xml")
def test_add_dep_mgmt2(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:dependencyManagement/a:dependencies/a:dependency',
namespaces=ns)
- self.assertEqual(len(r), 1)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_add_dep_mgmt gdep:adep",
"pom_add_dep_mgmt_nons.xml")
def test_add_dep_mgmt_nons(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:dependencyManagement/a:dependencies/a:dependency',
namespaces=ns)
- self.assertEqual(len(r), 1)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_add_plugin plugin:plug:3",
"pom_add_plugin.xml")
def test_add_plugin(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:build/a:plugins/a:plugin', namespaces=ns)
- self.assertEqual(len(r), 3)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_add_plugin plug:plug", "pom_add_plugin2.xml")
def test_add_plugin2(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:build/a:plugins/a:plugin', namespaces=ns)
- self.assertEqual(len(r), 1)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_add_plugin g:a:15", "pom_add_plugin_nons.xml")
def test_add_plugin_nons(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:build/a:plugins/a:plugin', namespaces=ns)
- self.assertEqual(len(r), 2)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_add_plugin :A-A",
"pom_add_plugin_default_gid.xml")
def test_add_plugin_default_gid(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:build/a:plugins/a:plugin', namespaces=ns)
- self.assertEqual(len(r), 1)
- r = doc.xpath('./a:build/a:plugins/a:plugin/a:groupId', namespaces=ns)
- self.assertEqual(len(r), 1)
- self.assertEqual(r[0].text, "org.apache.maven.plugins")
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_remove_parent", "pom_remove_parent.xml")
def test_remove_parent(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:parent', namespaces=ns)
- self.assertEqual(len(r), 0)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_remove_parent", "pom_remove_parent_nons.xml")
def test_remove_parent_nons(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:parent', namespaces=ns)
- self.assertEqual(len(r), 0)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_remove_parent", "pom_remove_parent_fail.xml")
def test_remove_parent_fail(self, stdin, stderr, returncode, pom_path):
@@ -244,60 +218,50 @@ class PomMacrosTest(unittest.TestCase):
def test_add_parent(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:parent', namespaces=ns)
- self.assertEqual(len(r), 1)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_add_parent pg:pa", "pom_add_parent_nons.xml")
def test_add_parent_nons(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:parent', namespaces=ns)
- self.assertEqual(len(r), 1)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_add_parent pg:p-a:1",
"pom_add_parent_second.xml")
def test_add_parent_second(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:parent', namespaces=ns)
- self.assertEqual(len(r), 2)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_set_parent pg:aa:5", "pom_set_parent.xml")
def test_set_parent(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:parent', namespaces=ns)
- self.assertEqual(len(r), 1)
- r = doc.xpath('./a:parent/a:groupId', namespaces=ns)
- self.assertEqual(len(r), 1)
- self.assertEqual(r[0].text, "pg")
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_set_parent pg:aa", "pom_set_parent_nons.xml")
def test_set_parent_nons(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:parent', namespaces=ns)
- self.assertEqual(len(r), 1)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_set_parent pg:aa", "pom_set_parent_fail.xml")
def test_set_parent_fail(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 1, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:parent', namespaces=ns)
- self.assertEqual(len(r), 0)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_xpath_remove pom:maven-old",
"pom_xpath_remove.xml")
def test_xpath_remove(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- doc = etree.parse(pom_path)
- r = doc.xpath('./a:prerequisities/a:maven-old', namespaces=ns)
- self.assertEqual(len(r), 0)
+ got, want, res = self.check_result(pom_path)
+ self.assertEqual(res, True)
@exec_macro("pom_xpath_remove
\"pom:dependency[pom:artifactId[text()='m-m']]\"",
"pom_xpath_remove2.xml")