maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject git commit: Use EasyMock instead of mocks created manually
Date Thu, 14 Nov 2013 23:21:42 GMT
Updated Branches:
  refs/heads/master 0d6d1f3ad -> f3298aaa5


Use EasyMock instead of mocks created manually


Project: http://git-wip-us.apache.org/repos/asf/maven-wagon/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-wagon/commit/f3298aaa
Tree: http://git-wip-us.apache.org/repos/asf/maven-wagon/tree/f3298aaa
Diff: http://git-wip-us.apache.org/repos/asf/maven-wagon/diff/f3298aaa

Branch: refs/heads/master
Commit: f3298aaa556a0e96b4ec19e22f50bfe3380ddfb2
Parents: 0d6d1f3
Author: Emmanuel Bourg <ebourg@apache.org>
Authored: Thu Nov 14 10:57:37 2013 +0100
Committer: Emmanuel Bourg <ebourg@apache.org>
Committed: Thu Nov 14 10:57:37 2013 +0100

----------------------------------------------------------------------
 .../wagon/events/SessionEventSupportTest.java   | 137 ++++++--------
 .../maven/wagon/events/SessionListenerMock.java | 184 -------------------
 .../wagon/events/TransferEventSupportTest.java  |  96 +++++-----
 .../wagon/events/TransferListenerMock.java      | 176 ------------------
 4 files changed, 107 insertions(+), 486 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/f3298aaa/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventSupportTest.java
----------------------------------------------------------------------
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventSupportTest.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventSupportTest.java
index 6230ff5..eca243a 100644
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventSupportTest.java
+++ b/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventSupportTest.java
@@ -22,7 +22,8 @@ package org.apache.maven.wagon.events;
 import junit.framework.TestCase;
 
 import org.apache.maven.wagon.Wagon;
