Initial import (#791263).

This commit is contained in:
Roman Kennke 2012-02-22 15:02:33 +01:00
parent 05a2e4aa10
commit 21cba1bf6c
7 changed files with 293 additions and 0 deletions

1
.gitignore vendored
View File

@ -0,0 +1 @@
/mockito-1.9.0.tar.xz

133
fix-cglib-refs.patch Normal file
View File

@ -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;

42
fixup-ant-script.patch Normal file
View File

@ -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 @@
<property name="maven.repository.dir" value="${basedir}/maven/repository" />
<path id="compile.classpath">
+ <fileset dir="/usr/share/java">
+ <include name="hamcrest/core.jar" />
+ <include name="junit4.jar" />
+ <include name="objenesis.jar" />
+ <include name="cglib.jar" />
+ </fileset>
<fileset dir="${lib.dir.run}" includes="*.jar" />
<fileset dir="${lib.dir.compile}" includes="*.jar" />
<fileset dir="${lib.dir.repackaged}" includes="*.jar" />
@@ -204,19 +210,14 @@
<delete file="${target.dir}/${jar.core.osgified}" />
</target>
- <target name="jar" depends="jar.all">
- <jarjar jarfile="${target.dir}/${jar.core}">
+ <target name="jar" depends="compile">
+ <jar jarfile="${target.dir}/${jar.core}">
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Implementation-Version" value="${version}"/>
</manifest>
- <fileset dir="${lib.dir.repackaged}" includes="*.txt" />
- <fileset dir="." file="LICENSE" />
- <fileset dir="." file="NOTICE" />
<fileset dir="${src.classes.dir}" />
- <fileset dir="${src.dir}" />
- <zipfileset src="${lib.dir.repackaged}/cglib-and-asm-1.0.jar"/>
- </jarjar>
+ </jar>
</target>
<target name="sources" >

View File

@ -0,0 +1,13 @@
#!/bin/sh
VERSION=1.9.0
SRCDIR=mockito-${VERSION}
hg clone https://code.google.com/p/mockito/ ${SRCDIR}
cd $SRCDIR
hg update ${VERSION}
rm -rf `find -name *.jar` build.gradle cglib-and-asm conf doc gradle gradlew gradlew.bat
dos2unix `find -name *.java`
cd ..
tar -cvJf mockito-${VERSION}.tar.xz ${SRCDIR}

View File

@ -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 @@
<artifactId>objenesis</artifactId>
<version>1.0</version>
</dependency>
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib</artifactId>
+ <version>2.2</version>
+ </dependency>
</dependencies>
</project>

88
mockito.spec Normal file
View File

@ -0,0 +1,88 @@
Name: mockito
Version: 1.9.0
Release: 3%{?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
BuildArch: noarch
BuildRequires: jpackage-utils
BuildRequires: java-devel
BuildRequires: ant
BuildRequires: objenesis
BuildRequires: cglib
BuildRequires: junit4
BuildRequires: hamcrest
Requires: jpackage-utils
Requires: java
Requires: objenesis
Requires: cglib
Requires: junit4
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 %{name}
Group: Documentation
Requires: jpackage-utils
%description javadoc
This package contains the API documentation for %{name}.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%build
ant jar javadoc
%install
mkdir -p $RPM_BUILD_ROOT%{_javadir}
cp -p target/mockito-core-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}.jar
install -d -m 755 $RPM_BUILD_ROOT%{_mavenpomdir}
install -pm 644 maven/mockito-core.pom \
$RPM_BUILD_ROOT%{_mavenpomdir}/JPP-%{name}.pom
mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/%{name}
cp -rp target/javadoc $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%add_maven_depmap JPP-%{name}.pom %{name}.jar
%files
%{_javadir}/%{name}.jar
%{_mavenpomdir}/JPP-%{name}.pom
%{_mavendepmapfragdir}/%{name}
%doc NOTICE
%doc LICENSE
%files javadoc
%{_javadocdir}/%{name}
%doc LICENSE
%doc NOTICE
%changelog
* Wed Feb 22 2012 Roman Kennke <rkennke@redhat.com> 1.9.0-3
- Added cglib dependency to pom
* Tue Feb 21 2012 Roman Kennke <rkennke@redhat.com> 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 <rkennke@redhat.com> 1.9.0-1
- Initial package

View File

@ -0,0 +1 @@
c358a9b514bee558dd78eaaa5d18cc15 mockito-1.9.0.tar.xz