throws Exception
{
final String content = "the content to return";
final long lastModified = System.currentTimeMillis();
final StringOutputStream out = new StringOutputStream();
StreamingWagon wagon = new TestWagon()
{
public void fillOutputData( OutputData outputData )
{
assertEquals( "resource", outputData.getResource().getName() );
assertEquals( content.length(), outputData.getResource().getContentLength() );
assertEquals( lastModified, outputData.getResource().getLastModified() );
outputData.setOutputStream( out );
}
};
wagon.connect( repository );
try
{
wagon.putFromStream( new StringInputStream( content ), "resource", content.length(), lastModified );
assertEquals( content, out.toString() );
}
finally
{
wagon.disconnect();
}