Skip to content

Commit ef26770

Browse files
Mathias de Riesemdrie
Mathias de Riese
authored andcommitted
MDEPLOY-118: fix path-handling in surefire tests for Windows.
1 parent 2e2ae57 commit ef26770

File tree

2 files changed

+25
-22
lines changed

2 files changed

+25
-22
lines changed

src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public void testBasicDeploy()
180180
assertEquals( "deploy-test", repo.getId() );
181181
assertEquals( "deploy-test", repo.getKey() );
182182
assertEquals( "file", repo.getProtocol() );
183-
assertEquals( "file://" + getBasedir() + "/target/remote-repo/basic-deploy-test", repo.getUrl() );
183+
assertEquals( "file://" + new File( getBasedir(), "/target/remote-repo/basic-deploy-test" ), repo.getUrl() );
184184

185185
mojo.execute();
186186

@@ -290,7 +290,7 @@ public void testSkippingDeploy()
290290
assertEquals( "deploy-test", repo.getId() );
291291
assertEquals( "deploy-test", repo.getKey() );
292292
assertEquals( "file", repo.getProtocol() );
293-
assertEquals( "file://" + getBasedir() + "/target/remote-repo/basic-deploy-test", repo.getUrl() );
293+
assertEquals( "file://" + new File( getBasedir(), "/target/remote-repo/basic-deploy-test" ), repo.getUrl() );
294294

295295
setVariableValueToObject( mojo, "skip", Boolean.TRUE.toString() );
296296

@@ -718,13 +718,15 @@ public void testComparePomWithDeployed()
718718
}
719719
catch( MojoFailureException e )
720720
{
721-
assertEquals( e.getMessage(),
722-
"Project version org.apache.maven.test:maven-deploy-test:1.0 already deployed with a differing POM.");
723-
assertEquals( e.getLongMessage(),
721+
assertEquals(
722+
"Project version org.apache.maven.test:maven-deploy-test:1.0 already deployed with a differing POM.",
723+
e.getMessage() );
724+
assertEquals(
724725
"Project version org.apache.maven.test:maven-deploy-test:1.0 already deployed and the POM "
725726
+ "'org.apache.maven.test:maven-deploy-test:pom:1.0' deployed in repository "
726727
+ "'file://" + remoteRepo.getPath() + "' differs from the POM that would be deployed. "
727-
+ "No artifacts will be deployed.");
728+
+ "No artifacts will be deployed.",
729+
e.getLongMessage() );
728730
}
729731

730732
//check the artifacts in remote repository

src/test/java/org/apache/maven/plugins/deploy/stubs/ArtifactRepositoryStub.java

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* under the License.
2020
*/
2121

22+
import java.io.File;
2223
import org.apache.maven.artifact.Artifact;
2324
import org.apache.maven.artifact.metadata.ArtifactMetadata;
2425
import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -31,9 +32,9 @@ public class ArtifactRepositoryStub
3132
extends StubArtifactRepository
3233
{
3334
private boolean blacklisted;
34-
35+
3536
private ArtifactRepositoryLayout layout;
36-
37+
3738
private String url;
3839

3940
private final String basedir = System.getProperty( "basedir" );
@@ -42,7 +43,7 @@ public ArtifactRepositoryStub()
4243
{
4344
super( null );
4445
}
45-
46+
4647
public ArtifactRepositoryStub( String dir )
4748
{
4849
super( dir );
@@ -52,54 +53,54 @@ public String pathOf( Artifact artifact )
5253
{
5354
return getLayout().pathOf( artifact );
5455
}
55-
56+
5657
public String pathOfRemoteRepositoryMetadata( ArtifactMetadata artifactMetadata )
5758
{
5859
return getLayout().pathOfRemoteRepositoryMetadata( artifactMetadata );
5960
}
60-
61+
6162
public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
6263
{
6364
return getLayout().pathOfLocalRepositoryMetadata( metadata, repository );
6465
}
65-
66+
6667
public String getUrl()
6768
{
6869
return url;
6970
}
70-
71+
7172
public void setAppendToUrl( String dir )
7273
{
73-
this.url = "file://" + basedir + "/target/remote-repo/" + dir;
74+
this.url = "file://" + new File( basedir + "/target/remote-repo/", dir ).getPath();
7475
}
75-
76+
7677
public String getBasedir()
7778
{
7879
return basedir;
7980
}
80-
81+
8182
public String getProtocol()
8283
{
8384
return "file";
8485
}
85-
86+
8687
public String getId()
8788
{
8889
return "deploy-test";
8990
}
90-
91+
9192
public ArtifactRepositoryPolicy getSnapshots()
9293
{
9394
return new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS,
9495
ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE );
9596
}
96-
97+
9798
public ArtifactRepositoryPolicy getReleases()
9899
{
99100
return new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS,
100101
ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE );
101102
}
102-
103+
103104
public ArtifactRepositoryLayout getLayout()
104105
{
105106
if( layout != null )
@@ -111,7 +112,7 @@ public ArtifactRepositoryLayout getLayout()
111112
return new DefaultRepositoryLayout();
112113
}
113114
}
114-
115+
115116
public String getKey()
116117
{
117118
return getId();
@@ -121,7 +122,7 @@ public boolean isUniqueVersion()
121122
{
122123
return false;
123124
}
124-
125+
125126
public void setBlacklisted( boolean blackListed )
126127
{
127128
this.blacklisted = blackListed;

0 commit comments

Comments
 (0)