File mockobjects.spec of Package mockobjects

#
# spec file for package mockobjects (Version 0.09)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2000-2008, JPackage Project
# All rights reserved.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define section		free
#%define j2ee12  %{?_with_j2ee12:1}%{!?_without_j2ee12:0}
#%define j2ee13  %{?_with_j2ee13:1}%{!?_without_j2ee13:0}

Name:           mockobjects
Version:        0.09
Release:        3
Summary:        Java MockObjects package
License:        BSD Style
Url:            http://www.mockobjects.com/
Group:          Development/Libraries/Java
#Vendor:         JPackage Project
#Distribution:   JPackage
Source0:        http://www.mockobjects.com/dist/%{name}-%{version}.tar.bz2
Source1:        http://repo1.maven.org/maven2/mockobjects/mockobjects-core/0.09/mockobjects-core-0.09.pom
Source2:        http://repo1.maven.org/maven2/mockobjects/mockobjects-jdk1.4/0.09/mockobjects-jdk1.4-0.09.pom
Source3:        http://repo1.maven.org/maven2/mockobjects/mockobjects-alt-jdk1.4/0.09/mockobjects-alt-jdk1.4-0.09.pom
Source4:        mockobjects-httpclient-0.09.pom
Source5:        mockobjects-alt-httpclient-0.09.pom
Source6:        mockobjects-jdk1.4-j2ee1.4-0.09.pom
Patch0:         %{name}-buildjdk.patch
Patch1:         %{name}-ext-httpmethod-abstract.patch
Patch2:         %{name}-AssertMo.patch
Patch3:         %{name}-MockPageContext.patch
Patch4:         %{name}-MockConnection.patch
Patch5:         %{name}-MockMessagePublisher.patch
Patch6:         %{name}-MockQueueConnectionFactory.patch
Patch7:         %{name}-MockQueueSender.patch
Patch8:         %{name}-MockSession.patch
Patch9:         %{name}-MockTopicConnectionFactory.patch
Patch10:        mockobjects-0.09-j2ee14-MockHttpServletRequest.patch
Patch11:        mockobjects-0.09-j2ee14-MockHttpServletResponse.patch
Patch12:        mockobjects-FileImpl.patch
Patch13:        mockobjects-java6.patch
Requires:       java >= 1.4.2
Requires:       junit
#BuildRequires:	java-devel = 1.5.0
BuildRequires:  java-devel
BuildRequires:  ant >= 1.6.5
BuildRequires:  ant-junit
BuildRequires:  jakarta-commons-httpclient3
BuildRequires:  junit
BuildRequires:  geronimo-j2ee-1_4-apis
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires(post):   jpackage-utils >= 1.7.5
Requires(postun): jpackage-utils >= 1.7.5

%description
The Mock Objects project is a generic unit testing framework whose goal
is to facilitate developing unit tests in the mock object style. The
goal of this project is to provide, a core mock objects framework. This
is a library of code that supports the implementation of mock objects.
It is based around a set of expectation classes for values and
collections. There are also various other classes to make mock objects
easier to write or to use.

%package jdk1_4
License:        BSD Style
Summary:        MockObjects for 1.4 JDK
Group:          Development/Libraries/Java
Provides:       %{name}-jdk1.4 = %{version}-%{release}
Requires:       %{name} = %{version}-%{release}
Requires:       java-devel >= 1.4.2

%description jdk1_4
MockObjects specific to JDK >= 1.4.x

%package httpclient
License:        BSD Style
Summary:        MockObjects for Commons HttpClient
Group:          Development/Libraries/Java
Requires:       %{name} = %{version}-%{release}
Requires:       jakarta-commons-httpclient3

%description httpclient
MockObjects for Jakarta Commons HttpClient

%package alt-httpclient
License:        BSD Style
Summary:        Mockable API for Commons HttpClient
Group:          Development/Libraries/Java
Requires:       %{name} = %{version}-%{release}
Requires:       %{name}-httpclient = %{version}-%{release}
Requires:       jakarta-commons-httpclient3

%description alt-httpclient
Alternative API for Jakarta Commons HttpClient to allow for testing

%package alt-jdk1_4
License:        BSD Style
Summary:        Mockable API for JDK 1.4
Group:          Development/Libraries/Java
Provides:       %{name}-alt-jdk1.4 = %{version}-%{release}
Requires:       %{name} = %{version}-%{release}
Requires:       %{name}-jdk1_4 = %{version}-%{release}
Requires:       java-devel >= 1.4.2

%description alt-jdk1_4
Alternative API for JDK 1.4 to allow for testing

