diff --git a/.devtoolset-3-mockito.metadata b/.devtoolset-3-mockito.metadata new file mode 100644 index 0000000..21da892 --- /dev/null +++ b/.devtoolset-3-mockito.metadata @@ -0,0 +1 @@ +4eff27daeddb37e0686dd0e2c678a1311349f522 SOURCES/mockito-1.9.0.tar.xz diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..76beb3d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/mockito-1.9.0.tar.xz diff --git a/README.md b/README.md deleted file mode 100644 index 98f42b4..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/fix-bnd-config.patch b/SOURCES/fix-bnd-config.patch new file mode 100644 index 0000000..b9eceae --- /dev/null +++ b/SOURCES/fix-bnd-config.patch @@ -0,0 +1,32 @@ +--- conf/mockito-core.bnd.orig 2012-09-06 14:42:08.417103606 +0200 ++++ conf/mockito-core.bnd 2012-09-06 14:43:41.391834567 +0200 +@@ -1,8 +1,3 @@ +--classpath= lib/run/com.springsource.org.junit-4.5.0.jar, \ +- lib/run/com.springsource.org.hamcrest.core-1.1.0.jar, \ +- lib/run/com.springsource.org.objenesis-1.0.0.jar +--versionpolicy=[${version;==;${@}},${version;+;${@}}) +- + Bundle-Name= Mockito Mock Library for Java. Core bundle requires Hamcrest-core and Objenesis. + Bundle-SymbolicName= org.mockito.mockito-core + Bundle-Version= 1.9.0 +@@ -10,15 +5,16 @@ + Export-Package= !org.mockito.asm.*, \ + !org.mockito.cglib.*, \ + !org.mockito.internal.*, \ +- org.mockito.*;version=${version} ++ org.mockito.* + + Import-Package= junit.*;resolution:=optional, \ + org.junit.*;resolution:=optional, \ + org.apache.tools.ant.*;resolution:=optional, \ + org.hamcrest;version="[1.0,2.0)", \ + org.objenesis;version="[1.0,2.0)", \ +- org.mockito.* ++ org.mockito.*, \ ++ net.sf.cglib* + + Private-Package: org.mockito.* + +--removeheaders: Private-Package +\ No newline at end of file ++-removeheaders: Private-Package diff --git a/SOURCES/fix-cglib-refs.patch b/SOURCES/fix-cglib-refs.patch new file mode 100644 index 0000000..19f8f21 --- /dev/null +++ b/SOURCES/fix-cglib-refs.patch @@ -0,0 +1,133 @@ +# HG changeset patch +# Parent 65e60f677b3cb9c40d5d37e91ce6be1897c46370 + +diff --git a/src/org/mockito/internal/creation/DelegatingMockitoMethodProxy.java b/src/org/mockito/internal/creation/DelegatingMockitoMethodProxy.java +--- a/src/org/mockito/internal/creation/DelegatingMockitoMethodProxy.java ++++ b/src/org/mockito/internal/creation/DelegatingMockitoMethodProxy.java +@@ -4,7 +4,7 @@ + */ + package org.mockito.internal.creation; + +-import org.mockito.cglib.proxy.MethodProxy; ++import net.sf.cglib.proxy.MethodProxy; + + public class DelegatingMockitoMethodProxy extends AbstractMockitoMethodProxy { + +diff --git a/src/org/mockito/internal/creation/MethodInterceptorFilter.java b/src/org/mockito/internal/creation/MethodInterceptorFilter.java +--- a/src/org/mockito/internal/creation/MethodInterceptorFilter.java ++++ b/src/org/mockito/internal/creation/MethodInterceptorFilter.java +@@ -8,8 +8,8 @@ + import java.io.Serializable; + import java.lang.reflect.Method; + +-import org.mockito.cglib.proxy.MethodInterceptor; +-import org.mockito.cglib.proxy.MethodProxy; ++import net.sf.cglib.proxy.MethodInterceptor; ++import net.sf.cglib.proxy.MethodProxy; + import org.mockito.internal.MockitoInvocationHandler; + import org.mockito.internal.creation.cglib.CGLIBHacker; + import org.mockito.internal.invocation.*; +diff --git a/src/org/mockito/internal/creation/MockitoMethodProxy.java b/src/org/mockito/internal/creation/MockitoMethodProxy.java +--- a/src/org/mockito/internal/creation/MockitoMethodProxy.java ++++ b/src/org/mockito/internal/creation/MockitoMethodProxy.java +@@ -4,7 +4,7 @@ + */ + package org.mockito.internal.creation; + +-import org.mockito.cglib.proxy.MethodProxy; ++import net.sf.cglib.proxy.MethodProxy; + + public interface MockitoMethodProxy { + +diff --git a/src/org/mockito/internal/creation/SerializableMockitoMethodProxy.java b/src/org/mockito/internal/creation/SerializableMockitoMethodProxy.java +--- a/src/org/mockito/internal/creation/SerializableMockitoMethodProxy.java ++++ b/src/org/mockito/internal/creation/SerializableMockitoMethodProxy.java +@@ -6,7 +6,7 @@ + + import java.io.Serializable; + +-import org.mockito.cglib.proxy.MethodProxy; ++import net.sf.cglib.proxy.MethodProxy; + import org.mockito.internal.util.reflection.Whitebox; + + public class SerializableMockitoMethodProxy extends AbstractMockitoMethodProxy implements Serializable { +diff --git a/src/org/mockito/internal/creation/cglib/CGLIBHacker.java b/src/org/mockito/internal/creation/cglib/CGLIBHacker.java +--- a/src/org/mockito/internal/creation/cglib/CGLIBHacker.java ++++ b/src/org/mockito/internal/creation/cglib/CGLIBHacker.java +@@ -8,7 +8,7 @@ + import java.lang.reflect.Field; + + import org.mockito.internal.creation.MockitoMethodProxy; +-import org.mockito.cglib.proxy.MethodProxy; ++import net.sf.cglib.proxy.MethodProxy; + + public class CGLIBHacker implements Serializable { + +diff --git a/src/org/mockito/internal/creation/cglib/MockitoNamingPolicy.java b/src/org/mockito/internal/creation/cglib/MockitoNamingPolicy.java +--- a/src/org/mockito/internal/creation/cglib/MockitoNamingPolicy.java ++++ b/src/org/mockito/internal/creation/cglib/MockitoNamingPolicy.java +@@ -4,7 +4,7 @@ + */ + package org.mockito.internal.creation.cglib; + +-import org.mockito.cglib.core.DefaultNamingPolicy; ++import net.sf.cglib.core.DefaultNamingPolicy; + + public class MockitoNamingPolicy extends DefaultNamingPolicy { + +diff --git a/src/org/mockito/internal/creation/jmock/ClassImposterizer.java b/src/org/mockito/internal/creation/jmock/ClassImposterizer.java +--- a/src/org/mockito/internal/creation/jmock/ClassImposterizer.java ++++ b/src/org/mockito/internal/creation/jmock/ClassImposterizer.java +@@ -7,8 +7,8 @@ + import java.lang.reflect.*; + import java.util.List; + +-import org.mockito.cglib.core.*; +-import org.mockito.cglib.proxy.*; ++import net.sf.cglib.core.*; ++import net.sf.cglib.proxy.*; + import org.mockito.exceptions.base.MockitoException; + import org.mockito.internal.creation.cglib.MockitoNamingPolicy; + import org.objenesis.ObjenesisStd; +diff --git a/src/org/mockito/internal/creation/jmock/SerializableNoOp.java b/src/org/mockito/internal/creation/jmock/SerializableNoOp.java +--- a/src/org/mockito/internal/creation/jmock/SerializableNoOp.java ++++ b/src/org/mockito/internal/creation/jmock/SerializableNoOp.java +@@ -6,8 +6,8 @@ + + import java.io.Serializable; + +-import org.mockito.cglib.proxy.Callback; +-import org.mockito.cglib.proxy.NoOp; ++import net.sf.cglib.proxy.Callback; ++import net.sf.cglib.proxy.NoOp; + + public class SerializableNoOp implements NoOp, Serializable { + +diff --git a/src/org/mockito/internal/stubbing/defaultanswers/ReturnsSmartNulls.java b/src/org/mockito/internal/stubbing/defaultanswers/ReturnsSmartNulls.java +--- a/src/org/mockito/internal/stubbing/defaultanswers/ReturnsSmartNulls.java ++++ b/src/org/mockito/internal/stubbing/defaultanswers/ReturnsSmartNulls.java +@@ -9,8 +9,8 @@ + import java.util.Arrays; + + import org.mockito.Mockito; +-import org.mockito.cglib.proxy.MethodInterceptor; +-import org.mockito.cglib.proxy.MethodProxy; ++import net.sf.cglib.proxy.MethodInterceptor; ++import net.sf.cglib.proxy.MethodProxy; + import org.mockito.exceptions.Reporter; + import org.mockito.internal.creation.jmock.ClassImposterizer; + import org.mockito.internal.debugging.Location; +diff --git a/src/org/mockito/internal/util/MockUtil.java b/src/org/mockito/internal/util/MockUtil.java +--- a/src/org/mockito/internal/util/MockUtil.java ++++ b/src/org/mockito/internal/util/MockUtil.java +@@ -4,8 +4,8 @@ + */ + package org.mockito.internal.util; + +-import org.mockito.cglib.proxy.Callback; +-import org.mockito.cglib.proxy.Factory; ++import net.sf.cglib.proxy.Callback; ++import net.sf.cglib.proxy.Factory; + import org.mockito.exceptions.misusing.NotAMockException; + import org.mockito.internal.InvocationNotifierHandler; + import org.mockito.internal.MockHandler; diff --git a/SOURCES/fixup-ant-script.patch b/SOURCES/fixup-ant-script.patch new file mode 100644 index 0000000..51a4384 --- /dev/null +++ b/SOURCES/fixup-ant-script.patch @@ -0,0 +1,42 @@ +# HG changeset patch +# Parent 5e1ff2ee5aa22b1c22238b520b3e6bd3b4aec0da + +diff --git a/build.xml b/build.xml +--- a/build.xml ++++ b/build.xml +@@ -42,6 +42,12 @@ + + + ++ ++ ++ ++ ++ ++ + + + +@@ -204,19 +210,14 @@ + + + +- +- ++ ++ + + + + +- +- +- + +- +- +- ++ + + + diff --git a/SOURCES/make-mockito-sourcetarball.sh b/SOURCES/make-mockito-sourcetarball.sh new file mode 100644 index 0000000..58c1b67 --- /dev/null +++ b/SOURCES/make-mockito-sourcetarball.sh @@ -0,0 +1,20 @@ +#!/bin/sh +#set -x + +VERSION=1.9.0 +SRCDIR=mockito-${VERSION} + +hg clone https://code.google.com/p/mockito/ ${SRCDIR} +pushd $SRCDIR +hg archive --prefix ${SRCDIR} -t tar -r ${VERSION} ../${SRCDIR}.tar +popd + +rm -rf ${SRCDIR} + +tar -xf ${SRCDIR}.tar +pushd ${SRCDIR} +rm -rf `find -name *.jar` build.gradle cglib-and-asm doc gradle gradlew gradlew.bat +dos2unix `find -name *.java` +popd + +tar -cvJf mockito-${VERSION}.tar.xz ${SRCDIR} diff --git a/SOURCES/maven-cglib-dependency.patch b/SOURCES/maven-cglib-dependency.patch new file mode 100644 index 0000000..313a9cf --- /dev/null +++ b/SOURCES/maven-cglib-dependency.patch @@ -0,0 +1,15 @@ +diff --git a/maven/mockito-core.pom b/maven/mockito-core.pom +--- a/maven/mockito-core.pom ++++ b/maven/mockito-core.pom +@@ -29,6 +29,11 @@ + objenesis + 1.0 + ++ ++ net.sf.cglib ++ cglib ++ 2.2 ++ + + + diff --git a/SOURCES/mockito-matcher.patch b/SOURCES/mockito-matcher.patch new file mode 100644 index 0000000..71572d7 --- /dev/null +++ b/SOURCES/mockito-matcher.patch @@ -0,0 +1,24 @@ +diff --git a/src/org/mockito/internal/matchers/LocalizedMatcher.java b/src/org/mockito/internal/matchers/LocalizedMatcher.java +index 01e83b3..7d249f5 100644 +--- a/src/org/mockito/internal/matchers/LocalizedMatcher.java ++++ b/src/org/mockito/internal/matchers/LocalizedMatcher.java +@@ -16,6 +16,12 @@ public class LocalizedMatcher implements Matcher, ContainsExtraTypeInformation, + private final Matcher actualMatcher; + private Location location; + ++ /* This is a hack for Fedora. Bug has been filed here: ++ * https://code.google.com/p/mockito/issues/detail?id=428 */ ++ public void describeMismatch(Object item, Description mismatchDescription) { ++ mismatchDescription.appendText("was ").appendValue(item); ++ } ++ + public LocalizedMatcher(Matcher actualMatcher) { + this.actualMatcher = actualMatcher; + this.location = new Location(); +@@ -65,4 +71,4 @@ public class LocalizedMatcher implements Matcher, ContainsExtraTypeInformation, + public Matcher getActualMatcher() { + return actualMatcher; + } +-} +\ No newline at end of file ++} diff --git a/SOURCES/setting-naming-policy.patch b/SOURCES/setting-naming-policy.patch new file mode 100644 index 0000000..d4f30b1 --- /dev/null +++ b/SOURCES/setting-naming-policy.patch @@ -0,0 +1,34 @@ +From 04e36a01e93c3b79caa9f7e9e8573fe2a0d65d1a Mon Sep 17 00:00:00 2001 +From: Michael Simacek +Date: Thu, 5 Dec 2013 16:53:36 +0100 +Subject: [PATCH] Setting naming policy + +Signed-off-by: Michael Simacek +--- + src/org/mockito/internal/creation/cglib/CGLIBHacker.java | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/org/mockito/internal/creation/cglib/CGLIBHacker.java b/src/org/mockito/internal/creation/cglib/CGLIBHacker.java +index 172f744..de53ab1 100644 +--- a/src/org/mockito/internal/creation/cglib/CGLIBHacker.java ++++ b/src/org/mockito/internal/creation/cglib/CGLIBHacker.java +@@ -20,6 +20,9 @@ public class CGLIBHacker implements Serializable { + Field createInfoField = reflectOnCreateInfo(methodProxy); + createInfoField.setAccessible(true); + Object createInfo = createInfoField.get(methodProxy); ++ if (createInfo == null) { ++ return; ++ } + Field namingPolicyField = createInfo.getClass().getDeclaredField("namingPolicy"); + namingPolicyField.setAccessible(true); + if (namingPolicyField.get(createInfo) == null) { +@@ -43,4 +46,4 @@ public class CGLIBHacker implements Serializable { + } + return cglibMethodProxyClass.getDeclaredField("createInfo"); + } +-} +\ No newline at end of file ++} +-- +1.8.3.1 + diff --git a/SPECS/mockito.spec b/SPECS/mockito.spec new file mode 100644 index 0000000..1050bdb --- /dev/null +++ b/SPECS/mockito.spec @@ -0,0 +1,154 @@ +%{?scl:%scl_package mockito} +%{!?scl:%global pkg_name %{name}} +%{!?maven_scl:%global maven_scl_prefix %{nil}} + +Name: %{?scl_prefix}mockito +Version: 1.9.0 +Release: 15%{?dist} +Summary: A Java mocking framework + +License: MIT +URL: http://code.google.com/p/mockito/ +Source0: mockito-%{version}.tar.xz +Source1: make-mockito-sourcetarball.sh +Patch0: fixup-ant-script.patch +Patch1: fix-cglib-refs.patch +Patch2: maven-cglib-dependency.patch +Patch3: fix-bnd-config.patch +Patch4: %{pkg_name}-matcher.patch +# Workaround for NPE in setting NamingPolicy in cglib +Patch5: setting-naming-policy.patch + +BuildArch: noarch +BuildRequires: jpackage-utils +BuildRequires: java-devel +BuildRequires: ant +BuildRequires: %{?scl_prefix}objenesis +BuildRequires: cglib +BuildRequires: junit +BuildRequires: hamcrest +BuildRequires: aqute-bnd + +Requires: jpackage-utils +Requires: %{?scl_prefix}objenesis +Requires: cglib +Requires: %{?scl_prefix}junit +Requires: hamcrest + +%description +Mockito is a mocking framework that tastes really good. It lets you write +beautiful tests with clean & simple API. Mockito doesn't give you hangover +because the tests are very readable and they produce clean verification +errors. + +%package javadoc +Summary: Javadocs for %{pkg_name} +Group: Documentation +Requires: jpackage-utils + +%description javadoc +This package contains the API documentation for %{pkg_name}. + +%prep +%setup -q -n %{pkg_name}-%{version} +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +# Set Bundle-Version properly +sed -i 's/Bundle-Version= ${version}/Bundle-Version= %{version}/' conf/mockito-core.bnd +%patch3 +%patch4 -p1 +%patch5 -p1 + +%build +scl enable %{scl} - <<"EOF" +build-jar-repository lib/compile objenesis +unset ANT_HOME +ant jar javadoc +# Convert to OSGi bundle +pushd target +java -jar $(build-classpath aqute-bnd) wrap -output mockito-core-%{version}.bar -properties ../conf/mockito-core.bnd mockito-core-%{version}.jar +popd +EOF + +%install +scl enable %{scl} - <<"EOF" +mkdir -p $RPM_BUILD_ROOT%{_javadir} +sed -i -e "s|@version@|%{version}|g" maven/mockito-core.pom +cp -p target/mockito-core-%{version}.bar $RPM_BUILD_ROOT%{_javadir}/%{pkg_name}.jar + +install -d -m 755 $RPM_BUILD_ROOT%{_mavenpomdir} +install -pm 644 maven/mockito-core.pom \ + $RPM_BUILD_ROOT%{_mavenpomdir}/JPP-%{pkg_name}.pom + +mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/%{pkg_name} +cp -rp target/javadoc/* $RPM_BUILD_ROOT%{_javadocdir}/%{pkg_name} + +%add_maven_depmap JPP-%{pkg_name}.pom %{pkg_name}.jar -a "org.mockito:mockito-all" +EOF + +%files +%{_javadir}/%{pkg_name}.jar +%{_mavenpomdir}/JPP-%{pkg_name}.pom +%{_mavendepmapfragdir}/%{pkg_name} +%doc NOTICE +%doc LICENSE + +%files javadoc +%{_javadocdir}/%{pkg_name} +%doc LICENSE +%doc NOTICE + +%changelog +* Fri Mar 28 2014 Michael Simacek - 1.9.0-15 +- Use Requires: java-headless rebuild (#1067528) + +* Wed Dec 11 2013 Michael Simacek - 1.9.0-14 +- Workaround for NPE in setting NamingPolicy + +* Sat Aug 03 2013 Fedora Release Engineering - 1.9.0-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Mon Mar 25 2013 Tomas Radej - 1.9.0-12 +- Patched LocalizedMatcher due to hamcrest update, (bug upstream) + +* Thu Feb 14 2013 Fedora Release Engineering - 1.9.0-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Thu Sep 6 2012 Severin Gehwolf 1.9.0-10 +- More Import-Package fixes. Note that fix-cglib-refs.patch is + not suitable for upstream: + http://code.google.com/p/mockito/issues/detail?id=373 + +* Tue Sep 4 2012 Severin Gehwolf 1.9.0-9 +- Fix missing Import-Package in manifest. + +* Mon Aug 27 2012 Severin Gehwolf 1.9.0-8 +- Add aqute bnd instructions for OSGi metadata + +* Fri Jul 20 2012 Fedora Release Engineering - 1.9.0-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Mon Apr 30 2012 Roman Kennke 1.9.0-6 +- Place JavaDoc in directly under %{_javadocdir}/%{name} instead + of %{_javadocdir}/%{name}/javadoc + +* Wed Apr 25 2012 Roman Kennke 1.9.0-5 +- Removed post/postun hook for update_maven_depmap + +* Tue Apr 24 2012 Roman Kennke 1.9.0-4 +- Fix groupId of cglib dependency +- Add additional depmap for mockito-all +- Update depmap on post and postun +- Fix version in pom + +* Wed Feb 22 2012 Roman Kennke 1.9.0-3 +- Added cglib dependency to pom + +* Tue Feb 21 2012 Roman Kennke 1.9.0-2 +- Include upstream Maven pom.xml in package +- Added missing Requires for cglib, junit4, hamcrest, objenesis +- Added source tarball generating script to sources + +* Thu Feb 16 2012 Roman Kennke 1.9.0-1 +- Initial package