server.setHandler( handlers );
addConnectors( server );
server.start();
StreamingWagon wagon = (StreamingWagon) getWagon();
Repository testRepository = new Repository( "id", getRepositoryUrl( server ) );
wagon.connect( testRepository, authInfo );
try
{
for ( int i = 0; i < putNumber; i++ )
{
File sourceFile = new File( localRepositoryPath, "test-secured-put-resource" );
sourceFile.delete();
assertFalse( sourceFile.exists() );
File tempFile = File.createTempFile( "wagon", "tmp" );
tempFile.deleteOnExit();
FileUtils.fileWrite( tempFile.getAbsolutePath(), "put top secret" );
try
{
wagon.put( tempFile, "test-secured-put-resource" );
}
finally
{
tempFile.delete();
}
assertEquals( "put top secret", FileUtils.fileRead( sourceFile.getAbsolutePath() ) );
}
}
finally
{
wagon.disconnect();
server.stop();
}
assertEquals( putNumber, putHandler.putCallNumber );
testPreemptiveAuthenticationPut( sh, supportPreemptiveAuthenticationPut() );
}