[javapackages] Add tests for -r option (maven_depmap.py)
by Michal Srb
commit 8c8e87028ebc10fc36c606b0699952728fc52d8b
Author: Michal Srb <msrb(a)redhat.com>
Date: Wed Oct 2 15:26:11 2013 +0200
Add tests for -r option (maven_depmap.py)
test/data/maven_depmap/JPP-testversioned.pom | 6 +++
test/data/maven_depmap/test_versioned-want.xml | 32 ++++++++++++++++
test/data/maven_depmap/test_versioned2-want.xml | 16 ++++++++
.../test_versioned_classifier-want.xml | 32 ++++++++++++++++
.../maven_depmap/test_versioned_with_pom-want.xml | 28 ++++++++++++++
test/maven_depmap_test.py | 39 ++++++++++++++++++++
6 files changed, 153 insertions(+), 0 deletions(-)
---
diff --git a/test/data/maven_depmap/JPP-testversioned.pom b/test/data/maven_depmap/JPP-testversioned.pom
new file mode 100644
index 0000000..f10a6cf
--- /dev/null
+++ b/test/data/maven_depmap/JPP-testversioned.pom
@@ -0,0 +1,6 @@
+<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>alias</groupId>
+ <artifactId>alias</artifactId>
+ <version>2012</version>
+</project>
diff --git a/test/data/maven_depmap/test_versioned-want.xml b/test/data/maven_depmap/test_versioned-want.xml
new file mode 100644
index 0000000..723afdf
--- /dev/null
+++ b/test/data/maven_depmap/test_versioned-want.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" ?>
+<dependencyMap>
+ <skipProvides/>
+ <dependency>
+ <maven>
+ <artifactId>a</artifactId>
+ <groupId>g</groupId>
+ <extension>war</extension>
+ <version>1.2.3</version>
+ </maven>
+ <jpp>
+ <artifactId>versioned</artifactId>
+ <groupId>JPP</groupId>
+ <extension>war</extension>
+ <version>1.2.3</version>
+ </jpp>
+ </dependency>
+ <dependency>
+ <maven>
+ <artifactId>a</artifactId>
+ <groupId>g</groupId>
+ <extension>war</extension>
+ <version>1.2.3</version>
+ </maven>
+ <jpp>
+ <artifactId>versioned</artifactId>
+ <groupId>JPP</groupId>
+ <extension>war</extension>
+ <version>2.0.0</version>
+ </jpp>
+ </dependency>
+</dependencyMap>
diff --git a/test/data/maven_depmap/test_versioned2-want.xml b/test/data/maven_depmap/test_versioned2-want.xml
new file mode 100644
index 0000000..fc4027d
--- /dev/null
+++ b/test/data/maven_depmap/test_versioned2-want.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" ?>
+<dependencyMap>
+ <skipProvides/>
+ <dependency>
+ <maven>
+ <artifactId>a</artifactId>
+ <groupId>g</groupId>
+ <version>1.2</version>
+ </maven>
+ <jpp>
+ <artifactId>versioned2</artifactId>
+ <groupId>JPP</groupId>
+ <version>1.2</version>
+ </jpp>
+ </dependency>
+</dependencyMap>
diff --git a/test/data/maven_depmap/test_versioned_classifier-want.xml b/test/data/maven_depmap/test_versioned_classifier-want.xml
new file mode 100644
index 0000000..217f166
--- /dev/null
+++ b/test/data/maven_depmap/test_versioned_classifier-want.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" ?>
+<dependencyMap>
+ <skipProvides/>
+ <dependency>
+ <maven>
+ <artifactId>a</artifactId>
+ <groupId>g</groupId>
+ <version>1</version>
+ <classifier>tests</classifier>
+ </maven>
+ <jpp>
+ <artifactId>versioned-3</artifactId>
+ <groupId>JPP</groupId>
+ <version>1</version>
+ <classifier>tests</classifier>
+ </jpp>
+ </dependency>
+ <dependency>
+ <maven>
+ <artifactId>a</artifactId>
+ <groupId>g</groupId>
+ <version>1</version>
+ <classifier>tests</classifier>
+ </maven>
+ <jpp>
+ <artifactId>versioned-3</artifactId>
+ <groupId>JPP</groupId>
+ <version>1.2</version>
+ <classifier>tests</classifier>
+ </jpp>
+ </dependency>
+</dependencyMap>
diff --git a/test/data/maven_depmap/test_versioned_with_pom-want.xml b/test/data/maven_depmap/test_versioned_with_pom-want.xml
new file mode 100644
index 0000000..427ffb0
--- /dev/null
+++ b/test/data/maven_depmap/test_versioned_with_pom-want.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" ?>
+<dependencyMap>
+ <skipProvides/>
+ <dependency>
+ <maven>
+ <artifactId>alias</artifactId>
+ <groupId>alias</groupId>
+ <version>2012</version>
+ </maven>
+ <jpp>
+ <artifactId>testversioned</artifactId>
+ <groupId>JPP</groupId>
+ <version>2013.10</version>
+ </jpp>
+ </dependency>
+ <dependency>
+ <maven>
+ <artifactId>alias</artifactId>
+ <groupId>alias</groupId>
+ <version>2012</version>
+ </maven>
+ <jpp>
+ <artifactId>testversioned</artifactId>
+ <groupId>JPP</groupId>
+ <version>2012</version>
+ </jpp>
+ </dependency>
+</dependencyMap>
diff --git a/test/data/maven_depmap/usr/share/java/testversioned.jar b/test/data/maven_depmap/usr/share/java/testversioned.jar
new file mode 100644
index 0000000..e69de29
diff --git a/test/data/maven_depmap/usr/share/java/versioned-3-tests.jar b/test/data/maven_depmap/usr/share/java/versioned-3-tests.jar
new file mode 100644
index 0000000..e69de29
diff --git a/test/data/maven_depmap/usr/share/java/versioned.war b/test/data/maven_depmap/usr/share/java/versioned.war
new file mode 100644
index 0000000..e69de29
diff --git a/test/maven_depmap_test.py b/test/maven_depmap_test.py
index 7ccc0dd..2d8bd8b 100644
--- a/test/maven_depmap_test.py
+++ b/test/maven_depmap_test.py
@@ -314,6 +314,45 @@ class TestMavenDepmap(unittest.TestCase):
self.assertEqual(report, [])
self.assertEqual(res, True)
+ @mvn_depmap('g:a:war:1.2.3', 'usr/share/java/versioned.war', ['-r', '2.0.0'])
+ def test_versioned(self, stdout, stderr, return_value, depmap):
+ self.assertEqual(return_value, 0, stderr)
+ got, want, res = self.check_result(inspect.currentframe().f_code.co_name,
+ depmap)
+ self.assertEqual(res, True)
+ self.assertEqual(False, os.path.exists('usr/share/java/versioned.war'))
+ self.assertEqual(True, os.path.exists('usr/share/java/versioned-1.2.3.war'))
+ self.assertEqual(True, os.path.exists('usr/share/java/versioned-2.0.0.war'))
+
+ @mvn_depmap('g:a:1.2', 'usr/share/java/versioned2.jar', ['-r', '1.2'])
+ def test_versioned2(self, stdout, stderr, return_value, depmap):
+ self.assertEqual(return_value, 0, stderr)
+ got, want, res = self.check_result(inspect.currentframe().f_code.co_name,
+ depmap)
+ self.assertEqual(res, True)
+ self.assertEqual(False, os.path.exists('usr/share/java/versioned2.jar'))
+ self.assertEqual(True, os.path.exists('usr/share/java/versioned2-1.2.jar'))
+
+ @mvn_depmap('g:a:jar:tests:1', 'usr/share/java/versioned-3-tests.jar', ['-r', '1,1.2'])
+ def test_versioned_classifier(self, stdout, stderr, return_value, depmap):
+ self.assertEqual(return_value, 0, stderr)
+ got, want, res = self.check_result(inspect.currentframe().f_code.co_name,
+ depmap)
+ self.assertEqual(res, True)
+ self.assertEqual(False, os.path.exists('usr/share/java/versioned-3-tests.jar'))
+ self.assertEqual(True, os.path.exists('usr/share/java/versioned-3-tests-1.jar'))
+ self.assertEqual(True, os.path.exists('usr/share/java/versioned-3-tests-1.2.jar'))
+
+ @mvn_depmap('JPP-testversioned.pom', 'usr/share/java/testversioned.jar', ['-r', '2013.10'])
+ def test_versioned_with_pom(self, stdout, stderr, return_value, depmap):
+ self.assertEqual(return_value, 0, stderr)
+ got, want, res = self.check_result(inspect.currentframe().f_code.co_name,
+ depmap)
+ self.assertEqual(res, True)
+ self.assertEqual(False, os.path.exists('usr/share/java/testversioned.jar'))
+ self.assertEqual(True, os.path.exists('usr/share/java/testversioned-2012.jar'))
+ self.assertEqual(True, os.path.exists('usr/share/java/testversioned-2013.10.jar'))
+
if __name__ == '__main__':
unittest.main()
10 years, 7 months
[javapackages] maven_depmap.py: get rid of version duplicates
by Michal Srb
commit 21a174ee89cff64f004350f5ed30cbc383450487
Author: Michal Srb <msrb(a)redhat.com>
Date: Wed Oct 2 15:10:32 2013 +0200
maven_depmap.py: get rid of version duplicates
java-utils/maven_depmap.py | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/java-utils/maven_depmap.py b/java-utils/maven_depmap.py
index 902806d..134201c 100644
--- a/java-utils/maven_depmap.py
+++ b/java-utils/maven_depmap.py
@@ -269,15 +269,15 @@ def output_fragment(fragment_path, fragment, mappings, add_versions):
root = Element("dependencyMap")
if not add_versions:
- versions = []
+ versions = set()
else:
- versions = add_versions.split(',')
+ versions = set(add_versions.split(','))
if add_versions or add_versions == "":
# skip RPM provides in compat packages
SubElement(root, "skipProvides")
- versions.insert(0, fragment.upstream_artifact.version)
+ versions.add(fragment.upstream_artifact.version)
for ver in versions:
for fragment in mappings:
dep = SubElement(root, "dependency")
10 years, 7 months
[javapackages] Update maven_depmap test_cdata because of test API change
by Mikolaj Izdebski
commit 1f078dbd7aec89654fd859959ef1dd11e8cc8407
Author: Mikolaj Izdebski <mizdebsk(a)redhat.com>
Date: Wed Oct 2 16:43:41 2013 +0200
Update maven_depmap test_cdata because of test API change
test/maven_depmap_test.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/test/maven_depmap_test.py b/test/maven_depmap_test.py
index 5d2d84d..7ccc0dd 100644
--- a/test/maven_depmap_test.py
+++ b/test/maven_depmap_test.py
@@ -309,8 +309,9 @@ class TestMavenDepmap(unittest.TestCase):
@mvn_depmap('JPP-cdata.pom')
def test_cdata(self, stdout, stderr, return_value, depmap):
self.assertEqual(return_value, 0, stderr)
- got, want, res = self.check_result(inspect.currentframe().f_code.co_name,
+ got, want, res, report = self.check_result(inspect.currentframe().f_code.co_name,
depmap)
+ self.assertEqual(report, [])
self.assertEqual(res, True)
10 years, 7 months
[javapackages] maven_depmap: add extension for pom only fragments
by Stanislav Ochotnicky
commit b80c1b6b7ef118456bcea3d4adb79ab3bac6cc83
Author: Stanislav Ochotnicky <sochotnicky(a)redhat.com>
Date: Wed Oct 2 16:24:13 2013 +0200
maven_depmap: add extension for pom only fragments
java-utils/maven_depmap.py | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
---
diff --git a/java-utils/maven_depmap.py b/java-utils/maven_depmap.py
index 88cacc9..902806d 100644
--- a/java-utils/maven_depmap.py
+++ b/java-utils/maven_depmap.py
@@ -220,6 +220,7 @@ def parse_pom(pom_file, prefix, jar_file = None):
if not jar_file:
if not pom.packaging or pom.packaging != "pom":
raise PackagingTypeMissingFile(pom_path)
+ extension = 'pom'
else:
# let's just take last part of filename as extension
fname, ext = os.path.splitext(jar_path)
10 years, 7 months
[javapackages] Comment improvement
by Mikolaj Izdebski
commit 071ce0798c53017109925ec3d243fa50d243a8e4
Author: Mikolaj Izdebski <mizdebsk(a)redhat.com>
Date: Wed Oct 2 16:20:06 2013 +0200
Comment improvement
s|%{datadir}/java-utils|%{_javadir}-utils|
java-utils/maven_depmap.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/java-utils/maven_depmap.py b/java-utils/maven_depmap.py
index 71f8739..88cacc9 100644
--- a/java-utils/maven_depmap.py
+++ b/java-utils/maven_depmap.py
@@ -33,7 +33,7 @@
# this script is used by add_maven_depmap rpm macro to generate
# mapping between maven groupId:artifactId and jar file in our local
# filesystem (i.e. %{_javadir})
-# rpm macro expects to find this file as %{_datadir}/java-utils/maven_depmap.py
+# rpm macro expects to find this file as %{_javadir}-utils/maven_depmap.py
from optparse import OptionParser
import sys
10 years, 7 months
[javapackages] Ignore some temporary and auto-generated files
by Mikolaj Izdebski
commit 5fce9e06f0b7bd2bdc480822ca3a4270f19af1b3
Author: Mikolaj Izdebski <mizdebsk(a)redhat.com>
Date: Wed Oct 2 16:13:29 2013 +0200
Ignore some temporary and auto-generated files
.gitignore | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 1bfd76f..e4a4d16 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,12 @@
+*~
*.tar.*
*.html
.images_uploaded
+*.pyc
+
+config.status
+
+target/
+root/
+python/build/
+python/javapackages.egg-info/
10 years, 7 months
[javapackages] Deduplicate name of testcase
by Stanislav Ochotnicky
commit 726c2e06d00ce546d1bae42865c18044886195e4
Author: Stanislav Ochotnicky <sochotnicky(a)redhat.com>
Date: Wed Oct 2 15:58:47 2013 +0200
Deduplicate name of testcase
Also fix test for unexpected sub-elements in text nodes
python/test/pom_test.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/python/test/pom_test.py b/python/test/pom_test.py
index 89e4ee7..7f7b41e 100644
--- a/python/test/pom_test.py
+++ b/python/test/pom_test.py
@@ -51,7 +51,7 @@ class TestPOM(unittest.TestCase):
self.assertEqual(p.version, "3.1.3")
@pomfile("parent-version.pom")
- def test_no_xmlns(self, p):
+ def test_parent_version(self, p):
self.assertEqual(p.packaging, None)
self.assertEqual(p.groupId, "commons-lang")
self.assertEqual(p.artifactId, "commons-lang")
@@ -65,6 +65,7 @@ class TestPOM(unittest.TestCase):
@exception_expected(PomLoadingException)
@pomfile("junit-broken-subnode.pom")
def test_pom_broken_subnode(self, p):
+ p.version
self.fail("Broken POM succesfully loaded")
@pomfile("junit-comments.pom")
10 years, 7 months
[javapackages] Fix test_cdata-want.xml
by Mikolaj Izdebski
commit c1766b0d13dfcd36c445a02cc196bfac468bfa77
Author: Mikolaj Izdebski <mizdebsk(a)redhat.com>
Date: Wed Oct 2 15:55:12 2013 +0200
Fix test_cdata-want.xml
test/data/maven_depmap/test_cdata-want.xml | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/test/data/maven_depmap/test_cdata-want.xml b/test/data/maven_depmap/test_cdata-want.xml
index fd1fda2..033f00b 100644
--- a/test/data/maven_depmap/test_cdata-want.xml
+++ b/test/data/maven_depmap/test_cdata-want.xml
@@ -3,12 +3,13 @@
<maven>
<groupId>group</groupId>
<artifactId>artifact</artifactId>
- <extension>artifact</extension>
+ <extension>pom</extension>
<version>1.2.3</version>
</maven>
<jpp>
<groupId>JPP</groupId>
- <artifactId>commons-war</artifactId>
+ <artifactId>cdata</artifactId>
+ <extension>pom</extension>
</jpp>
</dependency>
</dependencyMap>
10 years, 7 months
[javapackages] Add maven_depmap test for parent version
by Mikolaj Izdebski
commit f85f8d0993ba262ee90e06bd3e326feca3acbfcd
Author: Mikolaj Izdebski <mizdebsk(a)redhat.com>
Date: Wed Oct 2 15:53:17 2013 +0200
Add maven_depmap test for parent version
If groupId and version are omitted then appropriate entries form
parent should be used.
test/data/maven_depmap/JPP-parent-version.pom | 10 ++++++++++
.../data/maven_depmap/test_parent_version-want.xml | 15 +++++++++++++++
test/maven_depmap_test.py | 8 ++++++++
3 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/test/data/maven_depmap/JPP-parent-version.pom b/test/data/maven_depmap/JPP-parent-version.pom
new file mode 100644
index 0000000..a66fcea
--- /dev/null
+++ b/test/data/maven_depmap/JPP-parent-version.pom
@@ -0,0 +1,10 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>a</artifactId>
+ <packaging>pom</packaging>
+ <parent>
+ <groupId>g</groupId>
+ <artifactId>p</artifactId>
+ <version>1</version>
+ </parent>
+</project>
diff --git a/test/data/maven_depmap/test_parent_version-want.xml b/test/data/maven_depmap/test_parent_version-want.xml
new file mode 100644
index 0000000..64274c1
--- /dev/null
+++ b/test/data/maven_depmap/test_parent_version-want.xml
@@ -0,0 +1,15 @@
+<dependencyMap>
+ <dependency>
+ <maven>
+ <groupId>g</groupId>
+ <artifactId>a</artifactId>
+ <version>1</version>
+ <extension>pom</extension>
+ </maven>
+ <jpp>
+ <groupId>JPP</groupId>
+ <artifactId>parent-version</artifactId>
+ <extension>pom</extension>
+ </jpp>
+ </dependency>
+</dependencyMap>
diff --git a/test/maven_depmap_test.py b/test/maven_depmap_test.py
index b4c61d5..5d2d84d 100644
--- a/test/maven_depmap_test.py
+++ b/test/maven_depmap_test.py
@@ -92,6 +92,14 @@ class TestMavenDepmap(unittest.TestCase):
def test_missing_version(self, stdout, stderr, return_value, depmap):
self.assertNotEqual(return_value, 0)
+ @mvn_depmap('JPP-parent-version.pom')
+ def test_parent_version(self, stdout, stderr, return_value, depmap):
+ self.assertEqual(return_value, 0, stderr)
+ got, want, res, report = self.check_result(inspect.currentframe().f_code.co_name,
+ depmap)
+ self.assertEqual(report, [])
+ self.assertEqual(res, True)
+
@mvn_depmap('JPP-commons-war.pom', 'usr/share/java/commons-war.war')
def test_war(self, stdout, stderr, return_value, depmap):
self.assertEqual(return_value, 0, stderr)
10 years, 7 months
[javapackages] POM: strip comments and replace CDATA sections for parser
by Stanislav Ochotnicky
commit 59ec908f77f09f92d902f5ec0639ea0c756c87ea
Author: Stanislav Ochotnicky <sochotnicky(a)redhat.com>
Date: Wed Oct 2 15:47:52 2013 +0200
POM: strip comments and replace CDATA sections for parser
Also verify that requested text nodes have no children
python/javapackages/pom.py | 17 ++++++++++++++---
python/test/data/junit-broken-subnode.pom | 18 ++++++++++++++++++
python/test/data/junit-comments.pom | 17 +++++++++++++++++
python/test/pom_test.py | 14 +++++++++++++-
4 files changed, 62 insertions(+), 4 deletions(-)
---
diff --git a/python/javapackages/pom.py b/python/javapackages/pom.py
index 2051b9e..87a4f4d 100644
--- a/python/javapackages/pom.py
+++ b/python/javapackages/pom.py
@@ -30,7 +30,7 @@
#
# Authors: Stanislav Ochotnicky <sochotnicky(a)redhat.com>
-from lxml.etree import ElementTree
+from lxml.etree import ElementTree, XMLParser
class PomLoadingException(Exception):
pass
@@ -41,7 +41,9 @@ class POM(object):
"""
def __init__(self, path):
et = ElementTree ()
- self.__doc = et.parse(path)
+ parser = XMLParser(remove_comments=True,
+ strip_cdata=True)
+ self.__doc = et.parse(path, parser=parser)
if self.__doc is None:
raise PomLoadingException("Failed to load pom.xml. You have a problem")
@@ -67,6 +69,8 @@ class POM(object):
gId = self.__find('./pom:groupId')
if gId is None:
gId = self.__find('./pom:parent/pom:groupId')
+ if len(gId) != 0:
+ raise PomLoadingException("Unexpected child nodes under groupId")
return gId.text.strip()
@property
@@ -74,7 +78,10 @@ class POM(object):
"""
Effective artifactId of the pom Artifact
"""
- return self.__find('./pom:artifactId').text.strip()
+ aId = self.__find('./pom:artifactId')
+ if len(aId) != 0:
+ raise PomLoadingException("Unexpected child nodes under artifactId")
+ return aId.text.strip()
@property
def version(self):
@@ -86,6 +93,8 @@ class POM(object):
if version is None:
version = self.__find('./pom:parent/pom:version')
assert version is not None
+ if len(version) != 0:
+ raise PomLoadingException("Unexpected child nodes under version")
return version.text.strip()
@property
@@ -95,5 +104,7 @@ class POM(object):
"""
p = self.__find('./pom:packaging')
if p is not None:
+ if len(p) != 0:
+ raise PomLoadingException("Unexpected child nodes under packaging")
return p.text.strip()
return None
diff --git a/python/test/data/junit-broken-subnode.pom b/python/test/data/junit-broken-subnode.pom
new file mode 100644
index 0000000..4c2fc1d
--- /dev/null
+++ b/python/test/data/junit-broken-subnode.pom
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>
+ <v2>V2222</v2>
+ <!-- blah -->4.11<!-- some comment -->
+ </version>
+
+ <name>JUnit</name>
+ <url>http://junit.org</url>
+ <description>
+ JUnit is a regression testing framework written by Erich Gamma and Kent Beck.
+ It is used by the developer who implements unit tests in Java.
+ </description>
+</project>
diff --git a/python/test/data/junit-comments.pom b/python/test/data/junit-comments.pom
new file mode 100644
index 0000000..1c548d3
--- /dev/null
+++ b/python/test/data/junit-comments.pom
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>
+ <!-- blah -->4.11<!-- some comment -->
+ </version>
+
+ <name>JUnit</name>
+ <url>http://junit.org</url>
+ <description>
+ JUnit is a regression testing framework written by Erich Gamma and Kent Beck.
+ It is used by the developer who implements unit tests in Java.
+ </description>
+</project>
diff --git a/python/test/pom_test.py b/python/test/pom_test.py
index 39cb5ce..89e4ee7 100644
--- a/python/test/pom_test.py
+++ b/python/test/pom_test.py
@@ -2,7 +2,7 @@ import os
import unittest
import lxml
-from javapackages import POM
+from javapackages.pom import POM, PomLoadingException
from misc import exception_expected
@@ -62,6 +62,18 @@ class TestPOM(unittest.TestCase):
def test_unparsable_xml(self, p):
self.fail("Unparsable xml successfully parsed")
+ @exception_expected(PomLoadingException)
+ @pomfile("junit-broken-subnode.pom")
+ def test_pom_broken_subnode(self, p):
+ self.fail("Broken POM succesfully loaded")
+
+ @pomfile("junit-comments.pom")
+ def test_pom_comments(self, p):
+ self.assertEqual(p.packaging, None)
+ self.assertEqual(p.groupId, "junit")
+ self.assertEqual(p.artifactId, "junit")
+ self.assertEqual(p.version, "4.11")
+
if __name__ == '__main__':
unittest.main()
10 years, 7 months