diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 27386c7..f7d6089 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -24,8 +24,8 @@ jobs:
name: Verify
uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v3
with:
- ff-goal: '-P run-its install' # site use project version for reporting
- verify-goal: '-P run-its install' # should be the same as for first build
+ ff-goal: '-ntp -P run-its install' # site use project version for reporting
+ verify-goal: '-ntp -P run-its install' # should be the same as for first build
deploy:
name: Deploy
diff --git a/pom.xml b/pom.xml
index e12387a..43a7b7c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -183,6 +183,12 @@
slf4j-api
1.7.9
+
+ org.slf4j
+ slf4j-simple
+ 1.7.9
+ test
+
@@ -210,6 +216,18 @@
+
+ org.eclipse.jetty
+ jetty-server
+ 9.4.51.v20230217
+ test
+
+
+ org.eclipse.jetty
+ jetty-http
+ 9.4.51.v20230217
+ test
+
diff --git a/src/main/java/org/codehaus/mojo/wagon/AbstractCopyMojo.java b/src/main/java/org/codehaus/mojo/wagon/AbstractCopyMojo.java
index 653c08d..0996749 100644
--- a/src/main/java/org/codehaus/mojo/wagon/AbstractCopyMojo.java
+++ b/src/main/java/org/codehaus/mojo/wagon/AbstractCopyMojo.java
@@ -80,4 +80,4 @@ private void disconnectWagon( Wagon wagon )
}
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/org/codehaus/mojo/wagon/AbstractSingleWagonMojo.java b/src/main/java/org/codehaus/mojo/wagon/AbstractSingleWagonMojo.java
index 6ae305e..7b0fc41 100644
--- a/src/main/java/org/codehaus/mojo/wagon/AbstractSingleWagonMojo.java
+++ b/src/main/java/org/codehaus/mojo/wagon/AbstractSingleWagonMojo.java
@@ -92,4 +92,4 @@ public void execute()
protected abstract void execute( Wagon wagon )
throws MojoExecutionException, WagonException, IOException;
-}
\ No newline at end of file
+}
diff --git a/src/main/java/org/codehaus/mojo/wagon/AbstractWagonMojo.java b/src/main/java/org/codehaus/mojo/wagon/AbstractWagonMojo.java
index cd2e486..527412c 100644
--- a/src/main/java/org/codehaus/mojo/wagon/AbstractWagonMojo.java
+++ b/src/main/java/org/codehaus/mojo/wagon/AbstractWagonMojo.java
@@ -61,4 +61,4 @@ protected WagonFileSet getWagonFileSet( String fromDir, String includes, String
{
return WagonUtils.getWagonFileSet( fromDir, includes, excludes, caseSensitive, toDir );
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/org/codehaus/mojo/wagon/CopyMojo.java b/src/main/java/org/codehaus/mojo/wagon/CopyMojo.java
index f561f6d..51cf5bc 100644
--- a/src/main/java/org/codehaus/mojo/wagon/CopyMojo.java
+++ b/src/main/java/org/codehaus/mojo/wagon/CopyMojo.java
@@ -78,4 +78,4 @@ protected void copy( Wagon srcWagon, Wagon targetWagon )
wagonCopy.copy( srcWagon, fileSet, targetWagon, optimize, this.getLog() );
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/org/codehaus/mojo/wagon/ExistMojo.java b/src/main/java/org/codehaus/mojo/wagon/ExistMojo.java
index 5583c87..38885cd 100644
--- a/src/main/java/org/codehaus/mojo/wagon/ExistMojo.java
+++ b/src/main/java/org/codehaus/mojo/wagon/ExistMojo.java
@@ -56,4 +56,4 @@ protected void execute( Wagon wagon )
}
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/org/codehaus/mojo/wagon/MergeMavenRepoMojo.java b/src/main/java/org/codehaus/mojo/wagon/MergeMavenRepoMojo.java
index d324be7..b48450f 100644
--- a/src/main/java/org/codehaus/mojo/wagon/MergeMavenRepoMojo.java
+++ b/src/main/java/org/codehaus/mojo/wagon/MergeMavenRepoMojo.java
@@ -45,4 +45,4 @@ protected void copy( Wagon srcWagon, Wagon targetWagon )
mavenRepoMerger.merge( srcWagon, targetWagon, optimize, this.getLog() );
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/org/codehaus/mojo/wagon/shared/DefaultWagonUpload.java b/src/main/java/org/codehaus/mojo/wagon/shared/DefaultWagonUpload.java
index 8ff7234..50672ef 100644
--- a/src/main/java/org/codehaus/mojo/wagon/shared/DefaultWagonUpload.java
+++ b/src/main/java/org/codehaus/mojo/wagon/shared/DefaultWagonUpload.java
@@ -23,7 +23,6 @@
import java.io.IOException;
import java.util.Arrays;
-import org.apache.maven.plugin.logging.Log;
import org.apache.maven.shared.model.fileset.FileSet;
import org.apache.maven.shared.model.fileset.util.FileSetManager;
import org.apache.maven.wagon.CommandExecutor;
diff --git a/src/main/java/org/codehaus/mojo/wagon/shared/WagonUpload.java b/src/main/java/org/codehaus/mojo/wagon/shared/WagonUpload.java
index 7e2e38d..bf9b752 100644
--- a/src/main/java/org/codehaus/mojo/wagon/shared/WagonUpload.java
+++ b/src/main/java/org/codehaus/mojo/wagon/shared/WagonUpload.java
@@ -21,7 +21,6 @@
import java.io.IOException;
-import org.apache.maven.plugin.logging.Log;
import org.apache.maven.shared.model.fileset.FileSet;
import org.apache.maven.wagon.Wagon;
import org.apache.maven.wagon.WagonException;
diff --git a/src/test/java/org/codehaus/mojo/wagon/AbstractJettyIT.java b/src/test/java/org/codehaus/mojo/wagon/AbstractJettyIT.java
new file mode 100644
index 0000000..8130640
--- /dev/null
+++ b/src/test/java/org/codehaus/mojo/wagon/AbstractJettyIT.java
@@ -0,0 +1,51 @@
+package org.codehaus.mojo.wagon;
+
+import java.io.IOException;
+import java.nio.file.Path;
+import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
+import org.eclipse.jetty.server.handler.DefaultHandler;
+import org.eclipse.jetty.server.handler.HandlerList;
+import org.eclipse.jetty.server.handler.ResourceHandler;
+import org.junit.After;
+import org.junit.Before;
+
+public abstract class AbstractJettyIT {
+
+ private Server server;
+ private int port;
+
+ @Before
+ public void runJetty() throws Exception {
+ server = new Server();
+ ServerConnector connector = new ServerConnector(server);
+ connector.setPort(0);
+ connector.setHost("localhost");
+ server.addConnector(connector);
+
+ ResourceHandler resource_handler = new ResourceHandler();
+ resource_handler.setDirectoriesListed(true);
+ resource_handler.setResourceBase(getDirectoryToServe().toString());
+
+ HandlerList handlers = new HandlerList();
+ handlers.setHandlers(new Handler[] { resource_handler, new DefaultHandler() });
+ server.setHandler(handlers);
+
+ server.start();
+ this.port = connector.getLocalPort();
+ }
+
+
+ @After
+ public void tearDown() throws Exception {
+ server.stop();
+ }
+
+ protected int getServerPort() {
+ return this.port;
+ }
+
+ protected abstract Path getDirectoryToServe() throws IOException;
+
+}
diff --git a/src/test/java/org/codehaus/mojo/wagon/WagonMojoFtpBasicIT.java b/src/test/java/org/codehaus/mojo/wagon/WagonMojoFtpBasicIT.java
index 4e944fc..b9b8833 100644
--- a/src/test/java/org/codehaus/mojo/wagon/WagonMojoFtpBasicIT.java
+++ b/src/test/java/org/codehaus/mojo/wagon/WagonMojoFtpBasicIT.java
@@ -1,7 +1,13 @@
package org.codehaus.mojo.wagon;
+import io.takari.maven.testing.TestResources;
+import io.takari.maven.testing.executor.MavenExecution;
+import io.takari.maven.testing.executor.MavenExecutionResult;
+import io.takari.maven.testing.executor.MavenRuntime;
+import io.takari.maven.testing.executor.MavenRuntime.MavenRuntimeBuilder;
+import io.takari.maven.testing.executor.MavenVersions;
+import io.takari.maven.testing.executor.junit.MavenJUnitTestRunner;
import java.io.File;
-
import org.apache.ftpserver.ConnectionConfigFactory;
import org.apache.ftpserver.FtpServer;
import org.apache.ftpserver.FtpServerFactory;
@@ -15,14 +21,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-import io.takari.maven.testing.TestResources;
-import io.takari.maven.testing.executor.MavenExecution;
-import io.takari.maven.testing.executor.MavenExecutionResult;
-import io.takari.maven.testing.executor.MavenRuntime;
-import io.takari.maven.testing.executor.MavenRuntime.MavenRuntimeBuilder;
-import io.takari.maven.testing.executor.MavenVersions;
-import io.takari.maven.testing.executor.junit.MavenJUnitTestRunner;
-
@RunWith( MavenJUnitTestRunner.class )
@MavenVersions( { "3.2.5" } )
public class WagonMojoFtpBasicIT
diff --git a/src/test/java/org/codehaus/mojo/wagon/WagonMojoHttpIT.java b/src/test/java/org/codehaus/mojo/wagon/WagonMojoHttpIT.java
index e701c06..b642045 100644
--- a/src/test/java/org/codehaus/mojo/wagon/WagonMojoHttpIT.java
+++ b/src/test/java/org/codehaus/mojo/wagon/WagonMojoHttpIT.java
@@ -1,11 +1,6 @@
package org.codehaus.mojo.wagon;
-import java.io.File;
-
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import static java.util.Objects.requireNonNull;
import io.takari.maven.testing.TestResources;
import io.takari.maven.testing.executor.MavenExecution;
@@ -14,20 +9,36 @@
import io.takari.maven.testing.executor.MavenRuntime.MavenRuntimeBuilder;
import io.takari.maven.testing.executor.MavenVersions;
import io.takari.maven.testing.executor.junit.MavenJUnitTestRunner;
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
@RunWith( MavenJUnitTestRunner.class )
@MavenVersions( { "3.2.5" } )
-public class WagonMojoHttpIT
+public class WagonMojoHttpIT extends AbstractJettyIT
{
@Rule
public final TestResources resources = new TestResources();
+ private final MavenRuntimeBuilder mavenBuilder;
- public final MavenRuntime maven;
+ public MavenRuntime maven;
public WagonMojoHttpIT( MavenRuntimeBuilder builder )
throws Exception
{
- this.maven = builder.withCliOptions( "-B" ).build();
+ this.mavenBuilder = builder.withCliOptions( "-B" );
+ }
+
+ @Before
+ public void setPort() throws Exception {
+ this.maven = this.mavenBuilder.withCliOptions( "-Dserver.port=" + getServerPort() ).build();
}
@Test
@@ -41,6 +52,12 @@ public void testDownload()
result.assertErrorFreeLog();
Assert.assertTrue( new File( result.getBasedir(),
- "target/it/http-download/1.1/commons-dbutils-1.1-sources.jar" ).exists() );
+ "target/it/http-download/1.1/commons-dbutils-1.1-sources.txt" ).exists() );
+ }
+
+ @Override
+ protected Path getDirectoryToServe() throws IOException {
+ return resources.getBasedir("http-download").toPath()
+ .resolve("files");
}
}
diff --git a/src/test/java/org/codehaus/mojo/wagon/WagonMojoHttpSettingsIT.java b/src/test/java/org/codehaus/mojo/wagon/WagonMojoHttpSettingsIT.java
index a1e9e24..7c569d2 100644
--- a/src/test/java/org/codehaus/mojo/wagon/WagonMojoHttpSettingsIT.java
+++ b/src/test/java/org/codehaus/mojo/wagon/WagonMojoHttpSettingsIT.java
@@ -1,11 +1,5 @@
package org.codehaus.mojo.wagon;
-import java.io.File;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
import io.takari.maven.testing.TestResources;
import io.takari.maven.testing.executor.MavenExecution;
import io.takari.maven.testing.executor.MavenExecutionResult;
@@ -13,20 +7,33 @@
import io.takari.maven.testing.executor.MavenRuntime.MavenRuntimeBuilder;
import io.takari.maven.testing.executor.MavenVersions;
import io.takari.maven.testing.executor.junit.MavenJUnitTestRunner;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Path;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
@RunWith( MavenJUnitTestRunner.class )
@MavenVersions( { "3.2.5" } )
-public class WagonMojoHttpSettingsIT
+public class WagonMojoHttpSettingsIT extends AbstractJettyIT
{
@Rule
public final TestResources resources = new TestResources();
- public final MavenRuntime maven;
+ public MavenRuntime maven;
+ private final MavenRuntimeBuilder mavenBuilder;
public WagonMojoHttpSettingsIT( MavenRuntimeBuilder builder )
throws Exception
{
- this.maven = builder.withCliOptions( "-B", "-e", "-s", "settings.xml" ).build();
+ this.mavenBuilder = builder.withCliOptions( "-B", "-e", "-s", "settings.xml");
+ }
+
+ @Before
+ public void setPort() throws Exception {
+ this.maven = this.mavenBuilder.withCliOptions( "-Dserver.port=" + getServerPort() ).build();
}
@Test
@@ -39,4 +46,10 @@ public void testDownload()
MavenExecutionResult result = mavenExec.execute( "clean", "verify" );
result.assertErrorFreeLog();
}
+
+ @Override
+ protected Path getDirectoryToServe() throws IOException {
+ return resources.getBasedir("http-download").toPath()
+ .resolve("files");
+ }
}
diff --git a/src/test/projects/http-download/files/maven2/commons-dbutils/commons-dbutils/1.1/common-dbutils-1.1.pom.asc b/src/test/projects/http-download/files/maven2/commons-dbutils/commons-dbutils/1.1/common-dbutils-1.1.pom.asc
new file mode 100644
index 0000000..c6cac69
--- /dev/null
+++ b/src/test/projects/http-download/files/maven2/commons-dbutils/commons-dbutils/1.1/common-dbutils-1.1.pom.asc
@@ -0,0 +1 @@
+empty
diff --git a/src/test/projects/http-download/files/maven2/commons-dbutils/commons-dbutils/1.1/commons-dbutils-1.1-sources.txt b/src/test/projects/http-download/files/maven2/commons-dbutils/commons-dbutils/1.1/commons-dbutils-1.1-sources.txt
new file mode 100644
index 0000000..c6cac69
--- /dev/null
+++ b/src/test/projects/http-download/files/maven2/commons-dbutils/commons-dbutils/1.1/commons-dbutils-1.1-sources.txt
@@ -0,0 +1 @@
+empty
diff --git a/src/test/projects/http-download/files/maven2/commons-dbutils/commons-dbutils/1.2/commons-dbutils-1.2-sources.txt b/src/test/projects/http-download/files/maven2/commons-dbutils/commons-dbutils/1.2/commons-dbutils-1.2-sources.txt
new file mode 100644
index 0000000..c6cac69
--- /dev/null
+++ b/src/test/projects/http-download/files/maven2/commons-dbutils/commons-dbutils/1.2/commons-dbutils-1.2-sources.txt
@@ -0,0 +1 @@
+empty
diff --git a/src/test/projects/http-download/pom.xml b/src/test/projects/http-download/pom.xml
index b0011a4..a00039a 100644
--- a/src/test/projects/http-download/pom.xml
+++ b/src/test/projects/http-download/pom.xml
@@ -10,6 +10,7 @@
${project.build.directory}/it/http-download
3.0.0
+ 8080
@@ -42,7 +43,7 @@
list
- https://repo1.maven.org/maven2/commons-dbutils/commons-dbutils
+ http://localhost:${server.port}/maven2/commons-dbutils/commons-dbutils
@@ -54,8 +55,8 @@
download-single
- https://repo1.maven.org/maven2/commons-dbutils/commons-dbutils/1.1
- commons-dbutils-1.1-sources.jar
+ http://localhost:${server.port}/maven2/commons-dbutils/commons-dbutils/1.1
+ commons-dbutils-1.1-sources.txt
${downloadDirectory.base}
@@ -66,7 +67,7 @@
download-single
- https://repo1.maven.org/maven2/commons-dbutils/commons-dbutils/1.2/commons-dbutils-1.2-sources.jar
+ http://localhost:${server.port}/maven2/commons-dbutils/commons-dbutils/1.2/commons-dbutils-1.2-sources.txt
${downloadDirectory.base}
@@ -77,7 +78,7 @@
download
- https://repo1.maven.org/maven2/commons-dbutils/commons-dbutils
+ http://localhost:${server.port}/maven2/commons-dbutils/commons-dbutils
1.1/**
1.0/**, 1.2/**, 1.3/**, 1.4/**, 1.5/**, 1.6/**
${downloadDirectory.base}
diff --git a/src/test/resources/simplelogger.properties b/src/test/resources/simplelogger.properties
new file mode 100644
index 0000000..cd90c2a
--- /dev/null
+++ b/src/test/resources/simplelogger.properties
@@ -0,0 +1 @@
+org.slf4j.simpleLogger.defaultLogLevel=warn