commit 378936ff19db503363e7eadc68157fd89ef09fc2 Author: Michael Simacek msimacek@redhat.com Date: Mon Sep 30 11:19:27 2013 +0200
Some test for options of maven_depmap
test/data/maven_depmap/test_append-want.xml | 25 +++++++++++ .../test_append_and_namespace-want.xml | 29 +++++++++++++ .../maven_depmap/test_append_multiple-want.xml | 36 ++++++++++++++++ test/data/maven_depmap/test_namespace-want.xml | 16 +++++++ test/data/maven_depmap/test_prefix-want.xml | 14 ++++++ test/data/maven_depmap/usr/foo/share/java/foo.jar | Bin 0 -> 261 bytes test/maven_depmap_test.py | 43 ++++++++++++++++++++ 7 files changed, 163 insertions(+), 0 deletions(-) --- diff --git a/test/data/maven_depmap/test_append-want.xml b/test/data/maven_depmap/test_append-want.xml new file mode 100644 index 0000000..c552db1 --- /dev/null +++ b/test/data/maven_depmap/test_append-want.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" ?> +<dependencyMap> + <dependency> + <maven> + <artifactId>b</artifactId> + <groupId>a</groupId> + <version>12</version> + </maven> + <jpp> + <artifactId>commons-io</artifactId> + <groupId>JPP</groupId> + </jpp> + </dependency> + <dependency> + <maven> + <artifactId>y</artifactId> + <groupId>x</groupId> + <version>12</version> + </maven> + <jpp> + <artifactId>commons-io</artifactId> + <groupId>JPP</groupId> + </jpp> + </dependency> +</dependencyMap> diff --git a/test/data/maven_depmap/test_append_and_namespace-want.xml b/test/data/maven_depmap/test_append_and_namespace-want.xml new file mode 100644 index 0000000..703db54 --- /dev/null +++ b/test/data/maven_depmap/test_append_and_namespace-want.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" ?> +<dependencyMap> + <dependency> + <maven> + <artifactId>b</artifactId> + <groupId>a</groupId> + <version>12</version> + <namespace>myns</namespace> + </maven> + <jpp> + <artifactId>commons-io</artifactId> + <groupId>JPP</groupId> + <namespace>myns</namespace> + </jpp> + </dependency> + <dependency> + <maven> + <artifactId>y</artifactId> + <groupId>x</groupId> + <version>12</version> + <namespace>myns</namespace> + </maven> + <jpp> + <artifactId>commons-io</artifactId> + <groupId>JPP</groupId> + <namespace>myns</namespace> + </jpp> + </dependency> +</dependencyMap> diff --git a/test/data/maven_depmap/test_append_multiple-want.xml b/test/data/maven_depmap/test_append_multiple-want.xml new file mode 100644 index 0000000..f1d5ae4 --- /dev/null +++ b/test/data/maven_depmap/test_append_multiple-want.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" ?> +<dependencyMap> + <dependency> + <maven> + <artifactId>b</artifactId> + <groupId>a</groupId> + <version>12</version> + </maven> + <jpp> + <artifactId>commons-io</artifactId> + <groupId>JPP</groupId> + </jpp> + </dependency> + <dependency> + <maven> + <artifactId>y</artifactId> + <groupId>x</groupId> + <version>12</version> + </maven> + <jpp> + <artifactId>commons-io</artifactId> + <groupId>JPP</groupId> + </jpp> + </dependency> + <dependency> + <maven> + <artifactId>w</artifactId> + <groupId>z</groupId> + <version>12</version> + </maven> + <jpp> + <artifactId>commons-io</artifactId> + <groupId>JPP</groupId> + </jpp> + </dependency> +</dependencyMap> diff --git a/test/data/maven_depmap/test_namespace-want.xml b/test/data/maven_depmap/test_namespace-want.xml new file mode 100644 index 0000000..e8cc9fc --- /dev/null +++ b/test/data/maven_depmap/test_namespace-want.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" ?> +<dependencyMap> + <dependency> + <maven> + <artifactId>b</artifactId> + <groupId>a</groupId> + <version>12</version> + <namespace>myns</namespace> + </maven> + <jpp> + <artifactId>commons-io</artifactId> + <groupId>JPP</groupId> + <namespace>myns</namespace> + </jpp> + </dependency> +</dependencyMap> diff --git a/test/data/maven_depmap/test_prefix-want.xml b/test/data/maven_depmap/test_prefix-want.xml new file mode 100644 index 0000000..def0934 --- /dev/null +++ b/test/data/maven_depmap/test_prefix-want.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" ?> +<dependencyMap> + <dependency> + <maven> + <artifactId>b</artifactId> + <groupId>a</groupId> + <version>12</version> + </maven> + <jpp> + <artifactId>foo</artifactId> + <groupId>JPP</groupId> + </jpp> + </dependency> +</dependencyMap> diff --git a/test/data/maven_depmap/usr/foo/share/java/foo.jar b/test/data/maven_depmap/usr/foo/share/java/foo.jar new file mode 100644 index 0000000..fd87018 Binary files /dev/null and b/test/data/maven_depmap/usr/foo/share/java/foo.jar differ diff --git a/test/maven_depmap_test.py b/test/maven_depmap_test.py index 2f1c2fe..41a18b7 100644 --- a/test/maven_depmap_test.py +++ b/test/maven_depmap_test.py @@ -99,6 +99,14 @@ class TestMavenDepmap(unittest.TestCase): depmap) self.assertEqual(res, True)
+ @mvn_depmap('JPP-commons-io-commons-io.pom', '/usr/share/java/commons-io.jar') + def test_incorrect_subdir1(self, stdout, stderr, return_value, depmap): + self.assertEqual(return_value, 1, stderr) + + @mvn_depmap('JPP-commons-io.pom', '/usr/share/java/commons-io/commons-io.jar') + def test_incorrect_subdir2(self, stdout, stderr, return_value, depmap): + self.assertEqual(return_value, 1, stderr) + @mvn_depmap('a:b:12', 'usr/share/java/commons-io.jar') def test_mvn_spec(self, stdout, stderr, return_value, depmap): self.assertEqual(return_value, 0, stderr) @@ -120,6 +128,41 @@ class TestMavenDepmap(unittest.TestCase): depmap) self.assertEqual(res, True)
+ @mvn_depmap('a:b:12', 'usr/share/java/commons-io.jar', ['-a', 'x:y']) + def test_append(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) + + @mvn_depmap('a:b:12', 'usr/share/java/commons-io.jar', ['-a', 'x:y,z:w']) + def test_append_multiple(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) + + @mvn_depmap('a:b:12', 'usr/share/java/commons-io.jar', ['-n', 'myns']) + def test_namespace(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) + + @mvn_depmap('a:b:12', 'usr/share/java/commons-io.jar', ['--namespace=myns', '--append=x:y']) + def test_append_and_namespace(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) + + @mvn_depmap('a:b:12', 'usr/foo/share/java/foo.jar', ['-p', 'usr/foo']) + def test_prefix(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) +
if __name__ == '__main__': unittest.main()