File dummy = new File( "src/test/resources/dummy.txt" );
FileUtils.copyFileToDirectory( dummy, sub );
String url = getTestRepositoryUrl() + "/" + dir;
Repository repo = new Repository( "foo", url );
Wagon wagon = getWagon();
wagon.connect( repo, getAuthInfo() );
List<String> files = wagon.getFileList( subDir );
assertNotNull( files );
assertEquals( 1, files.size() );
assertTrue( files.contains( "dummy.txt" ) );
wagon.put( new File( "src/test/resources/dummy.txt" ), subDir + "/newdummy.txt" );
files = wagon.getFileList( subDir );
assertNotNull( files );
assertEquals( 2, files.size() );
assertTrue( files.contains( "dummy.txt" ) );
assertTrue( files.contains( "newdummy.txt" ) );
File sourceWithSpace = new File( "target/directory with spaces" );
if ( sourceWithSpace.exists() )
{
FileUtils.deleteDirectory( sourceWithSpace );
}
File resources = new File( "src/test/resources" );
FileUtils.copyDirectory( resources, sourceWithSpace );
wagon.putDirectory( sourceWithSpace, "target with spaces" );
files = wagon.getFileList( "target with spaces" );
assertNotNull( files );
assertTrue( files.contains( "dummy.txt" ) );
assertFalse( files.contains( "newdummy.txt" ) );
assertTrue( files.contains( "log4j.xml" ) );