Blob Blame History Raw
%bcond_without buildtex

%global jarname   rabbitmq-client

%global failjava  true
%global failjunit no
#global failjunit yes

Name:          rabbitmq-java-client
Version:       3.6.1
Release:       2%{?dist}
Summary:       Java Advanced Message Queue Protocol client library
License:       ASL 2.0 and GPLv2+ and MPLv1.1
URL:           http://www.rabbitmq.com/java-client.html
Source0:       http://www.rabbitmq.com/releases/%{name}/v%{version}/%{name}-%{version}.tar.gz

BuildArch:     noarch
BuildRequires: maven-local mvn(commons-cli:commons-cli) mvn(commons-io:commons-io) mvn(junit:junit)
BuildRequires: ant ant-junit
BuildRequires: java-headless
BuildRequires: python >= 2.6 python-simplejson

%if 0%{?with buildtex}
BuildRequires: texi2html
BuildRequires: %{_bindir}/pdflatex
%endif

%if 0%{?fedora}
Suggests:       rabbitmq-server
Suggests:       activemq
%endif


%description
The library allows Java code to interface to AMQP servers.
Please see the specification page for more information on AMQP
inter-operation and standards-conformance

You will need an AMQP server, such as our very own RabbitMQ server,
to use with the client library.


%package doc
Summary:       Documentation for %{name}
Requires:      %{name} = %{version}-%{release}

%description doc
This package contains additional documentation for %{name}.

%package javadoc
Summary:       Javadoc for %{name}

%description javadoc
This package contains javadoc for %{name}.


%prep
%setup -q
find . -name "*.bat" -delete
find . -name "*.class" -delete
find . -name "*.jar" -print -delete
# use ant only
rm Makefile

ln -sf $(build-classpath commons-cli) lib/
ln -sf $(build-classpath commons-io) lib/
ln -sf $(build-classpath junit) lib/

# Disable Spring bundlor support
sed -i "s|, bundlor.do||" build.xml
sed -i "s|, test-bundlor.do||" build.xml

#sed -i 's,\(\"jar.name\" value=\"\).*\",\1%{jarname}\",' build.xml
sed -i 's,\(\"haltOnFailureJunit\" value=\"\).*\",\1%{failjunit}\",' build.xml
sed -i 's,\(\"haltOnFailureJava\" value=\"\).*\",\1%{failjava}\",' build.xml


%build
%mvn_file com.rabbitmq:amqp-client %{name} %{jarname} amqp-client
export JAVA_HOME=%{java_home}
ant -Dimpl.version=%{version} maven-bundle

# distribute documentation
cd doc/channels
%if 0%{?with buildtex}
find . -name \*.tex -print -exec 'texi2html {} ; pdflatex {}' \; -delete
%endif
find . -not -name channels.\* -delete


%install
%mvn_artifact build/bundle/amqp-client-%{version}.pom build/bundle/amqp-client-%{version}.jar
%mvn_install -J build/doc/api


%check
ant test-jar

#ant test-suite
#ant -Dtest=testDoubleDeletionExchange test-single
ant test-server

# client tests need a mock server, ugly hackery :)
export RABBITMQ_LOG_BASE=.
export RABBITMQ_MNESIA_BASE=.
export RABBITMQ_NODENAME=testrabbit
export RABBITMQ_ENV=%{_prefix}/lib/rabbitmq/bin/rabbitmq-env
export RABBITMQ_SCRIPTS_DIR=$(dirname "$RABBITMQ_ENV")
%{_prefix}/lib/rabbitmq/bin/rabbitmq-server &disown
trap "kill $! || true" EXIT
sleep 4
pgrep -cf rabbitmq_server && ant test-client

# FIXME functional tests failure ahead!
#ant test-functional
#ant test-functional-and-server-with-ha

pkill -f rabbitmq_server ||:


%files -f .mfiles
%license LICENSE*
%doc README*

%files doc
%doc doc/*

%files javadoc -f .mfiles-javadoc
%license LICENSE*


%changelog
* Fri Mar 25 2016 Raphael Groner <projects.rg@smart.ms> - 3.6.1-2
- fix tests execution, properly stop mocked server

* Tue Mar 01 2016 Fedora Release Monitoring <release-monitoring@fedoraproject.org> - 3.6.1-1
- Update to 3.6.1 (#1313412)

* Fri Jan 08 2016 Fedora Release Monitoring <release-monitoring@fedoraproject.org> - 3.6.0-1
- Update to 3.6.0 (#1296745)

* Wed Oct 28 2015 Raphael Groner <projects.rg@smart.ms> - 3.5.6-1
- v3.5.6, rhbz#1270088

* Sat Sep 26 2015 Raphael Groner <projects.rg@smart.ms> - 3.5.5-1
- v3.5.5 (rhbz#1266284)

* Mon Jul 27 2015 Raphael Groner <projects.rg@smart.ms> - 3.5.4-1
- v3.5.4 (rhbz#1245851)
- enable weak dependencies
- use build conditional for tex

* Fri May 22 2015 Fedora Release Monitoring <release-monitoring@fedoraproject.org> - 3.5.3-1
- Update to 3.5.3 (#1221420)

* Tue Mar 24 2015 Raphael Groner <projects.rg@smart.ms> - 3.5.0-1
- v3.5.0

* Sun Feb 22 2015 Raphael Groner (Builder) <projects.rg@smart.ms> - 3.4.4-1
- new upstream release v3.4.4 (rhbz#1195018)

* Wed Jan 28 2015 Raphael Groner <projects.rg (AT) smart.ms> - 3.4.2-5
- introduce license macro

* Thu Dec 11 2014 Raphael Groner <projects.rg [AT] smart.ms> - 3.4.2-4
- fix documentation again

* Thu Dec 11 2014 Raphael Groner <projects.rg [AT] smart.ms> - 3.4.2-3
- fix documentation

* Wed Dec 10 2014 Raphael Groner <projects.rg [AT] smart.ms> - 3.4.2-2
- documentation subpackage

* Wed Dec 10 2014 Raphael Groner <projects.rg [AT] smart.ms> - 3.4.2-1
- maven contributions from puntogil
- update to 3.4.2

* Tue Nov 25 2014 Raphael Groner <projects.rg [AT] smart.ms> - 3.4.1-1
- update to 3.4.1

* Wed Jun 11 2014 gil cattaneo <puntogil@libero.it> 3.3.2-1
- initial rpm