Migrate from easymock 1 to easymock 3

- Resolves: rhbz#1002432

Signed-off-by: Mikolaj Izdebski <mizdebsk@redhat.com>
This commit is contained in:
Mikolaj Izdebski 2013-08-29 10:02:14 +02:00
parent b62e4ec0b2
commit a1aa0862fe
2 changed files with 154 additions and 2 deletions

View File

@ -0,0 +1,146 @@
From cb3b8016fa74d1684029034793c0605b36491b60 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Thu, 29 Aug 2013 10:11:48 +0200
Subject: [PATCH] Migrate from easymock 1 to easymock 3
---
maven-compat/pom.xml | 2 +-
.../maven/artifact/testutils/MockManager.java | 58 ----------------------
.../repository/legacy/DefaultWagonManagerTest.java | 7 ++-
pom.xml | 4 +-
4 files changed, 6 insertions(+), 65 deletions(-)
delete mode 100644 maven-compat/src/test/java/org/apache/maven/artifact/testutils/MockManager.java
diff --git a/maven-compat/pom.xml b/maven-compat/pom.xml
index 21270b7..e07855b 100644
--- a/maven-compat/pom.xml
+++ b/maven-compat/pom.xml
@@ -77,7 +77,7 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>easymock</groupId>
+ <groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<scope>test</scope>
</dependency>
diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/testutils/MockManager.java b/maven-compat/src/test/java/org/apache/maven/artifact/testutils/MockManager.java
deleted file mode 100644
index 4b6f637..0000000
--- a/maven-compat/src/test/java/org/apache/maven/artifact/testutils/MockManager.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.apache.maven.artifact.testutils;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.easymock.MockControl;
-
-public class MockManager
-{
-
- private List mockControls = new ArrayList();
-
- public void add( MockControl control )
- {
- mockControls.add( control );
- }
-
- public void replayAll()
- {
- for ( Object mockControl : mockControls )
- {
- MockControl control = (MockControl) mockControl;
-
- control.replay();
- }
- }
-
- public void verifyAll()
- {
- for ( Object mockControl : mockControls )
- {
- MockControl control = (MockControl) mockControl;
-
- control.verify();
- }
- }
-
-}
diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java
index bcda50a..6823ae2 100644
--- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java
@@ -45,7 +45,7 @@ import org.apache.maven.wagon.observers.AbstractTransferListener;
import org.apache.maven.wagon.observers.Debug;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
-import org.easymock.MockControl;
+import org.easymock.EasyMock;
/**
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
@@ -162,15 +162,14 @@ public class DefaultWagonManagerTest
StringWagon wagon = (StringWagon) wagonManager.getWagon( "string" );
wagon.addExpectedContent( repo.getLayout().pathOf( artifact ), "expected" );
- MockControl control = MockControl.createControl( UpdateCheckManager.class );
- control.replay();
+ EasyMock.replay();
wagonManager.getArtifact( artifact, repo, null, false );
assertTrue( artifact.getFile().exists() );
assertEquals( "expected", FileUtils.fileRead( artifact.getFile(), "UTF-8" ) );
- control.verify();
+ EasyMock.verify();
}
private Artifact createTestPomArtifact( String directory )
diff --git a/pom.xml b/pom.xml
index 19edb60..06e6256 100644
--- a/pom.xml
+++ b/pom.xml
@@ -44,7 +44,7 @@
<properties>
<classWorldsVersion>2.4.2</classWorldsVersion>
<commonsCliVersion>1.2</commonsCliVersion>
- <easyMockVersion>1.2_Java1.3</easyMockVersion>
+ <easyMockVersion>3.2</easyMockVersion>
<junitVersion>3.8.2</junitVersion>
<plexusVersion>1.5.5</plexusVersion>
<plexusInterpolationVersion>1.16</plexusInterpolationVersion>
@@ -320,7 +320,7 @@
</dependency>
<!--bootstrap-start-comment-->
<dependency>
- <groupId>easymock</groupId>
+ <groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>${easyMockVersion}</version>
<scope>test</scope>
--
1.8.3.1

View File

@ -1,6 +1,6 @@
Name: maven Name: maven
Version: 3.1.0 Version: 3.1.0
Release: 7%{?dist} Release: 8%{?dist}
Summary: Java project management and project comprehension tool Summary: Java project management and project comprehension tool
Group: Development/Tools Group: Development/Tools
@ -15,6 +15,7 @@ Source200: %{name}-script
# Patch1XX could be upstreamed probably # Patch1XX could be upstreamed probably
Patch100: 0005-Use-generics-in-modello-generated-code.patch Patch100: 0005-Use-generics-in-modello-generated-code.patch
Patch101: 0001-Migrate-from-easymock-1-to-easymock-3.patch
# Forwarded upstream (MNG-5502) # Forwarded upstream (MNG-5502)
Patch200: 0001-Update-Aether-to-0.9.0.M3.patch Patch200: 0001-Update-Aether-to-0.9.0.M3.patch
@ -39,7 +40,7 @@ BuildRequires: apache-resource-bundles
BuildRequires: atinject BuildRequires: atinject
BuildRequires: buildnumber-maven-plugin BuildRequires: buildnumber-maven-plugin
BuildRequires: cglib BuildRequires: cglib
BuildRequires: easymock BuildRequires: easymock3
BuildRequires: google-guice >= 3.0 BuildRequires: google-guice >= 3.0
BuildRequires: hamcrest BuildRequires: hamcrest
BuildRequires: jsr-305 BuildRequires: jsr-305
@ -97,6 +98,7 @@ Group: Documentation
%prep %prep
%setup -q -n apache-%{name}-%{version}%{?ver_add} %setup -q -n apache-%{name}-%{version}%{?ver_add}
%patch100 -p1 %patch100 -p1
%patch101 -p1
%patch200 -p1 %patch200 -p1
%patch300 -p1 %patch300 -p1
@ -228,6 +230,10 @@ ln -sf $(build-classpath plexus/classworlds) \
%changelog %changelog
* Thu Aug 29 2013 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.1.0-8
- Migrate from easymock 1 to easymock 3
- Resolves: rhbz#1002432
* Fri Aug 23 2013 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.1.0-7 * Fri Aug 23 2013 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.1.0-7
- Add patch for MNG-5503 - Add patch for MNG-5503
- Resolves: rhbz#991454 - Resolves: rhbz#991454