org.apache.maven.wagon
Class WagonTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.codehaus.plexus.PlexusTestCase
              extended by org.apache.maven.wagon.WagonTestCase
All Implemented Interfaces:
junit.framework.Test

public abstract class WagonTestCase
extends org.codehaus.plexus.PlexusTestCase

Version:
$Id: WagonTestCase.java 477175 2006-11-20 13:50:29Z brett $
Author:
Jason van Zyl

Field Summary
protected  java.io.File artifactDestFile
           
protected  java.io.File artifactSourceFile
           
protected  org.apache.maven.wagon.observers.ChecksumObserver checksumObserver
           
protected  java.io.File destFile
           
protected  org.apache.maven.wagon.repository.Repository localRepository
           
protected  java.lang.String localRepositoryPath
           
protected static java.lang.String POM
           
protected  java.lang.String resource
           
protected  java.io.File sourceFile
           
protected  org.apache.maven.wagon.repository.Repository testRepository
           
 
Fields inherited from class org.codehaus.plexus.PlexusTestCase
basedir, container
 
Constructor Summary
WagonTestCase()
           
 
Method Summary
protected  void assertNotExists(org.apache.maven.wagon.Wagon wagon, java.lang.String resourceName)
          Assert that a resource does not exist in the remote wagon system
protected  void assertResourcesAreInRemoteSide(org.apache.maven.wagon.Wagon wagon, java.util.List resourceNames)
           
protected  void createDirectory(org.apache.maven.wagon.Wagon wagon, java.lang.String resourceToCreate, java.lang.String dirName)
          Create a directory with a resource and check that the other ones don't exist
protected  org.apache.maven.wagon.repository.Repository createFileRepository(java.lang.String url)
           
protected  void customizeContext()
           
protected  void fileRoundTripTesting()
           
protected  org.apache.maven.wagon.authentication.AuthenticationInfo getAuthInfo()
           
protected  void getFile()
           
protected  org.apache.maven.wagon.repository.RepositoryPermissions getPermissions()
           
protected abstract  java.lang.String getProtocol()
          Protocol id of the Wagon to use, eg.
protected abstract  java.lang.String getTestRepositoryUrl()
          URL of the repository.
protected  org.apache.maven.wagon.Wagon getWagon()
           
private  void message(java.lang.String message)
           
protected  void putFile()
           
protected  void putFile(java.lang.String resourceName, java.lang.String testFileName, java.lang.String content)
           
protected  void setUp()
           
protected  void setupRepositories()
           
protected  void setupWagonTestingFixtures()
           
protected  void tearDownWagonTestingFixtures()
           
 void testFailedGet()
           
 void testWagon()
           
 void testWagonGetFileList()
          Test Wagon.getFileList(String).
 void testWagonGetFileListWhenDirectoryDoesNotExist()
          Test Wagon.getFileList(String) when the directory does not exist.
 void testWagonPutDirectory()
           
 void testWagonPutDirectoryDeepDestination()
          Test for putting a directory with a destination that multiple directories deep, all of which haven't been created.
 void testWagonPutDirectoryWhenDirectoryAlreadyExists()
          Test that when putting a directory that already exists new files get also copied
 void testWagonResourceExists()
          Test for an existing resource.
 void testWagonResourceNotExists()
          Test for an invalid resource.
private  void writeTestFile(java.lang.String child)
           
 
Methods inherited from class org.codehaus.plexus.PlexusTestCase
createContainerInstance, customizeContext, getBasedir, getClassLoader, getConfiguration, getConfiguration, getContainer, getCustomConfiguration, getResourceAsStream, getTestFile, getTestFile, getTestPath, getTestPath, lookup, lookup, release, tearDown
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

POM

protected static java.lang.String POM

localRepository

protected org.apache.maven.wagon.repository.Repository localRepository

testRepository

protected org.apache.maven.wagon.repository.Repository testRepository

localRepositoryPath

protected java.lang.String localRepositoryPath

sourceFile

protected java.io.File sourceFile

destFile

protected java.io.File destFile

resource

protected java.lang.String resource

artifactSourceFile

protected java.io.File artifactSourceFile

artifactDestFile

protected java.io.File artifactDestFile

checksumObserver

protected org.apache.maven.wagon.observers.ChecksumObserver checksumObserver
Constructor Detail

WagonTestCase

public WagonTestCase()
Method Detail

setUp

protected void setUp()
              throws java.lang.Exception
Overrides:
setUp in class org.codehaus.plexus.PlexusTestCase
Throws:
java.lang.Exception

getTestRepositoryUrl

protected abstract java.lang.String getTestRepositoryUrl()
                                                  throws java.io.IOException
URL of the repository. For a complete test it should point to a non existing folder so we also check for the creation of new folders in the remote site.

return the URL of the repository as specified by Wagon syntax

Throws:
java.io.IOException

getProtocol

protected abstract java.lang.String getProtocol()
Protocol id of the Wagon to use, eg. scp, ftp

Returns:
the protocol id

setupRepositories

protected void setupRepositories()
                          throws java.lang.Exception
