CPD Results
The following document contains the results of PMD's CPD 5.6.1.
Duplications
File |
Line |
org\apache\maven\wagon\http\HttpWagonTestCase.java |
851 |
org\apache\maven\wagon\http\HttpWagonTestCase.java |
1026 |
public void testRedirectPutFromStreamWithFullUrl()
throws Exception
{
Server realServer = new Server( );
addConnector( realServer );
File repositoryDirectory = getRepositoryDirectory();
FileUtils.deleteDirectory( repositoryDirectory );
repositoryDirectory.mkdirs();
PutHandler putHandler = new PutHandler( repositoryDirectory );
realServer.setHandler( putHandler );
realServer.start();
Server redirectServer = new Server( );
addConnector( redirectServer );
String protocol = getProtocol();
// protocol is wagon protocol but in fact dav is http(s)
if ( protocol.equals( "dav" ) )
{
protocol = "http";
}
if ( protocol.equals( "davs" ) )
{
protocol = "https";
}
String redirectUrl = protocol + "://localhost:" + getLocalPort( realServer );
RedirectHandler redirectHandler =
new RedirectHandler( "See Other", HttpServletResponse.SC_SEE_OTHER, redirectUrl, repositoryDirectory );
redirectServer.setHandler( redirectHandler );
redirectServer.start();
try
{
StreamingWagon wagon = (StreamingWagon) getWagon();
Repository repository = new Repository( "foo", getRepositoryUrl( redirectServer ) );
wagon.connect( repository );
File sourceFile = new File( repositoryDirectory, "test-secured-put-resource" );
sourceFile.delete();
assertFalse( sourceFile.exists() );
File tempFile = File.createTempFile( "wagon", "tmp" );
tempFile.deleteOnExit();
String content = "put top secret";
FileUtils.fileWrite( tempFile.getAbsolutePath(), content );
try ( FileInputStream fileInputStream = new FileInputStream( tempFile ) ) |
File |
Line |
org\apache\maven\wagon\http\HttpWagonTestCase.java |
937 |
org\apache\maven\wagon\http\HttpWagonTestCase.java |
1106 |
public void testRedirectPutFromStreamRelativeUrl()
throws Exception
{
Server realServer = new Server( );
addConnector( realServer );
File repositoryDirectory = getRepositoryDirectory();
FileUtils.deleteDirectory( repositoryDirectory );
repositoryDirectory.mkdirs();
PutHandler putHandler = new PutHandler( repositoryDirectory );
realServer.setHandler( putHandler );
realServer.start();
Server redirectServer = new Server( );
addConnector( redirectServer );
RedirectHandler redirectHandler =
new RedirectHandler( "See Other", HttpServletResponse.SC_SEE_OTHER, "/redirectRequest/foo",
repositoryDirectory );
redirectServer.setHandler( redirectHandler );
redirectServer.start();
try
{
StreamingWagon wagon = (StreamingWagon) getWagon();
Repository repository = new Repository( "foo", getRepositoryUrl( redirectServer ) );
wagon.connect( repository );
File sourceFile = new File( repositoryDirectory, "/redirectRequest/foo/test-secured-put-resource" );
sourceFile.delete();
assertFalse( sourceFile.exists() );
File tempFile = File.createTempFile( "wagon", "tmp" );
tempFile.deleteOnExit();
String content = "put top secret";
FileUtils.fileWrite( tempFile.getAbsolutePath(), content );
try ( FileInputStream fileInputStream = new FileInputStream( tempFile ) ) |
File |
Line |
org\apache\maven\wagon\http\HttpWagonTestCase.java |
724 |
org\apache\maven\wagon\http\HttpWagonTestCase.java |
788 |
public void testRedirectGetToStream()
throws Exception
{
StreamingWagon wagon = (StreamingWagon) getWagon();
Server realServer = new Server( );
TestHeaderHandler handler = new TestHeaderHandler();
realServer.setHandler( handler );
addConnector( realServer );
realServer.start();
Server redirectServer = new Server( );
addConnector( redirectServer );
String protocol = getProtocol();
// protocol is wagon protocol but in fact dav is http(s)
if ( protocol.equals( "dav" ) )
{
protocol = "http";
}
if ( protocol.equals( "davs" ) )
{
protocol = "https";
}
String redirectUrl = protocol + "://localhost:" + getLocalPort( realServer );
RedirectHandler redirectHandler =
new RedirectHandler( "See Other", HttpServletResponse.SC_SEE_OTHER, redirectUrl, null );
redirectServer.setHandler( redirectHandler );
redirectServer.start();
wagon.connect( new Repository( "id", getRepositoryUrl( redirectServer ) ) );
File tmpResult = File.createTempFile( "foo", "get" );
try ( FileOutputStream fileOutputStream = new FileOutputStream( tmpResult ) ) |