Skip to content

Commit

Permalink
[#74] rework integration tests pt.3, Wagon334MojoHttpIT
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarwell committed Oct 27, 2023
1 parent 6f174f1 commit 97db3f7
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
25 changes: 19 additions & 6 deletions src/test/java/org/codehaus/mojo/wagon/Wagon334MojoHttpIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import java.io.File;

import java.io.IOException;
import java.nio.file.Path;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -17,17 +20,21 @@

@RunWith( MavenJUnitTestRunner.class )
@MavenVersions( { "3.6.3" } )
public class Wagon334MojoHttpIT
public class Wagon334MojoHttpIT extends AbstractJettyIT
{
@Rule
public final TestResources resources = new TestResources();

public final MavenRuntime maven;
private final MavenRuntimeBuilder mavenBuilder;
public MavenRuntime maven;

public Wagon334MojoHttpIT(MavenRuntimeBuilder builder )
throws Exception
{
this.maven = builder.withCliOptions( "-B" ).build();
public Wagon334MojoHttpIT(MavenRuntimeBuilder builder ) {
this.mavenBuilder = builder.withCliOptions( "-B" );
}

@Before
public void setPort() throws Exception {
this.maven = this.mavenBuilder.withCliOptions( "-Dserver.port=" + getServerPort() ).build();
}

@Test
Expand All @@ -46,4 +53,10 @@ public void testDownload()
Assert.assertTrue( new File(downloadDir, "commons-dbutils-1.2-bin.tar.gz.asc.md5" ).exists() );
Assert.assertTrue( new File(downloadDir, "commons-dbutils-1.2-bin.tar.gz.asc.sha1" ).exists() );
}

@Override
protected Path getDirectoryToServe() throws IOException {
return resources.getBasedir("http-download-02").toPath()
.resolve("files");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
empty
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
empty
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
empty
5 changes: 3 additions & 2 deletions src/test/projects/http-download-02/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<properties>
<downloadDirectory.base>${project.build.directory}/it/http-download</downloadDirectory.base>
<wagon.api.version>3.3.4</wagon.api.version>
<server.port>8080</server.port>
</properties>

<build>
Expand Down Expand Up @@ -40,7 +41,7 @@
<goal>download</goal>
</goals>
<configuration>
<url>https://repo1.maven.org/maven2/commons-dbutils/commons-dbutils/1.2</url>
<url>http://localhost:${server.port}/maven2/commons-dbutils/commons-dbutils/1.2</url>
<includes>
commons-dbutils-1.2-bin.tar.gz.asc,
commons-dbutils-1.2-bin.tar.gz.asc.md5,
Expand All @@ -53,4 +54,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

0 comments on commit 97db3f7

Please sign in to comment.