Throws:
java.lang.Exception

customizeContext

protected void customizeContext()
                         throws java.lang.Exception
Overrides:
customizeContext in class org.codehaus.plexus.PlexusTestCase
Throws:
java.lang.Exception

setupWagonTestingFixtures

protected void setupWagonTestingFixtures()
                                  throws java.lang.Exception
Throws:
java.lang.Exception

tearDownWagonTestingFixtures

protected void tearDownWagonTestingFixtures()
                                     throws java.lang.Exception
Throws:
java.lang.Exception

getAuthInfo

protected org.apache.maven.wagon.authentication.AuthenticationInfo getAuthInfo()

getPermissions

protected org.apache.maven.wagon.repository.RepositoryPermissions getPermissions()

getWagon

protected org.apache.maven.wagon.Wagon getWagon()
                                         throws java.lang.Exception
Throws:
java.lang.Exception

message

private void message(java.lang.String message)

testWagon

public void testWagon()
               throws java.lang.Exception
Throws:
java.lang.Exception

testWagonPutDirectory

public void testWagonPutDirectory()
                           throws java.lang.Exception
Throws:
java.lang.Exception

testWagonPutDirectoryDeepDestination

public void testWagonPutDirectoryDeepDestination()
                                          throws java.lang.Exception
Test for putting a directory with a destination that multiple directories deep, all of which haven't been created.

Throws:
java.lang.Exception
Since:
1.0-beta-2

testWagonPutDirectoryWhenDirectoryAlreadyExists

public void testWagonPutDirectoryWhenDirectoryAlreadyExists()
                                                     throws java.lang.Exception
Test that when putting a directory that already exists new files get also copied

Throws:
java.lang.Exception
Since:
1.0-beta-1

createDirectory

protected void createDirectory(org.apache.maven.wagon.Wagon wagon,
                               java.lang.String resourceToCreate,
                               java.lang.String dirName)
                        throws java.lang.Exception
Create a directory with a resource and check that the other ones don't exist

Parameters:
wagon -
resourceToCreate - name of the resource to be created
dirName - directory name to create
Throws:
java.lang.Exception

assertResourcesAreInRemoteSide

protected void assertResourcesAreInRemoteSide(org.apache.maven.wagon.Wagon wagon,
                                              java.util.List resourceNames)
                                       throws java.io.IOException,
                                              org.apache.maven.wagon.TransferFailedException,
                                              org.apache.maven.wagon.ResourceDoesNotExistException,
                                              org.apache.maven.wagon.authorization.AuthorizationException
Throws:
java.io.IOException
org.apache.maven.wagon.TransferFailedException
org.apache.maven.wagon.ResourceDoesNotExistException
org.apache.maven.wagon.authorization.AuthorizationException

assertNotExists

protected void assertNotExists(org.apache.maven.wagon.Wagon wagon,
                               java.lang.String resourceName)
                        throws java.io.IOException,
                               org.apache.maven.wagon.TransferFailedException,
                               org.apache.maven.wagon.authorization.AuthorizationException
Assert that a resource does not exist in the remote wagon system

Parameters:
wagon - wagon to get the resource from
resourceName - name of the resource
Throws:
java.io.IOException - if a temp file can't be created
org.apache.maven.wagon.authorization.AuthorizationException
TransferFailedException
Since:
1.0-beta-1

writeTestFile

private void writeTestFile(java.lang.String child)
                    throws java.io.IOException
Throws:
java.io.IOException

testFailedGet

public void testFailedGet()
                   throws java.lang.Exception
Throws:
java.lang.Exception

testWagonGetFileList

public void testWagonGetFileList()
                          throws java.lang.Exception
Test Wagon.getFileList(String).

Throws:
java.lang.Exception
Since:
1.0-beta-2

testWagonGetFileListWhenDirectoryDoesNotExist

public void testWagonGetFileListWhenDirectoryDoesNotExist()
                                                   throws java.lang.Exception
Test Wagon.getFileList(String) when the directory does not exist.

Throws:
java.lang.Exception
Since:
1.0-beta-2

testWagonResourceExists

public void testWagonResourceExists()
                             throws java.lang.Exception
Test for an existing resource.

Throws:
java.lang.Exception
Since:
1.0-beta-2

testWagonResourceNotExists

public void testWagonResourceNotExists()
                                throws java.lang.Exception
Test for an invalid resource.

Throws:
java.lang.Exception
Since:
1.0-beta-2

putFile

protected void putFile(java.lang.String resourceName,
                       java.lang.String testFileName,
                       java.lang.String content)
                throws java.lang.Exception
Throws:
java.lang.Exception

putFile

protected void putFile()
                throws java.lang.Exception
Throws:
java.lang.Exception

getFile

protected void getFile()
                throws java.lang.Exception
Throws:
java.lang.Exception

fileRoundTripTesting

protected void fileRoundTripTesting()
                             throws java.lang.Exception
Throws:
java.lang.Exception

createFileRepository

protected org.apache.maven.wagon.repository.Repository createFileRepository(java.lang.String url)