-import org.easymock.EasyMock;
+
+import static org.easymock.EasyMock.*;
 
 /**
  * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
@@ -47,18 +48,18 @@ public class SessionEventSupportTest
         eventSupport = new SessionEventSupport();
         
         // TODO: actually test it gets called?
-        wagon = EasyMock.createMock( Wagon.class );
+        wagon = createNiceMock( Wagon.class );
     }
 
     public void testSessionListenerRegistration()
     {
-        final SessionListenerMock mock1 = new SessionListenerMock();
+        SessionListener mock1 = createMock( SessionListener.class );
 
         eventSupport.addSessionListener( mock1 );
 
         assertTrue( eventSupport.hasSessionListener( mock1 ) );
 
-        final SessionListenerMock mock2 = new SessionListenerMock();
+        SessionListener mock2 = createMock( SessionListener.class );
 
         assertFalse( eventSupport.hasSessionListener( mock2 ) );
 
@@ -81,192 +82,176 @@ public class SessionEventSupportTest
 
     public void testFireSessionDisconnected()
     {
-
-        final SessionListenerMock mock1 = new SessionListenerMock();
+        SessionListener mock1 = createMock( SessionListener.class );
 
         eventSupport.addSessionListener( mock1 );
 
-        final SessionListenerMock mock2 = new SessionListenerMock();
+        SessionListener mock2 = createMock( SessionListener.class );
 
         eventSupport.addSessionListener( mock2 );
 
         final SessionEvent event = new SessionEvent( wagon, 1 );
 
-        eventSupport.fireSessionDisconnected( event );
-
-        assertTrue( mock1.isSessionDisconnectedCalled() );
-
-        assertTrue( mock2.isSessionDisconnectedCalled() );
+        mock1.sessionDisconnected( event );
+        mock2.sessionDisconnected( event );
 
-        assertEquals( event, mock1.getSessionEvent() );
+        replay( mock1, mock2 );
 
-        assertEquals( event, mock2.getSessionEvent() );
+        eventSupport.fireSessionDisconnected( event );
 
+        verify( mock1, mock2 );
     }
 
     public void testFireSessionDisconneting()
     {
-        final SessionListenerMock mock1 = new SessionListenerMock();
+        SessionListener mock1 = createMock( SessionListener.class );
 
         eventSupport.addSessionListener( mock1 );
 
-        final SessionListenerMock mock2 = new SessionListenerMock();
+        SessionListener mock2 = createMock( SessionListener.class );
 
         eventSupport.addSessionListener( mock2 );
 
         final SessionEvent event = new SessionEvent( wagon, 1 );
 
-        eventSupport.fireSessionDisconnecting( event );
-
-        assertTrue( mock1.isSessionDisconnectingCalled() );
+        mock1.sessionDisconnecting( event );
+        mock2.sessionDisconnecting( event );
 
-        assertTrue( mock2.isSessionDisconnectingCalled() );
+        replay( mock1, mock2 );
 
-        assertEquals( event, mock1.getSessionEvent() );
+        eventSupport.fireSessionDisconnecting( event );
 
-        assertEquals( event, mock2.getSessionEvent() );
+        verify( mock1, mock2 );
     }
 
     public void testFireSessionLoggedIn()
     {
-        final SessionListenerMock mock1 = new SessionListenerMock();
+        SessionListener mock1 = createMock( SessionListener.class );
 
         eventSupport.addSessionListener( mock1 );
 
-        final SessionListenerMock mock2 = new SessionListenerMock();
+        SessionListener mock2 = createMock( SessionListener.class );
 
         eventSupport.addSessionListener( mock2 );
 
         final SessionEvent event = new SessionEvent( wagon, 1 );
 
-        eventSupport.fireSessionLoggedIn( event );
-
-        assertTrue( mock1.isSessionLoggedInCalled() );
+        mock1.sessionLoggedIn( event );
+        mock2.sessionLoggedIn( event );
 
-        assertTrue( mock2.isSessionLoggedInCalled() );
+        replay( mock1, mock2 );
 
-        assertEquals( event, mock1.getSessionEvent() );
-
-        assertEquals( event, mock2.getSessionEvent() );
+        eventSupport.fireSessionLoggedIn( event );
 
+        verify( mock1, mock2 );
     }
 
     public void testFireSessionLoggedOff()
     {
-        final SessionListenerMock mock1 = new SessionListenerMock();
+        SessionListener mock1 = createMock( SessionListener.class );
 
         eventSupport.addSessionListener( mock1 );
 
-        final SessionListenerMock mock2 = new SessionListenerMock();
+        SessionListener mock2 = createMock( SessionListener.class );
 
         eventSupport.addSessionListener( mock2 );
 
         final SessionEvent event = new SessionEvent( wagon, 1 );
 
-        eventSupport.fireSessionLoggedOff( event );
-
-        assertTrue( mock1.isSessionLoggedOffCalled() );
+        mock1.sessionLoggedOff( event );
+        mock2.sessionLoggedOff( event );
 
-        assertTrue( mock2.isSessionLoggedOffCalled() );
+        replay( mock1, mock2 );
 
-        assertEquals( event, mock1.getSessionEvent() );
+        eventSupport.fireSessionLoggedOff( event );
 
-        assertEquals( event, mock2.getSessionEvent() );
+        verify( mock1, mock2 );
     }
 
     public void testFireSessionOpened()
     {
-
-        final SessionListenerMock mock1 = new SessionListenerMock();
+        SessionListener mock1 = createMock( SessionListener.class );
 
         eventSupport.addSessionListener( mock1 );
 
-        final SessionListenerMock mock2 = new SessionListenerMock();
+        SessionListener mock2 = createMock( SessionListener.class );
 
         eventSupport.addSessionListener( mock2 );
 
         final SessionEvent event = new SessionEvent( wagon, 1 );
 
-        eventSupport.fireSessionOpened( event );
-
-        assertTrue( mock1.isSessionOpenedCalled() );
+        mock1.sessionOpened( event );
+        mock2.sessionOpened( event );
 
-        assertTrue( mock2.isSessionOpenedCalled() );
+        replay( mock1, mock2 );
 
-        assertEquals( event, mock1.getSessionEvent() );
-
-        assertEquals( event, mock2.getSessionEvent() );
+        eventSupport.fireSessionOpened( event );
 
+        verify( mock1, mock2 );
     }
 
     public void testFireSessionOpenning()
     {
-
-        final SessionListenerMock mock1 = new SessionListenerMock();
+        SessionListener mock1 = createMock( SessionListener.class );
 
         eventSupport.addSessionListener( mock1 );
 
-        final SessionListenerMock mock2 = new SessionListenerMock();
+        SessionListener mock2 = createMock( SessionListener.class );
 
         eventSupport.addSessionListener( mock2 );
 
         final SessionEvent event = new SessionEvent( wagon, 1 );
 
-        eventSupport.fireSessionOpening( event );
-
-        assertTrue( mock1.isSessionOpenningCalled() );
-
-        assertTrue( mock2.isSessionOpenningCalled() );
+        mock1.sessionOpening( event );
+        mock2.sessionOpening( event );
 
-        assertEquals( event, mock1.getSessionEvent() );
+        replay( mock1, mock2 );
 
-        assertEquals( event, mock2.getSessionEvent() );
+        eventSupport.fireSessionOpening( event );
 
+        verify( mock1, mock2 );
     }
 
     public void testFireSessionRefused()
     {
-        final SessionListenerMock mock1 = new SessionListenerMock();
+        SessionListener mock1 = createMock( SessionListener.class );
 
         eventSupport.addSessionListener( mock1 );
 
-        final SessionListenerMock mock2 = new SessionListenerMock();
+        SessionListener mock2 = createMock( SessionListener.class );
 
         eventSupport.addSessionListener( mock2 );
 
         final SessionEvent event = new SessionEvent( wagon, 1 );
 
-        eventSupport.fireSessionConnectionRefused( event );
-
-        assertTrue( mock1.isSessionRefusedCalled() );
+        mock1.sessionConnectionRefused( event );
+        mock2.sessionConnectionRefused( event );
 
-        assertTrue( mock2.isSessionRefusedCalled() );
+        replay( mock1, mock2 );
 
-        assertEquals( event, mock1.getSessionEvent() );
+        eventSupport.fireSessionConnectionRefused( event );
 
-        assertEquals( event, mock2.getSessionEvent() );
+        verify( mock1, mock2 );
     }
 
     public void testFireDebug()
     {
-        final SessionListenerMock mock1 = new SessionListenerMock();
+        SessionListener mock1 = createMock( SessionListener.class );
 
         eventSupport.addSessionListener( mock1 );
 
-        final SessionListenerMock mock2 = new SessionListenerMock();
+        SessionListener mock2 = createMock( SessionListener.class );
 
         eventSupport.addSessionListener( mock2 );
 
-        eventSupport.fireDebug( "mm" );
-
-        assertTrue( mock1.isDebugCalled() );
+        mock1.debug( "mm" );
+        mock2.debug( "mm" );
 
-        assertTrue( mock2.isDebugCalled() );
+        replay( mock1, mock2 );
 
-        assertEquals( "mm", mock1.getDebugMessage() );
-
-        assertEquals( "mm", mock2.getDebugMessage() );
+        eventSupport.fireDebug( "mm" );
 
+        verify( mock1, mock2 );
     }
     
 }

http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/f3298aaa/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionListenerMock.java
----------------------------------------------------------------------
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionListenerMock.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionListenerMock.java
deleted file mode 100644
index 6e09f2a..0000000
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionListenerMock.java
+++ /dev/null
@@ -1,184 +0,0 @@
-package org.apache.maven.wagon.events;
-
-/*
- * 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.
- */
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- *
- */
-public class SessionListenerMock
-    implements SessionListener
-{
-
-    private boolean connectionOpenningCalled = false;
-
-    private boolean debugCalled = false;
-
-    private boolean connectionLoggedOffCalled = false;
-
-    private boolean connectionLoggedInCalled = false;
-
-    private boolean connectionRefusedCalled = false;
-
-    private boolean connectionDisconnectedCalled = false;
-
-    private boolean connectionDisconnectingCalled = false;
-
-    private boolean connectionOpenedCalled = false;
-
-    private SessionEvent sessionEvent;
-
-    private String message;
-
-    public boolean isSessionDisconnectedCalled()
-    {
-        return connectionDisconnectedCalled;
-    }
-
-    public boolean isSessionDisconnectingCalled()
-    {
-        return connectionDisconnectingCalled;
-    }
-
-    public boolean isSessionLoggedInCalled()
-    {
-        return connectionLoggedInCalled;
-    }
-
-    public boolean isSessionLoggedOffCalled()
-    {
-        return connectionLoggedOffCalled;
-    }
-
-    public boolean isSessionOpenedCalled()
-    {
-        return connectionOpenedCalled;
-    }
-
-    public boolean isSessionOpenningCalled()
-    {
-        return connectionOpenningCalled;
-    }
-
-    public boolean isSessionRefusedCalled()
-    {
-        return connectionRefusedCalled;
-    }
-
-    public boolean isDebugCalled()
-    {
-        return debugCalled;
-    }
-
-    public void reset()
-    {
-        connectionOpenningCalled = false;
-
-        debugCalled = false;
-
-        connectionLoggedOffCalled = false;
-
-        connectionLoggedInCalled = false;
-
-        connectionRefusedCalled = false;
-
-        connectionDisconnectedCalled = false;
-
-        connectionDisconnectingCalled = false;
-
-        connectionOpenedCalled = false;
-
-        sessionEvent = null;
-
-        message = null;
-    }
-
-    public void sessionOpening( final SessionEvent connectionEvent )
-    {
-        connectionOpenningCalled = true;
-
-        this.sessionEvent = connectionEvent;
-    }
-
-    public void sessionOpened( final SessionEvent connectionEvent )
-    {
-        connectionOpenedCalled = true;
-
-        this.sessionEvent = connectionEvent;
-
-    }
-
-    public void sessionDisconnecting( final SessionEvent connectionEvent )
-    {
-        connectionDisconnectingCalled = true;
-
-        this.sessionEvent = connectionEvent;
-    }
-
-    public void sessionDisconnected( final SessionEvent connectionEvent )
-    {
-        connectionDisconnectedCalled = true;
-
-        this.sessionEvent = connectionEvent;
-    }
-
-    public void sessionConnectionRefused( final SessionEvent connectionEvent )
-    {
-        connectionRefusedCalled = true;
-
-        this.sessionEvent = connectionEvent;
-    }
-
-    public void sessionLoggedIn( final SessionEvent connectionEvent )
-    {
-        connectionLoggedInCalled = true;
-
-        this.sessionEvent = connectionEvent;
-    }
-
-    public void sessionLoggedOff( final SessionEvent connectionEvent )
-    {
-        connectionLoggedOffCalled = true;
-
-        this.sessionEvent = connectionEvent;
-    }
-
-    public void sessionError( final SessionEvent connectionEvent )
-    {
-        this.sessionEvent = connectionEvent;
-    }
-
-    public void debug( final String message )
-    {
-        debugCalled = true;
-
-        this.message = message;
-    }
-
-    public SessionEvent getSessionEvent()
-    {
-        return sessionEvent;
-    }
-
-    public String getDebugMessage()
-    {
-        return message;
-    }
-}

