Skip to content

Commit

Permalink
MDEPLOY-118: integration test: add two SNAPSHOT runs, not affected by…
Browse files Browse the repository at this point in the history
… feature.
  • Loading branch information
Mathias de Riese committed Sep 30, 2022
1 parent 7df63ae commit 12ab002
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/it/compare-pom/altered-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ under the License.

<groupId>org.apache.maven.its.deploy.comparepom</groupId>
<artifactId>test</artifactId>
<version>1.0</version>
<version>${revision}</version>
<packaging>pom</packaging>

<description>
Tests deployment comparing with a deployed POM. Parameter comparePomWithDeployed. Modified POM!
</description>

<properties>
<revision>1.0-SNAPSHOT</revision>
<maven.test.skip>true</maven.test.skip>
</properties>

Expand Down
15 changes: 10 additions & 5 deletions src/it/compare-pom/invoker.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@

invoker.debug = false

invoker.goals = -Dclassifier=first clean deploy
invoker.goals.1 = -Dclassifier=first clean deploy

invoker.goals.2 = -Dclassifier=second clean deploy
invoker.project.2 = altered-pom.xml
invoker.goals.2 = -Dclassifier=second -Dm-deploy-p.version=${project.version} clean deploy

invoker.project.3 = altered-pom.xml
invoker.goals.3 = -Dclassifier=third -Dm-deploy-p.version=${project.version} clean deploy
invoker.buildResult.3 = failure
invoker.goals.3 = -Drevision=1.0 -Dclassifier=first clean deploy

invoker.goals.4 = -Drevision=1.0 -Dclassifier=second clean deploy

invoker.project.5 = altered-pom.xml
invoker.goals.5 = -Drevision=1.0 -Dclassifier=third -Dm-deploy-p.version=${project.version} clean deploy
invoker.buildResult.5 = failure
3 changes: 2 additions & 1 deletion src/it/compare-pom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ under the License.

<groupId>org.apache.maven.its.deploy.comparepom</groupId>
<artifactId>test</artifactId>
<version>1.0</version>
<version>${revision}</version>
<packaging>pom</packaging>

<description>
Tests deployment comparing with a deployed POM. Parameter comparePomWithDeployed.
</description>

<properties>
<revision>1.0-SNAPSHOT</revision>
<maven.test.skip>true</maven.test.skip>
</properties>

Expand Down
16 changes: 13 additions & 3 deletions src/it/compare-pom/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ class LogInspector


assert new File( basedir, "repo/org/apache/maven/its/deploy/comparepom/test/maven-metadata.xml" ).exists()

File snDir = new File( basedir, "repo/org/apache/maven/its/deploy/comparepom/test/1.0-SNAPSHOT/" )
assert snDir.list( {d, f -> f ==~ /test-1.0-.*-first.jar/} as FilenameFilter ).size() == 1
assert snDir.list( {d, f -> f ==~ /test-1.0-.*-second.jar/} as FilenameFilter ).size() == 1
assert snDir.list( {d, f -> f ==~ /test-1.0-.*.pom/} as FilenameFilter ).size() == 2

assert new File( basedir, "repo/org/apache/maven/its/deploy/comparepom/test/1.0/test-1.0-first.jar" ).exists()
assert new File( basedir, "repo/org/apache/maven/its/deploy/comparepom/test/1.0/test-1.0-second.jar").exists()

Expand All @@ -62,18 +68,22 @@ assert buildLog.exists()
LogInspector li = new LogInspector( buildLog )
String groupUrl = "file:///${basedir}/repo/org/apache/maven/its/deploy/comparepom"

// First run: The POM tried to be downloaded and uploaded:
// 1st and 2nd run: The POM tried to be downloaded and uploaded:
assert li.containsAfter( "[INFO] Downloading from it: ${groupUrl}/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.pom" )
assert li.containsAfter( "[INFO] Downloading from it: ${groupUrl}/test/1.0-SNAPSHOT/test-1.0-SNAPSHOT.pom" )

// 3rd run: The POM tried to be downloaded and uploaded:
assert li.containsAfter( "[INFO] Downloading from it: ${groupUrl}/test/1.0/test-1.0.pom" )
assert li.containsAfter( "[INFO] Uploaded to it: ${groupUrl}/test/1.0/test-1.0.pom" )

// After that, it is never tried to be uploaded:
assert -1 == buildLog.text.indexOf( "[INFO] Uploading to it: ${groupUrl}/test/1.0/test-1.0.pom", li.index + 1 )

// Second run: POM is downloaded and not uploaded:
// 4th run: POM is downloaded and not uploaded:
assert li.containsAfter( "[INFO] Downloaded from it: ${groupUrl}/test/1.0/test-1.0.pom" )
assert li.containsAfter( "[INFO] Not deploying POM, since deployed POM is equal to current POM." )

// Third run: POM is downloaded, nothing is tried to be uploaded after that, and the build fails with error:
// 5th run: POM is downloaded, nothing is tried to be uploaded after that, and the build fails with error:
assert li.containsAfter( "[INFO] Downloaded from it: ${groupUrl}/test/1.0/test-1.0.pom" )
assert -1 == buildLog.text.indexOf( "[INFO] Uploading to", li.index + 1 )
assert li.containsAfter( "[ERROR] Project version org.apache.maven.its.deploy.comparepom:test:1.0 already deployed with a differing POM." )

0 comments on commit 12ab002

Please sign in to comment.