[annotation-indexer] Update to latest upstream version 1.6
by Michal Srb
commit 66cdf3cf0a6bd2bea95f98da9cbe9ebe41ace749
Author: Michal Srb <msrb(a)redhat.com>
Date: Fri Nov 8 06:39:52 2013 +0100
Update to latest upstream version 1.6
.gitignore | 1 +
annotation-indexer.spec | 12 +++++-------
sources | 2 +-
3 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 885ff7a..926b4e9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
/annotation-indexer-1.4.tar.gz
/LICENSE.txt
+/annotation-indexer-1.6.tar.gz
diff --git a/annotation-indexer.spec b/annotation-indexer.spec
index 183fb8f..0b5a60e 100644
--- a/annotation-indexer.spec
+++ b/annotation-indexer.spec
@@ -1,6 +1,6 @@
Name: annotation-indexer
-Version: 1.4
-Release: 3%{?dist}
+Version: 1.6
+Release: 1%{?dist}
Summary: Jenkins annotation-indexer library
# License is specified in pom file
@@ -9,9 +9,6 @@ URL: https://github.com/jenkinsci/lib-annotation-indexer
Source0: https://github.com/jenkinsci/lib-%{name}/archive/%{name}-%{version}.tar.gz
Source1: https://raw.github.com/jenkinsci/jenkins/jenkins-1.510/LICENSE.txt
-# Backported upstream patch, this can be removed if %%{version} > 1.4
-Patch0: 0001-when-the-source-tree-contains-a-compilation-error-it.patch
-
BuildArch: noarch
BuildRequires: maven-local
@@ -31,8 +28,6 @@ This package contains the API documentation for %{name}.
%prep
%setup -q -n lib-%{name}-%{name}-%{version}
-%patch0 -p1
-
cp %{SOURCE1} LICENSE
# Nothing really interesting in parent
@@ -53,6 +48,9 @@ cp %{SOURCE1} LICENSE
%doc LICENSE
%changelog
+* Fri Nov 08 2013 Michal Srb <msrb(a)redhat.com> - 1.6-1
+- Update to latest upstream version 1.6
+
* Tue Oct 01 2013 Michal Srb <msrb(a)redhat.com> - 1.4-3
- Backport upstream patch. It helps to identify root problem when build fails
diff --git a/sources b/sources
index 861ab8e..1bb954e 100644
--- a/sources
+++ b/sources
@@ -1,2 +1,2 @@
-18019eca5a00898d854826eec943c587 annotation-indexer-1.4.tar.gz
9cc0a29e6ed42f3362df214b05448545 LICENSE.txt
+5f7ee3c6da51bb4006fc126617d79b1f annotation-indexer-1.6.tar.gz
10 years, 6 months
[springframework-retry] Initial import
by Michal Srb
commit 797294151e51eaa79741f4f4f0f62b01d1c01353
Author: Michal Srb <msrb(a)redhat.com>
Date: Fri Nov 8 06:31:42 2013 +0100
Initial import
.gitignore | 2 +
sources | 2 +
springframework-retry.spec | 80 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 84 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..49e6af3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1,2 @@
+/LICENSE-2.0.txt
+/1.0.3.RELEASE.tar.gz
diff --git a/sources b/sources
index e69de29..5ad3cc5 100644
--- a/sources
+++ b/sources
@@ -0,0 +1,2 @@
+3b83ef96387f14655fc854ddc3c6bd57 LICENSE-2.0.txt
+b37eda3d9055c4b92b18e0053f475834 1.0.3.RELEASE.tar.gz
diff --git a/springframework-retry.spec b/springframework-retry.spec
new file mode 100644
index 0000000..b3b7cce
--- /dev/null
+++ b/springframework-retry.spec
@@ -0,0 +1,80 @@
+%global short_name spring-retry
+
+Name: springframework-retry
+Version: 1.0.3
+Release: 2%{?dist}
+Summary: Abstraction around retrying failed operations
+
+# License is specified in pom file
+# pull request: https://github.com/spring-projects/spring-retry/pull/9
+License: ASL 2.0
+URL: https://github.com/spring-projects/spring-retry
+Source0: https://github.com/spring-projects/%{short_name}/archive/%{version}.RELEA...
+Source1: http://www.apache.org/licenses/LICENSE-2.0.txt
+
+BuildRequires: maven-local
+BuildRequires: mvn(junit:junit)
+BuildRequires: mvn(org.apache.maven.plugins:maven-source-plugin)
+BuildRequires: mvn(org.aspectj:aspectjweaver)
+BuildRequires: mvn(org.easymock:easymock)
+BuildRequires: mvn(org.springframework:spring-context)
+BuildRequires: mvn(org.springframework:spring-tx)
+
+Provides: spring-retry = %{version}-%{release}
+Obsoletes: spring-retry < %{version}-%{release}
+
+BuildArch: noarch
+
+%description
+Spring Retry provides an abstraction around retrying failed operations,
+with an emphasis on declarative control of the process and policy-based
+bahaviour that is easy to extend and customize. For instance, you can
+configure a plain POJO operation to retry if it fails, based on the type
+of exception, and with a fixed or exponential backoff.
+
+%package javadoc
+Summary: Javadoc for %{name}
+
+Provides: spring-retry-javadoc = %{version}-%{release}
+Obsoletes: spring-retry-javadoc < %{version}-%{release}
+
+%description javadoc
+This package contains the API documentation for %{name}.
+
+%prep
+%setup -q -n %{short_name}-%{version}.RELEASE
+
+cp %{SOURCE1} LICENSE.txt
+
+%pom_xpath_remove "pom:extension[pom:artifactId[text()='org.springframework.build.aws.maven']]"
+%pom_remove_plugin :com.springsource.bundlor.maven
+%pom_remove_plugin :maven-jar-plugin
+
+# This can be removed when rhbz#1019083 is fixed for F20
+%pom_remove_dep org.aspectj:aspectjrt
+%pom_add_dep org.aspectj:aspectjweaver:test
+
+%pom_remove_dep org.springframework:spring-test
+
+%build
+%mvn_build
+
+%install
+%mvn_install
+
+%files -f .mfiles
+%dir %{_javadir}/%{name}
+%doc LICENSE.txt
+%files javadoc -f .mfiles-javadoc
+%doc LICENSE.txt
+
+%changelog
+* Mon Nov 04 2013 Michal Srb <msrb(a)redhat.com> - 1.0.3-2
+- Package rename (was spring-retry)
+
+* Tue Oct 22 2013 Michal Srb <msrb(a)redhat.com> - 1.0.3-1
+- Update to upstream version 1.0.3
+
+* Tue Oct 08 2013 Michal Srb <msrb(a)redhat.com> - 1.0.2-1
+- Initial packaging
+
10 years, 6 months
[javapackages] [test] more tests for rpm macros
by Michael Šimáček
commit c1bab46bdf01943ae2ffe73803b584d8a9646530
Author: Michael Simacek <msimacek(a)redhat.com>
Date: Thu Nov 7 16:17:39 2013 +0100
[test] more tests for rpm macros
test/data/mvn_build/singleton_00001.xml | 12 ++
test/data/mvn_build/singleton_00002.xml | 16 +++
test/data/mvn_build/singleton_00003.xml | 15 +++
test/data/mvn_config/multiline_00001.xml | 16 +++
test/mvn_macros_test.py | 174 +++++++++++++++++++++++++++++-
test/test_rpmbuild.py | 18 +++-
6 files changed, 245 insertions(+), 6 deletions(-)
---
diff --git a/test/data/mvn_build/singleton_00001.xml b/test/data/mvn_build/singleton_00001.xml
new file mode 100644
index 0000000..67cc726
--- /dev/null
+++ b/test/data/mvn_build/singleton_00001.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" ?>
+<configuration xmlns="http://fedorahosted.org/xmvn/CONFIG/0.6.0">
+
+
+
+ <!--XMvn configuration file generated by javapackages.xmvn_config (part of javapackages-tools)-->
+ <installerSettings>
+ <packageName>
+ test_mvn_build_singleton
+ </packageName>
+ </installerSettings>
+</configuration>
diff --git a/test/data/mvn_build/singleton_00002.xml b/test/data/mvn_build/singleton_00002.xml
new file mode 100644
index 0000000..ad650f0
--- /dev/null
+++ b/test/data/mvn_build/singleton_00002.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" ?>
+<configuration xmlns="http://fedorahosted.org/xmvn/CONFIG/0.6.0">
+
+
+
+ <!--XMvn configuration file generated by javapackages.xmvn_config (part of javapackages-tools)-->
+ <artifactManagement>
+ <rule>
+ <artifactGlob>
+ <classifier>*?</classifier>
+ </artifactGlob>
+ <optional>true</optional>
+ <targetPackage>__noinstall</targetPackage>
+ </rule>
+ </artifactManagement>
+</configuration>
diff --git a/test/data/mvn_build/singleton_00003.xml b/test/data/mvn_build/singleton_00003.xml
new file mode 100644
index 0000000..260bbab
--- /dev/null
+++ b/test/data/mvn_build/singleton_00003.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" ?>
+<configuration xmlns="http://fedorahosted.org/xmvn/CONFIG/0.6.0">
+
+
+
+ <!--XMvn configuration file generated by javapackages.xmvn_config (part of javapackages-tools)-->
+ <artifactManagement>
+ <rule>
+ <artifactGlob>
+ <artifactId>{*}</artifactId>
+ </artifactGlob>
+ <targetPackage>@1</targetPackage>
+ </rule>
+ </artifactManagement>
+</configuration>
diff --git a/test/data/mvn_config/multiline_00001.xml b/test/data/mvn_config/multiline_00001.xml
new file mode 100644
index 0000000..a7a7b1e
--- /dev/null
+++ b/test/data/mvn_config/multiline_00001.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" ?>
+<configuration xmlns="http://fedorahosted.org/xmvn/CONFIG/0.6.0">
+
+
+
+ <!--XMvn configuration file generated by javapackages.xmvn_config (part of javapackages-tools)-->
+ <a>
+ <b>
+ <c>
+ <bla>
+ bla
+ </bla>
+ </c>
+ </b>
+ </a>
+</configuration>
diff --git a/test/mvn_macros_test.py b/test/mvn_macros_test.py
index 4b609fe..5281b02 100644
--- a/test/mvn_macros_test.py
+++ b/test/mvn_macros_test.py
@@ -101,7 +101,7 @@ class MvnMacrosTest(unittest.TestCase):
_, stderr, return_value = pack.run_prep()
self.assertEqual(return_value, 0, stderr)
confpath = os.path.join(pack.buildpath, '.xmvn', 'config.d')
- filelist = os.listdir(confpath)
+ filelist = sorted(os.listdir(confpath))
self.assertEquals(len(filelist), 2)
for i in range(2):
actfile = os.path.join(confpath, filelist[i])
@@ -110,3 +110,175 @@ class MvnMacrosTest(unittest.TestCase):
report = compare_xml_files(actfile, expfile, ['artifactGlob'])
self.assertEquals(report, '', report)
+ @rpm_test()
+ def test_mvn_file_simple(self, pack):
+ pack.append_to_prep('%mvn_file :x file')
+ _, stderr, return_value = pack.run_prep()
+ self.assertEqual(return_value, 0, stderr)
+ confpath = os.path.join(pack.buildpath, '.xmvn', 'config.d')
+ filelist = os.listdir(confpath)
+ self.assertEquals(len(filelist), 1)
+ actfile = os.path.join(confpath, filelist[0])
+ expfile = os.path.join(DIRPATH, 'data', 'mvn_file', 'simple_00001.xml')
+ report = compare_xml_files(actfile, expfile, ['artifactGlob'])
+ self.assertEquals(report, '', report)
+
+ @rpm_test()
+ def test_mvn_file_symlinks(self, pack):
+ pack.append_to_prep('%mvn_file :a file sym1 sym2 sym3')
+ _, stderr, return_value = pack.run_prep()
+ self.assertEqual(return_value, 0, stderr)
+ confpath = os.path.join(pack.buildpath, '.xmvn', 'config.d')
+ filelist = os.listdir(confpath)
+ self.assertEquals(len(filelist), 1)
+ actfile = os.path.join(confpath, filelist[0])
+ expfile = os.path.join(DIRPATH, 'data', 'mvn_file',
+ 'symlinks_00001.xml')
+ report = compare_xml_files(actfile, expfile, ['artifactGlob'])
+ self.assertEquals(report, '', report)
+
+ @rpm_test()
+ def test_mvn_file_no_args(self, pack):
+ pack.append_to_prep('%mvn_file')
+ _, stderr, return_value = pack.run_prep()
+ self.assertNotEqual(return_value, 0)
+ self.assertNotEqual(stderr, '')
+
+ @rpm_test()
+ def test_mvn_file_single_arg(self, pack):
+ pack.append_to_prep('%mvn_file "aaa:bbb"')
+ _, stderr, return_value = pack.run_prep()
+ self.assertNotEqual(return_value, 0)
+ self.assertNotEqual(stderr, '')
+
+ @rpm_test()
+ def test_mvn_compat_version_simple(self, pack):
+ pack.append_to_prep('%mvn_compat_version aaa:bbb 1')
+ _, stderr, return_value = pack.run_prep()
+ self.assertEqual(return_value, 0, stderr)
+ confpath = os.path.join(pack.buildpath, '.xmvn', 'config.d')
+ filelist = os.listdir(confpath)
+ self.assertEquals(len(filelist), 1)
+ actfile = os.path.join(confpath, filelist[0])
+ expfile = os.path.join(DIRPATH, 'data', 'mvn_compat_version',
+ 'simple_00001.xml')
+ report = compare_xml_files(actfile, expfile, ['artifactGlob'])
+ self.assertEquals(report, '', report)
+
+ @rpm_test()
+ def test_mvn_compat_version_no_args(self, pack):
+ pack.append_to_prep('%mvn_compat_version')
+ _, stderr, return_value = pack.run_prep()
+ self.assertNotEqual(return_value, 0)
+ self.assertNotEqual(stderr, '')
+
+ @rpm_test()
+ def test_mvn_compat_version_single(self, pack):
+ pack.append_to_prep('%mvn_compat_version "aaa:bbb"')
+ _, stderr, return_value = pack.run_prep()
+ self.assertNotEqual(return_value, 0)
+ self.assertNotEqual(stderr, '')
+
+ @rpm_test()
+ def test_mvn_package_simple(self, pack):
+ pack.append_to_prep('%mvn_package aaa:bbb pack')
+ _, stderr, return_value = pack.run_prep()
+ self.assertEqual(return_value, 0, stderr)
+ confpath = os.path.join(pack.buildpath, '.xmvn', 'config.d')
+ filelist = os.listdir(confpath)
+ self.assertEquals(len(filelist), 1)
+ actfile = os.path.join(confpath, filelist[0])
+ expfile = os.path.join(DIRPATH, 'data', 'mvn_package',
+ 'simple_00001.xml')
+ report = compare_xml_files(actfile, expfile, ['artifactGlob'])
+ self.assertEquals(report, '', report)
+
+ @rpm_test()
+ def test_mvn_package_no_args(self, pack):
+ pack.append_to_prep('%mvn_package')
+ _, stderr, return_value = pack.run_prep()
+ self.assertNotEqual(return_value, 0)
+ self.assertNotEqual(stderr, '')
+
+ @rpm_test()
+ def test_mvn_package_single(self, pack):
+ pack.append_to_prep('%mvn_package aaa:bbb')
+ _, stderr, return_value = pack.run_prep()
+ self.assertEqual(return_value, 0, stderr)
+ confpath = os.path.join(pack.buildpath, '.xmvn', 'config.d')
+ filelist = os.listdir(confpath)
+ self.assertEquals(len(filelist), 1)
+ actfile = os.path.join(confpath, filelist[0])
+ expfile = os.path.join(DIRPATH, 'data', 'mvn_package',
+ 'single_00001.xml')
+ report = compare_xml_files(actfile, expfile, ['artifactGlob'])
+ self.assertEquals(report, '', report)
+
+ @rpm_test()
+ def test_mvn_config_no_args(self, pack):
+ pack.append_to_prep('%mvn_config')
+ _, stderr, return_value = pack.run_prep()
+ self.assertNotEqual(return_value, 0)
+ self.assertNotEqual(stderr, '')
+
+ @rpm_test()
+ def test_mvn_config_single(self, pack):
+ pack.append_to_prep('%mvn_config')
+ _, stderr, return_value = pack.run_prep()
+ self.assertNotEqual(return_value, 0)
+ self.assertNotEqual(stderr, '')
+
+ @rpm_test()
+ def test_mvn_config_path(self, pack):
+ pack.append_to_prep('%mvn_config a/b/c xxx')
+ _, stderr, return_value = pack.run_prep()
+ self.assertEqual(return_value, 0, stderr)
+ confpath = os.path.join(pack.buildpath, '.xmvn', 'config.d')
+ filelist = os.listdir(confpath)
+ self.assertEquals(len(filelist), 1)
+ actfile = os.path.join(confpath, filelist[0])
+ expfile = os.path.join(DIRPATH, 'data', 'mvn_config',
+ 'path_00001.xml')
+ report = compare_xml_files(actfile, expfile, ['artifactGlob'])
+ self.assertEquals(report, '', report)
+
+ @rpm_test()
+ def test_mvn_config_multiline(self, pack):
+ pack.append_to_prep("""%mvn_config a/b/c "
+ <bla>
+ bla
+ </bla>
+ " """)
+ _, stderr, return_value = pack.run_prep()
+ self.assertEqual(return_value, 0, stderr)
+ confpath = os.path.join(pack.buildpath, '.xmvn', 'config.d')
+ filelist = os.listdir(confpath)
+ self.assertEquals(len(filelist), 1)
+ actfile = os.path.join(confpath, filelist[0])
+ expfile = os.path.join(DIRPATH, 'data', 'mvn_config',
+ 'multiline_00001.xml')
+ report = compare_xml_files(actfile, expfile, ['artifactGlob'])
+ self.assertEquals(report, '', report)
+
+ @rpm_test()
+ def test_mvn_build_singleton(self, pack):
+ pack.append_to_build('%mvn_build -s')
+ _, stderr, return_value = pack.run_build()
+ self.assertEqual(return_value, 0, stderr)
+ confpath = os.path.join(pack.buildpath, '.xmvn', 'config.d')
+ filelist = sorted(os.listdir(confpath))
+ self.assertEquals(len(filelist), 3)
+ for i in range(3):
+ actfile = os.path.join(confpath, filelist[i])
+ filename = 'singleton_0000{i}.xml'.format(i=i + 1)
+ expfile = os.path.join(DIRPATH, 'data', 'mvn_build', filename)
+ report = compare_xml_files(actfile, expfile, ['artifactGlob'])
+ self.assertEquals(report, '', report)
+
+ expfile = os.path.join(pack.buildpath, '.xmvn', 'out')
+ actfile = os.path.join(DIRPATH, 'data', 'mvn_build',
+ 'singleton_out')
+ with open(actfile, 'r') as act:
+ with open(expfile, 'r') as exp:
+ self.assertEquals(act.read(), exp.read())
+
diff --git a/test/test_rpmbuild.py b/test/test_rpmbuild.py
index 59f1d03..bef4f82 100644
--- a/test/test_rpmbuild.py
+++ b/test/test_rpmbuild.py
@@ -23,6 +23,11 @@ class Package(object):
self.__prep = ''
self.__build = ''
self.buildpath = os.path.join('rpmbuild', 'BUILD', name + '-1')
+ self.__env = dict(os.environ)
+ self.__env['HOME'] = os.getcwd()
+ self.__env['PYTHONPATH'] = os.path.join(DIRPATH, '..', 'python')
+ self.__env['PATH'] = '{mock}:{path}'.format(mock=DIRPATH,
+ path=self.__env['PATH'])
def add_source(self, sourcepath, newname=None):
"""Add source file to a package
@@ -60,16 +65,13 @@ class Package(object):
return self.__invoke_rpmbuild(['-bb'])
def __invoke_rpmbuild(self, args):
- env = dict(os.environ)
- env['HOME'] = os.getcwd()
- env['PYTHONPATH'] = os.path.join(DIRPATH, '..', 'python')
outfile = open("tmpout", 'w')
errfile = open("tmperr", 'w')
topdir = '--define=_topdir {cwd}/rpmbuild'.format(cwd=os.getcwd())
proc = subprocess.Popen(['rpmbuild', topdir,
os.path.join('rpmbuild', 'SPECS',
self.__name + '.spec')]
- + args, shell=False, env=env,
+ + args, shell=False, env=self.__env,
stdout=outfile, stderr=errfile)
ret = proc.wait()
outfile = open("tmpout", 'r+')
@@ -80,6 +82,9 @@ class Package(object):
os.remove('tmperr')
return (out, err, ret)
+ def set_env(self, name, value):
+ self.__env[name] = value
+
def __prepare_all(self):
try:
os.mkdir('rpmbuild')
@@ -117,6 +122,7 @@ class Package(object):
""")
prep_section = dedent("""\
+
%prep
mkdir %{name}-%{version}
cd %{name}-%{version}
@@ -126,9 +132,11 @@ class Package(object):
prep_section += self.__prep
build_section = dedent("""\
- %build
+ %build
+ cd %{name}-%{version}
""")
+ build_section += self.__build
specpath = os.path.join('rpmbuild', 'SPECS', self.__name + '.spec')
with open(specpath, 'w') as specfile:
10 years, 6 months
[javapackages] [test] some tests for mvn macros in rpmbuild
by Michael Šimáček
commit 382bcabccbcf810c14e569af874d5ddb21cf3d6c
Author: Michael Simacek <msimacek(a)redhat.com>
Date: Thu Nov 7 13:56:26 2013 +0100
[test] some tests for mvn macros in rpmbuild
test/data/mvn_alias/more_invocations-00001.xml | 21 +++++
test/data/mvn_alias/more_invocations-00002.xml | 25 +++++
test/mvn_macros_test.py | 112 ++++++++++++++++++++++++
3 files changed, 158 insertions(+), 0 deletions(-)
---
diff --git a/test/data/mvn_alias/more_invocations-00001.xml b/test/data/mvn_alias/more_invocations-00001.xml
new file mode 100644
index 0000000..96c7405
--- /dev/null
+++ b/test/data/mvn_alias/more_invocations-00001.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" ?>
+<configuration xmlns="http://fedorahosted.org/xmvn/CONFIG/0.6.0">
+
+
+
+ <!--XMvn configuration file generated by javapackages.xmvn_config (part of javapackages-tools)-->
+ <artifactManagement>
+ <rule>
+ <artifactGlob>
+ <artifactId>bbb</artifactId>
+ <groupId>aaa</groupId>
+ </artifactGlob>
+ <aliases>
+ <alias>
+ <artifactId>ddd</artifactId>
+ <groupId>ccc</groupId>
+ </alias>
+ </aliases>
+ </rule>
+ </artifactManagement>
+</configuration>
diff --git a/test/data/mvn_alias/more_invocations-00002.xml b/test/data/mvn_alias/more_invocations-00002.xml
new file mode 100644
index 0000000..1a8cc8d
--- /dev/null
+++ b/test/data/mvn_alias/more_invocations-00002.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" ?>
+<configuration xmlns="http://fedorahosted.org/xmvn/CONFIG/0.6.0">
+
+
+
+ <!--XMvn configuration file generated by javapackages.xmvn_config (part of javapackages-tools)-->
+ <artifactManagement>
+ <rule>
+ <artifactGlob>
+ <artifactId>
+ zzz
+ </artifactId>
+ <groupId>
+ {xxx,yyy}
+ </groupId>
+ </artifactGlob>
+ <aliases>
+ <alias>
+ <artifactId>@1</artifactId>
+ <groupId>qqq</groupId>
+ </alias>
+ </aliases>
+ </rule>
+ </artifactManagement>
+</configuration>
diff --git a/test/mvn_macros_test.py b/test/mvn_macros_test.py
new file mode 100644
index 0000000..4b609fe
--- /dev/null
+++ b/test/mvn_macros_test.py
@@ -0,0 +1,112 @@
+import os
+import shutil
+import unittest
+
+from xml_compare import compare_xml_files
+from test_common import DIRPATH
+from test_rpmbuild import Package
+
+WORKDIR = os.path.join(DIRPATH, '.workdir')
+
+def rpm_test():
+ def test_decorator(function):
+ def test_decorated(self):
+ pack = Package(function.__name__)
+ function(self, pack)
+ return test_decorated
+ return test_decorator
+
+class MvnMacrosTest(unittest.TestCase):
+ maxDiff = 2048
+
+ def setUp(self):
+ self.olddir = os.getcwd()
+ try:
+ shutil.rmtree(WORKDIR)
+ except OSError:
+ pass
+ try:
+ os.mkdir(WORKDIR)
+ except OSError:
+ pass
+ os.chdir(WORKDIR)
+
+ def tearDown(self):
+ try:
+ shutil.rmtree(WORKDIR)
+ except OSError:
+ pass
+ os.chdir(self.olddir)
+
+ @rpm_test()
+ def test_mvn_alias_simple(self, pack):
+ pack.append_to_prep('%mvn_alias aaa:bbb xxx:yyy')
+ _, stderr, return_value = pack.run_prep()
+ self.assertEqual(return_value, 0, stderr)
+ confpath = os.path.join(pack.buildpath, '.xmvn', 'config.d')
+ filelist = os.listdir(confpath)
+ self.assertEquals(len(filelist), 1)
+ actfile = os.path.join(confpath, filelist[0])
+ expfile = os.path.join(DIRPATH, 'data', 'mvn_alias', 'simple_00001.xml')
+ report = compare_xml_files(actfile, expfile, ['artifactGlob'])
+ self.assertEquals(report, '', report)
+
+ @rpm_test()
+ def test_mvn_alias_backref(self, pack):
+ pack.append_to_prep("""%mvn_alias '*:{aaa,bbb}*' ':@1'""")
+ _, stderr, return_value = pack.run_prep()
+ self.assertEqual(return_value, 0, stderr)
+ confpath = os.path.join(pack.buildpath, '.xmvn', 'config.d')
+ filelist = os.listdir(confpath)
+ self.assertEquals(len(filelist), 1)
+ actfile = os.path.join(confpath, filelist[0])
+ expfile = os.path.join(DIRPATH, 'data', 'mvn_alias',
+ 'backref_00001.xml')
+ report = compare_xml_files(actfile, expfile, ['artifactGlob'])
+ self.assertEquals(report, '', report)
+
+ @rpm_test()
+ def test_mvn_alias_multi(self, pack):
+ pack.append_to_prep('%mvn_alias "aaa:bbb" "ccc:ddd" \
+ "eee:fff" "ggg:hhh"')
+ _, stderr, return_value = pack.run_prep()
+ self.assertEqual(return_value, 0, stderr)
+ confpath = os.path.join(pack.buildpath, '.xmvn', 'config.d')
+ filelist = os.listdir(confpath)
+ self.assertEquals(len(filelist), 1)
+ actfile = os.path.join(confpath, filelist[0])
+ expfile = os.path.join(DIRPATH, 'data', 'mvn_alias',
+ 'multi_00001.xml')
+ report = compare_xml_files(actfile, expfile, ['artifactGlob'])
+ self.assertEquals(report, '', report)
+
+ @rpm_test()
+ def test_mvn_alias_no_args(self, pack):
+ pack.append_to_prep('%mvn_alias')
+ _, stderr, return_value = pack.run_prep()
+ self.assertNotEqual(return_value, 0)
+ self.assertNotEqual(stderr, '')
+
+ @rpm_test()
+ def test_mvn_alias_single_arg(self, pack):
+ pack.append_to_prep('%mvn_alias "aaa:bbb"')
+ _, stderr, return_value = pack.run_prep()
+ self.assertNotEqual(return_value, 0)
+ self.assertNotEqual(stderr, '')
+
+ @rpm_test()
+ def test_mvn_alias_more_invocations(self, pack):
+ pack.append_to_prep('%mvn_alias "aaa:bbb" "ccc:ddd"')
+ pack.append_to_prep('%mvn_alias "{xxx,yyy}:zzz" "qqq:@1"')
+ _, stderr, return_value = pack.run_prep()
+ self.assertEqual(return_value, 0, stderr)
+ confpath = os.path.join(pack.buildpath, '.xmvn', 'config.d')
+ filelist = os.listdir(confpath)
+ self.assertEquals(len(filelist), 2)
+ for i in range(2):
+ actfile = os.path.join(confpath, filelist[i])
+ filename = 'more_invocations-0000{i}.xml'.format(i=i + 1)
+ expfile = os.path.join(DIRPATH, 'data', 'mvn_alias', filename)
+ report = compare_xml_files(actfile, expfile, ['artifactGlob'])
+ self.assertEquals(report, '', report)
+
10 years, 6 months
[javapackages] [test] minor fixes in RPM macros testing
by Michael Šimáček
commit 997733ef812885894e14b1bb3b46402c32c7f71f
Author: Michael Simacek <msimacek(a)redhat.com>
Date: Thu Nov 7 11:57:18 2013 +0100
[test] minor fixes in RPM macros testing
test/pom_macros_test.py | 3 ++-
test/test_rpmbuild.py | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/test/pom_macros_test.py b/test/pom_macros_test.py
index 8da2027..9660a4d 100644
--- a/test/pom_macros_test.py
+++ b/test/pom_macros_test.py
@@ -19,7 +19,8 @@ def exec_macro(command = "", pom = "pom.xml"):
pompath = os.path.join(WORKDIR, pom)
pomname = os.path.basename(pom)
package = Package(function.__name__)
- pomsourcepath = package.add_source(pompath)
+ package.add_source(pompath)
+ pomsourcepath = os.path.join(package.buildpath, pomname)
package.append_to_prep('%{command} {pom}'.format(command=command,
pom=pomname))
stdin, stderr, return_value = package.run_prep()
diff --git a/test/test_rpmbuild.py b/test/test_rpmbuild.py
index f2405d1..59f1d03 100644
--- a/test/test_rpmbuild.py
+++ b/test/test_rpmbuild.py
@@ -22,6 +22,7 @@ class Package(object):
self.__sources = {}
self.__prep = ''
self.__build = ''
+ self.buildpath = os.path.join('rpmbuild', 'BUILD', name + '-1')
def add_source(self, sourcepath, newname=None):
"""Add source file to a package
@@ -39,7 +40,6 @@ class Package(object):
if not newname:
newname = os.path.basename(sourcepath)
self.__sources[sourcepath] = newname
- return os.path.join('rpmbuild', 'BUILD', self.__name + '-1', newname)
def append_to_prep(self, to_append):
"""Appends given string to %prep section of spec."""
@@ -62,6 +62,7 @@ class Package(object):
def __invoke_rpmbuild(self, args):
env = dict(os.environ)
env['HOME'] = os.getcwd()
+ env['PYTHONPATH'] = os.path.join(DIRPATH, '..', 'python')
outfile = open("tmpout", 'w')
errfile = open("tmperr", 'w')
topdir = '--define=_topdir {cwd}/rpmbuild'.format(cwd=os.getcwd())
@@ -110,7 +111,7 @@ class Package(object):
header += 'Source{index}: {filename}\n'.format(filename=filename,
index=index)
- header += dedent("""\
+ header += dedent("""\
%description
This is just a test.
""")
10 years, 6 months
[javapackages] [test] pom macros pylint compliance
by Michael Šimáček
commit 0827a47439b9478b4d472a4a5dc029dfa3572f79
Author: Michael Simacek <msimacek(a)redhat.com>
Date: Thu Nov 7 09:47:47 2013 +0100
[test] pom macros pylint compliance
test/pom_macros_test.py | 234 ++++++++++++++++++++++++----------------------
1 files changed, 122 insertions(+), 112 deletions(-)
---
diff --git a/test/pom_macros_test.py b/test/pom_macros_test.py
index 95b844b..8da2027 100644
--- a/test/pom_macros_test.py
+++ b/test/pom_macros_test.py
@@ -3,38 +3,46 @@ import os
from shutil import copytree
from shutil import rmtree
-from lxml import etree
-from formencode import doctest_xml_compare
from test_rpmbuild import Package
from xml_compare import compare_xml_files
-ns = dict(a='http://maven.apache.org/POM/4.0.0')
-dirpath = os.path.dirname(os.path.realpath(__file__))
+DIRPATH = os.path.dirname(os.path.realpath(__file__))
-pepath = os.path.abspath(os.path.join(dirpath, "..",
- "java-utils/pom_editor.sh"))
-pe = '. {pepath}; '.format(pepath=pepath)
-
-datadir = os.path.join(dirpath, "data", "pom_macros")
-workdir = os.path.join(datadir, "..", 'pom_macros_workdir')
+DATADIR = os.path.join(DIRPATH, "data", "pom_macros")
+WORKDIR = os.path.join(DATADIR, "..", 'pom_macros_workdir')
def exec_macro(command = "", pom = "pom.xml"):
- def test_decorator(fn):
+ def test_decorator(function):
def test_decorated(self, *args, **kwargs):
- pompath = os.path.join(workdir, pom)
+ pompath = os.path.join(WORKDIR, pom)
pomname = os.path.basename(pom)
- package = Package(fn.__name__)
+ package = Package(function.__name__)
pomsourcepath = package.add_source(pompath)
package.append_to_prep('%{command} {pom}'.format(command=command,
pom=pomname))
stdin, stderr, return_value = package.run_prep()
- fn(self, stdin, stderr, return_value, pomsourcepath)
+ function(self, stdin, stderr, return_value, pomsourcepath)
return test_decorated
return test_decorator
+def check_result(pom_path):
+ wantpath = '{pom}-want'.format(pom=os.path.basename(pom_path))
+ report = compare_xml_files(pom_path, wantpath)
+ res = not report
+ return report, res
+
+def get_result_literally(pom_path):
+ with open(pom_path, 'r') as gotfile:
+ got = gotfile.read().split('\n')
+
+ wantpath = '{pom}-want'.format(pom=os.path.basename(pom_path))
+ with open(wantpath, 'r') as wantfile:
+ want = wantfile.read().split('\n')
+ return got, want
+
class PomMacrosTest(unittest.TestCase):
olddir = os.getcwd()
@@ -44,44 +52,29 @@ class PomMacrosTest(unittest.TestCase):
def setUpClass(cls):
cls.tearDownClass()
cls.olddir = os.getcwd()
- copytree(datadir, workdir)
- os.chdir(workdir)
+ copytree(DATADIR, WORKDIR)
+ os.chdir(WORKDIR)
@classmethod
def tearDownClass(cls):
try:
- rmtree(workdir)
+ rmtree(WORKDIR)
except OSError:
pass
os.chdir(cls.olddir)
- def check_result(self, pom_path):
- wantpath = '{pom}-want'.format(pom=os.path.basename(pom_path))
- report = compare_xml_files(pom_path, wantpath)
- res = not report
- return report, res
-
- def get_result_literally(self, pom_path):
- with open(pom_path, 'r') as gotfile:
- got = gotfile.read().split('\n')
-
- wantpath = '{pom}-want'.format(pom=os.path.basename(pom_path))
- with open(wantpath, 'r') as wantfile:
- want = wantfile.read().split('\n')
- return got, want
-
@exec_macro("pom_remove_dep :commons-io", "pom_remove_dep.xml")
def test_remove_dep(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@exec_macro("pom_remove_dep junit:", "pom_remove_dep_nons.xml")
@@ -89,154 +82,156 @@ class PomMacrosTest(unittest.TestCase):
# no namespace
self.assertEqual(returncode, 0, stderr)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
- @exec_macro("pom_remove_plugin my.group:my-plugin", "pom_remove_plugin2.xml")
+ @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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@exec_macro("pom_remove_plugin not:there", "pom_remove_plugin_ret1.xml")
def test_remove_plugin_ret1(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 1)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@exec_macro("pom_disable_module notthere", "pom_disable_module_ret1.xml")
- def test_disable_module_no_effect(self, stdin, stderr, returncode, pom_path):
+ def test_disable_module_no_effect(self, stdin, stderr,
+ returncode, pom_path):
self.assertEqual(returncode, 1)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@exec_macro("pom_add_dep gdep:adep:3.2:test", "pom_add_dep_whitespace.xml")
def test_add_dep_whitespace(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- got, want = self.get_result_literally(pom_path)
+ got, want = get_result_literally(pom_path)
self.assertEqual(got, want)
@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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@exec_macro("pom_remove_parent", "pom_remove_parent.xml")
def test_remove_parent(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@exec_macro("pom_remove_parent", "pom_remove_parent_fail.xml")
@@ -247,112 +242,117 @@ class PomMacrosTest(unittest.TestCase):
def test_add_parent(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@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)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
- @exec_macro("pom_xpath_remove \"pom:dependency[pom:artifactId[text()='m-m']]\"",
- "pom_xpath_remove2.xml")
+ @exec_macro("pom_xpath_remove \
+ \"pom:dependency[pom:artifactId[text()='m-m']]\"",
+ "pom_xpath_remove2.xml")
def test_xpath_remove2(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
- @exec_macro("pom_xpath_remove pom:dependencies", "pom_xpath_remove_nons.xml")
+ @exec_macro("pom_xpath_remove pom:dependencies",
+ "pom_xpath_remove_nons.xml")
def test_xpath_remove_nons(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
- @exec_macro("pom_xpath_remove pom:not/pom:there", "pom_xpath_remove_fail.xml")
+ @exec_macro("pom_xpath_remove pom:not/pom:there",
+ "pom_xpath_remove_fail.xml")
def test_xpath_remove_fail(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 1, stderr)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@exec_macro("pom_xpath_inject pom:parent '<version>1.2</version>'",
- "pom_xpath_inject.xml")
+ "pom_xpath_inject.xml")
def test_xpath_inject(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@exec_macro("pom_xpath_inject pom:parent '<version>1.2</version>'",
- "pom_xpath_inject_whitespace.xml")
+ "pom_xpath_inject_whitespace.xml")
def test_xpath_inject_whitespace(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- got, want = self.get_result_literally(pom_path)
+ got, want = get_result_literally(pom_path)
self.assertEqual(got, want)
@exec_macro("pom_xpath_inject pom:parent '<version>1.2</version>'",
- "pom_xpath_inject_whitespace1.xml")
- def test_xpath_inject_whitespace1(self, stdin, stderr, returncode, pom_path):
+ "pom_xpath_inject_whitespace1.xml")
+ def test_xpath_inject_whitespace1(self, stdin, stderr,
+ returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- got, want = self.get_result_literally(pom_path)
+ got, want = get_result_literally(pom_path)
self.assertEqual(got, want)
@exec_macro("pom_xpath_inject pom:build/pom:plugins '<plugin>\
- <groupId>some</groupId><artifactId>plugin</artifactId></plugin>'",
- "pom_xpath_inject2.xml")
+ <groupId>some</groupId>\
+ <artifactId>plugin</artifactId></plugin>'",
+ "pom_xpath_inject2.xml")
def test_xpath_inject2(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@exec_macro("pom_xpath_inject pom:project '<name>Commons Lang</name>'",
- "pom_xpath_inject_nons.xml")
+ "pom_xpath_inject_nons.xml")
def test_xpath_inject_nons(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@exec_macro("pom_xpath_inject pom:project '<name>Commons Lang<name>'",
@@ -361,55 +361,63 @@ class PomMacrosTest(unittest.TestCase):
# invalid XML code
self.assertEqual(returncode, 1, stderr)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
- @exec_macro("pom_xpath_replace pom:parent/pom:groupId '<groupId>commons</groupId>'",
- "pom_xpath_replace.xml")
+ @exec_macro("pom_xpath_replace pom:parent/pom:groupId \
+ '<groupId>commons</groupId>'",
+ "pom_xpath_replace.xml")
def test_xpath_replace(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
- @exec_macro("pom_xpath_replace pom:parent/pom:groupId '<groupId>commons</groupId>'",
- "pom_xpath_replace_whitespace.xml")
- def test_xpath_replace_whitespace(self, stdin, stderr, returncode, pom_path):
+ @exec_macro("pom_xpath_replace pom:parent/pom:groupId \
+ '<groupId>commons</groupId>'",
+ "pom_xpath_replace_whitespace.xml")
+ def test_xpath_replace_whitespace(self, stdin, stderr,
+ returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- got, want = self.get_result_literally(pom_path)
+ got, want = get_result_literally(pom_path)
self.assertEqual(got, want)
- @exec_macro("pom_xpath_replace \"pom:dependency[pom:artifactId[text()='junit']]/pom:version\"\
- '<version>commons</version>'", "pom_xpath_replace2.xml")
+ @exec_macro("pom_xpath_replace \
+ \"pom:dependency[pom:artifactId[text()='junit']]/pom:version\"\
+ '<version>commons</version>'", "pom_xpath_replace2.xml")
def test_xpath_replace2(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
- @exec_macro("pom_xpath_replace pom:parent '<groupId>org.apache.commons</groupId>'",
- "pom_xpath_replace_nons.xml")
+ @exec_macro("pom_xpath_replace pom:parent \
+ '<groupId>org.apache.commons</groupId>'",
+ "pom_xpath_replace_nons.xml")
def test_xpath_replace_nons(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
- @exec_macro("pom_xpath_replace pom:project/pom:not/pom:there '<groupId>commons</groupId>'",
- "pom_xpath_replace_fail.xml")
+ @exec_macro("pom_xpath_replace pom:project/pom:not/pom:there \
+ '<groupId>commons</groupId>'",
+ "pom_xpath_replace_fail.xml")
def test_xpath_replace_fail(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 1, stderr)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
- @exec_macro("pom_xpath_replace pom:project/pom:groupId '<groupId>commons<groupId>'",
- "pom_xpath_replace_invalid.xml")
- def test_xpath_replace_invalid_xml(self, stdin, stderr, returncode, pom_path):
+ @exec_macro("pom_xpath_replace pom:project/pom:groupId \
+ '<groupId>commons<groupId>'",
+ "pom_xpath_replace_invalid.xml")
+ def test_xpath_replace_invalid_xml(self, stdin, stderr,
+ returncode, pom_path):
self.assertEqual(returncode, 1, stderr)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@exec_macro("pom_xpath_set pom:project/pom:groupId 'commons'",
@@ -417,30 +425,32 @@ class PomMacrosTest(unittest.TestCase):
def test_xpath_set(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@exec_macro("pom_xpath_set \"pom:build/pom:plugins/pom:plugin[pom:groupId\
- [text()='org.codehaus.mojo']]/pom:version\" 2", "pom_xpath_set2.xml")
+ [text()='org.codehaus.mojo']]/pom:version\" 2",
+ "pom_xpath_set2.xml")
def test_xpath_set2(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
- @exec_macro("pom_xpath_set pom:parent/pom:artifactId 'a-Id'", "pom_xpath_set_nons.xml")
+ @exec_macro("pom_xpath_set pom:parent/pom:artifactId 'a-Id'",
+ "pom_xpath_set_nons.xml")
def test_xpath_set_nons(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 0, stderr)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@exec_macro("pom_xpath_set pom:project/pom:parent/pom:notThere Project",
- "pom_xpath_set_fail.xml")
+ "pom_xpath_set_fail.xml")
def test_xpath_set_fail(self, stdin, stderr, returncode, pom_path):
self.assertEqual(returncode, 1, stderr)
- report, res = self.check_result(pom_path)
+ report, res = check_result(pom_path)
self.assertEqual(res, True, report)
@exec_macro("pom_remove_parent", "unparsable_xml.pom")
10 years, 6 months