http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/f3298aaa/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventSupportTest.java
----------------------------------------------------------------------
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventSupportTest.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventSupportTest.java
index 9357480..79f83fa 100644
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventSupportTest.java
+++ b/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventSupportTest.java
@@ -21,8 +21,11 @@ package org.apache.maven.wagon.events;
 
 import junit.framework.TestCase;
 import org.apache.maven.wagon.Wagon;
+import org.apache.maven.wagon.resource.Resource;
 import org.easymock.EasyMock;
 
+import static org.easymock.EasyMock.*;
+
 /**
  * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
  */
@@ -44,16 +47,16 @@ public class TransferEventSupportTest
         eventSupport = new TransferEventSupport();
         
         // TODO: actually test it gets called?
-        wagon = EasyMock.createMock( Wagon.class );
+        wagon = EasyMock.createNiceMock( Wagon.class );
     }
 
     public void testTransferListenerRegistration()
     {
-        final TransferListenerMock mock1 = new TransferListenerMock();
+        TransferListener mock1 = createMock( TransferListener.class );
         eventSupport.addTransferListener( mock1 );
 
         assertTrue( eventSupport.hasTransferListener( mock1 ) );
-        final TransferListenerMock mock2 = new TransferListenerMock();
+        TransferListener mock2 = createMock( TransferListener.class );
 
         assertFalse( eventSupport.hasTransferListener( mock2 ) );
 
@@ -73,122 +76,115 @@ public class TransferEventSupportTest
 
     public void testFireTransferStarted()
     {
-        final TransferListenerMock mock1 = new TransferListenerMock();
+        TransferListener mock1 = createMock( TransferListener.class );
         eventSupport.addTransferListener( mock1 );
 
-        final TransferListenerMock mock2 = new TransferListenerMock();
+        TransferListener mock2 = createMock( TransferListener.class );
         eventSupport.addTransferListener( mock2 );
 
         final TransferEvent event = getEvent( wagon );
 
-        eventSupport.fireTransferStarted( event );
+        mock1.transferStarted( event );
+        mock2.transferStarted( event );
+
+        replay( mock1, mock2 );
 
-        assertTrue( mock1.isTransferStartedCalled() );
-        assertTrue( mock2.isTransferStartedCalled() );
-        assertEquals( event, mock1.getTransferEvent() );
-        assertEquals( event, mock2.getTransferEvent() );
+        eventSupport.fireTransferStarted( event );
 
+        verify( mock1, mock2 );
     }
 
     public void testFireTransferProgress()
     {
-        final TransferListenerMock mock1 = new TransferListenerMock();
+        TransferListener mock1 = createMock( TransferListener.class );
 
         eventSupport.addTransferListener( mock1 );
 
-        final TransferListenerMock mock2 = new TransferListenerMock();
+        TransferListener mock2 = createMock( TransferListener.class );
 
         eventSupport.addTransferListener( mock2 );
 
         final TransferEvent event = getEvent( wagon );
+        final byte[] buffer = "content".getBytes();
 
-        // TODO: should be testing the buffer
-        eventSupport.fireTransferProgress( event, null, 0 );
-
-        assertTrue( mock1.isTransferProgressCalled() );
+        mock1.transferProgress( event, buffer, 0 );
+        mock2.transferProgress( event, buffer, 0 );
 
-        assertTrue( mock2.isTransferProgressCalled() );
+        replay( mock1, mock2 );
 
-        assertEquals( event, mock1.getTransferEvent() );
+        eventSupport.fireTransferProgress( event, buffer , 0 );
 
-        assertEquals( event, mock2.getTransferEvent() );
+        verify( mock1, mock2 );
     }
 
     public void testFireTransferCompleted()
     {
-        final TransferListenerMock mock1 = new TransferListenerMock();
+        TransferListener mock1 = createMock( TransferListener.class );
 
         eventSupport.addTransferListener( mock1 );
 
-        final TransferListenerMock mock2 = new TransferListenerMock();
+        TransferListener mock2 = createMock( TransferListener.class );
 
         eventSupport.addTransferListener( mock2 );
 
         final TransferEvent event = getEvent( wagon );
 
-        eventSupport.fireTransferCompleted( event );
+        mock1.transferCompleted( event );
+        mock2.transferCompleted( event );
 
-        assertTrue( mock1.isTransferCompletedCalled() );
+        replay( mock1, mock2 );
 
-        assertTrue( mock2.isTransferCompletedCalled() );
-
-        assertEquals( event, mock1.getTransferEvent() );
-
-        assertEquals( event, mock2.getTransferEvent() );
+        eventSupport.fireTransferCompleted( event );
 
+        verify( mock1, mock2 );
     }
 
     public void testFireTransferError()
     {
-        final TransferListenerMock mock1 = new TransferListenerMock();
+        TransferListener mock1 = createMock( TransferListener.class );
 
         eventSupport.addTransferListener( mock1 );
 
-        final TransferListenerMock mock2 = new TransferListenerMock();
+        TransferListener mock2 = createMock( TransferListener.class );
 
         eventSupport.addTransferListener( mock2 );
 
         final TransferEvent event = getEvent( wagon );
+        
+        mock1.transferError( event );
+        mock2.transferError( event );
 
-        eventSupport.fireTransferError( event );
-
-        assertTrue( mock1.isTransferErrorCalled() );
-
-        assertTrue( mock2.isTransferErrorCalled() );
-
-        assertEquals( event, mock1.getTransferEvent() );
+        replay( mock1, mock2 );
 
-        assertEquals( event, mock2.getTransferEvent() );
+        eventSupport.fireTransferError( event );
 
+        verify( mock1, mock2 );
     }
 
     public void testFireDebug()
     {
-        final TransferListenerMock mock1 = new TransferListenerMock();
+        TransferListener mock1 = createMock( TransferListener.class );
 
         eventSupport.addTransferListener( mock1 );
 
-        final TransferListenerMock mock2 = new TransferListenerMock();
+        TransferListener mock2 = createMock( TransferListener.class );
 
         eventSupport.addTransferListener( mock2 );
 
-        eventSupport.fireDebug( "mm" );
-
-        assertTrue( mock1.isDebugCalled() );
-
-        assertTrue( mock2.isDebugCalled() );
-
-        assertEquals( "mm", mock1.getDebugMessage() );
+        mock1.debug( "mm" );
+        mock2.debug( "mm" );
 
-        assertEquals( "mm", mock2.getDebugMessage() );
+        replay( mock1, mock2 );
+        
+        eventSupport.fireDebug( "mm" );
 
+        verify( mock1, mock2 );
     }
 
     private TransferEvent getEvent( final Wagon wagon )
     {
-        final TransferEvent event = new TransferEvent( wagon, null, TransferEvent.TRANSFER_COMPLETED,
+        return new TransferEvent( wagon, new Resource(), TransferEvent.TRANSFER_COMPLETED,
                                                        TransferEvent.REQUEST_GET );
-        return event;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/f3298aaa/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferListenerMock.java
----------------------------------------------------------------------
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferListenerMock.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferListenerMock.java
deleted file mode 100644
index 1d5c62e..0000000
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferListenerMock.java
+++ /dev/null
@@ -1,176 +0,0 @@
-package org.apache.maven.wagon.events;
-
-/*
- * 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.
- */
-
-/**
- * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
- *
- */
-public class TransferListenerMock
-    implements TransferListener
-{
-
-    private String debugMessage;
-
-    private boolean debugCalled;
-
-    private TransferEvent transferEvent;
-
-    private boolean transferCompletedCalled;
-
-    private boolean transferProgressCalled;
-
-    private boolean transferStartedCalled;
-
-    private int numberOfProgressCalls;
-
-    private boolean transferErrorCalled;
-
-    private boolean transferInitiatedCalled;
-
-
-    public boolean isTransferInitiatedCalled()
-    {
-        return transferInitiatedCalled;
-    }
-
-    /**
-     * @return Returns the debugCalled.
-     */
-    public boolean isDebugCalled()
-    {
-        return debugCalled;
-    }
-
-    /**
-     * @return Returns the transferCompletedCalled.
-     */
-    public boolean isTransferCompletedCalled()
-    {
-        return transferCompletedCalled;
-    }
-
-    /**
-     * @return Returns the transferEvent.
-     */
-    public TransferEvent getTransferEvent()
-    {
-        return transferEvent;
-    }
-
-    /**
-     * @return Returns the transferProgressCalled.
-     */
-    public boolean isTransferProgressCalled()
-    {
-        return transferProgressCalled;
-    }
-
-    /**
-     * @return Returns the transferStartedCalled.
-     */
-    public boolean isTransferStartedCalled()
-    {
-        return transferStartedCalled;
-    }
-
-    public void transferInitiated( TransferEvent transferEvent )
-    {
-        this.transferEvent = transferEvent;
-        transferInitiatedCalled = true;
-    }
-
-    /**
-     * @see org.apache.maven.wagon.events.TransferListener#transferStarted(org.apache.maven.wagon.events.TransferEvent)
-     */
-    public void transferStarted( final TransferEvent transferEvent )
-    {
-        this.transferEvent = transferEvent;
-        transferStartedCalled = true;
-
-    }
-
-    /**
-     * @see org.apache.maven.wagon.events.TransferListener#transferProgress(org.apache.maven.wagon.events.TransferEvent)
-     */
-    public void transferProgress( final TransferEvent transferEvent, byte[] buffer, int length
)
-    {
-        this.transferEvent = transferEvent;
-        transferProgressCalled = true;
-        numberOfProgressCalls++;
-
-    }
-
-    /**
-     * @see org.apache.maven.wagon.events.TransferListener#transferCompleted(org.apache.maven.wagon.events.TransferEvent)
-     */
-    public void transferCompleted( final TransferEvent transferEvent )
-    {
-        this.transferEvent = transferEvent;
-        transferCompletedCalled = true;
-
-    }
-
-    /**
-     * @see org.apache.maven.wagon.events.TransferListener#debug(java.lang.String)
-     */
-    public void debug( final String message )
-    {
-        debugMessage = message;
-        debugCalled = true;
-
-    }
-
-    /**
-     * @return
-     */
-    public String getDebugMessage()
-    {
-
-        return debugMessage;
-    }
-
-    /**
-     * @return Returns the numberOfprogressCalls.
-     */
-    public int getNumberOfProgressCalls()
-    {
-        return numberOfProgressCalls;
-    }
-
-    /**
-     * @see org.apache.maven.wagon.events.TransferListener#transferError(org.apache.maven.wagon.events.TransferEvent)
-     */
-    public void transferError( final TransferEvent transferEvent )
-    {
-        this.transferEvent = transferEvent;
-        transferErrorCalled = true;
-
-    }
-
-    /**
-     * @return Returns the transferErrorCalled.
-     */
-    public boolean isTransferErrorCalled()
-    {
-        return transferErrorCalled;
-    }
-
-}


Mime
View raw message