%package jdk1_4-j2ee1_4
License:        BSD Style
Summary:        Mockable J2EE API for JDK 1.4 and J2EE 1.4
Group:          Development/Libraries/Java
Provides:       %{name}-jdk1.4-j2ee1.4 = %{version}-%{release}
Requires:       %{name} = %{version}-%{release}
Requires:       %{name}-jdk1_4 = %{version}-%{release}
Requires:       java-devel >= 1.4.2

%description jdk1_4-j2ee1_4
API for JDK 1.4 to allow testing with J2EE 1.4 mocks

%prep
%setup -q -n %{name}-%{version}
cp -r src/j2ee/1.3/com/mockobjects/servlet src/j2ee/1.4/com/mockobjects/
%patch0 -b .sav0
%patch1 -p1 -b .sav1
%patch2 -b .sav2
%patch3 -b .sav3
%patch4 -b .sav4
%patch5 -b .sav5
%patch6 -b .sav6
%patch7 -b .sav7
%patch8 -b .sav8
%patch9 -b .sav9
%patch10 -b .sav10
%patch11 -b .sav11
%patch12 -b .sav12
%patch13 -b .java6

%build
#export JAVA_HOME=%{_jvmdir}/java-1.5.0
CLASSPATH=`build-classpath junit` ant jar-core
CLASSPATH=`build-classpath junit` ant jar-jdk
CLASSPATH=`build-classpath jakarta-commons-httpclient3 junit` ant jar-ext-httpclient
rm -rf out/j2ee/classes/*
CLASSPATH=`build-classpath geronimo-j2ee-1.4-apis junit` ant -Dant.build.javac.source=1.5 -Dant.build.javac.target=1.5 -Djdk.version=1.4 -Dj2ee.version=1.4 compile-j2ee jar-j2ee

%install
# jars
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}
pushd out
install -m 644 %{name}-core-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-core-%{version}.jar
install -m 644 %{name}-httpclient.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-httpclient-%{version}.jar
install -m 644 alt-httpclient.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-alt-httpclient-%{version}.jar
# Install JDK Mocks and alternatives
install -m 644 %{name}-jdk1.4-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-jdk1.4-%{version}.jar
install -m 644 %{name}-alt-jdk1.4-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-alt-jdk1.4-%{version}.jar
# Install J2EE Mocks
install -m 644 %{name}-jdk1.4-j2ee1.4-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-jdk1.4-j2ee1.4-%{version}.jar
popd
# poms
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/maven2/poms
install -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP-mockobjects-core.pom
%add_to_maven_depmap %{name} %{name}-core %{version} JPP %{name}-core
install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP-mockobjects-jdk1.4.pom
%add_to_maven_depmap %{name} %{name}-jdk1.4 %{version} JPP %{name}-jdk1.4
install -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP-mockobjects-alt-jdk1.4.pom
%add_to_maven_depmap %{name} %{name}-alt-jdk1.4 %{version} JPP %{name}-alt-jdk1.4
install -m 644 %{SOURCE4} $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP-mockobjects-httpclient.pom
%add_to_maven_depmap %{name} %{name}-httpclient %{version} JPP %{name}-httpclient
install -m 644 %{SOURCE5} $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP-mockobjects-alt-httpclient.pom
%add_to_maven_depmap %{name} %{name}-alt-httpclient %{version} JPP %{name}-alt-httpclient
install -m 644 %{SOURCE6} $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP-mockobjects-jdk1.4-j2ee1.4.pom
%add_to_maven_depmap %{name} %{name}-jdk1.4-j2ee1.4 %{version} JPP %{name}-jdk1.4-j2ee1.4
pushd $RPM_BUILD_ROOT%{_javadir} 
for jar in *-%{version}.jar; do
	ln -sf ${jar} $(echo $jar| sed "s|-%{version}||g")
done
popd

%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT

%post
%update_maven_depmap

%postun
%update_maven_depmap

%files
%defattr(0644,root,root,0755)
%doc doc/README
%{_javadir}/%{name}-core*
%{_datadir}/maven2/poms
%config %{_mavendepmapfragdir}

%files jdk1_4
%defattr(0644,root,root,0755)
%{_javadir}/%{name}-jdk1.4-%{version}.jar
%{_javadir}/%{name}-jdk1.4.jar

%files httpclient
%defattr(0644,root,root,0755)
%{_javadir}/%{name}-httpclient*.jar

%files alt-jdk1_4
%defattr(0644,root,root,0755)
%{_javadir}/%{name}-alt-jdk1.4*.jar

%files alt-httpclient
%defattr(0644,root,root,0755)
%{_javadir}/%{name}-alt-httpclient*.jar

%files jdk1_4-j2ee1_4
%defattr(0644,root,root,0755)
%{_javadir}/%{name}-jdk1.4-j2ee1.4*.jar

%changelog