[maven-shared-io] 15/28: Added patches to compile the tests

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Wed Jul 19 17:19:43 UTC 2017


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to branch master
in repository maven-shared-io.

commit 28ea05a031a17c73338e4af07c678f1cc9606fe5
Author: Emmanuel Bourg <ebourg at apache.org>
Date:   Mon Jan 20 11:33:52 2014 +0000

    Added patches to compile the tests
---
 debian/patches/01-upgrade-easymock.patch           | 1098 ++++++++++++++++++++
 .../patches/02-maven-artifact-compatibility.patch  |   23 +
 debian/patches/series                              |    2 +
 3 files changed, 1123 insertions(+)

diff --git a/debian/patches/01-upgrade-easymock.patch b/debian/patches/01-upgrade-easymock.patch
new file mode 100644
index 0000000..d5cf8ca
--- /dev/null
+++ b/debian/patches/01-upgrade-easymock.patch
@@ -0,0 +1,1098 @@
+Description: Upgrade the dependency on Easymock. This patch has been applied upstream.
+Author: Emmanuel Bourg <ebourg at apache.org>
+Forwarded: https://github.com/apache/maven-shared/commit/56e570232a0ae933e4427c7d1edcdd2d4cff7420
+--- a/src/test/java/org/apache/maven/shared/io/MockManager.java
++++ /dev/null
+@@ -1,58 +0,0 @@
+-package org.apache.maven.shared.io;
+-
+-/*
+- * 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 ( Iterator it = mockControls.iterator(); it.hasNext(); )
+-        {
+-            MockControl control = (MockControl) it.next();
+-
+-            control.replay();
+-        }
+-    }
+-
+-    public void verifyAll()
+-    {
+-        for ( Iterator it = mockControls.iterator(); it.hasNext(); )
+-        {
+-            MockControl control = (MockControl) it.next();
+-
+-            control.verify();
+-        }
+-    }
+-
+-}
+--- a/src/test/java/org/apache/maven/shared/io/download/DefaultDownloadManagerTest.java
++++ b/src/test/java/org/apache/maven/shared/io/download/DefaultDownloadManagerTest.java
+@@ -24,7 +24,6 @@
+ import java.util.Collections;
+ 
+ import org.apache.maven.artifact.manager.WagonManager;
+-import org.apache.maven.shared.io.MockManager;
+ import org.apache.maven.shared.io.TestUtils;
+ import org.apache.maven.shared.io.logging.DefaultMessageHolder;
+ import org.apache.maven.shared.io.logging.MessageHolder;
+@@ -40,20 +39,15 @@
+ import org.apache.maven.wagon.proxy.ProxyInfo;
+ import org.apache.maven.wagon.repository.Repository;
+ import org.codehaus.plexus.PlexusTestCase;
+-import org.easymock.MockControl;
++
++import static org.easymock.EasyMock.*;
+ 
+ public class DefaultDownloadManagerTest
+     extends PlexusTestCase
+ {
+ 
+-    private MockManager mockManager;
+-
+-    private MockControl wagonManagerControl;
+-
+     private WagonManager wagonManager;
+ 
+-    private MockControl wagonControl;
+-
+     private Wagon wagon;
+ 
+     public void setUp()
+@@ -61,17 +55,8 @@
+     {
+         super.setUp();
+ 
+-        mockManager = new MockManager();
+-
+-        wagonManagerControl = MockControl.createControl( WagonManager.class );
+-        mockManager.add( wagonManagerControl );
+-
+-        wagonManager = (WagonManager) wagonManagerControl.getMock();
+-
+-        wagonControl = MockControl.createControl( Wagon.class );
+-        mockManager.add( wagonControl );
+-
+-        wagon = (Wagon) wagonControl.getMock();
++        wagonManager = createMock( WagonManager.class );
++        wagon = createMock( Wagon.class );
+     }
+ 
+     public void testShouldConstructWithNoParamsAndHaveNonNullMessageHolder()
+@@ -81,18 +66,11 @@
+ 
+     public void testShouldConstructWithWagonManager()
+     {
+-        MockManager mockManager = new MockManager();
+-
+-        MockControl ctl = MockControl.createControl( WagonManager.class );
+-        mockManager.add( ctl );
+-
+-        WagonManager wagonManager = (WagonManager) ctl.getMock();
+-
+-        mockManager.replayAll();
++        replay( wagonManager );
+ 
+         new DefaultDownloadManager( wagonManager );
+ 
+-        mockManager.verifyAll();
++        verify( wagonManager );
+     }
+ 
+     public void testShouldLookupInstanceDefaultRoleHint()
+@@ -103,14 +81,7 @@
+ 
+     public void testShouldFailToDownloadMalformedURL()
+     {
+-        MockManager mockManager = new MockManager();
+-
+-        MockControl ctl = MockControl.createControl( WagonManager.class );
+-        mockManager.add( ctl );
+-
+-        WagonManager wagonManager = (WagonManager) ctl.getMock();
+-
+-        mockManager.replayAll();
++        replay( wagonManager );
+ 
+         DownloadManager mgr = new DefaultDownloadManager( wagonManager );
+ 
+@@ -125,7 +96,7 @@
+             assertTrue( e.getMessage().indexOf( "invalid URL" ) > -1 );
+         }
+ 
+-        mockManager.verifyAll();
++        verify( wagonManager );
+     }
+ 
+     public void testShouldDownloadFromTempFileWithNoTransferListeners()
+@@ -136,13 +107,13 @@
+ 
+         setupDefaultMockConfiguration();
+ 
+-        mockManager.replayAll();
++        replay( wagon, wagonManager );
+ 
+         DownloadManager downloadManager = new DefaultDownloadManager( wagonManager );
+ 
+         downloadManager.download( tempFile.toURL().toExternalForm(), new DefaultMessageHolder() );
+ 
+-        mockManager.verifyAll();
++        verify( wagon, wagonManager );
+     }
+ 
+     public void testShouldDownloadFromTempFileTwiceAndUseCache()
+@@ -153,7 +124,7 @@
+ 
+         setupDefaultMockConfiguration();
+ 
+-        mockManager.replayAll();
++        replay( wagon, wagonManager );
+ 
+         DownloadManager downloadManager = new DefaultDownloadManager( wagonManager );
+ 
+@@ -167,7 +138,7 @@
+         assertEquals( 1, mh.size() );
+         assertTrue( mh.render().indexOf( "Using cached" ) > -1 );
+ 
+-        mockManager.verifyAll();
++        verify( wagon, wagonManager );
+     }
+ 
+     public void testShouldDownloadFromTempFileWithOneTransferListener()
+@@ -178,23 +149,20 @@
+ 
+         setupDefaultMockConfiguration();
+ 
+-        MockControl transferListenerControl = MockControl.createControl( TransferListener.class );
+-        mockManager.add( transferListenerControl );
+-
+-        TransferListener transferListener = (TransferListener) transferListenerControl.getMock();
++        TransferListener transferListener = createMock( TransferListener.class );
+ 
+         wagon.addTransferListener( transferListener );
+ 
+         wagon.removeTransferListener( transferListener );
+ 
+-        mockManager.replayAll();
++        replay( wagon, wagonManager, transferListener );
+ 
+         DownloadManager downloadManager = new DefaultDownloadManager( wagonManager );
+ 
+         downloadManager.download( tempFile.toURL().toExternalForm(), Collections.singletonList( transferListener ),
+                                   new DefaultMessageHolder() );
+ 
+-        mockManager.verifyAll();
++        verify( wagon, wagonManager, transferListener );
+     }
+ 
+     public void testShouldFailToDownloadWhenWagonProtocolNotFound()
+@@ -205,7 +173,7 @@
+ 
+         setupMocksWithWagonManagerGetException( new UnsupportedProtocolException( "not supported" ) );
+ 
+-        mockManager.replayAll();
++        replay( wagon, wagonManager );
+ 
+         DownloadManager downloadManager = new DefaultDownloadManager( wagonManager );
+ 
+@@ -220,7 +188,7 @@
+             assertTrue( TestUtils.toString( e ).indexOf( "UnsupportedProtocolException" ) > -1 );
+         }
+ 
+-        mockManager.verifyAll();
++        verify( wagon, wagonManager );
+     }
+ 
+     public void testShouldFailToDownloadWhenWagonConnectThrowsConnectionException()
+@@ -231,7 +199,7 @@
+ 
+         setupMocksWithWagonConnectionException( new ConnectionException( "connect error" ) );
+ 
+-        mockManager.replayAll();
++        replay( wagon, wagonManager );
+ 
+         DownloadManager downloadManager = new DefaultDownloadManager( wagonManager );
+ 
+@@ -246,7 +214,7 @@
+             assertTrue( TestUtils.toString( e ).indexOf( "ConnectionException" ) > -1 );
+         }
+ 
+-        mockManager.verifyAll();
++        verify( wagon, wagonManager );
+     }
+ 
+     public void testShouldFailToDownloadWhenWagonConnectThrowsAuthenticationException()
+@@ -257,7 +225,7 @@
+ 
+         setupMocksWithWagonConnectionException( new AuthenticationException( "bad credentials" ) );
+ 
+-        mockManager.replayAll();
++        replay( wagon, wagonManager );
+ 
+         DownloadManager downloadManager = new DefaultDownloadManager( wagonManager );
+ 
+@@ -272,7 +240,7 @@
+             assertTrue( TestUtils.toString( e ).indexOf( "AuthenticationException" ) > -1 );
+         }
+ 
+-        mockManager.verifyAll();
++        verify( wagon, wagonManager );
+     }
+ 
+     public void testShouldFailToDownloadWhenWagonGetThrowsTransferFailedException()
+@@ -283,7 +251,7 @@
+ 
+         setupMocksWithWagonGetException( new TransferFailedException( "bad transfer" ) );
+ 
+-        mockManager.replayAll();
++        replay( wagon, wagonManager );
+ 
+         DownloadManager downloadManager = new DefaultDownloadManager( wagonManager );
+ 
+@@ -298,7 +266,7 @@
+             assertTrue( TestUtils.toString( e ).indexOf( "TransferFailedException" ) > -1 );
+         }
+ 
+-        mockManager.verifyAll();
++        verify( wagon, wagonManager );
+     }
+ 
+     public void testShouldFailToDownloadWhenWagonGetThrowsResourceDoesNotExistException()
+@@ -309,7 +277,7 @@
+ 
+         setupMocksWithWagonGetException( new ResourceDoesNotExistException( "bad resource" ) );
+ 
+-        mockManager.replayAll();
++        replay( wagon, wagonManager );
+ 
+         DownloadManager downloadManager = new DefaultDownloadManager( wagonManager );
+ 
+@@ -324,7 +292,7 @@
+             assertTrue( TestUtils.toString( e ).indexOf( "ResourceDoesNotExistException" ) > -1 );
+         }
+ 
+-        mockManager.verifyAll();
++        verify( wagon, wagonManager );
+     }
+ 
+     public void testShouldFailToDownloadWhenWagonGetThrowsAuthorizationException()
+@@ -335,7 +303,7 @@
+ 
+         setupMocksWithWagonGetException( new AuthorizationException( "bad transfer" ) );
+ 
+-        mockManager.replayAll();
++        replay( wagon, wagonManager );
+ 
+         DownloadManager downloadManager = new DefaultDownloadManager( wagonManager );
+ 
+@@ -350,7 +318,7 @@
+             assertTrue( TestUtils.toString( e ).indexOf( "AuthorizationException" ) > -1 );
+         }
+ 
+-        mockManager.verifyAll();
++        verify( wagon, wagonManager );
+     }
+ 
+     public void testShouldFailToDownloadWhenWagonDisconnectThrowsConnectionException()
+@@ -361,7 +329,7 @@
+ 
+         setupMocksWithWagonDisconnectException( new ConnectionException( "not connected" ) );
+ 
+-        mockManager.replayAll();
++        replay( wagon, wagonManager );
+ 
+         DownloadManager downloadManager = new DefaultDownloadManager( wagonManager );
+ 
+@@ -371,33 +339,27 @@
+ 
+         assertTrue( mh.render().indexOf( "ConnectionException" ) > -1 );
+ 
+-        mockManager.verifyAll();
++        verify( wagon, wagonManager );
+     }
+ 
+     private void setupDefaultMockConfiguration()
+     {
+         try
+         {
+-            wagonManager.getWagon( "file" );
+-            wagonManagerControl.setReturnValue( wagon );
++            expect( wagonManager.getWagon( "file" ) ).andReturn( wagon );
+         }
+         catch ( UnsupportedProtocolException e )
+         {
+             fail( "This shouldn't happen!!" );
+         }
+ 
+-        wagonManager.getAuthenticationInfo( "" );
+-        wagonManagerControl.setMatcher( MockControl.ALWAYS_MATCHER );
+-        wagonManagerControl.setReturnValue( null );
++        expect( wagonManager.getAuthenticationInfo( anyString() ) ).andReturn( null );
+ 
+-        wagonManager.getProxy( "" );
+-        wagonManagerControl.setMatcher( MockControl.ALWAYS_MATCHER );
+-        wagonManagerControl.setReturnValue( null );
++        expect( wagonManager.getProxy( anyString() ) ).andReturn( null );
+ 
+         try
+         {
+-            wagon.connect( new Repository(), new AuthenticationInfo(), new ProxyInfo() );
+-            wagonControl.setMatcher( MockControl.ALWAYS_MATCHER );
++            wagon.connect( anyObject( Repository.class ) , anyObject( AuthenticationInfo.class ), anyObject( ProxyInfo.class ) );
+         }
+         catch ( ConnectionException e )
+         {
+@@ -410,8 +372,7 @@
+ 
+         try
+         {
+-            wagon.get( "file:///some/path", new File( "." ) );
+-            wagonControl.setMatcher( MockControl.ALWAYS_MATCHER );
++            wagon.get( anyString(), anyObject( File.class ) );
+         }
+         catch ( TransferFailedException e )
+         {
+@@ -440,8 +401,7 @@
+     {
+         try
+         {
+-            wagonManager.getWagon( "file" );
+-            wagonManagerControl.setThrowable( error );
++            expect( wagonManager.getWagon( "file" ) ).andThrow( error );
+         }
+         catch ( UnsupportedProtocolException e )
+         {
+@@ -453,27 +413,21 @@
+     {
+         try
+         {
+-            wagonManager.getWagon( "file" );
+-            wagonManagerControl.setReturnValue( wagon );
++            expect( wagonManager.getWagon( "file" ) ).andReturn( wagon );
+         }
+         catch ( UnsupportedProtocolException e )
+         {
+             fail( "This shouldn't happen!!" );
+         }
+ 
+-        wagonManager.getAuthenticationInfo( "" );
+-        wagonManagerControl.setMatcher( MockControl.ALWAYS_MATCHER );
+-        wagonManagerControl.setReturnValue( null );
++        expect( wagonManager.getAuthenticationInfo( anyString() ) ).andReturn( null );
+ 
+-        wagonManager.getProxy( "" );
+-        wagonManagerControl.setMatcher( MockControl.ALWAYS_MATCHER );
+-        wagonManagerControl.setReturnValue( null );
++        expect( wagonManager.getProxy( anyString() ) ).andReturn( null );
+ 
+         try
+         {
+-            wagon.connect( new Repository(), new AuthenticationInfo(), new ProxyInfo() );
+-            wagonControl.setMatcher( MockControl.ALWAYS_MATCHER );
+-            wagonControl.setThrowable( error );
++            wagon.connect( anyObject( Repository.class ) , anyObject( AuthenticationInfo.class ), anyObject( ProxyInfo.class ) );
++            expectLastCall().andThrow( error );
+         }
+         catch ( ConnectionException e )
+         {
+@@ -489,26 +443,20 @@
+     {
+         try
+         {
+-            wagonManager.getWagon( "file" );
+-            wagonManagerControl.setReturnValue( wagon );
++            expect( wagonManager.getWagon( "file" ) ).andReturn( wagon );
+         }
+         catch ( UnsupportedProtocolException e )
+         {
+             fail( "This shouldn't happen!!" );
+         }
+ 
+-        wagonManager.getAuthenticationInfo( "" );
+-        wagonManagerControl.setMatcher( MockControl.ALWAYS_MATCHER );
+-        wagonManagerControl.setReturnValue( null );
++        expect( wagonManager.getAuthenticationInfo( anyString() ) ).andReturn( null );
+ 
+-        wagonManager.getProxy( "" );
+-        wagonManagerControl.setMatcher( MockControl.ALWAYS_MATCHER );
+-        wagonManagerControl.setReturnValue( null );
++        expect( wagonManager.getProxy( anyString() ) ).andReturn( null );
+ 
+         try
+         {
+-            wagon.connect( new Repository(), new AuthenticationInfo(), new ProxyInfo() );
+-            wagonControl.setMatcher( MockControl.ALWAYS_MATCHER );
++            wagon.connect( anyObject( Repository.class ) , anyObject( AuthenticationInfo.class ), anyObject( ProxyInfo.class ) );
+         }
+         catch ( ConnectionException e )
+         {
+@@ -521,9 +469,8 @@
+ 
+         try
+         {
+-            wagon.get( "file:///some/path", new File( "." ) );
+-            wagonControl.setMatcher( MockControl.ALWAYS_MATCHER );
+-            wagonControl.setThrowable( error );
++            wagon.get( anyString(), anyObject( File.class ) );
++            expectLastCall().andThrow( error );
+         }
+         catch ( TransferFailedException e )
+         {
+@@ -552,26 +499,20 @@
+     {
+         try
+         {
+-            wagonManager.getWagon( "file" );
+-            wagonManagerControl.setReturnValue( wagon );
++            expect( wagonManager.getWagon( "file" ) ).andReturn( wagon );
+         }
+         catch ( UnsupportedProtocolException e )
+         {
+             fail( "This shouldn't happen!!" );
+         }
+ 
+-        wagonManager.getAuthenticationInfo( "" );
+-        wagonManagerControl.setMatcher( MockControl.ALWAYS_MATCHER );
+-        wagonManagerControl.setReturnValue( null );
++        expect( wagonManager.getAuthenticationInfo( anyString() ) ).andReturn( null );
+ 
+-        wagonManager.getProxy( "" );
+-        wagonManagerControl.setMatcher( MockControl.ALWAYS_MATCHER );
+-        wagonManagerControl.setReturnValue( null );
++        expect( wagonManager.getProxy( anyString() ) ).andReturn( null );
+ 
+         try
+         {
+-            wagon.connect( new Repository(), new AuthenticationInfo(), new ProxyInfo() );
+-            wagonControl.setMatcher( MockControl.ALWAYS_MATCHER );
++            wagon.connect( anyObject( Repository.class ) , anyObject( AuthenticationInfo.class ), anyObject( ProxyInfo.class ) );
+         }
+         catch ( ConnectionException e )
+         {
+@@ -584,8 +525,7 @@
+ 
+         try
+         {
+-            wagon.get( "file:///some/path", new File( "." ) );
+-            wagonControl.setMatcher( MockControl.ALWAYS_MATCHER );
++            wagon.get( anyString(), anyObject( File.class ) );
+         }
+         catch ( TransferFailedException e )
+         {
+@@ -603,7 +543,7 @@
+         try
+         {
+             wagon.disconnect();
+-            wagonControl.setThrowable( error );
++            expectLastCall().andThrow( error );
+         }
+         catch ( ConnectionException e )
+         {
+--- a/src/test/java/org/apache/maven/shared/io/location/ArtifactLocatorStrategyTest.java
++++ b/src/test/java/org/apache/maven/shared/io/location/ArtifactLocatorStrategyTest.java
+@@ -31,68 +31,49 @@
+ import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+ import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+ import org.apache.maven.artifact.resolver.ArtifactResolver;
+-import org.apache.maven.shared.io.MockManager;
+ import org.apache.maven.shared.io.logging.DefaultMessageHolder;
+ import org.apache.maven.shared.io.logging.MessageHolder;
+-import org.easymock.MockControl;
++
++import static org.easymock.EasyMock.*;
+ 
+ public class ArtifactLocatorStrategyTest
+     extends TestCase
+ {
+ 
+-    private MockManager mockManager = new MockManager();
+-
+-    private MockControl factoryControl;
+-
+     private ArtifactFactory factory;
+ 
+-    private MockControl resolverControl;
+-
+     private ArtifactResolver resolver;
+ 
+-    private MockControl localRepositoryControl;
+-
+     private ArtifactRepository localRepository;
+ 
+     public void setUp()
+     {
+-        factoryControl = MockControl.createControl( ArtifactFactory.class );
+-        mockManager.add( factoryControl );
+-
+-        factory = (ArtifactFactory) factoryControl.getMock();
+-
+-        resolverControl = MockControl.createControl( ArtifactResolver.class );
+-        mockManager.add( resolverControl );
+-
+-        resolver = (ArtifactResolver) resolverControl.getMock();
+-
+-        localRepositoryControl = MockControl.createControl( ArtifactRepository.class );
+-        mockManager.add( localRepositoryControl );
+-
+-        localRepository = (ArtifactRepository) localRepositoryControl.getMock();
++        factory = createMock( ArtifactFactory.class );
++        resolver = createMock( ArtifactResolver.class );
++        localRepository = createMock( ArtifactRepository.class );
+     }
+ 
+     public void testShouldConstructWithoutDefaultArtifactType()
+     {
+-        mockManager.replayAll();
++        replay( factory, resolver, localRepository );
+ 
+         new ArtifactLocatorStrategy( factory, resolver, localRepository, Collections.EMPTY_LIST );
+ 
+-        mockManager.verifyAll();
++        verify( factory, resolver, localRepository );
+     }
+ 
+     public void testShouldConstructWithDefaultArtifactType()
+     {
+-        mockManager.replayAll();
++        replay( factory, resolver, localRepository );
+ 
+         new ArtifactLocatorStrategy( factory, resolver, localRepository, Collections.EMPTY_LIST, "zip" );
+ 
+-        mockManager.verifyAll();
++        verify( factory, resolver, localRepository );
+     }
+ 
+     public void testShouldFailToResolveSpecWithOneToken()
+     {
+-        mockManager.replayAll();
++        replay( factory, resolver, localRepository );
+ 
+         LocatorStrategy strategy = new ArtifactLocatorStrategy( factory, resolver, localRepository,
+                                                                 Collections.EMPTY_LIST, "zip" );
+@@ -103,12 +84,12 @@
+         assertNull( location );
+         assertEquals( 1, mh.size() );
+ 
+-        mockManager.verifyAll();
++        verify( factory, resolver, localRepository );
+     }
+ 
+     public void testShouldFailToResolveSpecWithTwoTokens()
+     {
+-        mockManager.replayAll();
++        replay( factory, resolver, localRepository );
+ 
+         LocatorStrategy strategy = new ArtifactLocatorStrategy( factory, resolver, localRepository,
+                                                                 Collections.EMPTY_LIST, "zip" );
+@@ -119,7 +100,7 @@
+         assertNull( location );
+         assertEquals( 1, mh.size() );
+ 
+-        mockManager.verifyAll();
++        verify( factory, resolver, localRepository );
+     }
+ 
+     public void testShouldResolveSpecWithThreeTokensUsingDefaultType()
+@@ -128,17 +109,12 @@
+         File tempFile = File.createTempFile( "artifact-location.", ".temp" );
+         tempFile.deleteOnExit();
+ 
+-        MockControl artifactControl = MockControl.createControl( Artifact.class );
+-        mockManager.add( artifactControl );
+-
+-        Artifact artifact = (Artifact) artifactControl.getMock();
+-        artifact.getFile();
+-        artifactControl.setReturnValue( tempFile );
+-        artifact.getFile();
+-        artifactControl.setReturnValue( tempFile );
+-
+-        factory.createArtifact( "group", "artifact", "version", null, "jar" );
+-        factoryControl.setReturnValue( artifact );
++        Artifact artifact = createMock( Artifact.class );
++        
++        expect( artifact.getFile() ).andReturn( tempFile );
++        expect( artifact.getFile() ).andReturn( tempFile );
++        
++        expect( factory.createArtifact( "group", "artifact", "version", null, "jar" ) ).andReturn( artifact );
+ 
+         try
+         {
+@@ -155,7 +131,7 @@
+             fail( "This should NEVER happen. It's a mock!" );
+         }
+ 
+-        mockManager.replayAll();
++        replay( factory, resolver, localRepository, artifact );
+ 
+         LocatorStrategy strategy = new ArtifactLocatorStrategy( factory, resolver, localRepository,
+                                                                 Collections.EMPTY_LIST );
+@@ -168,7 +144,7 @@
+ 
+         assertSame( tempFile, location.getFile() );
+ 
+-        mockManager.verifyAll();
++        verify( factory, resolver, localRepository, artifact );
+     }
+ 
+     public void testShouldResolveSpecWithThreeTokensUsingCustomizedDefaultType()
+@@ -177,17 +153,12 @@
+         File tempFile = File.createTempFile( "artifact-location.", ".temp" );
+         tempFile.deleteOnExit();
+ 
+-        MockControl artifactControl = MockControl.createControl( Artifact.class );
+-        mockManager.add( artifactControl );
+-
+-        Artifact artifact = (Artifact) artifactControl.getMock();
+-        artifact.getFile();
+-        artifactControl.setReturnValue( tempFile );
+-        artifact.getFile();
+-        artifactControl.setReturnValue( tempFile );
+-
+-        factory.createArtifact( "group", "artifact", "version", null, "zip" );
+-        factoryControl.setReturnValue( artifact );
++        Artifact artifact = createMock( Artifact.class );
++        
++        expect( artifact.getFile() ).andReturn( tempFile );
++        expect( artifact.getFile() ).andReturn( tempFile );
++        
++        expect( factory.createArtifact( "group", "artifact", "version", null, "zip" ) ).andReturn( artifact );
+ 
+         try
+         {
+@@ -204,7 +175,7 @@
+             fail( "This should NEVER happen. It's a mock!" );
+         }
+ 
+-        mockManager.replayAll();
++        replay( factory, resolver, localRepository, artifact );
+ 
+         LocatorStrategy strategy = new ArtifactLocatorStrategy( factory, resolver, localRepository,
+                                                                 Collections.EMPTY_LIST, "zip" );
+@@ -217,7 +188,7 @@
+ 
+         assertSame( tempFile, location.getFile() );
+ 
+-        mockManager.verifyAll();
++        verify( factory, resolver, localRepository, artifact );
+     }
+ 
+     public void testShouldResolveSpecWithFourTokens()
+@@ -226,17 +197,12 @@
+         File tempFile = File.createTempFile( "artifact-location.", ".temp" );
+         tempFile.deleteOnExit();
+ 
+-        MockControl artifactControl = MockControl.createControl( Artifact.class );
+-        mockManager.add( artifactControl );
+-
+-        Artifact artifact = (Artifact) artifactControl.getMock();
+-        artifact.getFile();
+-        artifactControl.setReturnValue( tempFile );
+-        artifact.getFile();
+-        artifactControl.setReturnValue( tempFile );
+-
+-        factory.createArtifact( "group", "artifact", "version", null, "zip" );
+-        factoryControl.setReturnValue( artifact );
++        Artifact artifact = createMock( Artifact.class );
++        
++        expect( artifact.getFile() ).andReturn( tempFile );
++        expect( artifact.getFile() ).andReturn( tempFile );
++        
++        expect( factory.createArtifact( "group", "artifact", "version", null, "zip" ) ).andReturn( artifact );
+ 
+         try
+         {
+@@ -253,7 +219,7 @@
+             fail( "This should NEVER happen. It's a mock!" );
+         }
+ 
+-        mockManager.replayAll();
++        replay( factory, resolver, localRepository, artifact );
+ 
+         LocatorStrategy strategy = new ArtifactLocatorStrategy( factory, resolver, localRepository,
+                                                                 Collections.EMPTY_LIST );
+@@ -266,7 +232,7 @@
+ 
+         assertSame( tempFile, location.getFile() );
+ 
+-        mockManager.verifyAll();
++        verify( factory, resolver, localRepository, artifact );
+     }
+ 
+     public void testShouldResolveSpecWithFiveTokens()
+@@ -275,17 +241,13 @@
+         File tempFile = File.createTempFile( "artifact-location.", ".temp" );
+         tempFile.deleteOnExit();
+ 
+-        MockControl artifactControl = MockControl.createControl( Artifact.class );
+-        mockManager.add( artifactControl );
+-
+-        Artifact artifact = (Artifact) artifactControl.getMock();
+-        artifact.getFile();
+-        artifactControl.setReturnValue( tempFile );
+-        artifact.getFile();
+-        artifactControl.setReturnValue( tempFile );
+-
+-        factory.createArtifactWithClassifier( "group", "artifact", "version", "zip", "classifier" );
+-        factoryControl.setReturnValue( artifact );
++        Artifact artifact = createMock( Artifact.class );
++        
++        expect( artifact.getFile() ).andReturn( tempFile );
++        expect( artifact.getFile() ).andReturn( tempFile );
++        
++        expect( factory.createArtifactWithClassifier( "group", "artifact", "version", "zip", "classifier" ) )
++                .andReturn( artifact );
+ 
+         try
+         {
+@@ -302,7 +264,7 @@
+             fail( "This should NEVER happen. It's a mock!" );
+         }
+ 
+-        mockManager.replayAll();
++        replay( factory, resolver, localRepository, artifact );
+ 
+         LocatorStrategy strategy = new ArtifactLocatorStrategy( factory, resolver, localRepository,
+                                                                 Collections.EMPTY_LIST );
+@@ -315,7 +277,7 @@
+ 
+         assertSame( tempFile, location.getFile() );
+ 
+-        mockManager.verifyAll();
++        verify( factory, resolver, localRepository, artifact );
+     }
+ 
+     public void testShouldResolveSpecWithFiveTokensAndEmptyTypeToken()
+@@ -324,17 +286,13 @@
+         File tempFile = File.createTempFile( "artifact-location.", ".temp" );
+         tempFile.deleteOnExit();
+ 
+-        MockControl artifactControl = MockControl.createControl( Artifact.class );
+-        mockManager.add( artifactControl );
+-
+-        Artifact artifact = (Artifact) artifactControl.getMock();
+-        artifact.getFile();
+-        artifactControl.setReturnValue( tempFile );
+-        artifact.getFile();
+-        artifactControl.setReturnValue( tempFile );
+-
+-        factory.createArtifactWithClassifier( "group", "artifact", "version", "jar", "classifier" );
+-        factoryControl.setReturnValue( artifact );
++        Artifact artifact = createMock( Artifact.class );
++        
++        expect( artifact.getFile() ).andReturn( tempFile );
++        expect( artifact.getFile() ).andReturn( tempFile );
++        
++        expect( factory.createArtifactWithClassifier( "group", "artifact", "version", "jar", "classifier" ) )
++                .andReturn( artifact );
+ 
+         try
+         {
+@@ -351,7 +309,7 @@
+             fail( "This should NEVER happen. It's a mock!" );
+         }
+ 
+-        mockManager.replayAll();
++        replay( factory, resolver, localRepository, artifact );
+ 
+         LocatorStrategy strategy = new ArtifactLocatorStrategy( factory, resolver, localRepository,
+                                                                 Collections.EMPTY_LIST );
+@@ -364,7 +322,7 @@
+ 
+         assertSame( tempFile, location.getFile() );
+ 
+-        mockManager.verifyAll();
++        verify( factory, resolver, localRepository, artifact );
+     }
+ 
+     public void testShouldResolveSpecWithMoreThanFiveTokens()
+@@ -373,17 +331,13 @@
+         File tempFile = File.createTempFile( "artifact-location.", ".temp" );
+         tempFile.deleteOnExit();
+ 
+-        MockControl artifactControl = MockControl.createControl( Artifact.class );
+-        mockManager.add( artifactControl );
+-
+-        Artifact artifact = (Artifact) artifactControl.getMock();
+-        artifact.getFile();
+-        artifactControl.setReturnValue( tempFile );
+-        artifact.getFile();
+-        artifactControl.setReturnValue( tempFile );
+-
+-        factory.createArtifactWithClassifier( "group", "artifact", "version", "zip", "classifier" );
+-        factoryControl.setReturnValue( artifact );
++        Artifact artifact = createMock( Artifact.class );
++        
++        expect( artifact.getFile() ).andReturn( tempFile );
++        expect( artifact.getFile() ).andReturn( tempFile );
++        
++        expect( factory.createArtifactWithClassifier( "group", "artifact", "version", "zip", "classifier" ) )
++                .andReturn( artifact );
+ 
+         try
+         {
+@@ -400,7 +354,7 @@
+             fail( "This should NEVER happen. It's a mock!" );
+         }
+ 
+-        mockManager.replayAll();
++        replay( factory, resolver, localRepository, artifact );
+ 
+         LocatorStrategy strategy = new ArtifactLocatorStrategy( factory, resolver, localRepository,
+                                                                 Collections.EMPTY_LIST );
+@@ -415,23 +369,18 @@
+ 
+         assertSame( tempFile, location.getFile() );
+ 
+-        mockManager.verifyAll();
++        verify( factory, resolver, localRepository, artifact );
+     }
+ 
+     public void testShouldNotResolveSpecToArtifactWithNullFile()
+         throws IOException
+     {
+-        MockControl artifactControl = MockControl.createControl( Artifact.class );
+-        mockManager.add( artifactControl );
+-
+-        Artifact artifact = (Artifact) artifactControl.getMock();
+-        artifact.getFile();
+-        artifactControl.setReturnValue( null );
+-        artifact.getId();
+-        artifactControl.setReturnValue( "<some-artifact-id>" );
+-
+-        factory.createArtifact( "group", "artifact", "version", null, "jar" );
+-        factoryControl.setReturnValue( artifact );
++        Artifact artifact = createMock( Artifact.class );
++        
++        expect( artifact.getFile() ).andReturn( null );
++        expect( artifact.getId() ).andReturn( "<some-artifact-id>" );
++        
++        expect( factory.createArtifact( "group", "artifact", "version", null, "jar" )).andReturn( artifact );
+ 
+         try
+         {
+@@ -448,7 +397,7 @@
+             fail( "This should NEVER happen. It's a mock!" );
+         }
+ 
+-        mockManager.replayAll();
++        replay( factory, resolver, localRepository, artifact );
+ 
+         LocatorStrategy strategy = new ArtifactLocatorStrategy( factory, resolver, localRepository,
+                                                                 Collections.EMPTY_LIST );
+@@ -461,30 +410,25 @@
+ 
+         assertTrue( mh.render().indexOf( "<some-artifact-id>" ) > -1 );
+ 
+-        mockManager.verifyAll();
++        verify( factory, resolver, localRepository, artifact );
+     }
+ 
+     public void testShouldNotResolveWhenArtifactNotFoundExceptionThrown()
+         throws IOException
+     {
+-        MockControl artifactControl = MockControl.createControl( Artifact.class );
+-        mockManager.add( artifactControl );
+-
+-        Artifact artifact = (Artifact) artifactControl.getMock();
++        Artifact artifact = createMock( Artifact.class );
+ 
+-        artifact.getId();
+-        artifactControl.setReturnValue( "<some-artifact-id>" );
++        expect( artifact.getId() ).andReturn( "<some-artifact-id>" );
+ 
+-        factory.createArtifact( "group", "artifact", "version", null, "jar" );
+-        factoryControl.setReturnValue( artifact );
++        expect( factory.createArtifact( "group", "artifact", "version", null, "jar" ) ).andReturn( artifact );
+ 
+         try
+         {
+             resolver.resolve( artifact, Collections.EMPTY_LIST, localRepository );
+-            resolverControl.setThrowable( new ArtifactNotFoundException( "not found", "group", "artifact", "version",
+-                                                                         "jar", Collections.EMPTY_LIST,
+-                                                                         "http://nowhere.com", Collections.EMPTY_LIST,
+-                                                                         new NullPointerException() ) );
++            expectLastCall().andThrow( new ArtifactNotFoundException( "not found", "group", "artifact", "version",
++                                                                               "jar", Collections.EMPTY_LIST,
++                                                                               "http://nowhere.com", Collections.EMPTY_LIST,
++                                                                                new NullPointerException() ) );
+         }
+         catch ( ArtifactResolutionException e )
+         {
+@@ -497,7 +441,7 @@
+             fail( "This should NEVER happen. It's a mock!" );
+         }
+ 
+-        mockManager.replayAll();
++        replay( factory, resolver, localRepository, artifact );
+ 
+         LocatorStrategy strategy = new ArtifactLocatorStrategy( factory, resolver, localRepository,
+                                                                 Collections.EMPTY_LIST );
+@@ -511,30 +455,25 @@
+         assertTrue( mh.render().indexOf( "<some-artifact-id>" ) > -1 );
+         assertTrue( mh.render().indexOf( "not found" ) > -1 );
+ 
+-        mockManager.verifyAll();
++        verify( factory, resolver, localRepository, artifact );
+     }
+ 
+     public void testShouldNotResolveWhenArtifactResolutionExceptionThrown()
+         throws IOException
+     {
+-        MockControl artifactControl = MockControl.createControl( Artifact.class );
+-        mockManager.add( artifactControl );
+-
+-        Artifact artifact = (Artifact) artifactControl.getMock();
++        Artifact artifact = createMock( Artifact.class );
+ 
+-        artifact.getId();
+-        artifactControl.setReturnValue( "<some-artifact-id>" );
++        expect( artifact.getId() ).andReturn( "<some-artifact-id>" );
+ 
+-        factory.createArtifact( "group", "artifact", "version", null, "jar" );
+-        factoryControl.setReturnValue( artifact );
++        expect( factory.createArtifact( "group", "artifact", "version", null, "jar" ) ).andReturn( artifact );
+ 
+         try
+         {
+             resolver.resolve( artifact, Collections.EMPTY_LIST, localRepository );
+-            resolverControl.setThrowable( new ArtifactResolutionException( "resolution failed", "group", "artifact",
+-                                                                           "version", "jar", Collections.EMPTY_LIST,
+-                                                                           Collections.EMPTY_LIST,
+-                                                                           new NullPointerException() ) );
++            expectLastCall().andThrow( new ArtifactResolutionException( "resolution failed", "group", "artifact",
++                                                                                 "version", "jar", Collections.EMPTY_LIST,
++                                                                                 Collections.EMPTY_LIST,
++                                                                                 new NullPointerException() ) );
+         }
+         catch ( ArtifactResolutionException e )
+         {
+@@ -547,7 +486,7 @@
+             fail( "This should NEVER happen. It's a mock!" );
+         }
+ 
+-        mockManager.replayAll();
++        replay( factory, resolver, localRepository, artifact );
+ 
+         LocatorStrategy strategy = new ArtifactLocatorStrategy( factory, resolver, localRepository,
+                                                                 Collections.EMPTY_LIST );
+@@ -561,7 +500,7 @@
+         assertTrue( mh.render().indexOf( "<some-artifact-id>" ) > -1 );
+         assertTrue( mh.render().indexOf( "resolution failed" ) > -1 );
+ 
+-        mockManager.verifyAll();
++        verify( factory, resolver, localRepository, artifact );
+     }
+ 
+ }
+--- a/src/test/java/org/apache/maven/shared/io/location/LocatorTest.java
++++ b/src/test/java/org/apache/maven/shared/io/location/LocatorTest.java
+@@ -23,13 +23,13 @@
+ import java.util.Collections;
+ import java.util.List;
+ 
+-import org.apache.maven.shared.io.MockManager;
+ import org.apache.maven.shared.io.logging.DefaultMessageHolder;
+ import org.apache.maven.shared.io.logging.MessageHolder;
+-import org.easymock.MockControl;
+ 
+ import junit.framework.TestCase;
+ 
++import static org.easymock.EasyMock.*;
++
+ public class LocatorTest
+     extends TestCase
+ {
+@@ -61,21 +61,10 @@
+ 
+     public void testSetStrategiesShouldClearAnyPreExistingStrategiesOut()
+     {
+-        MockManager mgr = new MockManager();
+-
+-        MockControl originalStrategyControl = MockControl.createControl( LocatorStrategy.class );
+-
+-        mgr.add( originalStrategyControl );
+-
+-        LocatorStrategy originalStrategy = (LocatorStrategy) originalStrategyControl.getMock();
+-
+-        MockControl replacementStrategyControl = MockControl.createControl( LocatorStrategy.class );
++        LocatorStrategy originalStrategy = createMock( LocatorStrategy.class );
++        LocatorStrategy replacementStrategy = createMock( LocatorStrategy.class );
+ 
+-        mgr.add( replacementStrategyControl );
+-
+-        LocatorStrategy replacementStrategy = (LocatorStrategy) replacementStrategyControl.getMock();
+-
+-        mgr.replayAll();
++        replay( originalStrategy, replacementStrategy );
+ 
+         Locator locator = new Locator();
+         locator.addStrategy( originalStrategy );
+@@ -87,20 +76,14 @@
+         assertFalse( strategies.contains( originalStrategy ) );
+         assertTrue( strategies.contains( replacementStrategy ) );
+ 
+-        mgr.verifyAll();
++        verify( originalStrategy, replacementStrategy );
+     }
+ 
+     public void testShouldRemovePreviouslyAddedStrategy()
+     {
+-        MockManager mgr = new MockManager();
+-
+-        MockControl originalStrategyControl = MockControl.createControl( LocatorStrategy.class );
+-
+-        mgr.add( originalStrategyControl );
+-
+-        LocatorStrategy originalStrategy = (LocatorStrategy) originalStrategyControl.getMock();
++        LocatorStrategy originalStrategy = createMock( LocatorStrategy.class );
+ 
+-        mgr.replayAll();
++        replay( originalStrategy );
+ 
+         Locator locator = new Locator();
+         locator.addStrategy( originalStrategy );
+@@ -115,7 +98,7 @@
+ 
+         assertFalse( strategies.contains( originalStrategy ) );
+ 
+-        mgr.verifyAll();
++        verify( originalStrategy );
+     }
+ 
+     public void testResolutionFallsThroughStrategyStackAndReturnsNullIfNotResolved()
diff --git a/debian/patches/02-maven-artifact-compatibility.patch b/debian/patches/02-maven-artifact-compatibility.patch
new file mode 100644
index 0000000..32e56b6
--- /dev/null
+++ b/debian/patches/02-maven-artifact-compatibility.patch
@@ -0,0 +1,23 @@
+Description: Fixes the compatibility with the version of maven-artifact in Debian.
+Author: Emmanuel Bourg <ebourg at apache.org>
+Bug: https://github.com/apache/maven-shared/pull/4
+--- a/src/test/java/org/apache/maven/shared/io/location/ArtifactLocatorStrategyTest.java
++++ b/src/test/java/org/apache/maven/shared/io/location/ArtifactLocatorStrategyTest.java
+@@ -426,7 +426,7 @@
+         {
+             resolver.resolve( artifact, Collections.EMPTY_LIST, localRepository );
+             expectLastCall().andThrow( new ArtifactNotFoundException( "not found", "group", "artifact", "version",
+-                                                                               "jar", Collections.EMPTY_LIST,
++                                                                               "jar", null, Collections.EMPTY_LIST,
+                                                                                "http://nowhere.com", Collections.EMPTY_LIST,
+                                                                                 new NullPointerException() ) );
+         }
+@@ -471,7 +471,7 @@
+         {
+             resolver.resolve( artifact, Collections.EMPTY_LIST, localRepository );
+             expectLastCall().andThrow( new ArtifactResolutionException( "resolution failed", "group", "artifact",
+-                                                                                 "version", "jar", Collections.EMPTY_LIST,
++                                                                                 "version", "jar", null, Collections.EMPTY_LIST,
+                                                                                  Collections.EMPTY_LIST,
+                                                                                  new NullPointerException() ) );
+         }
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..3aa6cde
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,2 @@
+01-upgrade-easymock.patch
+02-maven-artifact-compatibility.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/maven-shared-io.git



More information about the pkg-java-commits mailing list